tst.stan.xbe.shared2 0.0.1
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/xbe-lib/src/component-props/index.d.ts +55 -0
- package/dist/xbe-lib/src/component-props/index.d.ts.map +1 -0
- package/dist/xbe-lib/src/component-props/index.js +1 -0
- package/dist/xbe-lib/src/index.d.ts +8 -0
- package/dist/xbe-lib/src/index.d.ts.map +1 -0
- package/dist/xbe-lib/src/index.js +7 -0
- package/dist/xbe-lib/src/middleware/index.d.ts +2 -0
- package/dist/xbe-lib/src/middleware/index.d.ts.map +1 -0
- package/dist/xbe-lib/src/middleware/index.js +3 -0
- package/dist/xbe-lib/src/services/CacheService/InMemoryCacheProvider.d.ts +26 -0
- package/dist/xbe-lib/src/services/CacheService/InMemoryCacheProvider.d.ts.map +1 -0
- package/dist/xbe-lib/src/services/CacheService/InMemoryCacheProvider.js +50 -0
- package/dist/xbe-lib/src/services/CacheService/VercelEdgeCacheService.d.ts +26 -0
- package/dist/xbe-lib/src/services/CacheService/VercelEdgeCacheService.d.ts.map +1 -0
- package/dist/xbe-lib/src/services/CacheService/VercelEdgeCacheService.js +37 -0
- package/dist/xbe-lib/src/services/CacheService/index.d.ts +53 -0
- package/dist/xbe-lib/src/services/CacheService/index.d.ts.map +1 -0
- package/dist/xbe-lib/src/services/CacheService/index.js +55 -0
- package/dist/xbe-lib/src/services/NavigationService/NavigationService.d.ts +61 -0
- package/dist/xbe-lib/src/services/NavigationService/NavigationService.d.ts.map +1 -0
- package/dist/xbe-lib/src/services/NavigationService/NavigationService.js +82 -0
- package/dist/xbe-lib/src/services/NavigationService/index.d.ts +4 -0
- package/dist/xbe-lib/src/services/NavigationService/index.d.ts.map +1 -0
- package/dist/xbe-lib/src/services/NavigationService/index.js +1 -0
- package/dist/xbe-lib/src/services/NavigationService/models/ItemSearchResults.d.ts +5 -0
- package/dist/xbe-lib/src/services/NavigationService/models/ItemSearchResults.d.ts.map +1 -0
- package/dist/xbe-lib/src/services/NavigationService/models/ItemSearchResults.js +1 -0
- package/dist/xbe-lib/src/services/NavigationService/models/LinkField.d.ts +19 -0
- package/dist/xbe-lib/src/services/NavigationService/models/LinkField.d.ts.map +1 -0
- package/dist/xbe-lib/src/services/NavigationService/models/LinkField.js +1 -0
- package/dist/xbe-lib/src/services/NavigationService/models/NavigationCTA.d.ts +11 -0
- package/dist/xbe-lib/src/services/NavigationService/models/NavigationCTA.d.ts.map +1 -0
- package/dist/xbe-lib/src/services/NavigationService/models/NavigationCTA.js +1 -0
- package/dist/xbe-lib/src/services/NavigationService/models/NavigationDataSourceResponse.d.ts +5 -0
- package/dist/xbe-lib/src/services/NavigationService/models/NavigationDataSourceResponse.d.ts.map +1 -0
- package/dist/xbe-lib/src/services/NavigationService/models/NavigationDataSourceResponse.js +1 -0
- package/dist/xbe-lib/src/services/NavigationService/models/NavigationDropdown.d.ts +14 -0
- package/dist/xbe-lib/src/services/NavigationService/models/NavigationDropdown.d.ts.map +1 -0
- package/dist/xbe-lib/src/services/NavigationService/models/NavigationDropdown.js +1 -0
- package/dist/xbe-lib/src/services/NavigationService/models/NavigationFolder.d.ts +12 -0
- package/dist/xbe-lib/src/services/NavigationService/models/NavigationFolder.d.ts.map +1 -0
- package/dist/xbe-lib/src/services/NavigationService/models/NavigationFolder.js +1 -0
- package/dist/xbe-lib/src/services/NavigationService/models/NavigationGroup.d.ts +10 -0
- package/dist/xbe-lib/src/services/NavigationService/models/NavigationGroup.d.ts.map +1 -0
- package/dist/xbe-lib/src/services/NavigationService/models/NavigationGroup.js +1 -0
- package/dist/xbe-lib/src/services/NavigationService/models/NavigationItem.d.ts +9 -0
- package/dist/xbe-lib/src/services/NavigationService/models/NavigationItem.d.ts.map +1 -0
- package/dist/xbe-lib/src/services/NavigationService/models/NavigationItem.js +1 -0
- package/dist/xbe-lib/src/services/NavigationService/models/TextField.d.ts +5 -0
- package/dist/xbe-lib/src/services/NavigationService/models/TextField.d.ts.map +1 -0
- package/dist/xbe-lib/src/services/NavigationService/models/TextField.js +1 -0
- package/dist/xbe-lib/src/services/NavigationService/models/index.d.ts +10 -0
- package/dist/xbe-lib/src/services/NavigationService/models/index.d.ts.map +1 -0
- package/dist/xbe-lib/src/services/NavigationService/models/index.js +9 -0
- package/dist/xbe-lib/src/services/NavigationService/queries/navigation-datasource.graphql.d.ts +2 -0
- package/dist/xbe-lib/src/services/NavigationService/queries/navigation-datasource.graphql.d.ts.map +1 -0
- package/dist/xbe-lib/src/services/NavigationService/queries/navigation-datasource.graphql.js +62 -0
- package/dist/xbe-lib/src/services/SxaService/constants.d.ts +44 -0
- package/dist/xbe-lib/src/services/SxaService/constants.d.ts.map +1 -0
- package/dist/xbe-lib/src/services/SxaService/constants.js +43 -0
- package/dist/xbe-lib/src/services/SxaService/index.d.ts +166 -0
- package/dist/xbe-lib/src/services/SxaService/index.d.ts.map +1 -0
- package/dist/xbe-lib/src/services/SxaService/index.js +319 -0
- package/dist/xbe-lib/src/services/SxaService/models/SiteInfoCollection.d.ts +21 -0
- package/dist/xbe-lib/src/services/SxaService/models/SiteInfoCollection.d.ts.map +1 -0
- package/dist/xbe-lib/src/services/SxaService/models/SiteInfoCollection.js +1 -0
- package/dist/xbe-lib/src/services/SxaService/models/SiteInfoCollectionResult.d.ts +17 -0
- package/dist/xbe-lib/src/services/SxaService/models/SiteInfoCollectionResult.d.ts.map +1 -0
- package/dist/xbe-lib/src/services/SxaService/models/SiteInfoCollectionResult.js +1 -0
- package/dist/xbe-lib/src/services/SxaService/models/SiteInfoQueryResult.d.ts +15 -0
- package/dist/xbe-lib/src/services/SxaService/models/SiteInfoQueryResult.d.ts.map +1 -0
- package/dist/xbe-lib/src/services/SxaService/models/SiteInfoQueryResult.js +1 -0
- package/dist/xbe-lib/src/services/SxaService/models/Tenant.d.ts +17 -0
- package/dist/xbe-lib/src/services/SxaService/models/Tenant.d.ts.map +1 -0
- package/dist/xbe-lib/src/services/SxaService/models/Tenant.js +1 -0
- package/dist/xbe-lib/src/services/SxaService/models/TenantQueryResult.d.ts +49 -0
- package/dist/xbe-lib/src/services/SxaService/models/TenantQueryResult.d.ts.map +1 -0
- package/dist/xbe-lib/src/services/SxaService/models/TenantQueryResult.js +1 -0
- package/dist/xbe-lib/src/services/SxaService/models/TenantSite.d.ts +19 -0
- package/dist/xbe-lib/src/services/SxaService/models/TenantSite.d.ts.map +1 -0
- package/dist/xbe-lib/src/services/SxaService/models/TenantSite.js +1 -0
- package/dist/xbe-lib/src/services/SxaService/models/index.d.ts +7 -0
- package/dist/xbe-lib/src/services/SxaService/models/index.d.ts.map +1 -0
- package/dist/xbe-lib/src/services/SxaService/models/index.js +1 -0
- package/dist/xbe-lib/src/services/SxaService/queries/index.d.ts +2 -0
- package/dist/xbe-lib/src/services/SxaService/queries/index.d.ts.map +1 -0
- package/dist/xbe-lib/src/services/SxaService/queries/index.js +1 -0
- package/dist/xbe-lib/src/services/SxaService/queries/queryTenantData.d.ts +19 -0
- package/dist/xbe-lib/src/services/SxaService/queries/queryTenantData.d.ts.map +1 -0
- package/dist/xbe-lib/src/services/SxaService/queries/queryTenantData.js +84 -0
- package/dist/xbe-lib/src/services/index.d.ts +6 -0
- package/dist/xbe-lib/src/services/index.d.ts.map +1 -0
- package/dist/xbe-lib/src/services/index.js +7 -0
- package/dist/xbe-lib/src/sitecore/SitecoreConfigLoader.d.ts +16 -0
- package/dist/xbe-lib/src/sitecore/SitecoreConfigLoader.d.ts.map +1 -0
- package/dist/xbe-lib/src/sitecore/SitecoreConfigLoader.js +22 -0
- package/dist/xbe-lib/src/sitecore/createSitecoreClient.d.ts +29 -0
- package/dist/xbe-lib/src/sitecore/createSitecoreClient.d.ts.map +1 -0
- package/dist/xbe-lib/src/sitecore/createSitecoreClient.js +26 -0
- package/dist/xbe-lib/src/sitecore/fetchComponentData.d.ts +37 -0
- package/dist/xbe-lib/src/sitecore/fetchComponentData.d.ts.map +1 -0
- package/dist/xbe-lib/src/sitecore/fetchComponentData.js +44 -0
- package/dist/xbe-lib/src/utils/debug.d.ts +40 -0
- package/dist/xbe-lib/src/utils/debug.d.ts.map +1 -0
- package/dist/xbe-lib/src/utils/debug.js +37 -0
- package/dist/xbe-lib/src/utils/index.d.ts +6 -0
- package/dist/xbe-lib/src/utils/index.d.ts.map +1 -0
- package/dist/xbe-lib/src/utils/index.js +7 -0
- package/dist/xbe-lib/src/utils/isServer.d.ts +24 -0
- package/dist/xbe-lib/src/utils/isServer.d.ts.map +1 -0
- package/dist/xbe-lib/src/utils/isServer.js +25 -0
- package/dist/xbe-lib/src/utils/sitecorePathExtractor.d.ts +53 -0
- package/dist/xbe-lib/src/utils/sitecorePathExtractor.d.ts.map +1 -0
- package/dist/xbe-lib/src/utils/sitecorePathExtractor.js +236 -0
- package/dist/xbe-ui/src/components/basic/icon/icon.d.ts +59 -0
- package/dist/xbe-ui/src/components/basic/icon/icon.d.ts.map +1 -0
- package/dist/xbe-ui/src/components/basic/icon/icon.js +83 -0
- package/dist/xbe-ui/src/components/basic/image/image.d.ts +54 -0
- package/dist/xbe-ui/src/components/basic/image/image.d.ts.map +1 -0
- package/dist/xbe-ui/src/components/basic/image/image.js +47 -0
- package/dist/xbe-ui/src/components/basic/richtext/richtext.d.ts +36 -0
- package/dist/xbe-ui/src/components/basic/richtext/richtext.d.ts.map +1 -0
- package/dist/xbe-ui/src/components/basic/richtext/richtext.js +16 -0
- package/dist/xbe-ui/src/components/basic/text/text.d.ts +30 -0
- package/dist/xbe-ui/src/components/basic/text/text.d.ts.map +1 -0
- package/dist/xbe-ui/src/components/basic/text/text.js +42 -0
- package/dist/xbe-ui/src/components/basic/video/video.d.ts +48 -0
- package/dist/xbe-ui/src/components/basic/video/video.d.ts.map +1 -0
- package/dist/xbe-ui/src/components/basic/video/video.js +37 -0
- package/dist/xbe-ui/src/components/collections/accordion/accordion-item.d.ts +16 -0
- package/dist/xbe-ui/src/components/collections/accordion/accordion-item.d.ts.map +1 -0
- package/dist/xbe-ui/src/components/collections/accordion/accordion-item.js +27 -0
- package/dist/xbe-ui/src/components/collections/accordion/index.d.ts +12 -0
- package/dist/xbe-ui/src/components/collections/accordion/index.d.ts.map +1 -0
- package/dist/xbe-ui/src/components/collections/accordion/index.js +17 -0
- package/dist/xbe-ui/src/components/collections/carousel/carousel-slide.d.ts +7 -0
- package/dist/xbe-ui/src/components/collections/carousel/carousel-slide.d.ts.map +1 -0
- package/dist/xbe-ui/src/components/collections/carousel/carousel-slide.js +5 -0
- package/dist/xbe-ui/src/components/collections/carousel/index.d.ts +11 -0
- package/dist/xbe-ui/src/components/collections/carousel/index.d.ts.map +1 -0
- package/dist/xbe-ui/src/components/collections/carousel/index.js +26 -0
- package/dist/xbe-ui/src/components/collections/content-block/index.d.ts +34 -0
- package/dist/xbe-ui/src/components/collections/content-block/index.d.ts.map +1 -0
- package/dist/xbe-ui/src/components/collections/content-block/index.js +35 -0
- package/dist/xbe-ui/src/components/collections/content-card/index.d.ts +57 -0
- package/dist/xbe-ui/src/components/collections/content-card/index.d.ts.map +1 -0
- package/dist/xbe-ui/src/components/collections/content-card/index.js +75 -0
- package/dist/xbe-ui/src/components/collections/duo-block/index.d.ts +24 -0
- package/dist/xbe-ui/src/components/collections/duo-block/index.d.ts.map +1 -0
- package/dist/xbe-ui/src/components/collections/duo-block/index.js +28 -0
- package/dist/xbe-ui/src/components/collections/icon-card/index.d.ts +38 -0
- package/dist/xbe-ui/src/components/collections/icon-card/index.d.ts.map +1 -0
- package/dist/xbe-ui/src/components/collections/icon-card/index.js +27 -0
- package/dist/xbe-ui/src/components/collections/link-list/index.d.ts +116 -0
- package/dist/xbe-ui/src/components/collections/link-list/index.d.ts.map +1 -0
- package/dist/xbe-ui/src/components/collections/link-list/index.js +77 -0
- package/dist/xbe-ui/src/components/collections/maps/index.d.ts +21 -0
- package/dist/xbe-ui/src/components/collections/maps/index.d.ts.map +1 -0
- package/dist/xbe-ui/src/components/collections/maps/index.js +11 -0
- package/dist/xbe-ui/src/components/collections/profile/index.d.ts +40 -0
- package/dist/xbe-ui/src/components/collections/profile/index.d.ts.map +1 -0
- package/dist/xbe-ui/src/components/collections/profile/index.js +99 -0
- package/dist/xbe-ui/src/components/layout/grid-container.d.ts +27 -0
- package/dist/xbe-ui/src/components/layout/grid-container.d.ts.map +1 -0
- package/dist/xbe-ui/src/components/layout/grid-container.js +110 -0
- package/dist/xbe-ui/src/components/layout/grid-item.d.ts +32 -0
- package/dist/xbe-ui/src/components/layout/grid-item.d.ts.map +1 -0
- package/dist/xbe-ui/src/components/layout/grid-item.js +57 -0
- package/dist/xbe-ui/src/components/structure/breadcrumb/breadcrumb.d.ts +24 -0
- package/dist/xbe-ui/src/components/structure/breadcrumb/breadcrumb.d.ts.map +1 -0
- package/dist/xbe-ui/src/components/structure/breadcrumb/breadcrumb.js +27 -0
- package/dist/xbe-ui/src/components/system/linkrenderer.d.ts +52 -0
- package/dist/xbe-ui/src/components/system/linkrenderer.d.ts.map +1 -0
- package/dist/xbe-ui/src/components/system/linkrenderer.js +42 -0
- package/dist/xbe-ui/src/hooks/useDisableBodyScroll.d.ts +7 -0
- package/dist/xbe-ui/src/hooks/useDisableBodyScroll.d.ts.map +1 -0
- package/dist/xbe-ui/src/hooks/useDisableBodyScroll.js +24 -0
- package/dist/xbe-ui/src/hooks/useToggle.d.ts +2 -0
- package/dist/xbe-ui/src/hooks/useToggle.d.ts.map +1 -0
- package/dist/xbe-ui/src/hooks/useToggle.js +11 -0
- package/dist/xbe-ui/src/index.d.ts +27 -0
- package/dist/xbe-ui/src/index.d.ts.map +1 -0
- package/dist/xbe-ui/src/index.js +27 -0
- package/dist/xbe-ui/src/lib/utils.d.ts +3 -0
- package/dist/xbe-ui/src/lib/utils.d.ts.map +1 -0
- package/dist/xbe-ui/src/lib/utils.js +5 -0
- package/dist/xbe-ui/src/shardcn/accordion.d.ts +8 -0
- package/dist/xbe-ui/src/shardcn/accordion.d.ts.map +1 -0
- package/dist/xbe-ui/src/shardcn/accordion.js +14 -0
- package/dist/xbe-ui/src/shardcn/carousel.d.ts +29 -0
- package/dist/xbe-ui/src/shardcn/carousel.d.ts.map +1 -0
- package/dist/xbe-ui/src/shardcn/carousel.js +111 -0
- package/dist/xbe-ui/src/types/heading.d.ts +9 -0
- package/dist/xbe-ui/src/types/heading.d.ts.map +1 -0
- package/dist/xbe-ui/src/types/heading.js +1 -0
- package/dist/xbe-ui/src/utils/images/cloudflare-loader.d.ts +4 -0
- package/dist/xbe-ui/src/utils/images/cloudflare-loader.d.ts.map +1 -0
- package/dist/xbe-ui/src/utils/images/cloudflare-loader.js +40 -0
- package/dist/xbe-ui/src/utils/images/default-loader.d.ts +4 -0
- package/dist/xbe-ui/src/utils/images/default-loader.d.ts.map +1 -0
- package/dist/xbe-ui/src/utils/images/default-loader.js +30 -0
- package/dist/xbe-ui/src/utils/images/generate-image-url.d.ts +10 -0
- package/dist/xbe-ui/src/utils/images/generate-image-url.d.ts.map +1 -0
- package/dist/xbe-ui/src/utils/images/generate-image-url.js +28 -0
- package/dist/xbe-ui/src/utils/images/image-loader.d.ts +4 -0
- package/dist/xbe-ui/src/utils/images/image-loader.d.ts.map +1 -0
- package/dist/xbe-ui/src/utils/images/image-loader.js +11 -0
- package/dist/xbe-ui/src/utils/images/raw-loader.d.ts +17 -0
- package/dist/xbe-ui/src/utils/images/raw-loader.d.ts.map +1 -0
- package/dist/xbe-ui/src/utils/images/raw-loader.js +28 -0
- package/dist/xbe-ui/src/utils/url.d.ts +2 -0
- package/dist/xbe-ui/src/utils/url.d.ts.map +1 -0
- package/dist/xbe-ui/src/utils/url.js +22 -0
- package/dist/xbe.shared/src/index.d.ts +2 -0
- package/dist/xbe.shared/src/index.d.ts.map +1 -0
- package/dist/xbe.shared/src/index.js +1 -0
- package/package.json +39 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { ComponentParams, ComponentRendering, NextjsContentSdkComponent, Page } from '@sitecore-content-sdk/nextjs';
|
|
2
|
+
/**
|
|
3
|
+
* Props passed to components rendered through Sitecore JSS.
|
|
4
|
+
*
|
|
5
|
+
* @property rendering - The component rendering data from Sitecore, including fields and placeholders
|
|
6
|
+
* @property params - Component parameters configured in Sitecore, extended with rendering-specific properties
|
|
7
|
+
* @property page - The current page context and data
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* const MyComponent: React.FC<ComponentProps> = ({ rendering, params, page }) => {
|
|
12
|
+
* return <div style={params.styles}>{rendering.fields.title}</div>;
|
|
13
|
+
* };
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export type ComponentProps = {
|
|
17
|
+
rendering: ComponentRendering;
|
|
18
|
+
params: ComponentParams & {
|
|
19
|
+
/**
|
|
20
|
+
* The identifier for the rendering
|
|
21
|
+
*/
|
|
22
|
+
RenderingIdentifier?: string;
|
|
23
|
+
/**
|
|
24
|
+
* The styles for the rendering
|
|
25
|
+
* This value is calculated by the Placeholder component
|
|
26
|
+
*/
|
|
27
|
+
styles?: string;
|
|
28
|
+
/**
|
|
29
|
+
* The enabled placeholders for the rendering
|
|
30
|
+
*/
|
|
31
|
+
EnabledPlaceholders?: string;
|
|
32
|
+
DynamicPlaceholderId?: string;
|
|
33
|
+
};
|
|
34
|
+
page: Page;
|
|
35
|
+
componentMap: Map<string, NextjsContentSdkComponent>;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Represents the props for a component that includes page context information.
|
|
39
|
+
*
|
|
40
|
+
* @remarks
|
|
41
|
+
* This type extends the base `ComponentProps` with additional page context,
|
|
42
|
+
* allowing components to access page-level data and configuration.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```typescript
|
|
46
|
+
* const MyComponent: React.FC<ComponentWithContextProps> = ({ page, ...props }) => {
|
|
47
|
+
* // Access page context and component props
|
|
48
|
+
* return <div>{page.title}</div>;
|
|
49
|
+
* };
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
export type ComponentWithContextProps = ComponentProps & {
|
|
53
|
+
page: Page;
|
|
54
|
+
};
|
|
55
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../xbe-lib/src/component-props/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AAGpH;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,SAAS,EAAE,kBAAkB,CAAC;IAC9B,MAAM,EAAE,eAAe,GAAG;QACxB;;WAEG;QACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;QAC7B;;;WAGG;QACH,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB;;WAEG;QACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;QAC7B,oBAAoB,CAAC,EAAE,MAAM,CAAC;KAC/B,CAAC;IACF,IAAI,EAAE,IAAI,CAAC;IACX,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,yBAAyB,CAAC,CAAC;CACtD,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,yBAAyB,GAAG,cAAc,GAAG;IACvD,IAAI,EAAE,IAAI,CAAC;CACZ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './component-props';
|
|
2
|
+
export * from './middleware';
|
|
3
|
+
export * from './services';
|
|
4
|
+
export * from './sitecore/SitecoreConfigLoader';
|
|
5
|
+
export * from './sitecore/createSitecoreClient';
|
|
6
|
+
export * from './sitecore/fetchComponentData';
|
|
7
|
+
export * from './utils';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../xbe-lib/src/index.tsx"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,iCAAiC,CAAC;AAChD,cAAc,iCAAiC,CAAC;AAChD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './component-props';
|
|
2
|
+
export * from './middleware';
|
|
3
|
+
export * from './services';
|
|
4
|
+
export * from './sitecore/SitecoreConfigLoader';
|
|
5
|
+
export * from './sitecore/createSitecoreClient';
|
|
6
|
+
export * from './sitecore/fetchComponentData';
|
|
7
|
+
export * from './utils';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../xbe-lib/src/middleware/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { CacheService } from './index';
|
|
2
|
+
/**
|
|
3
|
+
* An in-memory cache provider implementation that stores cached items with time-to-live (TTL) expiration.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* This cache provider uses a static Map to store cache entries across all instances. Each entry
|
|
7
|
+
* contains a value and an expiration timestamp. Expired entries are automatically removed when
|
|
8
|
+
* accessed or during enumeration.
|
|
9
|
+
*
|
|
10
|
+
* @typeParam T - The type of values stored in the cache
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* const cache = new InMemoryCacheProvider<string>();
|
|
15
|
+
* await cache.set('myKey', 'myValue', 60000); // Cache for 60 seconds
|
|
16
|
+
* const value = await cache.get('myKey');
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare class InMemoryCacheProvider<T> implements CacheService<T> {
|
|
20
|
+
private static cache;
|
|
21
|
+
get(key: string): Promise<T | undefined>;
|
|
22
|
+
set(key: string, value: T, ttlMs?: number): Promise<void>;
|
|
23
|
+
delete(key: string): Promise<void>;
|
|
24
|
+
getEntries(): Promise<[string, T][]>;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=InMemoryCacheProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InMemoryCacheProvider.d.ts","sourceRoot":"","sources":["../../../../../../xbe-lib/src/services/CacheService/InMemoryCacheProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAG5C;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,qBAAqB,CAAC,CAAC,CAAE,YAAW,YAAY,CAAC,CAAC,CAAC;IAC5D,OAAO,CAAC,MAAM,CAAC,KAAK,CAAsD;IAEpE,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;IAUxC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,SAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAIhE,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIlC,UAAU,IAAI,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC;CAa7C"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// Example in-memory fallback (not Edge-compatible, but useful for local/dev)
|
|
2
|
+
/**
|
|
3
|
+
* An in-memory cache provider implementation that stores cached items with time-to-live (TTL) expiration.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* This cache provider uses a static Map to store cache entries across all instances. Each entry
|
|
7
|
+
* contains a value and an expiration timestamp. Expired entries are automatically removed when
|
|
8
|
+
* accessed or during enumeration.
|
|
9
|
+
*
|
|
10
|
+
* @typeParam T - The type of values stored in the cache
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* const cache = new InMemoryCacheProvider<string>();
|
|
15
|
+
* await cache.set('myKey', 'myValue', 60000); // Cache for 60 seconds
|
|
16
|
+
* const value = await cache.get('myKey');
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export class InMemoryCacheProvider {
|
|
20
|
+
static cache = new Map();
|
|
21
|
+
async get(key) {
|
|
22
|
+
const entry = InMemoryCacheProvider.cache.get(key);
|
|
23
|
+
if (!entry)
|
|
24
|
+
return undefined;
|
|
25
|
+
if (entry.expires < Date.now()) {
|
|
26
|
+
InMemoryCacheProvider.cache.delete(key);
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
return entry.value;
|
|
30
|
+
}
|
|
31
|
+
async set(key, value, ttlMs = 5 * 60 * 1000) {
|
|
32
|
+
InMemoryCacheProvider.cache.set(key, { value, expires: Date.now() + ttlMs });
|
|
33
|
+
}
|
|
34
|
+
async delete(key) {
|
|
35
|
+
InMemoryCacheProvider.cache.delete(key);
|
|
36
|
+
}
|
|
37
|
+
async getEntries() {
|
|
38
|
+
const entries = [];
|
|
39
|
+
const now = Date.now();
|
|
40
|
+
for (const [key, entry] of InMemoryCacheProvider.cache.entries()) {
|
|
41
|
+
if (entry.expires >= now) {
|
|
42
|
+
entries.push([key, entry.value]);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
InMemoryCacheProvider.cache.delete(key);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return entries;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { CacheService } from './index';
|
|
2
|
+
/**
|
|
3
|
+
* Cache provider implementation using Vercel Edge Config for storage.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* This provider is designed to work with Vercel's Edge Config API for distributed caching
|
|
7
|
+
* at the edge. Note that write operations (set/delete) typically require backend/admin API access.
|
|
8
|
+
*
|
|
9
|
+
* @typeParam T - The type of values stored in the cache
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* const cache = new VercelEdgeCacheProvider<string>();
|
|
14
|
+
* const value = await cache.get('myKey');
|
|
15
|
+
* await cache.set('myKey', 'myValue', 3600000);
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @see {@link CacheService} for the interface implementation details
|
|
19
|
+
*/
|
|
20
|
+
export declare class VercelEdgeCacheProvider<T> implements CacheService<T> {
|
|
21
|
+
get(key: string): Promise<T | undefined>;
|
|
22
|
+
set(key: string, value: T, ttlMs?: number): Promise<void>;
|
|
23
|
+
delete(key: string): Promise<void>;
|
|
24
|
+
getEntries(): Promise<[string, T][]>;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=VercelEdgeCacheService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VercelEdgeCacheService.d.ts","sourceRoot":"","sources":["../../../../../../xbe-lib/src/services/CacheService/VercelEdgeCacheService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAI5C;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,uBAAuB,CAAC,CAAC,CAAE,YAAW,YAAY,CAAC,CAAC,CAAC;IACxD,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;IAKxC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKzD,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKlC,UAAU,IAAI,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC;CAI7C"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// Skeleton voor Vercel Edge Config cache service
|
|
2
|
+
// Zie: https://vercel.com/docs/storage/edge-config/sdk
|
|
3
|
+
/**
|
|
4
|
+
* Cache provider implementation using Vercel Edge Config for storage.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* This provider is designed to work with Vercel's Edge Config API for distributed caching
|
|
8
|
+
* at the edge. Note that write operations (set/delete) typically require backend/admin API access.
|
|
9
|
+
*
|
|
10
|
+
* @typeParam T - The type of values stored in the cache
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* const cache = new VercelEdgeCacheProvider<string>();
|
|
15
|
+
* const value = await cache.get('myKey');
|
|
16
|
+
* await cache.set('myKey', 'myValue', 3600000);
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @see {@link CacheService} for the interface implementation details
|
|
20
|
+
*/
|
|
21
|
+
export class VercelEdgeCacheProvider {
|
|
22
|
+
async get(key) {
|
|
23
|
+
// TODO: Implementeer ophalen uit Vercel Edge Config
|
|
24
|
+
throw new Error('VercelEdgeCacheService.get not implemented');
|
|
25
|
+
}
|
|
26
|
+
async set(key, value, ttlMs) {
|
|
27
|
+
// TODO: Implementeer schrijven naar Vercel Edge Config (let op: meestal alleen via backend/admin API mogelijk)
|
|
28
|
+
throw new Error('VercelEdgeCacheService.set not implemented');
|
|
29
|
+
}
|
|
30
|
+
async delete(key) {
|
|
31
|
+
// TODO: Implementeer verwijderen uit Vercel Edge Config (optioneel, afhankelijk van API)
|
|
32
|
+
throw new Error('VercelEdgeCacheService.delete not implemented');
|
|
33
|
+
}
|
|
34
|
+
async getEntries() {
|
|
35
|
+
throw new Error('Method not implemented.');
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A generic cache service interface for storing and retrieving values with optional time-to-live (TTL).
|
|
3
|
+
*
|
|
4
|
+
* @template T - The type of values stored in the cache
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* const cache: CacheService<User> = new MyCacheImplementation();
|
|
9
|
+
* await cache.set('user:123', userData, 60000); // Cache for 60 seconds
|
|
10
|
+
* const user = await cache.get('user:123');
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
export interface CacheService<T> {
|
|
14
|
+
get(key: string): Promise<T | undefined>;
|
|
15
|
+
set(key: string, value: T, ttlMs?: number): Promise<void>;
|
|
16
|
+
delete?(key: string): Promise<void>;
|
|
17
|
+
getEntries(): Promise<[string, T][]>;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Enumeration of available cache provider types.
|
|
21
|
+
*
|
|
22
|
+
* @remarks
|
|
23
|
+
* This enum defines the supported cache storage mechanisms that can be used
|
|
24
|
+
* by the CacheService to store and retrieve cached data.
|
|
25
|
+
*
|
|
26
|
+
* @enum {string}
|
|
27
|
+
*
|
|
28
|
+
* @property {string} Memory - In-memory cache storage (non-persistent)
|
|
29
|
+
* @property {string} Vercel - Vercel KV storage for distributed caching
|
|
30
|
+
*/
|
|
31
|
+
export declare enum CacheProviderType {
|
|
32
|
+
Memory = "memory",
|
|
33
|
+
Vercel = "vercel"
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Creates and returns a cache service instance of the specified provider type.
|
|
37
|
+
*
|
|
38
|
+
* @template T - The type of data that will be cached by the service
|
|
39
|
+
* @param {CacheProviderType} [type=CacheProviderType.Memory] - The type of cache provider to instantiate. Defaults to Memory provider.
|
|
40
|
+
* @returns {CacheService<T>} A new instance of the specified cache service provider
|
|
41
|
+
* @throws {Error} Throws an error if the specified provider type is not registered in the provider registry
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```typescript
|
|
45
|
+
* // Create a memory cache provider
|
|
46
|
+
* const memoryCache = getCacheProvider<string>();
|
|
47
|
+
*
|
|
48
|
+
* // Create a specific cache provider
|
|
49
|
+
* const redisCache = getCacheProvider<User>(CacheProviderType.Redis);
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
export declare function getCacheProvider<T>(type?: CacheProviderType): CacheService<T>;
|
|
53
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../xbe-lib/src/services/CacheService/index.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,YAAY,CAAC,CAAC;IAC3B,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC;IACzC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1D,MAAM,CAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpC,UAAU,IAAK,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;CACzC;AAED;;;;;;;;;;;GAWG;AACH,oBAAY,iBAAiB;IACzB,MAAM,WAAW;IACjB,MAAM,WAAW;CACpB;AAgBD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,IAAI,GAAE,iBAA4C,GAAG,YAAY,CAAC,CAAC,CAAC,CAIvG"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { InMemoryCacheProvider } from './InMemoryCacheProvider';
|
|
2
|
+
import { VercelEdgeCacheProvider } from './VercelEdgeCacheService';
|
|
3
|
+
/**
|
|
4
|
+
* Enumeration of available cache provider types.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* This enum defines the supported cache storage mechanisms that can be used
|
|
8
|
+
* by the CacheService to store and retrieve cached data.
|
|
9
|
+
*
|
|
10
|
+
* @enum {string}
|
|
11
|
+
*
|
|
12
|
+
* @property {string} Memory - In-memory cache storage (non-persistent)
|
|
13
|
+
* @property {string} Vercel - Vercel KV storage for distributed caching
|
|
14
|
+
*/
|
|
15
|
+
export var CacheProviderType;
|
|
16
|
+
(function (CacheProviderType) {
|
|
17
|
+
CacheProviderType["Memory"] = "memory";
|
|
18
|
+
CacheProviderType["Vercel"] = "vercel";
|
|
19
|
+
})(CacheProviderType || (CacheProviderType = {}));
|
|
20
|
+
/**
|
|
21
|
+
* Registry mapping cache provider types to their corresponding implementation classes.
|
|
22
|
+
*
|
|
23
|
+
* @remarks
|
|
24
|
+
* This registry is used to dynamically instantiate the appropriate cache provider
|
|
25
|
+
* based on the specified {@link CacheProviderType}.
|
|
26
|
+
*
|
|
27
|
+
* @internal
|
|
28
|
+
*/
|
|
29
|
+
const providerRegistry = {
|
|
30
|
+
[CacheProviderType.Memory]: InMemoryCacheProvider,
|
|
31
|
+
[CacheProviderType.Vercel]: VercelEdgeCacheProvider,
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Creates and returns a cache service instance of the specified provider type.
|
|
35
|
+
*
|
|
36
|
+
* @template T - The type of data that will be cached by the service
|
|
37
|
+
* @param {CacheProviderType} [type=CacheProviderType.Memory] - The type of cache provider to instantiate. Defaults to Memory provider.
|
|
38
|
+
* @returns {CacheService<T>} A new instance of the specified cache service provider
|
|
39
|
+
* @throws {Error} Throws an error if the specified provider type is not registered in the provider registry
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```typescript
|
|
43
|
+
* // Create a memory cache provider
|
|
44
|
+
* const memoryCache = getCacheProvider<string>();
|
|
45
|
+
*
|
|
46
|
+
* // Create a specific cache provider
|
|
47
|
+
* const redisCache = getCacheProvider<User>(CacheProviderType.Redis);
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
export function getCacheProvider(type = CacheProviderType.Memory) {
|
|
51
|
+
const ProviderClass = providerRegistry[type];
|
|
52
|
+
if (!ProviderClass)
|
|
53
|
+
throw new Error(`Unknown cache provider: ${type}`);
|
|
54
|
+
return new ProviderClass();
|
|
55
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { SitecoreClient } from '@sitecore-content-sdk/core/client';
|
|
2
|
+
import { NavigationGroup } from './models';
|
|
3
|
+
export type { NavigationDataSourceResponse, NavigationGroup, NavigationDropdown, NavigationFolder, NavigationItem, NavigationCTA, TextField, LinkField, ItemSearchResults, } from './models';
|
|
4
|
+
/**
|
|
5
|
+
* Configuration options for the NavigationService.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* This configuration type is used to initialize the NavigationService with the necessary
|
|
9
|
+
* dependencies required for navigation operations.
|
|
10
|
+
*
|
|
11
|
+
* @property client - The Sitecore client instance used to communicate with the Sitecore GraphQL API.
|
|
12
|
+
* @property language - The default language to use for navigation queries. Defaults to 'en'.
|
|
13
|
+
*/
|
|
14
|
+
export type NavigationServiceConfig = {
|
|
15
|
+
client: SitecoreClient;
|
|
16
|
+
language?: string;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Service for fetching navigation data from Sitecore through GraphQL.
|
|
20
|
+
*
|
|
21
|
+
* This service provides methods to query and retrieve navigation structures from Sitecore,
|
|
22
|
+
* including multi-level navigation hierarchies with dropdowns, folders, and navigation items.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* const navService = new NavigationService({ client: sitecoreClient, language: 'en' });
|
|
27
|
+
* const navigation = await navService.fetchNavigation('/sitecore/content/site/navigation/main');
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare class NavigationService {
|
|
31
|
+
private client;
|
|
32
|
+
private language;
|
|
33
|
+
constructor(config: NavigationServiceConfig);
|
|
34
|
+
/**
|
|
35
|
+
* Fetches navigation data from Sitecore for a given datasource path.
|
|
36
|
+
*
|
|
37
|
+
* @param datasource - The Sitecore item path or ID of the navigation datasource
|
|
38
|
+
* @param language - Optional language override. If not provided, uses the language from the service config
|
|
39
|
+
* @returns A promise that resolves to the NavigationGroup data structure. Returns an empty NavigationGroup if no datasource provided or no data returned
|
|
40
|
+
*
|
|
41
|
+
* @remarks
|
|
42
|
+
* This method queries the Sitecore GraphQL endpoint to retrieve a hierarchical navigation structure.
|
|
43
|
+
* The structure includes navigation groups, dropdowns, folders, and individual navigation items.
|
|
44
|
+
* The query is optimized to limit complexity by restricting the number of items at each level.
|
|
45
|
+
* If no datasource is provided or no data is returned, this method logs an error and returns an empty NavigationGroup.
|
|
46
|
+
*/
|
|
47
|
+
fetchNavigation(datasource: string, language?: string): Promise<NavigationGroup>;
|
|
48
|
+
/**
|
|
49
|
+
* Updates the default language used for navigation queries.
|
|
50
|
+
*
|
|
51
|
+
* @param language - The new default language code (e.g., 'en', 'nl', 'de')
|
|
52
|
+
*/
|
|
53
|
+
setLanguage(language: string): void;
|
|
54
|
+
/**
|
|
55
|
+
* Gets the current default language setting.
|
|
56
|
+
*
|
|
57
|
+
* @returns The current language code
|
|
58
|
+
*/
|
|
59
|
+
getLanguage(): string;
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=NavigationService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NavigationService.d.ts","sourceRoot":"","sources":["../../../../../../xbe-lib/src/services/NavigationService/NavigationService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAgC,eAAe,EAAE,MAAM,UAAU,CAAC;AAKzE,YAAY,EACR,4BAA4B,EAC5B,eAAe,EACf,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,SAAS,EACT,SAAS,EACT,iBAAiB,GACpB,MAAM,UAAU,CAAC;AAElB;;;;;;;;;GASG;AACH,MAAM,MAAM,uBAAuB,GAAG;IAClC,MAAM,EAAE,cAAc,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,qBAAa,iBAAiB;IAC1B,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,QAAQ,CAAS;gBAEb,MAAM,EAAE,uBAAuB;IAK3C;;;;;;;;;;;;OAYG;IACG,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IA2CtF;;;;OAIG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAInC;;;;OAIG;IACH,WAAW,IAAI,MAAM;CAGxB"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { QueryNavigationDataSource } from './queries/navigation-datasource.graphql';
|
|
2
|
+
/**
|
|
3
|
+
* Service for fetching navigation data from Sitecore through GraphQL.
|
|
4
|
+
*
|
|
5
|
+
* This service provides methods to query and retrieve navigation structures from Sitecore,
|
|
6
|
+
* including multi-level navigation hierarchies with dropdowns, folders, and navigation items.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* const navService = new NavigationService({ client: sitecoreClient, language: 'en' });
|
|
11
|
+
* const navigation = await navService.fetchNavigation('/sitecore/content/site/navigation/main');
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export class NavigationService {
|
|
15
|
+
client;
|
|
16
|
+
language;
|
|
17
|
+
constructor(config) {
|
|
18
|
+
this.client = config.client;
|
|
19
|
+
this.language = config.language || 'en';
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Fetches navigation data from Sitecore for a given datasource path.
|
|
23
|
+
*
|
|
24
|
+
* @param datasource - The Sitecore item path or ID of the navigation datasource
|
|
25
|
+
* @param language - Optional language override. If not provided, uses the language from the service config
|
|
26
|
+
* @returns A promise that resolves to the NavigationGroup data structure. Returns an empty NavigationGroup if no datasource provided or no data returned
|
|
27
|
+
*
|
|
28
|
+
* @remarks
|
|
29
|
+
* This method queries the Sitecore GraphQL endpoint to retrieve a hierarchical navigation structure.
|
|
30
|
+
* The structure includes navigation groups, dropdowns, folders, and individual navigation items.
|
|
31
|
+
* The query is optimized to limit complexity by restricting the number of items at each level.
|
|
32
|
+
* If no datasource is provided or no data is returned, this method logs an error and returns an empty NavigationGroup.
|
|
33
|
+
*/
|
|
34
|
+
async fetchNavigation(datasource, language) {
|
|
35
|
+
const emptyNavigationGroup = {
|
|
36
|
+
closeIconName: { value: '', __typename: 'TextField' },
|
|
37
|
+
openIconName: { value: '', __typename: 'TextField' },
|
|
38
|
+
level1: { results: [], __typename: 'ItemSearchResults' },
|
|
39
|
+
__typename: 'XBE_Navigation_Group'
|
|
40
|
+
};
|
|
41
|
+
if (!datasource) {
|
|
42
|
+
console.error('[NavigationService.fetchNavigation] No datasource provided.');
|
|
43
|
+
return emptyNavigationGroup;
|
|
44
|
+
}
|
|
45
|
+
const queryLanguage = language || this.language;
|
|
46
|
+
try {
|
|
47
|
+
console.log(`[NavigationService.fetchNavigation] Fetching with datasource: ${datasource}, language: ${queryLanguage}`);
|
|
48
|
+
const result = await this.client.getData(QueryNavigationDataSource, {
|
|
49
|
+
datasource,
|
|
50
|
+
language: queryLanguage,
|
|
51
|
+
});
|
|
52
|
+
//console.log('[NavigationService.fetchNavigation] Raw result:', JSON.stringify(result, null, 2));
|
|
53
|
+
if (!result?.navigation) {
|
|
54
|
+
console.error('[NavigationService.fetchNavigation] No navigation data returned from GraphQL.');
|
|
55
|
+
return emptyNavigationGroup;
|
|
56
|
+
}
|
|
57
|
+
//console.log('[NavigationService.fetchNavigation] closeIconName:', result.navigation.closeIconName.value);
|
|
58
|
+
//console.log('[NavigationService.fetchNavigation] openIconName:', result.navigation.openIconName.value);
|
|
59
|
+
return result.navigation;
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
console.error('[NavigationService.fetchNavigation] Error fetching navigation data:', error);
|
|
63
|
+
return emptyNavigationGroup;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Updates the default language used for navigation queries.
|
|
68
|
+
*
|
|
69
|
+
* @param language - The new default language code (e.g., 'en', 'nl', 'de')
|
|
70
|
+
*/
|
|
71
|
+
setLanguage(language) {
|
|
72
|
+
this.language = language;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Gets the current default language setting.
|
|
76
|
+
*
|
|
77
|
+
* @returns The current language code
|
|
78
|
+
*/
|
|
79
|
+
getLanguage() {
|
|
80
|
+
return this.language;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { NavigationService } from './NavigationService';
|
|
2
|
+
export type { NavigationServiceConfig } from './NavigationService';
|
|
3
|
+
export type { NavigationDataSourceResponse, NavigationGroup, NavigationDropdown, NavigationFolder, NavigationItem, NavigationCTA, TextField, LinkField, ItemSearchResults, Level2Item, } from './models';
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../xbe-lib/src/services/NavigationService/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,YAAY,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AACnE,YAAY,EACV,4BAA4B,EAC5B,eAAe,EACf,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,SAAS,EACT,SAAS,EACT,iBAAiB,EACjB,UAAU,GACX,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { NavigationService } from './NavigationService';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ItemSearchResults.d.ts","sourceRoot":"","sources":["../../../../../../../xbe-lib/src/services/NavigationService/models/ItemSearchResults.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB,CAAC,CAAC,GAAG,OAAO;IAC5C,OAAO,EAAE,CAAC,EAAE,CAAC;IACb,UAAU,EAAE,mBAAmB,CAAC;CACjC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface LinkFieldValue {
|
|
2
|
+
href?: string;
|
|
3
|
+
linktype?: string;
|
|
4
|
+
url?: string;
|
|
5
|
+
anchor?: string;
|
|
6
|
+
target?: string;
|
|
7
|
+
text?: string;
|
|
8
|
+
class?: string;
|
|
9
|
+
title?: string;
|
|
10
|
+
querystring?: string;
|
|
11
|
+
id?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface LinkField {
|
|
14
|
+
jsonValue: {
|
|
15
|
+
value: LinkFieldValue;
|
|
16
|
+
};
|
|
17
|
+
__typename: 'LinkField';
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=LinkField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LinkField.d.ts","sourceRoot":"","sources":["../../../../../../../xbe-lib/src/services/NavigationService/models/LinkField.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,SAAS;IACxB,SAAS,EAAE;QACT,KAAK,EAAE,cAAc,CAAC;KACvB,CAAC;IACF,UAAU,EAAE,WAAW,CAAC;CACzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { LinkField } from './LinkField';
|
|
2
|
+
export interface NavigationCTA {
|
|
3
|
+
id?: string;
|
|
4
|
+
link?: LinkField;
|
|
5
|
+
navigationTitle?: {
|
|
6
|
+
jsonValue: unknown;
|
|
7
|
+
__typename: 'RichTextField';
|
|
8
|
+
};
|
|
9
|
+
__typename: 'XBE_CTA';
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=NavigationCTA.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NavigationCTA.d.ts","sourceRoot":"","sources":["../../../../../../../xbe-lib/src/services/NavigationService/models/NavigationCTA.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,WAAW,aAAa;IAC5B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,eAAe,CAAC,EAAE;QAChB,SAAS,EAAE,OAAO,CAAC;QACnB,UAAU,EAAE,eAAe,CAAC;KAC7B,CAAC;IACF,UAAU,EAAE,SAAS,CAAC;CACvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/xbe-lib/src/services/NavigationService/models/NavigationDataSourceResponse.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NavigationDataSourceResponse.d.ts","sourceRoot":"","sources":["../../../../../../../xbe-lib/src/services/NavigationService/models/NavigationDataSourceResponse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,MAAM,WAAW,4BAA4B;IAC3C,UAAU,EAAE,eAAe,CAAC;CAC7B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ItemSearchResults } from './ItemSearchResults';
|
|
2
|
+
import { LinkField } from './LinkField';
|
|
3
|
+
import { NavigationCTA } from './NavigationCTA';
|
|
4
|
+
import { NavigationFolder } from './NavigationFolder';
|
|
5
|
+
import { TextField } from './TextField';
|
|
6
|
+
export type Level2Item = NavigationFolder | NavigationCTA;
|
|
7
|
+
export interface NavigationDropdown {
|
|
8
|
+
id: string;
|
|
9
|
+
link: LinkField;
|
|
10
|
+
navigationTitle: TextField;
|
|
11
|
+
level2: ItemSearchResults<Level2Item>;
|
|
12
|
+
__typename: 'XBE_Navigation_Dropdown';
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=NavigationDropdown.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NavigationDropdown.d.ts","sourceRoot":"","sources":["../../../../../../../xbe-lib/src/services/NavigationService/models/NavigationDropdown.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,MAAM,UAAU,GAAG,gBAAgB,GAAG,aAAa,CAAC;AAE1D,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,SAAS,CAAC;IAChB,eAAe,EAAE,SAAS,CAAC;IAC3B,MAAM,EAAE,iBAAiB,CAAC,UAAU,CAAC,CAAC;IACtC,UAAU,EAAE,yBAAyB,CAAC;CACvC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ItemSearchResults } from './ItemSearchResults';
|
|
2
|
+
import { LinkField } from './LinkField';
|
|
3
|
+
import { NavigationItem } from './NavigationItem';
|
|
4
|
+
import { TextField } from './TextField';
|
|
5
|
+
export interface NavigationFolder {
|
|
6
|
+
id: string;
|
|
7
|
+
navigationTitle: TextField;
|
|
8
|
+
link: LinkField;
|
|
9
|
+
level3: ItemSearchResults<NavigationItem>;
|
|
10
|
+
__typename: 'XBE_Navigation_Folder';
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=NavigationFolder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NavigationFolder.d.ts","sourceRoot":"","sources":["../../../../../../../xbe-lib/src/services/NavigationService/models/NavigationFolder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,eAAe,EAAE,SAAS,CAAC;IAC3B,IAAI,EAAE,SAAS,CAAC;IAChB,MAAM,EAAE,iBAAiB,CAAC,cAAc,CAAC,CAAC;IAC1C,UAAU,EAAE,uBAAuB,CAAC;CACrC"}
|