@se-studio/core-ui 1.0.44 → 1.0.46
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/README.md +2 -8
- package/dist/index.d.ts +3 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/utils/buildPageMetadata.d.ts +20 -1
- package/dist/utils/buildPageMetadata.d.ts.map +1 -1
- package/dist/utils/buildPageMetadata.js +37 -0
- package/dist/utils/buildPageMetadata.js.map +1 -1
- package/dist/utils/componentUtils.d.ts +39 -146
- package/dist/utils/componentUtils.d.ts.map +1 -1
- package/dist/utils/componentUtils.js +142 -101
- package/dist/utils/componentUtils.js.map +1 -1
- package/dist/utils/urlUtils.d.ts +5 -0
- package/dist/utils/urlUtils.d.ts.map +1 -1
- package/dist/utils/urlUtils.js +10 -0
- package/dist/utils/urlUtils.js.map +1 -1
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -397,17 +397,12 @@ const previewConfig = mergeCmsRendererConfig(
|
|
|
397
397
|
#### Utilities
|
|
398
398
|
- **`buildPageMetadata`** - Generates Next.js metadata object from CMS page model
|
|
399
399
|
- **`handleCmsError`** - Error handling utility for CMS operations
|
|
400
|
-
- **`
|
|
401
|
-
- **`
|
|
402
|
-
- **`extractPageContext`** - Extract specific page context fields
|
|
400
|
+
- **`getRelatedArticles`** - Utility to fetch related articles for collections
|
|
401
|
+
- **`getRelatedPeople`** - Utility to fetch related people for collections
|
|
403
402
|
- **`cn`** - Utility function for merging Tailwind CSS classes
|
|
404
403
|
|
|
405
404
|
#### Types
|
|
406
405
|
- **`CmsRendererConfig`** - Complete renderer configuration type
|
|
407
|
-
- **`ComponentRenderer<T>`** - Type for component renderer functions
|
|
408
|
-
- **`CollectionRenderer<T>`** - Type for collection renderer functions
|
|
409
|
-
- **`ComponentConfig<T>`** - Type-safe component configuration
|
|
410
|
-
- **`CollectionConfig<T>`** - Type-safe collection configuration
|
|
411
406
|
|
|
412
407
|
For detailed JSDoc documentation on all exports, see the TypeScript declaration files (`.d.ts`) in the package.
|
|
413
408
|
|
|
@@ -417,7 +412,6 @@ For advanced CMS infrastructure usage, including:
|
|
|
417
412
|
- Configuration composition patterns
|
|
418
413
|
- Embeddable components
|
|
419
414
|
- Context passing
|
|
420
|
-
- Type-safe prop extraction
|
|
421
415
|
- Preview mode setup
|
|
422
416
|
|
|
423
417
|
See the [CMS Infrastructure Guide](./CMS_INFRASTRUCTURE.md).
|
package/dist/index.d.ts
CHANGED
|
@@ -67,10 +67,9 @@ export { default as ResponsiveVisual } from './framework/ResponsiveVisual';
|
|
|
67
67
|
export { useClickTracking } from './hooks/useClickTracking';
|
|
68
68
|
export { RTF } from './rtf/rtf';
|
|
69
69
|
export type { IBuildInformation } from './utils/buildPageMetadata';
|
|
70
|
-
export { buildPageMetadata } from './utils/buildPageMetadata';
|
|
70
|
+
export { buildPageMetadata, calculateTitleAndDescription } from './utils/buildPageMetadata';
|
|
71
71
|
export { cn } from './utils/cn';
|
|
72
|
-
export
|
|
73
|
-
export { createCollectionProps, createComponentProps, extractCollectionInfo, extractComponentInfo, extractPageContext, } from './utils/componentUtils';
|
|
72
|
+
export { getRelatedArticles, getRelatedPeople, } from './utils/componentUtils';
|
|
74
73
|
export { convertText } from './utils/convertText';
|
|
75
74
|
export { handleCmsError } from './utils/errorHandling';
|
|
76
75
|
export { captureException, initErrorMonitoring } from './utils/errorMonitoring';
|
|
@@ -84,7 +83,7 @@ export type { StructuredDataConfig, StructuredDataContext } from './utils/struct
|
|
|
84
83
|
export { buildStructuredDataContext } from './utils/structuredDataUtils';
|
|
85
84
|
export { UnsupportedWarning } from './utils/UnsupportedWarning';
|
|
86
85
|
export { DEFAULT_ALLOWED_UNUSED, UnusedChecker } from './utils/UnusedChecker';
|
|
87
|
-
export { isAbsoluteUrl } from './utils/urlUtils';
|
|
86
|
+
export { getCurrentPageUrl, isAbsoluteUrl } from './utils/urlUtils';
|
|
88
87
|
export { calculateHorizontalPositionClassName } from './utils/visualPositions';
|
|
89
88
|
export { calculateVisualSizes } from './utils/visualSizes';
|
|
90
89
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAKH,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAEvF,OAAO,EACL,mBAAmB,EACnB,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,gBAAgB,EAChB,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,YAAY,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAE9D,YAAY,EACV,aAAa,EACb,kBAAkB,EAClB,uBAAuB,EACvB,qBAAqB,EACrB,0BAA0B,GAC3B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,YAAY,EACV,YAAY,EACZ,iBAAiB,EACjB,sBAAsB,EACtB,oBAAoB,EACpB,yBAAyB,GAC1B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,YAAY,EACV,oBAAoB,EACpB,uBAAuB,GACxB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACr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uBAAuB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAEhF,YAAY,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACxE,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,YAAY,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EACL,0BAA0B,EAC1B,0BAA0B,EAC1B,yBAAyB,EACzB,mBAAmB,GACpB,MAAM,sBAAsB,CAAC;AAE9B,YAAY,EACV,sBAAsB,EACtB,sBAAsB,EACtB,YAAY,GACb,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,yBAAyB,EACzB,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAC/F,OAAO,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC9E,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,oCAAoC,EAAE,MAAM,yBAAyB,CAAC;AAC/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -66,10 +66,10 @@ export { default as ResponsiveVisual } from './framework/ResponsiveVisual';
|
|
|
66
66
|
// Shared Hooks
|
|
67
67
|
export { useClickTracking } from './hooks/useClickTracking';
|
|
68
68
|
export { RTF } from './rtf/rtf';
|
|
69
|
-
export { buildPageMetadata } from './utils/buildPageMetadata';
|
|
69
|
+
export { buildPageMetadata, calculateTitleAndDescription } from './utils/buildPageMetadata';
|
|
70
70
|
// Shared Utilities
|
|
71
71
|
export { cn } from './utils/cn';
|
|
72
|
-
export {
|
|
72
|
+
export { getRelatedArticles, getRelatedPeople, } from './utils/componentUtils';
|
|
73
73
|
export { convertText } from './utils/convertText';
|
|
74
74
|
export { handleCmsError } from './utils/errorHandling';
|
|
75
75
|
export { captureException, initErrorMonitoring } from './utils/errorMonitoring';
|
|
@@ -80,7 +80,7 @@ export { buildStructuredDataContext } from './utils/structuredDataUtils';
|
|
|
80
80
|
export { UnsupportedWarning } from './utils/UnsupportedWarning';
|
|
81
81
|
// Development Utilities
|
|
82
82
|
export { DEFAULT_ALLOWED_UNUSED, UnusedChecker } from './utils/UnusedChecker';
|
|
83
|
-
export { isAbsoluteUrl } from './utils/urlUtils';
|
|
83
|
+
export { getCurrentPageUrl, isAbsoluteUrl } from './utils/urlUtils';
|
|
84
84
|
export { calculateHorizontalPositionClassName } from './utils/visualPositions';
|
|
85
85
|
export { calculateVisualSizes } from './utils/visualSizes';
|
|
86
86
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,kDAAkD;AAElD,YAAY;AACZ,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACvF,qBAAqB;AACrB,OAAO,EACL,mBAAmB,EACnB,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,sBAAsB,CAAC;AAM9B,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAS9D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAQ3D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAKzD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE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le, IBaseArticleType, IBaseCustomType, IBaseModel, IBaseTag } from '@se-studio/core-data-types';
|
|
2
2
|
import type { Metadata, ResolvingMetadata } from 'next';
|
|
3
3
|
/**
|
|
4
4
|
* Configuration for building page metadata.
|
|
@@ -57,4 +57,23 @@ export interface IBuildInformation {
|
|
|
57
57
|
* ```
|
|
58
58
|
*/
|
|
59
59
|
export declare function buildPageMetadata(model: Pick<IBaseModel, 'title' | 'description' | 'featuredImage' | 'indexed'>, path: string, { baseUrl, isProduction, customerName, applicationName }: IBuildInformation, _parent: ResolvingMetadata): Metadata;
|
|
60
|
+
/**
|
|
61
|
+
* Utility function to calculate title and description for various content types.
|
|
62
|
+
*
|
|
63
|
+
* This provides a standard way to generate SEO text for resource index pages,
|
|
64
|
+
* topic pages, and individual articles. Projects can use this in their
|
|
65
|
+
* metadata generation logic.
|
|
66
|
+
*
|
|
67
|
+
* @param params - Objects representing the context (article, tag, articleType, customType)
|
|
68
|
+
* @returns Object with title and description strings
|
|
69
|
+
*/
|
|
70
|
+
export declare function calculateTitleAndDescription({ articleType, customType, tag, article, }: {
|
|
71
|
+
articleType?: IBaseArticleType;
|
|
72
|
+
customType?: IBaseCustomType;
|
|
73
|
+
tag?: IBaseTag;
|
|
74
|
+
article?: IBaseArticle;
|
|
75
|
+
}): {
|
|
76
|
+
title: string;
|
|
77
|
+
description: string;
|
|
78
|
+
};
|
|
60
79
|
//# sourceMappingURL=buildPageMetadata.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildPageMetadata.d.ts","sourceRoot":"","sources":["../../src/utils/buildPageMetadata.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"buildPageMetadata.d.ts","sourceRoot":"","sources":["../../src/utils/buildPageMetadata.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,UAAU,EACV,QAAQ,EACT,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAExD;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,0DAA0D;IAC1D,OAAO,EAAE,MAAM,CAAC;IAChB,6CAA6C;IAC7C,YAAY,EAAE,OAAO,CAAC;IACtB,8CAA8C;IAC9C,aAAa,EAAE,OAAO,CAAC;IACvB,wCAAwC;IACxC,YAAY,EAAE,MAAM,CAAC;IACrB,2DAA2D;IAC3D,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,yDAAyD;IACzD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,+DAA+D;IAC/D,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,IAAI,CAAC,UAAU,EAAE,OAAO,GAAG,aAAa,GAAG,eAAe,GAAG,SAAS,CAAC,EAC9E,IAAI,EAAE,MAAM,EACZ,EAAE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,EAAE,iBAAiB,EAC3E,OAAO,EAAE,iBAAiB,GACzB,QAAQ,CA8CV;AAED;;;;;;;;;GASG;AACH,wBAAgB,4BAA4B,CAAC,EAC3C,WAAW,EACX,UAAU,EACV,GAAG,EACH,OAAO,GACR,EAAE;IACD,WAAW,CAAC,EAAE,gBAAgB,CAAC;IAC/B,UAAU,CAAC,EAAE,eAAe,CAAC;IAC7B,GAAG,CAAC,EAAE,QAAQ,CAAC;IACf,OAAO,CAAC,EAAE,YAAY,CAAC;CACxB;;;EA0BA"}
|
|
@@ -79,4 +79,41 @@ export function buildPageMetadata(model, path, { baseUrl, isProduction, customer
|
|
|
79
79
|
};
|
|
80
80
|
return result;
|
|
81
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* Utility function to calculate title and description for various content types.
|
|
84
|
+
*
|
|
85
|
+
* This provides a standard way to generate SEO text for resource index pages,
|
|
86
|
+
* topic pages, and individual articles. Projects can use this in their
|
|
87
|
+
* metadata generation logic.
|
|
88
|
+
*
|
|
89
|
+
* @param params - Objects representing the context (article, tag, articleType, customType)
|
|
90
|
+
* @returns Object with title and description strings
|
|
91
|
+
*/
|
|
92
|
+
export function calculateTitleAndDescription({ articleType, customType, tag, article, }) {
|
|
93
|
+
if (article) {
|
|
94
|
+
return { title: article.title, description: article.description };
|
|
95
|
+
}
|
|
96
|
+
if (tag && articleType) {
|
|
97
|
+
return {
|
|
98
|
+
title: `${tag.title}`,
|
|
99
|
+
description: `Browse the latest ${articleType.name.toLowerCase()} resources related to ${tag.name.toLowerCase()}.`,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
if (tag && customType) {
|
|
103
|
+
return {
|
|
104
|
+
title: `${tag.title}`,
|
|
105
|
+
description: `Browse the latest ${customType.name.toLowerCase()} resources related to ${tag.name.toLowerCase()}.`,
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
if (tag) {
|
|
109
|
+
return { title: tag.title, description: tag.description };
|
|
110
|
+
}
|
|
111
|
+
if (articleType) {
|
|
112
|
+
return { title: articleType.title, description: articleType.description };
|
|
113
|
+
}
|
|
114
|
+
if (customType) {
|
|
115
|
+
return { title: customType.title, description: customType.description };
|
|
116
|
+
}
|
|
117
|
+
return { title: '', description: '' };
|
|
118
|
+
}
|
|
82
119
|
//# sourceMappingURL=buildPageMetadata.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildPageMetadata.js","sourceRoot":"","sources":["../../src/utils/buildPageMetadata.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"buildPageMetadata.js","sourceRoot":"","sources":["../../src/utils/buildPageMetadata.ts"],"names":[],"mappings":"AA6BA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,MAAM,UAAU,iBAAiB,CAC/B,KAA8E,EAC9E,IAAY,EACZ,EAA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AW,EAAE,EAAE,EAAE,CAAC;AACxC,CAAC"}
|
|
@@ -1,147 +1,40 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
export
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* @
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
* Extract specific collection information fields that a collection needs.
|
|
41
|
-
* This is used when you only need a subset of the collection fields.
|
|
42
|
-
*
|
|
43
|
-
* @param information - The full collection information object
|
|
44
|
-
* @param keys - Array of keys to extract from the information object
|
|
45
|
-
* @returns Object with only the specified keys
|
|
46
|
-
*
|
|
47
|
-
* @example
|
|
48
|
-
* ```tsx
|
|
49
|
-
* const props = extractCollectionInfo(information, ['heading', 'body', 'contents']);
|
|
50
|
-
* // props will have type { heading?: string | null, body?: unknown, contents?: ReadonlyArray<CollectionContent> }
|
|
51
|
-
* ```
|
|
52
|
-
*/
|
|
53
|
-
export declare function extractCollectionInfo<K extends keyof IBaseCollection>(information: IBaseCollection, keys: ReadonlyArray<K>): Pick<IBaseCollection, K>;
|
|
54
|
-
/**
|
|
55
|
-
* Extract specific page context fields that a component needs.
|
|
56
|
-
*
|
|
57
|
-
* @param pageContext - The full page context object
|
|
58
|
-
* @param keys - Array of keys to extract from the page context
|
|
59
|
-
* @returns Object with only the specified keys
|
|
60
|
-
*
|
|
61
|
-
* @example
|
|
62
|
-
* ```tsx
|
|
63
|
-
* const contextProps = extractPageContext(pageContext, ['articleLink', 'pageLink']);
|
|
64
|
-
* ```
|
|
65
|
-
*/
|
|
66
|
-
export declare function extractPageContext<K extends keyof IPageContext>(pageContext: IPageContext, keys: ReadonlyArray<K>): Pick<IPageContext, K>;
|
|
67
|
-
/**
|
|
68
|
-
* Helper type to create a component renderer function with specific prop requirements.
|
|
69
|
-
* This provides better type safety when defining component renderers.
|
|
70
|
-
*
|
|
71
|
-
* @example
|
|
72
|
-
* ```tsx
|
|
73
|
-
* const config = {
|
|
74
|
-
* componentProps: ['heading', 'body', 'links'],
|
|
75
|
-
* contextProps: ['pageLink'],
|
|
76
|
-
* additionalProps: { theme: 'dark' as const }
|
|
77
|
-
* } as const satisfies ComponentConfig;
|
|
78
|
-
*
|
|
79
|
-
* const MyComponent: ComponentRenderer<typeof config> = ({ heading, body, links, pageLink, theme }) => {
|
|
80
|
-
* // All props are properly typed
|
|
81
|
-
* return <div>{heading}</div>;
|
|
82
|
-
* };
|
|
83
|
-
* ```
|
|
84
|
-
*/
|
|
85
|
-
export type ComponentRenderer<T extends ComponentConfig> = (props: GeneratePropsFromComponentConfig<T>) => React.ReactElement | null;
|
|
86
|
-
/**
|
|
87
|
-
* Helper type to create a collection renderer function with specific prop requirements.
|
|
88
|
-
* This provides better type safety when defining collection renderers.
|
|
89
|
-
*
|
|
90
|
-
* @example
|
|
91
|
-
* ```tsx
|
|
92
|
-
* const config = {
|
|
93
|
-
* collectionProps: ['heading', 'body', 'contents'],
|
|
94
|
-
* contextProps: ['articleLink'],
|
|
95
|
-
* additionalProps: { layout: 'grid' as const }
|
|
96
|
-
* } as const satisfies CollectionConfig;
|
|
97
|
-
*
|
|
98
|
-
* const MyCollection: CollectionRenderer<typeof config> = ({ heading, body, contents, articleLink, layout }) => {
|
|
99
|
-
* // All props are properly typed
|
|
100
|
-
* return <div>{heading}</div>;
|
|
101
|
-
* };
|
|
102
|
-
* ```
|
|
103
|
-
*/
|
|
104
|
-
export type CollectionRenderer<T extends CollectionConfig> = (props: GeneratePropsFromCollectionConfig<T>) => React.ReactElement | null;
|
|
105
|
-
/**
|
|
106
|
-
* Create props object for a component renderer from component information and page context.
|
|
107
|
-
* This function extracts the specified fields and combines them with additional props.
|
|
108
|
-
*
|
|
109
|
-
* @param config - Configuration specifying which props to extract
|
|
110
|
-
* @param information - The component information object
|
|
111
|
-
* @param pageContext - The page context object
|
|
112
|
-
* @param additionalProps - Additional props to include (optional)
|
|
113
|
-
* @returns Combined props object ready to pass to the component
|
|
114
|
-
*
|
|
115
|
-
* @example
|
|
116
|
-
* ```tsx
|
|
117
|
-
* const config = {
|
|
118
|
-
* componentProps: ['heading', 'body'],
|
|
119
|
-
* contextProps: ['pageLink'],
|
|
120
|
-
* } as const;
|
|
121
|
-
*
|
|
122
|
-
* const props = createComponentProps(config, information, pageContext);
|
|
123
|
-
* ```
|
|
124
|
-
*/
|
|
125
|
-
export declare function createComponentProps<T extends ComponentConfig>(config: T, information: IBaseComponent, pageContext: IPageContext, additionalProps?: T['additionalProps']): GeneratePropsFromComponentConfig<T>;
|
|
126
|
-
/**
|
|
127
|
-
* Create props object for a collection renderer from collection information and page context.
|
|
128
|
-
* This function extracts the specified fields and combines them with additional props.
|
|
129
|
-
*
|
|
130
|
-
* @param config - Configuration specifying which props to extract
|
|
131
|
-
* @param information - The collection information object
|
|
132
|
-
* @param pageContext - The page context object
|
|
133
|
-
* @param additionalProps - Additional props to include (optional)
|
|
134
|
-
* @returns Combined props object ready to pass to the collection
|
|
135
|
-
*
|
|
136
|
-
* @example
|
|
137
|
-
* ```tsx
|
|
138
|
-
* const config = {
|
|
139
|
-
* collectionProps: ['heading', 'contents'],
|
|
140
|
-
* contextProps: ['articleLink'],
|
|
141
|
-
* } as const;
|
|
142
|
-
*
|
|
143
|
-
* const props = createCollectionProps(config, information, pageContext);
|
|
144
|
-
* ```
|
|
145
|
-
*/
|
|
146
|
-
export declare function createCollectionProps<T extends CollectionConfig>(config: T, information: IBaseCollection, pageContext: IPageContext, additionalProps?: T['additionalProps']): GeneratePropsFromCollectionConfig<T>;
|
|
1
|
+
import { type BaseConverterContext, type ContentfulConfig, type FetchOptions, type IContentfulCollection } from '@se-studio/contentful-rest-api';
|
|
2
|
+
import { type BaseCollectionContent, type IArticleLink, type IContentContext, type IPersonLink } from '@se-studio/core-data-types';
|
|
3
|
+
/**
|
|
4
|
+
* Generic helper to get related articles for a collection.
|
|
5
|
+
*
|
|
6
|
+
* This function orchestrates the fetching of related articles by:
|
|
7
|
+
* 1. Extracting hard-coded articles from collection contents
|
|
8
|
+
* 2. Extracting filter criteria from collection links (tags, article type)
|
|
9
|
+
* 3. Extracting fallback criteria from page context (article type, current article)
|
|
10
|
+
* 4. Fetching additional articles if needed to reach the requested count
|
|
11
|
+
* 5. Returning manual articles followed by fetched articles
|
|
12
|
+
*
|
|
13
|
+
* @param information - The collection information containing contents and links
|
|
14
|
+
* @param contentContext - The content context containing page context
|
|
15
|
+
* @param converterContext - The project-specific converter context (contains URL rules)
|
|
16
|
+
* @param config - Contentful configuration
|
|
17
|
+
* @param count - Maximum number of articles to return (optional)
|
|
18
|
+
* @param options - Optional fetch options for preview mode and caching
|
|
19
|
+
* @returns Array of article links (manual articles first, then fetched)
|
|
20
|
+
*/
|
|
21
|
+
export declare function getRelatedArticles<T extends BaseCollectionContent>(information: IContentfulCollection<T>, contentContext: IContentContext, converterContext: BaseConverterContext, config: ContentfulConfig, count: number | undefined, options: FetchOptions): Promise<IArticleLink[]>;
|
|
22
|
+
/**
|
|
23
|
+
* Generic helper to get related people for a collection.
|
|
24
|
+
*
|
|
25
|
+
* This function orchestrates the fetching of related people by:
|
|
26
|
+
* 1. Extracting hard-coded people from collection contents
|
|
27
|
+
* 2. Fetching additional people if needed to reach the requested count
|
|
28
|
+
* 3. Excluding the current person (if on a person page) and manually added people
|
|
29
|
+
* 4. Returning manual people followed by fetched people
|
|
30
|
+
*
|
|
31
|
+
* @param information - The collection information containing contents
|
|
32
|
+
* @param contentContext - The content context containing page context
|
|
33
|
+
* @param converterContext - The project-specific converter context
|
|
34
|
+
* @param config - Contentful configuration
|
|
35
|
+
* @param count - Maximum number of people to return (default: 4)
|
|
36
|
+
* @param options - Optional fetch options for preview mode and caching
|
|
37
|
+
* @returns Array of person links (manual people first, then fetched)
|
|
38
|
+
*/
|
|
39
|
+
export declare function getRelatedPeople<T extends BaseCollectionContent>(information: IContentfulCollection<T>, contentContext: IContentContext, converterContext: BaseConverterContext, config: ContentfulConfig, count: number, options: FetchOptions): Promise<IPersonLink[]>;
|
|
147
40
|
//# sourceMappingURL=componentUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"componentUtils.d.ts","sourceRoot":"","sources":["../../src/utils/componentUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"componentUtils.d.ts","sourceRoot":"","sources":["../../src/utils/componentUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,EAGrB,KAAK,YAAY,EAEjB,KAAK,qBAAqB,EAE3B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,YAAY,EAEjB,KAAK,eAAe,EACpB,KAAK,WAAW,EAKjB,MAAM,4BAA4B,CAAC;AA8EpC;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,kBAAkB,CAAC,CAAC,SAAS,qBAAqB,EACtE,WAAW,EAAE,qBAAqB,CAAC,CAAC,CAAC,EACrC,cAAc,EAAE,eAAe,EAC/B,gBAAgB,EAAE,oBAAoB,EACtC,MAAM,EAAE,gBAAgB,EACxB,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,OAAO,EAAE,YAAY,GACpB,OAAO,CAAC,YAAY,EAAE,CAAC,CA6CzB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,gBAAgB,CAAC,CAAC,SAAS,qBAAqB,EACpE,WAAW,EAAE,qBAAqB,CAAC,CAAC,CAAC,EACrC,cAAc,EAAE,eAAe,EAC/B,gBAAgB,EAAE,oBAAoB,EACtC,MAAM,EAAE,gBAAgB,EACxB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,YAAY,GACpB,OAAO,CAAC,WAAW,EAAE,CAAC,CAmCxB"}
|
|
@@ -1,126 +1,167 @@
|
|
|
1
|
+
import { contentfulAllArticleLinks, contentfulAllPersonLinks, filterRelatedArticles, } from '@se-studio/contentful-rest-api';
|
|
2
|
+
import { isArticleLink, isArticleTypeLink, isPersonLink, isTagLink, } from '@se-studio/core-data-types';
|
|
1
3
|
/**
|
|
2
|
-
* Extract
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* @param information - The full component information object
|
|
6
|
-
* @param keys - Array of keys to extract from the information object
|
|
7
|
-
* @returns Object with only the specified keys
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```tsx
|
|
11
|
-
* const props = extractComponentInfo(information, ['heading', 'body', 'links']);
|
|
12
|
-
* // props will have type { heading?: string | null, body?: unknown, links?: ReadonlyArray<ILinkProps> }
|
|
13
|
-
* ```
|
|
4
|
+
* Extract filter criteria (article types, tags, authors) from collection links.
|
|
5
|
+
* Internal helper for getRelatedArticles.
|
|
14
6
|
*/
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
7
|
+
function extractFilterCriteria(links) {
|
|
8
|
+
const articleTypeIds = [];
|
|
9
|
+
const tagIds = [];
|
|
10
|
+
const authorIds = [];
|
|
11
|
+
if (links) {
|
|
12
|
+
for (const link of links) {
|
|
13
|
+
if (isArticleTypeLink(link)) {
|
|
14
|
+
articleTypeIds.push(link.id);
|
|
15
|
+
}
|
|
16
|
+
else if (isTagLink(link)) {
|
|
17
|
+
tagIds.push(link.id);
|
|
18
|
+
}
|
|
19
|
+
else if (isPersonLink(link)) {
|
|
20
|
+
authorIds.push(link.id);
|
|
21
|
+
}
|
|
20
22
|
}
|
|
21
23
|
}
|
|
22
|
-
return
|
|
24
|
+
return { articleTypeIds, tagIds, authorIds };
|
|
23
25
|
}
|
|
24
26
|
/**
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* @param information - The full collection information object
|
|
29
|
-
* @param keys - Array of keys to extract from the information object
|
|
30
|
-
* @returns Object with only the specified keys
|
|
31
|
-
*
|
|
32
|
-
* @example
|
|
33
|
-
* ```tsx
|
|
34
|
-
* const props = extractCollectionInfo(information, ['heading', 'body', 'contents']);
|
|
35
|
-
* // props will have type { heading?: string | null, body?: unknown, contents?: ReadonlyArray<CollectionContent> }
|
|
36
|
-
* ```
|
|
27
|
+
* Apply fallback criteria from page context when no explicit criteria provided.
|
|
28
|
+
* Internal helper for getRelatedArticles.
|
|
37
29
|
*/
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
if (
|
|
42
|
-
|
|
30
|
+
function applyFallbackCriteria(criteria, contentContext) {
|
|
31
|
+
if (criteria.articleTypeIds.length === 0) {
|
|
32
|
+
const articleType = contentContext.pageContext?.articleType;
|
|
33
|
+
if (articleType) {
|
|
34
|
+
criteria.articleTypeIds.push(articleType.id);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
const article = contentContext.pageContext?.article;
|
|
38
|
+
if (article?.articleType?.id) {
|
|
39
|
+
criteria.articleTypeIds.push(article.articleType.id);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (criteria.authorIds.length === 0) {
|
|
44
|
+
const person = contentContext.pageContext?.person;
|
|
45
|
+
if (person) {
|
|
46
|
+
criteria.authorIds.push(person.id);
|
|
43
47
|
}
|
|
44
48
|
}
|
|
45
|
-
return result;
|
|
46
49
|
}
|
|
47
50
|
/**
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* @param pageContext - The full page context object
|
|
51
|
-
* @param keys - Array of keys to extract from the page context
|
|
52
|
-
* @returns Object with only the specified keys
|
|
53
|
-
*
|
|
54
|
-
* @example
|
|
55
|
-
* ```tsx
|
|
56
|
-
* const contextProps = extractPageContext(pageContext, ['articleLink', 'pageLink']);
|
|
57
|
-
* ```
|
|
51
|
+
* Determine whether we should fetch additional articles.
|
|
52
|
+
* Internal helper for getRelatedArticles.
|
|
58
53
|
*/
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
if (key in pageContext) {
|
|
63
|
-
result[key] = pageContext[key];
|
|
64
|
-
}
|
|
54
|
+
function shouldFetchArticles(isAll, remainingSlots, criteria) {
|
|
55
|
+
if (isAll) {
|
|
56
|
+
return true;
|
|
65
57
|
}
|
|
66
|
-
|
|
58
|
+
const hasSlots = remainingSlots !== undefined && remainingSlots > 0;
|
|
59
|
+
const hasFilters = criteria.articleTypeIds.length > 0 ||
|
|
60
|
+
criteria.tagIds.length > 0 ||
|
|
61
|
+
criteria.authorIds.length > 0;
|
|
62
|
+
return hasSlots && hasFilters;
|
|
67
63
|
}
|
|
68
64
|
/**
|
|
69
|
-
*
|
|
70
|
-
* This function extracts the specified fields and combines them with additional props.
|
|
65
|
+
* Generic helper to get related articles for a collection.
|
|
71
66
|
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
67
|
+
* This function orchestrates the fetching of related articles by:
|
|
68
|
+
* 1. Extracting hard-coded articles from collection contents
|
|
69
|
+
* 2. Extracting filter criteria from collection links (tags, article type)
|
|
70
|
+
* 3. Extracting fallback criteria from page context (article type, current article)
|
|
71
|
+
* 4. Fetching additional articles if needed to reach the requested count
|
|
72
|
+
* 5. Returning manual articles followed by fetched articles
|
|
77
73
|
*
|
|
78
|
-
* @
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
* const props = createComponentProps(config, information, pageContext);
|
|
86
|
-
* ```
|
|
74
|
+
* @param information - The collection information containing contents and links
|
|
75
|
+
* @param contentContext - The content context containing page context
|
|
76
|
+
* @param converterContext - The project-specific converter context (contains URL rules)
|
|
77
|
+
* @param config - Contentful configuration
|
|
78
|
+
* @param count - Maximum number of articles to return (optional)
|
|
79
|
+
* @param options - Optional fetch options for preview mode and caching
|
|
80
|
+
* @returns Array of article links (manual articles first, then fetched)
|
|
87
81
|
*/
|
|
88
|
-
export function
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}
|
|
82
|
+
export async function getRelatedArticles(information, contentContext, converterContext, config, count, options) {
|
|
83
|
+
const isAll = typeof count === 'undefined';
|
|
84
|
+
// Step 1: Extract hard-coded articles from contents
|
|
85
|
+
const manualArticles = information.contents?.filter((item) => isArticleLink(item)) ?? [];
|
|
86
|
+
// Early return if we have enough manual articles
|
|
87
|
+
if (!isAll && count !== undefined && manualArticles.length >= count) {
|
|
88
|
+
return manualArticles.slice(0, count);
|
|
89
|
+
}
|
|
90
|
+
// Step 2: Extract and apply filter criteria
|
|
91
|
+
const criteria = extractFilterCriteria(information.links);
|
|
92
|
+
applyFallbackCriteria(criteria, contentContext);
|
|
93
|
+
// Step 3: Build exclusion list
|
|
94
|
+
const currentArticle = contentContext.pageContext?.article;
|
|
95
|
+
const excludeArticleIds = [
|
|
96
|
+
...manualArticles.map((article) => article.id),
|
|
97
|
+
...(currentArticle ? [currentArticle.id] : []),
|
|
98
|
+
];
|
|
99
|
+
// Step 4: Fetch additional articles if needed
|
|
100
|
+
const remainingSlots = isAll || count === undefined ? undefined : count - manualArticles.length;
|
|
101
|
+
let fetchedArticles = [];
|
|
102
|
+
if (shouldFetchArticles(isAll, remainingSlots, criteria)) {
|
|
103
|
+
try {
|
|
104
|
+
const response = await contentfulAllArticleLinks(converterContext, config, options);
|
|
105
|
+
const filterOptions = {
|
|
106
|
+
excludeArticleIds,
|
|
107
|
+
tagIds: criteria.tagIds,
|
|
108
|
+
articleTypeIds: criteria.articleTypeIds,
|
|
109
|
+
authorIds: criteria.authorIds,
|
|
110
|
+
count: remainingSlots,
|
|
111
|
+
};
|
|
112
|
+
fetchedArticles = filterRelatedArticles(response.data, filterOptions);
|
|
113
|
+
}
|
|
114
|
+
catch (error) {
|
|
115
|
+
console.error('[getRelatedArticles] Error fetching articles:', error);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
// Step 5: Return manual articles followed by fetched articles
|
|
119
|
+
return [...manualArticles, ...fetchedArticles].slice(0, count);
|
|
96
120
|
}
|
|
97
121
|
/**
|
|
98
|
-
*
|
|
99
|
-
* This function extracts the specified fields and combines them with additional props.
|
|
122
|
+
* Generic helper to get related people for a collection.
|
|
100
123
|
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
124
|
+
* This function orchestrates the fetching of related people by:
|
|
125
|
+
* 1. Extracting hard-coded people from collection contents
|
|
126
|
+
* 2. Fetching additional people if needed to reach the requested count
|
|
127
|
+
* 3. Excluding the current person (if on a person page) and manually added people
|
|
128
|
+
* 4. Returning manual people followed by fetched people
|
|
106
129
|
*
|
|
107
|
-
* @
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
* const props = createCollectionProps(config, information, pageContext);
|
|
115
|
-
* ```
|
|
130
|
+
* @param information - The collection information containing contents
|
|
131
|
+
* @param contentContext - The content context containing page context
|
|
132
|
+
* @param converterContext - The project-specific converter context
|
|
133
|
+
* @param config - Contentful configuration
|
|
134
|
+
* @param count - Maximum number of people to return (default: 4)
|
|
135
|
+
* @param options - Optional fetch options for preview mode and caching
|
|
136
|
+
* @returns Array of person links (manual people first, then fetched)
|
|
116
137
|
*/
|
|
117
|
-
export function
|
|
118
|
-
|
|
119
|
-
const
|
|
120
|
-
return
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
138
|
+
export async function getRelatedPeople(information, contentContext, converterContext, config, count, options) {
|
|
139
|
+
// Step 1: Extract hard-coded people from contents
|
|
140
|
+
const manualPeople = information.contents?.filter((item) => isPersonLink(item)) ?? [];
|
|
141
|
+
// Early return if we have enough manual people
|
|
142
|
+
if (manualPeople.length >= count) {
|
|
143
|
+
return manualPeople.slice(0, count);
|
|
144
|
+
}
|
|
145
|
+
// Step 2: Build exclusion list
|
|
146
|
+
const currentPerson = contentContext.pageContext?.person;
|
|
147
|
+
const excludePersonIds = new Set([
|
|
148
|
+
...manualPeople.map((person) => person.id),
|
|
149
|
+
...(currentPerson ? [currentPerson.id] : []),
|
|
150
|
+
]);
|
|
151
|
+
// Step 3: Fetch additional people if needed
|
|
152
|
+
const remainingSlots = count - manualPeople.length;
|
|
153
|
+
let fetchedPeople = [];
|
|
154
|
+
try {
|
|
155
|
+
const response = await contentfulAllPersonLinks(converterContext, config, options);
|
|
156
|
+
// Filter out excluded people
|
|
157
|
+
fetchedPeople = response.data
|
|
158
|
+
.filter((person) => isPersonLink(person) && !excludePersonIds.has(person.id))
|
|
159
|
+
.slice(0, remainingSlots);
|
|
160
|
+
}
|
|
161
|
+
catch (error) {
|
|
162
|
+
console.error('[getRelatedPeople] Error fetching people:', error);
|
|
163
|
+
}
|
|
164
|
+
// Step 4: Return manual people followed by fetched people
|
|
165
|
+
return [...manualPeople, ...fetchedPeople].slice(0, count);
|
|
125
166
|
}
|
|
126
167
|
//# sourceMappingURL=componentUtils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"componentUtils.js","sourceRoot":"","sources":["../../src/utils/componentUtils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"componentUtils.js","sourceRoot":"","sources":["../../src/utils/componentUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,yBAAyB,EACzB,wBAAwB,EAExB,qBAAqB,GAGtB,MAAM,gCA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AO,CAAC,CAAC;QAEnF,6BAA6B;QAC7B,aAAa,GAAG,QAAQ,CAAC,IAAI;aAC1B,MAAM,CACL,CAAC,MAAM,EAAyB,EAAE,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAC5F;aACA,KAAK,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC;IAC9B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,2CAA2C,EAAE,KAAK,CAAC,CAAC;IACpE,CAAC;IAED,0DAA0D;IAC1D,OAAO,CAAC,GAAG,YAAY,EAAE,GAAG,aAAa,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;AAC7D,CAAC"}
|
package/dist/utils/urlUtils.d.ts
CHANGED
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
export declare function isAbsoluteUrl(url: string): boolean;
|
|
2
|
+
/**
|
|
3
|
+
* Utility function to get the current page URL safely.
|
|
4
|
+
* Returns an empty string when running on the server.
|
|
5
|
+
*/
|
|
6
|
+
export declare function getCurrentPageUrl(): string;
|
|
2
7
|
//# sourceMappingURL=urlUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"urlUtils.d.ts","sourceRoot":"","sources":["../../src/utils/urlUtils.ts"],"names":[],"mappings":"AAAA,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAOlD"}
|
|
1
|
+
{"version":3,"file":"urlUtils.d.ts","sourceRoot":"","sources":["../../src/utils/urlUtils.ts"],"names":[],"mappings":"AAAA,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAOlD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAK1C"}
|
package/dist/utils/urlUtils.js
CHANGED
|
@@ -7,4 +7,14 @@ export function isAbsoluteUrl(url) {
|
|
|
7
7
|
return false;
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* Utility function to get the current page URL safely.
|
|
12
|
+
* Returns an empty string when running on the server.
|
|
13
|
+
*/
|
|
14
|
+
export function getCurrentPageUrl() {
|
|
15
|
+
if (typeof window !== 'undefined') {
|
|
16
|
+
return window.location.href;
|
|
17
|
+
}
|
|
18
|
+
return '';
|
|
19
|
+
}
|
|
10
20
|
//# sourceMappingURL=urlUtils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"urlUtils.js","sourceRoot":"","sources":["../../src/utils/urlUtils.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,aAAa,CAAC,GAAW;IACvC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;QAC5B,OAAO,MAAM,CAAC,QAAQ,KAAK,OAAO,IAAI,MAAM,CAAC,QAAQ,KAAK,QAAQ,CAAC;IACrE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
|
|
1
|
+
{"version":3,"file":"urlUtils.js","sourceRoot":"","sources":["../../src/utils/urlUtils.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,aAAa,CAAC,GAAW;IACvC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;QAC5B,OAAO,MAAM,CAAC,QAAQ,KAAK,OAAO,IAAI,MAAM,CAAC,QAAQ,KAAK,QAAQ,CAAC;IACrE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,iBAAiB;IAC/B,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;QAClC,OAAO,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC;IAC9B,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@se-studio/core-ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.46",
|
|
4
4
|
"description": "Shared React UI component library with Tailwind CSS v4 for SE Studio applications",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"url": "https://github.com/Something-Else-Studio/se-core-product/issues"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"next": "^
|
|
45
|
+
"next": "^15.5.0",
|
|
46
46
|
"react": "^19.2.0",
|
|
47
47
|
"react-dom": "^19.2.0"
|
|
48
48
|
},
|
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
"html-entities": "^2.6.0",
|
|
59
59
|
"mustache": "4.2.0",
|
|
60
60
|
"tailwind-merge": "^3.4.0",
|
|
61
|
-
"@se-studio/contentful-rest-api": "1.0.
|
|
62
|
-
"@se-studio/core-data-types": "1.0.
|
|
61
|
+
"@se-studio/contentful-rest-api": "1.0.46",
|
|
62
|
+
"@se-studio/core-data-types": "1.0.46"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@biomejs/biome": "^2.3.10",
|
|
@@ -69,8 +69,8 @@
|
|
|
69
69
|
"@types/react": "^19.2.7",
|
|
70
70
|
"@types/react-dom": "^19.2.3",
|
|
71
71
|
"@vitejs/plugin-react": "^5.1.2",
|
|
72
|
-
"jsdom": "^27.
|
|
73
|
-
"next": "^
|
|
72
|
+
"jsdom": "^27.4.0",
|
|
73
|
+
"next": "^15.5.9",
|
|
74
74
|
"typescript": "^5.9.3",
|
|
75
75
|
"vitest": "^4.0.16"
|
|
76
76
|
},
|