@geins/core 0.6.0 → 0.6.2
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/constants/image.d.ts +9 -0
- package/dist/constants/index.d.ts +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.esm.js +1 -1
- package/dist/utils/imageUrl.d.ts +54 -0
- package/package.json +1 -1
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { GeinsImageType } from '@geins/types';
|
|
2
|
+
/**
|
|
3
|
+
* Builds a Geins CDN image URL for a specific folder.
|
|
4
|
+
* @param imageBaseUrl - The resolved image endpoint (e.g. `https://monitor.commerce.services`).
|
|
5
|
+
* @param type - The image content type.
|
|
6
|
+
* @param folder - The CDN folder (e.g. `raw`, `100x100`).
|
|
7
|
+
* @param fileName - The raw file name from the GraphQL API.
|
|
8
|
+
* @returns The full CDN URL, or `''` if inputs are missing.
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* const url = buildGeinsImageUrl(
|
|
12
|
+
* 'https://monitor.commerce.services',
|
|
13
|
+
* 'product',
|
|
14
|
+
* 'raw',
|
|
15
|
+
* 'shoe.jpg',
|
|
16
|
+
* );
|
|
17
|
+
* // => 'https://monitor.commerce.services/product/raw/shoe.jpg'
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare function buildGeinsImageUrl(imageBaseUrl: string, type: GeinsImageType, folder: string, fileName: string): string;
|
|
21
|
+
/**
|
|
22
|
+
* Builds a Geins CDN URL for the raw (original) image.
|
|
23
|
+
* @param imageBaseUrl - The resolved image endpoint.
|
|
24
|
+
* @param type - The image content type.
|
|
25
|
+
* @param fileName - The raw file name from the GraphQL API.
|
|
26
|
+
* @returns The full CDN URL for the original image.
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* const url = buildGeinsRawUrl(
|
|
30
|
+
* 'https://monitor.commerce.services',
|
|
31
|
+
* 'product',
|
|
32
|
+
* 'shoe.jpg',
|
|
33
|
+
* );
|
|
34
|
+
* // => 'https://monitor.commerce.services/product/raw/shoe.jpg'
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export declare function buildGeinsRawUrl(imageBaseUrl: string, type: GeinsImageType, fileName: string): string;
|
|
38
|
+
/**
|
|
39
|
+
* Builds a Geins CDN URL for the 100×100 thumbnail.
|
|
40
|
+
* @param imageBaseUrl - The resolved image endpoint.
|
|
41
|
+
* @param type - The image content type.
|
|
42
|
+
* @param fileName - The raw file name from the GraphQL API.
|
|
43
|
+
* @returns The full CDN URL for the thumbnail.
|
|
44
|
+
* @example
|
|
45
|
+
* ```ts
|
|
46
|
+
* const url = buildGeinsThumbnailUrl(
|
|
47
|
+
* 'https://monitor.commerce.services',
|
|
48
|
+
* 'product',
|
|
49
|
+
* 'shoe.jpg',
|
|
50
|
+
* );
|
|
51
|
+
* // => 'https://monitor.commerce.services/product/100x100/shoe.jpg'
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export declare function buildGeinsThumbnailUrl(imageBaseUrl: string, type: GeinsImageType, fileName: string): string;
|