@chayns-components/core 5.5.56 → 5.5.59-beta.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.
- package/lib/cjs/api/image/post.js +8 -3
- package/lib/cjs/api/image/post.js.map +1 -1
- package/lib/cjs/api/video/post.js +7 -3
- package/lib/cjs/api/video/post.js.map +1 -1
- package/lib/cjs/components/animated-number/AnimatedNumber.js.map +1 -1
- package/lib/cjs/config/uploadUrls.js +83 -0
- package/lib/cjs/config/uploadUrls.js.map +1 -0
- package/lib/cjs/config/uploadUrls.test.js +64 -0
- package/lib/cjs/config/uploadUrls.test.js.map +1 -0
- package/lib/cjs/index.js +25 -0
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/utils/uploadFile.js +6 -3
- package/lib/cjs/utils/uploadFile.js.map +1 -1
- package/lib/esm/api/image/post.js +8 -3
- package/lib/esm/api/image/post.js.map +1 -1
- package/lib/esm/api/video/post.js +7 -3
- package/lib/esm/api/video/post.js.map +1 -1
- package/lib/esm/components/animated-number/AnimatedNumber.js.map +1 -1
- package/lib/esm/config/uploadUrls.js +74 -0
- package/lib/esm/config/uploadUrls.js.map +1 -0
- package/lib/esm/config/uploadUrls.test.js +62 -0
- package/lib/esm/config/uploadUrls.test.js.map +1 -0
- package/lib/esm/index.js +1 -0
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/utils/uploadFile.js +6 -3
- package/lib/esm/utils/uploadFile.js.map +1 -1
- package/lib/types/api/image/post.d.ts +6 -1
- package/lib/types/api/video/post.d.ts +6 -1
- package/lib/types/config/uploadUrls.d.ts +54 -0
- package/lib/types/index.d.ts +1 -0
- package/lib/types/utils/uploadFile.d.ts +6 -1
- package/package.json +3 -3
- package/lib/cjs/constants/serverUrls.js +0 -61
- package/lib/cjs/constants/serverUrls.js.map +0 -1
- package/lib/esm/constants/serverUrls.js +0 -55
- package/lib/esm/constants/serverUrls.js.map +0 -1
- package/lib/types/constants/serverUrls.d.ts +0 -34
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnimatedNumber.js","names":["React","useEffect","useMemo","useState","animate","useMotionValue","DEFAULT_ROUND","Math","round","DEFAULT_EASE","AnimatedNumber","value","duration","delay","locale","format","startFrom","onComplete","ease","motionValue","display","setDisplay","formatter","n","toLocaleString","set","controls","stop","unsub","on","v","createElement","Fragment","displayName"],"sources":["../../../../src/components/animated-number/AnimatedNumber.tsx"],"sourcesContent":["import React, { FC, useEffect, useMemo, useState } from 'react';\nimport { animate, useMotionValue } from 'motion/react';\nimport { Easing
|
|
1
|
+
{"version":3,"file":"AnimatedNumber.js","names":["React","useEffect","useMemo","useState","animate","useMotionValue","DEFAULT_ROUND","Math","round","DEFAULT_EASE","AnimatedNumber","value","duration","delay","locale","format","startFrom","onComplete","ease","motionValue","display","setDisplay","formatter","n","toLocaleString","set","controls","stop","unsub","on","v","createElement","Fragment","displayName"],"sources":["../../../../src/components/animated-number/AnimatedNumber.tsx"],"sourcesContent":["import React, { FC, useEffect, useMemo, useState } from 'react';\nimport { animate, useMotionValue } from 'motion/react';\nimport { Easing } from 'motion';\n\ntype Ease = [number, number, number, number] | ((t: number) => number) | string;\n\nexport interface AnimatedNumberProps {\n /**\n * Start delay of the animation in seconds.\n */\n delay?: number;\n /**\n * Total duration of the animation in seconds.\n */\n duration?: number;\n /**\n * Easing curve of the animation (e.g., cubic-bezier like [0.16, 1, 0.3, 1] or predefined easings).\n * Controls how the animation accelerates/decelerates.\n */\n ease?: Ease;\n /**\n * Custom formatter for the displayed value.\n * If provided, it overrides locale/toLocaleString and round.\n * Example: (n) => `${Math.round(n)} points`\n */\n format?: (n: number) => string;\n /**\n * Locale used by toLocaleString when no custom formatter is provided.\n */\n locale?: string;\n /**\n * Callback invoked when the animation completes.\n */\n onComplete?: () => void;\n /**\n * Custom rounding function when no custom formatter is provided.\n * Default: Math.round\n */\n round?: (n: number) => number;\n /**\n * Starting value for the animation.\n * Default: 0\n */\n startFrom?: number;\n /**\n * Target value to animate to.\n */\n value: number;\n}\n\nconst DEFAULT_ROUND = Math.round;\nconst DEFAULT_EASE: Ease = [0.16, 1, 0.3, 1];\n\nexport const AnimatedNumber: FC<AnimatedNumberProps> = ({\n value,\n duration = 2,\n delay = 0,\n locale = 'de',\n format,\n round = DEFAULT_ROUND,\n startFrom = 0,\n onComplete,\n ease = DEFAULT_EASE,\n}) => {\n const motionValue = useMotionValue(startFrom);\n\n const [display, setDisplay] = useState<number>(startFrom);\n\n const formatter = useMemo(() => {\n if (format) return format;\n\n return (n: number) => round(n).toLocaleString(locale);\n }, [format, locale, round]);\n\n useEffect(() => {\n motionValue.set(startFrom);\n\n const controls = animate(motionValue, value, {\n duration,\n delay,\n ease: ease as Easing,\n onComplete,\n });\n\n return () => controls.stop();\n }, [value, duration, delay, startFrom, onComplete, ease, motionValue]);\n\n useEffect(() => {\n const unsub = motionValue.on('change', (v) => setDisplay(v));\n\n return () => unsub();\n }, [motionValue]);\n\n return <>{formatter(display)}</>;\n};\n\nAnimatedNumber.displayName = 'AnimatedNumber';\n\nexport default AnimatedNumber;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAQC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AAC/D,SAASC,OAAO,EAAEC,cAAc,QAAQ,cAAc;AAiDtD,MAAMC,aAAa,GAAGC,IAAI,CAACC,KAAK;AAChC,MAAMC,YAAkB,GAAG,CAAC,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;AAE5C,OAAO,MAAMC,cAAuC,GAAGA,CAAC;EACpDC,KAAK;EACLC,QAAQ,GAAG,CAAC;EACZC,KAAK,GAAG,CAAC;EACTC,MAAM,GAAG,IAAI;EACbC,MAAM;EACNP,KAAK,GAAGF,aAAa;EACrBU,SAAS,GAAG,CAAC;EACbC,UAAU;EACVC,IAAI,GAAGT;AACX,CAAC,KAAK;EACF,MAAMU,WAAW,GAAGd,cAAc,CAACW,SAAS,CAAC;EAE7C,MAAM,C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load service URLs that are used when no custom URLs have
|
|
7
|
+
* been configured via {@link setUploadUrls}.
|
|
8
|
+
*/
|
|
9
|
+
export const DEFAULT_UPLOAD_URLS = {
|
|
10
|
+
imageServiceUrl: 'https://cube.tobit.cloud/image-service/v3/Images',
|
|
11
|
+
imageResizerUrl: 'https://cube.tobit.cloud/image-resizer-backend/api/v1.0/image',
|
|
12
|
+
videoServiceUrl: 'https://streamingservice.chayns.space/video'
|
|
13
|
+
};
|
|
14
|
+
let configuredUploadUrls = {
|
|
15
|
+
...DEFAULT_UPLOAD_URLS
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Overrides the URLs of the services used to upload images and videos, e.g. for
|
|
20
|
+
* OnPremise deployments with self-hosted services.
|
|
21
|
+
*
|
|
22
|
+
* This has to be called once during the startup of the consuming application,
|
|
23
|
+
* before an upload is triggered. Environment variables cannot be used inside
|
|
24
|
+
* this package, because it is bundled before the consuming application is built
|
|
25
|
+
* and therefore no longer contains replaceable `process.env` references.
|
|
26
|
+
*
|
|
27
|
+
* Only the URLs that are passed are overridden, all others keep their current
|
|
28
|
+
* value.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* setUploadUrls({
|
|
33
|
+
* imageServiceUrl: process.env.PUBLIC_IMAGE_SERVICE_URL,
|
|
34
|
+
* imageResizerUrl: process.env.PUBLIC_IMAGE_RESIZER_URL,
|
|
35
|
+
* videoServiceUrl: process.env.PUBLIC_VIDEO_SERVICE_URL,
|
|
36
|
+
* });
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export const setUploadUrls = urls => {
|
|
40
|
+
if (!urls) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
configuredUploadUrls = {
|
|
44
|
+
imageServiceUrl: urls.imageServiceUrl ?? configuredUploadUrls.imageServiceUrl,
|
|
45
|
+
imageResizerUrl: urls.imageResizerUrl ?? configuredUploadUrls.imageResizerUrl,
|
|
46
|
+
videoServiceUrl: urls.videoServiceUrl ?? configuredUploadUrls.videoServiceUrl
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Returns the currently configured upload service URLs, optionally merged with
|
|
52
|
+
* the given overrides. Overrides take precedence over the globally configured
|
|
53
|
+
* URLs, which in turn take precedence over {@link DEFAULT_UPLOAD_URLS}.
|
|
54
|
+
*/
|
|
55
|
+
export const getUploadUrls = overrides => {
|
|
56
|
+
if (!overrides) {
|
|
57
|
+
return configuredUploadUrls;
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
imageServiceUrl: overrides.imageServiceUrl ?? configuredUploadUrls.imageServiceUrl,
|
|
61
|
+
imageResizerUrl: overrides.imageResizerUrl ?? configuredUploadUrls.imageResizerUrl,
|
|
62
|
+
videoServiceUrl: overrides.videoServiceUrl ?? configuredUploadUrls.videoServiceUrl
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Resets the upload service URLs to {@link DEFAULT_UPLOAD_URLS}.
|
|
68
|
+
*/
|
|
69
|
+
export const resetUploadUrls = () => {
|
|
70
|
+
configuredUploadUrls = {
|
|
71
|
+
...DEFAULT_UPLOAD_URLS
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
//# sourceMappingURL=uploadUrls.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uploadUrls.js","names":["DEFAULT_UPLOAD_URLS","imageServiceUrl","imageResizerUrl","videoServiceUrl","configuredUploadUrls","setUploadUrls","urls","getUploadUrls","overrides","resetUploadUrls"],"sources":["../../../src/config/uploadUrls.ts"],"sourcesContent":["/**\n * URLs of the services used to upload images and videos.\n */\nexport interface UploadUrls {\n /**\n * URL of the image service used to upload images.\n */\n imageServiceUrl: string;\n /**\n * URL of the image resizer service used to upload images larger than 10 MB.\n */\n imageResizerUrl: string;\n /**\n * URL of the streaming service used to upload videos.\n */\n videoServiceUrl: string;\n}\n\n/**\n * Default chayns upload service URLs that are used when no custom URLs have\n * been configured via {@link setUploadUrls}.\n */\nexport const DEFAULT_UPLOAD_URLS: UploadUrls = {\n imageServiceUrl: 'https://cube.tobit.cloud/image-service/v3/Images',\n imageResizerUrl: 'https://cube.tobit.cloud/image-resizer-backend/api/v1.0/image',\n videoServiceUrl: 'https://streamingservice.chayns.space/video',\n};\n\nlet configuredUploadUrls: UploadUrls = { ...DEFAULT_UPLOAD_URLS };\n\n/**\n * Overrides the URLs of the services used to upload images and videos, e.g. for\n * OnPremise deployments with self-hosted services.\n *\n * This has to be called once during the startup of the consuming application,\n * before an upload is triggered. Environment variables cannot be used inside\n * this package, because it is bundled before the consuming application is built\n * and therefore no longer contains replaceable `process.env` references.\n *\n * Only the URLs that are passed are overridden, all others keep their current\n * value.\n *\n * @example\n * ```ts\n * setUploadUrls({\n * imageServiceUrl: process.env.PUBLIC_IMAGE_SERVICE_URL,\n * imageResizerUrl: process.env.PUBLIC_IMAGE_RESIZER_URL,\n * videoServiceUrl: process.env.PUBLIC_VIDEO_SERVICE_URL,\n * });\n * ```\n */\nexport const setUploadUrls = (urls?: Partial<UploadUrls>): void => {\n if (!urls) {\n return;\n }\n\n configuredUploadUrls = {\n imageServiceUrl: urls.imageServiceUrl ?? configuredUploadUrls.imageServiceUrl,\n imageResizerUrl: urls.imageResizerUrl ?? configuredUploadUrls.imageResizerUrl,\n videoServiceUrl: urls.videoServiceUrl ?? configuredUploadUrls.videoServiceUrl,\n };\n};\n\n/**\n * Returns the currently configured upload service URLs, optionally merged with\n * the given overrides. Overrides take precedence over the globally configured\n * URLs, which in turn take precedence over {@link DEFAULT_UPLOAD_URLS}.\n */\nexport const getUploadUrls = (overrides?: Partial<UploadUrls>): UploadUrls => {\n if (!overrides) {\n return configuredUploadUrls;\n }\n\n return {\n imageServiceUrl: overrides.imageServiceUrl ?? configuredUploadUrls.imageServiceUrl,\n imageResizerUrl: overrides.imageResizerUrl ?? configuredUploadUrls.imageResizerUrl,\n videoServiceUrl: overrides.videoServiceUrl ?? configuredUploadUrls.videoServiceUrl,\n };\n};\n\n/**\n * Resets the upload service URLs to {@link DEFAULT_UPLOAD_URLS}.\n */\nexport const resetUploadUrls = (): void => {\n configuredUploadUrls = { ...DEFAULT_UPLOAD_URLS };\n};\n"],"mappings":"AAAA;AACA;AACA;;AAgBA;AACA;AACA;AACA;AACA,OAAO,MAAMA,mBAA+B,GAAG;EAC3CC,eAAe,EAAE,kDAAkD;EACnEC,eAAe,EAAE,+DAA+D;EAChFC,eAAe,EAAE;AACrB,CAAC;AAED,IAAIC,oBAAgC,GAAG;EAAE,GAAGJ;AAAoB,CAAC;;AAEjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMK,aAAa,GAAIC,IAA0B,IAAW;EAC/D,IAAI,CAACA,IAAI,EAAE;IACP;EACJ;EAEAF,oBAAoB,GAAG;IACnBH,eAAe,EAAEK,IAAI,CAACL,eAAe,IAAIG,oBAAoB,CAACH,eAAe;IAC7EC,eAAe,EAAEI,IAAI,CAACJ,eAAe,IAAIE,oBAAoB,CAACF,eAAe;IAC7EC,eAAe,EAAEG,IAAI,CAACH,eAAe,IAAIC,oBAAoB,CAACD;EAClE,CAAC;AACL,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMI,aAAa,GAAIC,SAA+B,IAAiB;EAC1E,IAAI,CAACA,SAAS,EAAE;IACZ,OAAOJ,oBAAoB;EAC/B;EAEA,OAAO;IACHH,eAAe,EAAEO,SAAS,CAACP,eAAe,IAAIG,oBAAoB,CAACH,eAAe;IAClFC,eAAe,EAAEM,SAAS,CAACN,eAAe,IAAIE,oBAAoB,CAACF,eAAe;IAClFC,eAAe,EAAEK,SAAS,CAACL,eAAe,IAAIC,oBAAoB,CAACD;EACvE,CAAC;AACL,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMM,eAAe,GAAGA,CAAA,KAAY;EACvCL,oBAAoB,GAAG;IAAE,GAAGJ;EAAoB,CAAC;AACrD,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { afterEach, describe, expect, it } from 'vitest';
|
|
2
|
+
import { DEFAULT_UPLOAD_URLS, getUploadUrls, resetUploadUrls, setUploadUrls } from './uploadUrls';
|
|
3
|
+
describe('uploadUrls', () => {
|
|
4
|
+
afterEach(() => {
|
|
5
|
+
resetUploadUrls();
|
|
6
|
+
});
|
|
7
|
+
it('returns the default urls when nothing has been configured', () => {
|
|
8
|
+
expect(getUploadUrls()).toEqual(DEFAULT_UPLOAD_URLS);
|
|
9
|
+
});
|
|
10
|
+
it('overrides only the urls that are passed', () => {
|
|
11
|
+
setUploadUrls({
|
|
12
|
+
imageServiceUrl: 'https://onprem.local/img'
|
|
13
|
+
});
|
|
14
|
+
expect(getUploadUrls()).toEqual({
|
|
15
|
+
...DEFAULT_UPLOAD_URLS,
|
|
16
|
+
imageServiceUrl: 'https://onprem.local/img'
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
it('keeps the configured url when an undefined value is passed', () => {
|
|
20
|
+
setUploadUrls({
|
|
21
|
+
videoServiceUrl: 'https://onprem.local/video'
|
|
22
|
+
});
|
|
23
|
+
setUploadUrls({
|
|
24
|
+
videoServiceUrl: undefined
|
|
25
|
+
});
|
|
26
|
+
expect(getUploadUrls().videoServiceUrl).toBe('https://onprem.local/video');
|
|
27
|
+
});
|
|
28
|
+
it('ignores an undefined configuration', () => {
|
|
29
|
+
setUploadUrls({
|
|
30
|
+
imageResizerUrl: 'https://onprem.local/resizer'
|
|
31
|
+
});
|
|
32
|
+
setUploadUrls(undefined);
|
|
33
|
+
expect(getUploadUrls().imageResizerUrl).toBe('https://onprem.local/resizer');
|
|
34
|
+
});
|
|
35
|
+
it('prefers the given overrides over the configured urls', () => {
|
|
36
|
+
setUploadUrls({
|
|
37
|
+
imageServiceUrl: 'https://onprem.local/img'
|
|
38
|
+
});
|
|
39
|
+
expect(getUploadUrls({
|
|
40
|
+
imageServiceUrl: 'https://call.local/img'
|
|
41
|
+
}).imageServiceUrl).toBe('https://call.local/img');
|
|
42
|
+
});
|
|
43
|
+
it('does not change the configured urls when overrides are given', () => {
|
|
44
|
+
setUploadUrls({
|
|
45
|
+
imageServiceUrl: 'https://onprem.local/img'
|
|
46
|
+
});
|
|
47
|
+
getUploadUrls({
|
|
48
|
+
imageServiceUrl: 'https://call.local/img'
|
|
49
|
+
});
|
|
50
|
+
expect(getUploadUrls().imageServiceUrl).toBe('https://onprem.local/img');
|
|
51
|
+
});
|
|
52
|
+
it('resets the urls back to the defaults', () => {
|
|
53
|
+
setUploadUrls({
|
|
54
|
+
imageServiceUrl: 'https://onprem.local/img',
|
|
55
|
+
imageResizerUrl: 'https://onprem.local/resizer',
|
|
56
|
+
videoServiceUrl: 'https://onprem.local/video'
|
|
57
|
+
});
|
|
58
|
+
resetUploadUrls();
|
|
59
|
+
expect(getUploadUrls()).toEqual(DEFAULT_UPLOAD_URLS);
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
//# sourceMappingURL=uploadUrls.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uploadUrls.test.js","names":["afterEach","describe","expect","it","DEFAULT_UPLOAD_URLS","getUploadUrls","resetUploadUrls","setUploadUrls","toEqual","imageServiceUrl","videoServiceUrl","undefined","toBe","imageResizerUrl"],"sources":["../../../src/config/uploadUrls.test.ts"],"sourcesContent":["import { afterEach, describe, expect, it } from 'vitest';\nimport { DEFAULT_UPLOAD_URLS, getUploadUrls, resetUploadUrls, setUploadUrls } from './uploadUrls';\n\ndescribe('uploadUrls', () => {\n afterEach(() => {\n resetUploadUrls();\n });\n\n it('returns the default urls when nothing has been configured', () => {\n expect(getUploadUrls()).toEqual(DEFAULT_UPLOAD_URLS);\n });\n\n it('overrides only the urls that are passed', () => {\n setUploadUrls({ imageServiceUrl: 'https://onprem.local/img' });\n\n expect(getUploadUrls()).toEqual({\n ...DEFAULT_UPLOAD_URLS,\n imageServiceUrl: 'https://onprem.local/img',\n });\n });\n\n it('keeps the configured url when an undefined value is passed', () => {\n setUploadUrls({ videoServiceUrl: 'https://onprem.local/video' });\n setUploadUrls({ videoServiceUrl: undefined });\n\n expect(getUploadUrls().videoServiceUrl).toBe('https://onprem.local/video');\n });\n\n it('ignores an undefined configuration', () => {\n setUploadUrls({ imageResizerUrl: 'https://onprem.local/resizer' });\n setUploadUrls(undefined);\n\n expect(getUploadUrls().imageResizerUrl).toBe('https://onprem.local/resizer');\n });\n\n it('prefers the given overrides over the configured urls', () => {\n setUploadUrls({ imageServiceUrl: 'https://onprem.local/img' });\n\n expect(getUploadUrls({ imageServiceUrl: 'https://call.local/img' }).imageServiceUrl).toBe(\n 'https://call.local/img',\n );\n });\n\n it('does not change the configured urls when overrides are given', () => {\n setUploadUrls({ imageServiceUrl: 'https://onprem.local/img' });\n getUploadUrls({ imageServiceUrl: 'https://call.local/img' });\n\n expect(getUploadUrls().imageServiceUrl).toBe('https://onprem.local/img');\n });\n\n it('resets the urls back to the defaults', () => {\n setUploadUrls({\n imageServiceUrl: 'https://onprem.local/img',\n imageResizerUrl: 'https://onprem.local/resizer',\n videoServiceUrl: 'https://onprem.local/video',\n });\n resetUploadUrls();\n\n expect(getUploadUrls()).toEqual(DEFAULT_UPLOAD_URLS);\n });\n});\n"],"mappings":"AAAA,SAASA,SAAS,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AACxD,SAASC,mBAAmB,EAAEC,aAAa,EAAEC,eAAe,EAAEC,aAAa,QAAQ,cAAc;AAEjGN,QAAQ,CAAC,YAAY,EAAE,MAAM;EACzBD,SAAS,CAAC,MAAM;IACZM,eAAe,CAAC,CAAC;EACrB,CAAC,CAAC;EAEFH,EAAE,CAAC,2DAA2D,EAAE,MAAM;IAClED,MAAM,CAACG,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a,CAAC,CAAC,CAACI,eAAe,CAAC,CAACG,IAAI,CAAC,0BAA0B,CAAC;EAC5E,CAAC,CAAC;EAEFT,EAAE,CAAC,sCAAsC,EAAE,MAAM;IAC7CI,aAAa,CAAC;MACVE,eAAe,EAAE,0BAA0B;MAC3CI,eAAe,EAAE,8BAA8B;MAC/CH,eAAe,EAAE;IACrB,CAAC,CAAC;IACFJ,eAAe,CAAC,CAAC;IAEjBJ,MAAM,CAACG,aAAa,CAAC,CAAC,CAAC,CAACG,OAAO,CAACJ,mBAAmB,CAAC;EACxD,CAAC,CAAC;AACN,CAAC,CAAC","ignoreList":[]}
|
package/lib/esm/index.js
CHANGED
|
@@ -80,6 +80,7 @@ export { filterFilesByMimeType, getFileAsArrayBuffer, selectFiles } from './util
|
|
|
80
80
|
export { isTobitEmployee } from './utils/isTobitEmployee';
|
|
81
81
|
export { getUsableHeight } from './utils/pageProvider';
|
|
82
82
|
export { uploadFile } from './utils/uploadFile';
|
|
83
|
+
export { DEFAULT_UPLOAD_URLS, getUploadUrls, resetUploadUrls, setUploadUrls } from './config/uploadUrls';
|
|
83
84
|
export { ComboBoxSize } from './components/combobox/ComboBox.types';
|
|
84
85
|
export { default as Skeleton } from './components/skeleton';
|
|
85
86
|
export { SkeletonAnimationType } from './components/skeleton/types';
|
package/lib/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["default","Accordion","AccordionContent","AccordionGroup","AccordionIntro","AccordionItem","AmountControl","VerificationBadge","AreaContext","AreaProvider","Badge","Button","Checkbox","ColorSchemeProvider","useColorScheme","BadgeSize","BadgeDesign","useContainer","ContainerAnchor","useFocusRingPortal","DropdownDirection","useIsMeasuredClone","useCombinedRefs","Filter","AnimatedNumber","FileList","FileSelect","DropdownBodyWrapper","ComboBox","ContentCard","CopyableContent","CopyableContentAppearance","HighlightSlider","ContextMenu","ContextMenuAlignment","ExpandableContent","FileInput","STREAMINGSERVICE_FILE_TYPES","TSIMG_FILE_TYPES","FilterButton","FilterButtons","GridImage","GroupedImage","Icon","Input","InputSize","List","ListItemContent","ListItem","LIST_ITEM_MARKER","withListItemMarker","withListItemMarkerForwardRef","MentionFinder","MultiActionButton","NumberInput","PageProvider","Popup","PopupContent","ProgressBar","PopupAlignment","RadioButtonGroup","RadioButton","ScrollView","SearchBox","SearchInput","SelectButton","SetupWizardItem","SetupWizard","SharingContextMenu","SharingBar","SharingButton","Signature","SliderButton","Slider","SmallWaitCursor","SmallWaitCursorSize","SmallWaitCursorSpeed","TagInput","TextArea","Tooltip","Truncation","MentionFinderPopupAlignment","useElementSize","ContentCardType","isValidFileType","getHumanSize","FilterButtonItemShape","FilterButtonSize","MultiActionButtonHeight","MultiActionButtonStatusType","ClampPosition","useIsTouch","filterFilesByMimeType","getFileAsArrayBuffer","selectFiles","isTobitEmployee","getUsableHeight","uploadFile","ComboBoxSize","Skeleton","SkeletonAnimationType","Masonry","useKeyboardFocusHighlighting"],"sources":["../../src/index.ts"],"sourcesContent":["// noinspection JSUnusedGlobalSymbols\n\nexport { default as Accordion } from './components/accordion/Accordion';\nexport { default as AccordionContent } from './components/accordion/accordion-content/AccordionContent';\nexport { default as AccordionGroup } from './components/accordion/accordion-group/AccordionGroup';\nexport { default as AccordionIntro } from './components/accordion/accordion-intro/AccordionIntro';\nexport { default as AccordionItem } from './components/accordion/accordion-item/AccordionItem';\nexport { default as AmountControl } from './components/amount-control/AmountControl';\nexport { default as VerificationBadge } from './components/verification-badge/VerificationBadge';\nexport {\n AreaContext,\n default as AreaProvider,\n} from './components/area-provider/AreaContextProvider';\nexport { default as Badge } from './components/badge/Badge';\nexport { default as Button } from './components/button/Button';\nexport { default as Checkbox } from './components/checkbox/Checkbox';\nexport {\n default as ColorSchemeProvider,\n useColorScheme,\n} from './components/color-scheme-provider/ColorSchemeProvider';\nexport { BadgeSize, BadgeDesign } from './components/badge/Badge.types';\nexport type {\n ColorSchemeContextProps,\n WithTheme,\n} from './components/color-scheme-provider/ColorSchemeProvider';\nexport { useContainer, ContainerAnchor } from './hooks/container';\nexport { useFocusRingPortal } from './hooks/useFocusRingPortal';\nexport { DropdownDirection, type DropdownCoordinates } from './types/dropdown';\nexport { useIsMeasuredClone } from './hooks/element';\nexport { useCombinedRefs } from './hooks/ref';\nexport { default as Filter, type FilterRightIcon } from './components/filter/Filter';\nexport {\n type SortItem,\n type SearchConfig,\n type SortConfig,\n type CheckboxConfig,\n type FilterButtonConfig,\n type FilterRef,\n} from './types/filter';\nexport { default as AnimatedNumber } from './components/animated-number/AnimatedNumber';\nexport {\n default as FileList,\n type IFileItem as FileListItem,\n} from './components/file-list/FileList';\nexport { default as FileSelect } from './components/file-select/FileSelect';\nexport { default as DropdownBodyWrapper } from './components/dropdown-body-wrapper/DropdownBodyWrapper';\nexport { default as ComboBox } from './components/combobox/ComboBox';\nexport { default as ContentCard } from './components/content-card/ContentCard';\nexport {\n default as CopyableContent,\n CopyableContentAppearance,\n type CopyableContentProps,\n} from './components/copyable-content/CopyableContent';\nexport { default as HighlightSlider } from './components/highlight-slider/HighlightSlider';\nexport type { HighlightSliderItemColors as HighlightSliderColors } from './components/highlight-slider/highlight-slider-item/HighlightSliderItem';\nexport { default as ContextMenu } from './components/context-menu/ContextMenu';\nexport {\n ContextMenuAlignment,\n type ContextMenuCoordinates,\n type ContextMenuItem,\n type ContextMenuProps,\n type ContextMenuRef,\n} from './components/context-menu/ContextMenu.types';\nexport { default as ExpandableContent } from './components/expandable-content/ExpandableContent';\nexport {\n default as FileInput,\n type FileInputRef,\n STREAMINGSERVICE_FILE_TYPES,\n TSIMG_FILE_TYPES,\n} from './components/file-input/FileInput';\nexport { default as FilterButton } from './components/filter-buttons/filter-button/FilterButton';\nexport { default as FilterButtons } from './components/filter-buttons/FilterButtons';\nexport { default as GridImage } from './components/grid-image/GridImage';\nexport { default as GroupedImage } from './components/grouped-image/GroupedImage';\nexport { default as Icon, type IconProps } from './components/icon/Icon';\nexport { default as Input, InputSize } from './components/input/Input';\nexport { default as List } from './components/list/List';\nexport { default as ListItemContent } from './components/list/list-item/list-item-content/ListItemContent';\nexport {\n default as ListItem,\n type ListItemElements,\n type ListItemProps,\n type ListItemRef,\n type ListItemSize,\n} from './components/list/list-item/ListItem';\nexport {\n type ListItemMarkedForwardRefComponent,\n type ListItemMarkedComponent,\n type ListItemMetaProps,\n LIST_ITEM_MARKER,\n withListItemMarker,\n withListItemMarkerForwardRef,\n} from './components/list/list-item/ListItem.utils';\nexport { default as MentionFinder } from './components/mention-finder/MentionFinder';\nexport type { MentionMember } from './components/mention-finder/MentionFinder';\nexport { default as MultiActionButton } from './components/multi-action-button/MultiActionButton';\nexport { default as NumberInput } from './components/number-input/NumberInput';\nexport { default as PageProvider } from './components/page-provider/PageProvider';\nexport { default as Popup } from './components/popup/Popup';\nexport { default as PopupContent } from './components/popup/popup-content/PopupContent';\nexport { default as ProgressBar } from './components/progress-bar/ProgressBar';\nexport { PopupAlignment } from './types/popup';\nexport type { PopupProps } from './components/popup/Popup.types';\nexport {\n default as RadioButtonGroup,\n type RadioButtonGroupRef,\n} from './components/radio-button/radio-button-group/RadioButtonGroup';\nexport { default as RadioButton } from './components/radio-button/RadioButton';\nexport { default as ScrollView } from './components/scroll-view/ScrollView';\nexport { default as SearchBox } from './components/search-box/SearchBox';\nexport { default as SearchInput } from './components/search-input/SearchInput';\nexport { default as SelectButton } from './components/select-button/SelectButton';\nexport { default as SetupWizardItem } from './components/setup-wizard/setup-wizard-item/SetupWizardItem';\nexport { default as SetupWizard } from './components/setup-wizard/SetupWizard';\nexport type { SetupWizardRef } from './components/setup-wizard/SetupWizard';\nexport { default as SharingContextMenu } from './components/sharing-context-menu/SharingContextMenu';\nexport { default as SharingBar } from './components/sharing-bar/SharingBar';\nexport { default as SharingButton } from './components/sharing-button/SharingButton';\nexport { default as Signature } from './components/signature/Signature';\nexport type { SignatureRef } from './components/signature/Signature';\nexport { default as SliderButton } from './components/slider-button/SliderButton';\nexport { default as Slider } from './components/slider/Slider';\nexport {\n default as SmallWaitCursor,\n SmallWaitCursorSize,\n SmallWaitCursorSpeed,\n} from './components/small-wait-cursor/SmallWaitCursor';\nexport type { Tag } from './types/tagInput';\nexport { default as TagInput } from './components/tag-input/TagInput';\nexport type { TagInputRef } from './components/tag-input/TagInput';\nexport { default as TextArea } from './components/text-area/TextArea';\nexport { default as Tooltip } from './components/tooltip/Tooltip';\nexport { default as Truncation } from './components/truncation/Truncation';\nexport { MentionFinderPopupAlignment } from './constants/mentionFinder';\nexport { useElementSize } from './hooks/element';\nexport type { BrowserName } from './types/chayns';\nexport { ContentCardType } from './types/contentCard';\nexport type { FileItem, Image, InternalFileItem, Meta, Video } from './types/file';\nexport { isValidFileType, getHumanSize } from './utils/file';\nexport type { FileInputFileItem } from './types/fileInput';\nexport { FilterButtonItemShape, FilterButtonSize } from './types/filterButtons';\nexport type { IFilterButtonItem as FilterButtonItem } from './types/filterButtons';\nexport type { IListItemRightElements } from './types/list';\nexport type { PopupRef } from './types/popup';\nexport type { RadioButtonItem } from './types/radioButton';\nexport type {\n ISearchBoxItem as SearchBoxItem,\n ISearchBoxItems as SearchBoxItems,\n} from './types/searchBox';\nexport type { SearchBoxSortFunction } from './utils/searchBox';\nexport type { SelectButtonItem } from './types/selectButton';\nexport type { SliderButtonItem } from './types/slider-button';\nexport {\n type MultiActionButtonAction,\n type MultiActionButtonActionEvent,\n type MultiActionButtonActionStatus,\n MultiActionButtonHeight,\n type MultiActionButtonProps,\n type MultiActionButtonSecondaryContextMenu,\n MultiActionButtonStatusType,\n} from './components/multi-action-button/MultiActionButton.types';\nexport { ClampPosition } from './types/truncation';\nexport { useIsTouch } from './utils/environment';\nexport { filterFilesByMimeType, getFileAsArrayBuffer, selectFiles } from './utils/fileDialog';\nexport { isTobitEmployee } from './utils/isTobitEmployee';\nexport { getUsableHeight } from './utils/pageProvider';\nexport { uploadFile } from './utils/uploadFile';\nexport type { Theme } from './components/color-scheme-provider/ColorSchemeProvider';\nexport { ComboBoxSize } from './components/combobox/ComboBox.types';\nexport type {\n IComboBoxItem as ComboBoxItem,\n ComboBoxTextStyles,\n IComboBoxItems as ComboBoxItems,\n ComboBoxRef,\n} from './components/combobox/ComboBox.types';\nexport { default as Skeleton } from './components/skeleton';\nexport { SkeletonAnimationType } from './components/skeleton/types';\nexport { default as Masonry } from './components/masonry/Masonry';\nexport { useKeyboardFocusHighlighting } from './hooks/useKeyboardFocusHighlighting';\n"],"mappings":"AAAA;;AAEA,SAASA,OAAO,IAAIC,SAAS,QAAQ,kCAAkC;AACvE,SAASD,OAAO,IAAIE,gBAAgB,QAAQ,2DAA2D;AACvG,SAASF,OAAO,IAAIG,cAAc,QAAQ,uDAAuD;AACjG,SAASH,OAAO,IAAII,cAAc,QAAQ,uDAAuD;AACjG,SAASJ,OAAO,IAAIK,aAAa,QAAQ,qDAAqD;AAC9F,SAASL,OAAO,IAAIM,aAAa,QAAQ,2CAA2C;AACpF,SAASN,OAAO,IAAIO,iBAAiB,QAAQ,mDAAmD;AAChG,SACIC,WAAW,EACXR,OAAO,IAAIS,YAAY,QACpB,gDAAgD;AACvD,SAAST,OAAO,IAAIU,KAAK,QAAQ,0BAA0B;AAC3D,SAASV,OAAO,IAAIW,MAAM,QAAQ,4BAA4B;AAC9D,SAASX,OAAO,IAAIY,QAAQ,QAAQ,gCAAgC;AACpE,SACIZ,OAAO,IAAIa,mBAAmB,EAC9BC,cAAc,QACX,wDAAwD;AAC/D,SAASC,SAAS,EAAEC,WAAW,QAAQ,gCAAgC;AAKvE,SAASC,YAAY,EAAEC,eAAe,QAAQ,mBAAmB;AACjE,SAASC,kBAAkB,QAAQ,4BAA4B;AAC/D,SAASC,iBAAiB,QAAkC,kBAAkB;AAC9E,SAASC,kBAAkB,QAAQ,iBAAiB;AACpD,SAASC,eAAe,QAAQ,aAAa;AAC7C,SAAStB,OAAO,IAAIuB,MAAM,QAA8B,4BAA4B;AASpF,SAASvB,OAAO,IAAIwB,cAAc,QAAQ,6CAA6C;AACvF,SACIxB,OAA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,UAAU,QAAQ,oCAAoC;AAC1E,SAASC,2BAA2B,QAAQ,2BAA2B;AACvE,SAASC,cAAc,QAAQ,iBAAiB;AAEhD,SAASC,eAAe,QAAQ,qBAAqB;AAErD,SAASC,eAAe,EAAEC,YAAY,QAAQ,cAAc;AAE5D,SAASC,qBAAqB,EAAEC,gBAAgB,QAAQ,uBAAuB;AAY/E,SAIIC,uBAAuB,EAGvBC,2BAA2B,QACxB,0DAA0D;AACjE,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,UAAU,QAAQ,qBAAqB;AAChD,SAASC,qBAAqB,EAAEC,oBAAoB,EAAEC,WAAW,QAAQ,oBAAoB;AAC7F,SAASC,eAAe,QAAQ,yBAAyB;AACzD,SAASC,eAAe,QAAQ,sBAAsB;AACtD,SAASC,UAAU,QAAQ,oBAAoB;AAE/C,SAASC,YAAY,QAAQ,sCAAsC;AAOnE,SAASlG,OAAO,IAAImG,QAAQ,QAAQ,uBAAuB;AAC3D,SAASC,qBAAqB,QAAQ,6BAA6B;AACnE,SAASpG,OAAO,IAAIqG,OAAO,QAAQ,8BAA8B;AACjE,SAASC,4BAA4B,QAAQ,sCAAsC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["default","Accordion","AccordionContent","AccordionGroup","AccordionIntro","AccordionItem","AmountControl","VerificationBadge","AreaContext","AreaProvider","Badge","Button","Checkbox","ColorSchemeProvider","useColorScheme","BadgeSize","BadgeDesign","useContainer","ContainerAnchor","useFocusRingPortal","DropdownDirection","useIsMeasuredClone","useCombinedRefs","Filter","AnimatedNumber","FileList","FileSelect","DropdownBodyWrapper","ComboBox","ContentCard","CopyableContent","CopyableContentAppearance","HighlightSlider","ContextMenu","ContextMenuAlignment","ExpandableContent","FileInput","STREAMINGSERVICE_FILE_TYPES","TSIMG_FILE_TYPES","FilterButton","FilterButtons","GridImage","GroupedImage","Icon","Input","InputSize","List","ListItemContent","ListItem","LIST_ITEM_MARKER","withListItemMarker","withListItemMarkerForwardRef","MentionFinder","MultiActionButton","NumberInput","PageProvider","Popup","PopupContent","ProgressBar","PopupAlignment","RadioButtonGroup","RadioButton","ScrollView","SearchBox","SearchInput","SelectButton","SetupWizardItem","SetupWizard","SharingContextMenu","SharingBar","SharingButton","Signature","SliderButton","Slider","SmallWaitCursor","SmallWaitCursorSize","SmallWaitCursorSpeed","TagInput","TextArea","Tooltip","Truncation","MentionFinderPopupAlignment","useElementSize","ContentCardType","isValidFileType","getHumanSize","FilterButtonItemShape","FilterButtonSize","MultiActionButtonHeight","MultiActionButtonStatusType","ClampPosition","useIsTouch","filterFilesByMimeType","getFileAsArrayBuffer","selectFiles","isTobitEmployee","getUsableHeight","uploadFile","DEFAULT_UPLOAD_URLS","getUploadUrls","resetUploadUrls","setUploadUrls","ComboBoxSize","Skeleton","SkeletonAnimationType","Masonry","useKeyboardFocusHighlighting"],"sources":["../../src/index.ts"],"sourcesContent":["// noinspection JSUnusedGlobalSymbols\n\nexport { default as Accordion } from './components/accordion/Accordion';\nexport { default as AccordionContent } from './components/accordion/accordion-content/AccordionContent';\nexport { default as AccordionGroup } from './components/accordion/accordion-group/AccordionGroup';\nexport { default as AccordionIntro } from './components/accordion/accordion-intro/AccordionIntro';\nexport { default as AccordionItem } from './components/accordion/accordion-item/AccordionItem';\nexport { default as AmountControl } from './components/amount-control/AmountControl';\nexport { default as VerificationBadge } from './components/verification-badge/VerificationBadge';\nexport {\n AreaContext,\n default as AreaProvider,\n} from './components/area-provider/AreaContextProvider';\nexport { default as Badge } from './components/badge/Badge';\nexport { default as Button } from './components/button/Button';\nexport { default as Checkbox } from './components/checkbox/Checkbox';\nexport {\n default as ColorSchemeProvider,\n useColorScheme,\n} from './components/color-scheme-provider/ColorSchemeProvider';\nexport { BadgeSize, BadgeDesign } from './components/badge/Badge.types';\nexport type {\n ColorSchemeContextProps,\n WithTheme,\n} from './components/color-scheme-provider/ColorSchemeProvider';\nexport { useContainer, ContainerAnchor } from './hooks/container';\nexport { useFocusRingPortal } from './hooks/useFocusRingPortal';\nexport { DropdownDirection, type DropdownCoordinates } from './types/dropdown';\nexport { useIsMeasuredClone } from './hooks/element';\nexport { useCombinedRefs } from './hooks/ref';\nexport { default as Filter, type FilterRightIcon } from './components/filter/Filter';\nexport {\n type SortItem,\n type SearchConfig,\n type SortConfig,\n type CheckboxConfig,\n type FilterButtonConfig,\n type FilterRef,\n} from './types/filter';\nexport { default as AnimatedNumber } from './components/animated-number/AnimatedNumber';\nexport {\n default as FileList,\n type IFileItem as FileListItem,\n} from './components/file-list/FileList';\nexport { default as FileSelect } from './components/file-select/FileSelect';\nexport { default as DropdownBodyWrapper } from './components/dropdown-body-wrapper/DropdownBodyWrapper';\nexport { default as ComboBox } from './components/combobox/ComboBox';\nexport { default as ContentCard } from './components/content-card/ContentCard';\nexport {\n default as CopyableContent,\n CopyableContentAppearance,\n type CopyableContentProps,\n} from './components/copyable-content/CopyableContent';\nexport { default as HighlightSlider } from './components/highlight-slider/HighlightSlider';\nexport type { HighlightSliderItemColors as HighlightSliderColors } from './components/highlight-slider/highlight-slider-item/HighlightSliderItem';\nexport { default as ContextMenu } from './components/context-menu/ContextMenu';\nexport {\n ContextMenuAlignment,\n type ContextMenuCoordinates,\n type ContextMenuItem,\n type ContextMenuProps,\n type ContextMenuRef,\n} from './components/context-menu/ContextMenu.types';\nexport { default as ExpandableContent } from './components/expandable-content/ExpandableContent';\nexport {\n default as FileInput,\n type FileInputRef,\n STREAMINGSERVICE_FILE_TYPES,\n TSIMG_FILE_TYPES,\n} from './components/file-input/FileInput';\nexport { default as FilterButton } from './components/filter-buttons/filter-button/FilterButton';\nexport { default as FilterButtons } from './components/filter-buttons/FilterButtons';\nexport { default as GridImage } from './components/grid-image/GridImage';\nexport { default as GroupedImage } from './components/grouped-image/GroupedImage';\nexport { default as Icon, type IconProps } from './components/icon/Icon';\nexport { default as Input, InputSize } from './components/input/Input';\nexport { default as List } from './components/list/List';\nexport { default as ListItemContent } from './components/list/list-item/list-item-content/ListItemContent';\nexport {\n default as ListItem,\n type ListItemElements,\n type ListItemProps,\n type ListItemRef,\n type ListItemSize,\n} from './components/list/list-item/ListItem';\nexport {\n type ListItemMarkedForwardRefComponent,\n type ListItemMarkedComponent,\n type ListItemMetaProps,\n LIST_ITEM_MARKER,\n withListItemMarker,\n withListItemMarkerForwardRef,\n} from './components/list/list-item/ListItem.utils';\nexport { default as MentionFinder } from './components/mention-finder/MentionFinder';\nexport type { MentionMember } from './components/mention-finder/MentionFinder';\nexport { default as MultiActionButton } from './components/multi-action-button/MultiActionButton';\nexport { default as NumberInput } from './components/number-input/NumberInput';\nexport { default as PageProvider } from './components/page-provider/PageProvider';\nexport { default as Popup } from './components/popup/Popup';\nexport { default as PopupContent } from './components/popup/popup-content/PopupContent';\nexport { default as ProgressBar } from './components/progress-bar/ProgressBar';\nexport { PopupAlignment } from './types/popup';\nexport type { PopupProps } from './components/popup/Popup.types';\nexport {\n default as RadioButtonGroup,\n type RadioButtonGroupRef,\n} from './components/radio-button/radio-button-group/RadioButtonGroup';\nexport { default as RadioButton } from './components/radio-button/RadioButton';\nexport { default as ScrollView } from './components/scroll-view/ScrollView';\nexport { default as SearchBox } from './components/search-box/SearchBox';\nexport { default as SearchInput } from './components/search-input/SearchInput';\nexport { default as SelectButton } from './components/select-button/SelectButton';\nexport { default as SetupWizardItem } from './components/setup-wizard/setup-wizard-item/SetupWizardItem';\nexport { default as SetupWizard } from './components/setup-wizard/SetupWizard';\nexport type { SetupWizardRef } from './components/setup-wizard/SetupWizard';\nexport { default as SharingContextMenu } from './components/sharing-context-menu/SharingContextMenu';\nexport { default as SharingBar } from './components/sharing-bar/SharingBar';\nexport { default as SharingButton } from './components/sharing-button/SharingButton';\nexport { default as Signature } from './components/signature/Signature';\nexport type { SignatureRef } from './components/signature/Signature';\nexport { default as SliderButton } from './components/slider-button/SliderButton';\nexport { default as Slider } from './components/slider/Slider';\nexport {\n default as SmallWaitCursor,\n SmallWaitCursorSize,\n SmallWaitCursorSpeed,\n} from './components/small-wait-cursor/SmallWaitCursor';\nexport type { Tag } from './types/tagInput';\nexport { default as TagInput } from './components/tag-input/TagInput';\nexport type { TagInputRef } from './components/tag-input/TagInput';\nexport { default as TextArea } from './components/text-area/TextArea';\nexport { default as Tooltip } from './components/tooltip/Tooltip';\nexport { default as Truncation } from './components/truncation/Truncation';\nexport { MentionFinderPopupAlignment } from './constants/mentionFinder';\nexport { useElementSize } from './hooks/element';\nexport type { BrowserName } from './types/chayns';\nexport { ContentCardType } from './types/contentCard';\nexport type { FileItem, Image, InternalFileItem, Meta, Video } from './types/file';\nexport { isValidFileType, getHumanSize } from './utils/file';\nexport type { FileInputFileItem } from './types/fileInput';\nexport { FilterButtonItemShape, FilterButtonSize } from './types/filterButtons';\nexport type { IFilterButtonItem as FilterButtonItem } from './types/filterButtons';\nexport type { IListItemRightElements } from './types/list';\nexport type { PopupRef } from './types/popup';\nexport type { RadioButtonItem } from './types/radioButton';\nexport type {\n ISearchBoxItem as SearchBoxItem,\n ISearchBoxItems as SearchBoxItems,\n} from './types/searchBox';\nexport type { SearchBoxSortFunction } from './utils/searchBox';\nexport type { SelectButtonItem } from './types/selectButton';\nexport type { SliderButtonItem } from './types/slider-button';\nexport {\n type MultiActionButtonAction,\n type MultiActionButtonActionEvent,\n type MultiActionButtonActionStatus,\n MultiActionButtonHeight,\n type MultiActionButtonProps,\n type MultiActionButtonSecondaryContextMenu,\n MultiActionButtonStatusType,\n} from './components/multi-action-button/MultiActionButton.types';\nexport { ClampPosition } from './types/truncation';\nexport { useIsTouch } from './utils/environment';\nexport { filterFilesByMimeType, getFileAsArrayBuffer, selectFiles } from './utils/fileDialog';\nexport { isTobitEmployee } from './utils/isTobitEmployee';\nexport { getUsableHeight } from './utils/pageProvider';\nexport { uploadFile } from './utils/uploadFile';\nexport {\n DEFAULT_UPLOAD_URLS,\n getUploadUrls,\n resetUploadUrls,\n setUploadUrls,\n type UploadUrls,\n} from './config/uploadUrls';\nexport type { Theme } from './components/color-scheme-provider/ColorSchemeProvider';\nexport { ComboBoxSize } from './components/combobox/ComboBox.types';\nexport type {\n IComboBoxItem as ComboBoxItem,\n ComboBoxTextStyles,\n IComboBoxItems as ComboBoxItems,\n ComboBoxRef,\n} from './components/combobox/ComboBox.types';\nexport { default as Skeleton } from './components/skeleton';\nexport { SkeletonAnimationType } from './components/skeleton/types';\nexport { default as Masonry } from './components/masonry/Masonry';\nexport { useKeyboardFocusHighlighting } from './hooks/useKeyboardFocusHighlighting';\n"],"mappings":"AAAA;;AAEA,SAASA,OAAO,IAAIC,SAAS,QAAQ,kCAAkC;AACvE,SAASD,OAAO,IAAIE,gBAAgB,QAAQ,2DAA2D;AACvG,SAASF,OAAO,IAAIG,cAAc,QAAQ,uDAAuD;AACjG,SAASH,OAAO,IAAII,cAAc,QAAQ,uDAAuD;AACjG,SAASJ,OAAO,IAAIK,aAAa,QAAQ,qDAAqD;AAC9F,SAASL,OAAO,IAAIM,aAAa,QAAQ,2CAA2C;AACpF,SAASN,OAAO,IAAIO,iBAAiB,QAAQ,mDAAmD;AAChG,SACIC,WAAW,EACXR,OAAO,IAAIS,YAAY,QACpB,gDAAgD;AACvD,SAAST,OAAO,IAAIU,KAAK,QAAQ,0BAA0B;AAC3D,SAASV,OAAO,IAAIW,MAAM,QAAQ,4BAA4B;AAC9D,SAASX,OAAO,IAAIY,QAAQ,QAAQ,gCAAgC;AACpE,SACIZ,OAAO,IAAIa,mBAAmB,EAC9BC,cAAc,QACX,wDAAwD;AAC/D,SAASC,SAAS,EAAEC,WAAW,QAAQ,gCAAgC;AAKvE,SAASC,YAAY,EAAEC,eAAe,QAAQ,mBAAmB;AACjE,SAASC,kBAAkB,QAAQ,4BAA4B;AAC/D,SAASC,iBAAiB,QAAkC,kBAAkB;AAC9E,SAASC,kBAAkB,QAAQ,iBAAiB;AACpD,SAASC,eAAe,QAAQ,aAAa;AAC7C,SAAStB,OAAO,IAAIuB,MAAM,QAA8B,4BAA4B;AASpF,SAASvB,OAAO,IAAIwB,cAAc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AA8B;AACjE,SAAS/E,OAAO,IAAIgF,UAAU,QAAQ,oCAAoC;AAC1E,SAASC,2BAA2B,QAAQ,2BAA2B;AACvE,SAASC,cAAc,QAAQ,iBAAiB;AAEhD,SAASC,eAAe,QAAQ,qBAAqB;AAErD,SAASC,eAAe,EAAEC,YAAY,QAAQ,cAAc;AAE5D,SAASC,qBAAqB,EAAEC,gBAAgB,QAAQ,uBAAuB;AAY/E,SAIIC,uBAAuB,EAGvBC,2BAA2B,QACxB,0DAA0D;AACjE,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,UAAU,QAAQ,qBAAqB;AAChD,SAASC,qBAAqB,EAAEC,oBAAoB,EAAEC,WAAW,QAAQ,oBAAoB;AAC7F,SAASC,eAAe,QAAQ,yBAAyB;AACzD,SAASC,eAAe,QAAQ,sBAAsB;AACtD,SAASC,UAAU,QAAQ,oBAAoB;AAC/C,SACIC,mBAAmB,EACnBC,aAAa,EACbC,eAAe,EACfC,aAAa,QAEV,qBAAqB;AAE5B,SAASC,YAAY,QAAQ,sCAAsC;AAOnE,SAAStG,OAAO,IAAIuG,QAAQ,QAAQ,uBAAuB;AAC3D,SAASC,qBAAqB,QAAQ,6BAA6B;AACnE,SAASxG,OAAO,IAAIyG,OAAO,QAAQ,8BAA8B;AACjE,SAASC,4BAA4B,QAAQ,sCAAsC","ignoreList":[]}
|
|
@@ -3,14 +3,16 @@ import { postVideo } from '../api/video/post';
|
|
|
3
3
|
export const uploadFile = async ({
|
|
4
4
|
fileToUpload,
|
|
5
5
|
callback,
|
|
6
|
-
shouldUploadImageToSite
|
|
6
|
+
shouldUploadImageToSite,
|
|
7
|
+
uploadUrls
|
|
7
8
|
}) => {
|
|
8
9
|
if (!fileToUpload || fileToUpload.state !== undefined && fileToUpload.state !== 'none') {
|
|
9
10
|
return;
|
|
10
11
|
}
|
|
11
12
|
if (fileToUpload.file?.type.includes('video/')) {
|
|
12
13
|
const uploadedVideo = await postVideo({
|
|
13
|
-
file: fileToUpload.file
|
|
14
|
+
file: fileToUpload.file,
|
|
15
|
+
uploadUrls
|
|
14
16
|
});
|
|
15
17
|
if (uploadedVideo) {
|
|
16
18
|
callback({
|
|
@@ -22,7 +24,8 @@ export const uploadFile = async ({
|
|
|
22
24
|
if (fileToUpload.file?.type.includes('image/')) {
|
|
23
25
|
const uploadedImage = await postImage({
|
|
24
26
|
file: fileToUpload.file,
|
|
25
|
-
shouldUploadImageToSite
|
|
27
|
+
shouldUploadImageToSite,
|
|
28
|
+
uploadUrls
|
|
26
29
|
});
|
|
27
30
|
if (uploadedImage) {
|
|
28
31
|
callback({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uploadFile.js","names":["postImage","postVideo","uploadFile","fileToUpload","callback","shouldUploadImageToSite","state","undefined","file","type","includes","uploadedVideo","id","toString","uploadedImage","url","base","key","meta","ratio","width","height","Number"],"sources":["../../../src/utils/uploadFile.ts"],"sourcesContent":["import { postImage } from '../api/image/post';\nimport { postVideo } from '../api/video/post';\nimport type { Image, InternalFileItem, Video } from '../types/file';\n\ninterface UploadFilesOptions {\n fileToUpload: InternalFileItem;\n callback: (UploadedFile: Video | Image) => void;\n shouldUploadImageToSite?: boolean;\n}\n\nexport const uploadFile = async ({\n fileToUpload,\n callback,\n shouldUploadImageToSite,\n}: UploadFilesOptions): Promise<void> => {\n if (!fileToUpload || (fileToUpload.state !== undefined && fileToUpload.state !== 'none')) {\n return;\n }\n\n if (fileToUpload.file?.type.includes('video/')) {\n const uploadedVideo = await postVideo({ file: fileToUpload.file });\n\n if (uploadedVideo) {\n callback({\n ...uploadedVideo,\n id: uploadedVideo.id.toString(),\n });\n }\n }\n\n if (fileToUpload.file?.type.includes('image/')) {\n const uploadedImage = await postImage({
|
|
1
|
+
{"version":3,"file":"uploadFile.js","names":["postImage","postVideo","uploadFile","fileToUpload","callback","shouldUploadImageToSite","uploadUrls","state","undefined","file","type","includes","uploadedVideo","id","toString","uploadedImage","url","base","key","meta","ratio","width","height","Number"],"sources":["../../../src/utils/uploadFile.ts"],"sourcesContent":["import { postImage } from '../api/image/post';\nimport { postVideo } from '../api/video/post';\nimport type { UploadUrls } from '../config/uploadUrls';\nimport type { Image, InternalFileItem, Video } from '../types/file';\n\ninterface UploadFilesOptions {\n fileToUpload: InternalFileItem;\n callback: (UploadedFile: Video | Image) => void;\n shouldUploadImageToSite?: boolean;\n /**\n * Overrides the globally configured upload service URLs for this upload.\n */\n uploadUrls?: Partial<UploadUrls>;\n}\n\nexport const uploadFile = async ({\n fileToUpload,\n callback,\n shouldUploadImageToSite,\n uploadUrls,\n}: UploadFilesOptions): Promise<void> => {\n if (!fileToUpload || (fileToUpload.state !== undefined && fileToUpload.state !== 'none')) {\n return;\n }\n\n if (fileToUpload.file?.type.includes('video/')) {\n const uploadedVideo = await postVideo({ file: fileToUpload.file, uploadUrls });\n\n if (uploadedVideo) {\n callback({\n ...uploadedVideo,\n id: uploadedVideo.id.toString(),\n });\n }\n }\n\n if (fileToUpload.file?.type.includes('image/')) {\n const uploadedImage = await postImage({\n file: fileToUpload.file,\n shouldUploadImageToSite,\n uploadUrls,\n });\n\n if (uploadedImage) {\n callback({\n url: `${uploadedImage.base}/${uploadedImage.key}`,\n id: uploadedImage.key,\n meta: uploadedImage.meta,\n ratio:\n uploadedImage.meta?.width && uploadedImage.meta?.height\n ? Number(uploadedImage.meta?.width) / Number(uploadedImage.meta?.height)\n : undefined,\n });\n }\n }\n};\n"],"mappings":"AAAA,SAASA,SAAS,QAAQ,mBAAmB;AAC7C,SAASC,SAAS,QAAQ,mBAAmB;AAc7C,OAAO,MAAMC,UAAU,GAAG,MAAAA,CAAO;EAC7BC,YAAY;EACZC,QAAQ;EACRC,uBAAuB;EACvBC;AACgB,CAAC,KAAoB;EACrC,IAAI,CAACH,YAAY,IAAKA,YAAY,CAACI,KAAK,KAAKC,SAAS,IAAIL,YAAY,CAACI,KAAK,KAAK,MAAO,EAAE;IACtF;EACJ;EAEA,IAAIJ,YAAY,CAACM,IAAI,EAAEC,IAAI,CAACC,QAAQ,CAAC,QAAQ,CAAC,EAAE;IAC5C,MAAMC,aAAa,GAAG,MAAMX,SAAS,CAAC;MAAEQ,IAAI,EAAEN,YAAY,CAACM,IAAI;MAAEH;IAAW,CAAC,CAAC;IAE9E,IAAIM,aAAa,EAAE;MACfR,QAAQ,CAAC;QACL,GAAGQ,aAAa;QAChBC,EAAE,EAAED,aAAa,CAACC,EAAE,CAACC,QAAQ,CAAC;MAClC,CAAC,CAAC;IACN;EACJ;EAEA,IAAIX,YAAY,CAACM,IAAI,EAAEC,IAAI,CAACC,QAAQ,CAAC,QAAQ,CAAC,EAAE;IAC5C,MAAMI,aAAa,GAAG,MAAMf,SAAS,CAAC;MAClCS,IAAI,EAAEN,YAAY,CAACM,IAAI;MACvBJ,uBAAuB;MACvBC;IACJ,CAAC,CAAC;IAEF,IAAIS,aAAa,EAAE;MACfX,QAAQ,CAAC;QACLY,GAAG,EAAE,GAAGD,aAAa,CAACE,IAAI,IAAIF,aAAa,CAACG,GAAG,EAAE;QACjDL,EAAE,EAAEE,aAAa,CAACG,GAAG;QACrBC,IAAI,EAAEJ,aAAa,CAACI,IAAI;QACxBC,KAAK,EACDL,aAAa,CAACI,IAAI,EAAEE,KAAK,IAAIN,aAAa,CAACI,IAAI,EAAEG,MAAM,GACjDC,MAAM,CAACR,aAAa,CAACI,IAAI,EAAEE,KAAK,CAAC,GAAGE,MAAM,CAACR,aAAa,CAACI,IAAI,EAAEG,MAAM,CAAC,GACtEd;MACd,CAAC,CAAC;IACN;EACJ;AACJ,CAAC","ignoreList":[]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type UploadUrls } from '../../config/uploadUrls';
|
|
1
2
|
import type { Meta } from '../../types/file';
|
|
2
3
|
export interface PostImageResult {
|
|
3
4
|
key: string;
|
|
@@ -23,9 +24,13 @@ export interface Signature {
|
|
|
23
24
|
interface PostImageOptions {
|
|
24
25
|
file: File;
|
|
25
26
|
shouldUploadImageToSite?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Overrides the globally configured upload service URLs for this upload.
|
|
29
|
+
*/
|
|
30
|
+
uploadUrls?: Partial<UploadUrls>;
|
|
26
31
|
}
|
|
27
32
|
/**
|
|
28
33
|
* Uploads an image to the tsimg cloud service
|
|
29
34
|
*/
|
|
30
|
-
export declare const postImage: ({ file, shouldUploadImageToSite, }: PostImageOptions) => Promise<PostImageResult | undefined>;
|
|
35
|
+
export declare const postImage: ({ file, shouldUploadImageToSite, uploadUrls, }: PostImageOptions) => Promise<PostImageResult | undefined>;
|
|
31
36
|
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type UploadUrls } from '../../config/uploadUrls';
|
|
1
2
|
export interface PostVideoResult {
|
|
2
3
|
id: string;
|
|
3
4
|
originalVideoQuality: string;
|
|
@@ -7,9 +8,13 @@ export interface PostVideoResult {
|
|
|
7
8
|
}
|
|
8
9
|
interface PostVideoOptions {
|
|
9
10
|
file: File | Blob;
|
|
11
|
+
/**
|
|
12
|
+
* Overrides the globally configured upload service URLs for this upload.
|
|
13
|
+
*/
|
|
14
|
+
uploadUrls?: Partial<UploadUrls>;
|
|
10
15
|
}
|
|
11
16
|
/**
|
|
12
17
|
* Uploads a video to the streaming service
|
|
13
18
|
*/
|
|
14
|
-
export declare const postVideo: ({ file, }: PostVideoOptions) => Promise<PostVideoResult | undefined>;
|
|
19
|
+
export declare const postVideo: ({ file, uploadUrls, }: PostVideoOptions) => Promise<PostVideoResult | undefined>;
|
|
15
20
|
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* URLs of the services used to upload images and videos.
|
|
3
|
+
*/
|
|
4
|
+
export interface UploadUrls {
|
|
5
|
+
/**
|
|
6
|
+
* URL of the image service used to upload images.
|
|
7
|
+
*/
|
|
8
|
+
imageServiceUrl: string;
|
|
9
|
+
/**
|
|
10
|
+
* URL of the image resizer service used to upload images larger than 10 MB.
|
|
11
|
+
*/
|
|
12
|
+
imageResizerUrl: string;
|
|
13
|
+
/**
|
|
14
|
+
* URL of the streaming service used to upload videos.
|
|
15
|
+
*/
|
|
16
|
+
videoServiceUrl: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Default chayns upload service URLs that are used when no custom URLs have
|
|
20
|
+
* been configured via {@link setUploadUrls}.
|
|
21
|
+
*/
|
|
22
|
+
export declare const DEFAULT_UPLOAD_URLS: UploadUrls;
|
|
23
|
+
/**
|
|
24
|
+
* Overrides the URLs of the services used to upload images and videos, e.g. for
|
|
25
|
+
* OnPremise deployments with self-hosted services.
|
|
26
|
+
*
|
|
27
|
+
* This has to be called once during the startup of the consuming application,
|
|
28
|
+
* before an upload is triggered. Environment variables cannot be used inside
|
|
29
|
+
* this package, because it is bundled before the consuming application is built
|
|
30
|
+
* and therefore no longer contains replaceable `process.env` references.
|
|
31
|
+
*
|
|
32
|
+
* Only the URLs that are passed are overridden, all others keep their current
|
|
33
|
+
* value.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* setUploadUrls({
|
|
38
|
+
* imageServiceUrl: process.env.PUBLIC_IMAGE_SERVICE_URL,
|
|
39
|
+
* imageResizerUrl: process.env.PUBLIC_IMAGE_RESIZER_URL,
|
|
40
|
+
* videoServiceUrl: process.env.PUBLIC_VIDEO_SERVICE_URL,
|
|
41
|
+
* });
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export declare const setUploadUrls: (urls?: Partial<UploadUrls>) => void;
|
|
45
|
+
/**
|
|
46
|
+
* Returns the currently configured upload service URLs, optionally merged with
|
|
47
|
+
* the given overrides. Overrides take precedence over the globally configured
|
|
48
|
+
* URLs, which in turn take precedence over {@link DEFAULT_UPLOAD_URLS}.
|
|
49
|
+
*/
|
|
50
|
+
export declare const getUploadUrls: (overrides?: Partial<UploadUrls>) => UploadUrls;
|
|
51
|
+
/**
|
|
52
|
+
* Resets the upload service URLs to {@link DEFAULT_UPLOAD_URLS}.
|
|
53
|
+
*/
|
|
54
|
+
export declare const resetUploadUrls: () => void;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -98,6 +98,7 @@ export { filterFilesByMimeType, getFileAsArrayBuffer, selectFiles } from './util
|
|
|
98
98
|
export { isTobitEmployee } from './utils/isTobitEmployee';
|
|
99
99
|
export { getUsableHeight } from './utils/pageProvider';
|
|
100
100
|
export { uploadFile } from './utils/uploadFile';
|
|
101
|
+
export { DEFAULT_UPLOAD_URLS, getUploadUrls, resetUploadUrls, setUploadUrls, type UploadUrls, } from './config/uploadUrls';
|
|
101
102
|
export type { Theme } from './components/color-scheme-provider/ColorSchemeProvider';
|
|
102
103
|
export { ComboBoxSize } from './components/combobox/ComboBox.types';
|
|
103
104
|
export type { IComboBoxItem as ComboBoxItem, ComboBoxTextStyles, IComboBoxItems as ComboBoxItems, ComboBoxRef, } from './components/combobox/ComboBox.types';
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
+
import type { UploadUrls } from '../config/uploadUrls';
|
|
1
2
|
import type { Image, InternalFileItem, Video } from '../types/file';
|
|
2
3
|
interface UploadFilesOptions {
|
|
3
4
|
fileToUpload: InternalFileItem;
|
|
4
5
|
callback: (UploadedFile: Video | Image) => void;
|
|
5
6
|
shouldUploadImageToSite?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Overrides the globally configured upload service URLs for this upload.
|
|
9
|
+
*/
|
|
10
|
+
uploadUrls?: Partial<UploadUrls>;
|
|
6
11
|
}
|
|
7
|
-
export declare const uploadFile: ({ fileToUpload, callback, shouldUploadImageToSite, }: UploadFilesOptions) => Promise<void>;
|
|
12
|
+
export declare const uploadFile: ({ fileToUpload, callback, shouldUploadImageToSite, uploadUrls, }: UploadFilesOptions) => Promise<void>;
|
|
8
13
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chayns-components/core",
|
|
3
|
-
"version": "5.5.
|
|
3
|
+
"version": "5.5.59-beta.0",
|
|
4
4
|
"description": "A set of beautiful React components for developing your own applications with chayns.",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"browserslist": [
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {
|
|
87
87
|
"chayns-api": ">=2.2.0",
|
|
88
|
-
"motion": "
|
|
88
|
+
"motion": "^12.4.1 || ^13.0.0",
|
|
89
89
|
"react": ">=18.0.0",
|
|
90
90
|
"react-dom": ">=18.0.0",
|
|
91
91
|
"styled-components": ">=5.3.11"
|
|
@@ -93,5 +93,5 @@
|
|
|
93
93
|
"publishConfig": {
|
|
94
94
|
"access": "public"
|
|
95
95
|
},
|
|
96
|
-
"gitHead": "
|
|
96
|
+
"gitHead": "e8dc8555063d257462a88de3e45dc960fc212d79"
|
|
97
97
|
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.VIDEO_SERVICE_URL = exports.IMAGE_SERVICE_URL = exports.IMAGE_RESIZER_URL = void 0;
|
|
7
|
-
/**
|
|
8
|
-
* URL of the image service used to upload images.
|
|
9
|
-
*
|
|
10
|
-
* Can be overridden via the `PUBLIC_IMAGE_SERVICE_URL` environment variable
|
|
11
|
-
* (e.g. for OnPremise deployments with a self-hosted image service). The
|
|
12
|
-
* variable is expected to be substituted for its value by a pre-deploy
|
|
13
|
-
* script that replaces literal `process.env.PUBLIC_IMAGE_SERVICE_URL`
|
|
14
|
-
* occurrences with a quoted string, mirroring the approach used in the
|
|
15
|
-
* chayns-threads project.
|
|
16
|
-
*
|
|
17
|
-
* Accessing `process` is wrapped in a try/catch so that a `ReferenceError`
|
|
18
|
-
* thrown in environments where the substitution did not run and `process`
|
|
19
|
-
* is not defined (e.g. in the browser) is swallowed, falling back to the
|
|
20
|
-
* default chayns image service instead. Unlike a `typeof process` guard,
|
|
21
|
-
* this does not suppress an already-substituted literal value at runtime,
|
|
22
|
-
* since that value no longer depends on `process` being defined.
|
|
23
|
-
*/
|
|
24
|
-
const IMAGE_SERVICE_URL = exports.IMAGE_SERVICE_URL = (() => {
|
|
25
|
-
try {
|
|
26
|
-
return process.env.PUBLIC_IMAGE_SERVICE_URL ?? 'https://cube.tobit.cloud/image-service/v3/Images';
|
|
27
|
-
} catch {
|
|
28
|
-
return 'https://cube.tobit.cloud/image-service/v3/Images';
|
|
29
|
-
}
|
|
30
|
-
})();
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* URL of the image resizer service used to upload images larger than 10 MB.
|
|
34
|
-
*
|
|
35
|
-
* Can be overridden via the `PUBLIC_IMAGE_RESIZER_URL` environment variable
|
|
36
|
-
* (e.g. for OnPremise deployments with a self-hosted image service). See
|
|
37
|
-
* {@link IMAGE_SERVICE_URL} for details on the substitution mechanism.
|
|
38
|
-
*/
|
|
39
|
-
const IMAGE_RESIZER_URL = exports.IMAGE_RESIZER_URL = (() => {
|
|
40
|
-
try {
|
|
41
|
-
return process.env.PUBLIC_IMAGE_RESIZER_URL ?? 'https://cube.tobit.cloud/image-resizer-backend/api/v1.0/image';
|
|
42
|
-
} catch {
|
|
43
|
-
return 'https://cube.tobit.cloud/image-resizer-backend/api/v1.0/image';
|
|
44
|
-
}
|
|
45
|
-
})();
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* URL of the streaming service used to upload videos.
|
|
49
|
-
*
|
|
50
|
-
* Can be overridden via the `PUBLIC_VIDEO_SERVICE_URL` environment variable
|
|
51
|
-
* (e.g. for OnPremise deployments with a self-hosted video service). See
|
|
52
|
-
* {@link IMAGE_SERVICE_URL} for details on the substitution mechanism.
|
|
53
|
-
*/
|
|
54
|
-
const VIDEO_SERVICE_URL = exports.VIDEO_SERVICE_URL = (() => {
|
|
55
|
-
try {
|
|
56
|
-
return process.env.PUBLIC_VIDEO_SERVICE_URL ?? 'https://streamingservice.chayns.space/video';
|
|
57
|
-
} catch {
|
|
58
|
-
return 'https://streamingservice.chayns.space/video';
|
|
59
|
-
}
|
|
60
|
-
})();
|
|
61
|
-
//# sourceMappingURL=serverUrls.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"serverUrls.js","names":["IMAGE_SERVICE_URL","exports","process","env","PUBLIC_IMAGE_SERVICE_URL","IMAGE_RESIZER_URL","PUBLIC_IMAGE_RESIZER_URL","VIDEO_SERVICE_URL","PUBLIC_VIDEO_SERVICE_URL"],"sources":["../../../src/constants/serverUrls.ts"],"sourcesContent":["/**\n * URL of the image service used to upload images.\n *\n * Can be overridden via the `PUBLIC_IMAGE_SERVICE_URL` environment variable\n * (e.g. for OnPremise deployments with a self-hosted image service). The\n * variable is expected to be substituted for its value by a pre-deploy\n * script that replaces literal `process.env.PUBLIC_IMAGE_SERVICE_URL`\n * occurrences with a quoted string, mirroring the approach used in the\n * chayns-threads project.\n *\n * Accessing `process` is wrapped in a try/catch so that a `ReferenceError`\n * thrown in environments where the substitution did not run and `process`\n * is not defined (e.g. in the browser) is swallowed, falling back to the\n * default chayns image service instead. Unlike a `typeof process` guard,\n * this does not suppress an already-substituted literal value at runtime,\n * since that value no longer depends on `process` being defined.\n */\nexport const IMAGE_SERVICE_URL = ((): string => {\n try {\n return (\n process.env.PUBLIC_IMAGE_SERVICE_URL ??\n 'https://cube.tobit.cloud/image-service/v3/Images'\n );\n } catch {\n return 'https://cube.tobit.cloud/image-service/v3/Images';\n }\n})();\n\n/**\n * URL of the image resizer service used to upload images larger than 10 MB.\n *\n * Can be overridden via the `PUBLIC_IMAGE_RESIZER_URL` environment variable\n * (e.g. for OnPremise deployments with a self-hosted image service). See\n * {@link IMAGE_SERVICE_URL} for details on the substitution mechanism.\n */\nexport const IMAGE_RESIZER_URL = ((): string => {\n try {\n return (\n process.env.PUBLIC_IMAGE_RESIZER_URL ??\n 'https://cube.tobit.cloud/image-resizer-backend/api/v1.0/image'\n );\n } catch {\n return 'https://cube.tobit.cloud/image-resizer-backend/api/v1.0/image';\n }\n})();\n\n/**\n * URL of the streaming service used to upload videos.\n *\n * Can be overridden via the `PUBLIC_VIDEO_SERVICE_URL` environment variable\n * (e.g. for OnPremise deployments with a self-hosted video service). See\n * {@link IMAGE_SERVICE_URL} for details on the substitution mechanism.\n */\nexport const VIDEO_SERVICE_URL = ((): string => {\n try {\n return (\n process.env.PUBLIC_VIDEO_SERVICE_URL ?? 'https://streamingservice.chayns.space/video'\n );\n } catch {\n return 'https://streamingservice.chayns.space/video';\n }\n})();\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,GAAG,CAAC,MAAc;EAC5C,IAAI;IACA,OACIE,OAAO,CAACC,GAAG,CAACC,wBAAwB,IACpC,kDAAkD;EAE1D,CAAC,CAAC,MAAM;IACJ,OAAO,kDAAkD;EAC7D;AACJ,CAAC,EAAE,CAAC;;AAEJ;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,iBAAiB,GAAAJ,OAAA,CAAAI,iBAAA,GAAG,CAAC,MAAc;EAC5C,IAAI;IACA,OACIH,OAAO,CAACC,GAAG,CAACG,wBAAwB,IACpC,+DAA+D;EAEvE,CAAC,CAAC,MAAM;IACJ,OAAO,+DAA+D;EAC1E;AACJ,CAAC,EAAE,CAAC;;AAEJ;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,iBAAiB,GAAAN,OAAA,CAAAM,iBAAA,GAAG,CAAC,MAAc;EAC5C,IAAI;IACA,OACIL,OAAO,CAACC,GAAG,CAACK,wBAAwB,IAAI,6CAA6C;EAE7F,CAAC,CAAC,MAAM;IACJ,OAAO,6CAA6C;EACxD;AACJ,CAAC,EAAE,CAAC","ignoreList":[]}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* URL of the image service used to upload images.
|
|
3
|
-
*
|
|
4
|
-
* Can be overridden via the `PUBLIC_IMAGE_SERVICE_URL` environment variable
|
|
5
|
-
* (e.g. for OnPremise deployments with a self-hosted image service). The
|
|
6
|
-
* variable is expected to be substituted for its value by a pre-deploy
|
|
7
|
-
* script that replaces literal `process.env.PUBLIC_IMAGE_SERVICE_URL`
|
|
8
|
-
* occurrences with a quoted string, mirroring the approach used in the
|
|
9
|
-
* chayns-threads project.
|
|
10
|
-
*
|
|
11
|
-
* Accessing `process` is wrapped in a try/catch so that a `ReferenceError`
|
|
12
|
-
* thrown in environments where the substitution did not run and `process`
|
|
13
|
-
* is not defined (e.g. in the browser) is swallowed, falling back to the
|
|
14
|
-
* default chayns image service instead. Unlike a `typeof process` guard,
|
|
15
|
-
* this does not suppress an already-substituted literal value at runtime,
|
|
16
|
-
* since that value no longer depends on `process` being defined.
|
|
17
|
-
*/
|
|
18
|
-
export const IMAGE_SERVICE_URL = (() => {
|
|
19
|
-
try {
|
|
20
|
-
return process.env.PUBLIC_IMAGE_SERVICE_URL ?? 'https://cube.tobit.cloud/image-service/v3/Images';
|
|
21
|
-
} catch {
|
|
22
|
-
return 'https://cube.tobit.cloud/image-service/v3/Images';
|
|
23
|
-
}
|
|
24
|
-
})();
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* URL of the image resizer service used to upload images larger than 10 MB.
|
|
28
|
-
*
|
|
29
|
-
* Can be overridden via the `PUBLIC_IMAGE_RESIZER_URL` environment variable
|
|
30
|
-
* (e.g. for OnPremise deployments with a self-hosted image service). See
|
|
31
|
-
* {@link IMAGE_SERVICE_URL} for details on the substitution mechanism.
|
|
32
|
-
*/
|
|
33
|
-
export const IMAGE_RESIZER_URL = (() => {
|
|
34
|
-
try {
|
|
35
|
-
return process.env.PUBLIC_IMAGE_RESIZER_URL ?? 'https://cube.tobit.cloud/image-resizer-backend/api/v1.0/image';
|
|
36
|
-
} catch {
|
|
37
|
-
return 'https://cube.tobit.cloud/image-resizer-backend/api/v1.0/image';
|
|
38
|
-
}
|
|
39
|
-
})();
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* URL of the streaming service used to upload videos.
|
|
43
|
-
*
|
|
44
|
-
* Can be overridden via the `PUBLIC_VIDEO_SERVICE_URL` environment variable
|
|
45
|
-
* (e.g. for OnPremise deployments with a self-hosted video service). See
|
|
46
|
-
* {@link IMAGE_SERVICE_URL} for details on the substitution mechanism.
|
|
47
|
-
*/
|
|
48
|
-
export const VIDEO_SERVICE_URL = (() => {
|
|
49
|
-
try {
|
|
50
|
-
return process.env.PUBLIC_VIDEO_SERVICE_URL ?? 'https://streamingservice.chayns.space/video';
|
|
51
|
-
} catch {
|
|
52
|
-
return 'https://streamingservice.chayns.space/video';
|
|
53
|
-
}
|
|
54
|
-
})();
|
|
55
|
-
//# sourceMappingURL=serverUrls.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"serverUrls.js","names":["IMAGE_SERVICE_URL","process","env","PUBLIC_IMAGE_SERVICE_URL","IMAGE_RESIZER_URL","PUBLIC_IMAGE_RESIZER_URL","VIDEO_SERVICE_URL","PUBLIC_VIDEO_SERVICE_URL"],"sources":["../../../src/constants/serverUrls.ts"],"sourcesContent":["/**\n * URL of the image service used to upload images.\n *\n * Can be overridden via the `PUBLIC_IMAGE_SERVICE_URL` environment variable\n * (e.g. for OnPremise deployments with a self-hosted image service). The\n * variable is expected to be substituted for its value by a pre-deploy\n * script that replaces literal `process.env.PUBLIC_IMAGE_SERVICE_URL`\n * occurrences with a quoted string, mirroring the approach used in the\n * chayns-threads project.\n *\n * Accessing `process` is wrapped in a try/catch so that a `ReferenceError`\n * thrown in environments where the substitution did not run and `process`\n * is not defined (e.g. in the browser) is swallowed, falling back to the\n * default chayns image service instead. Unlike a `typeof process` guard,\n * this does not suppress an already-substituted literal value at runtime,\n * since that value no longer depends on `process` being defined.\n */\nexport const IMAGE_SERVICE_URL = ((): string => {\n try {\n return (\n process.env.PUBLIC_IMAGE_SERVICE_URL ??\n 'https://cube.tobit.cloud/image-service/v3/Images'\n );\n } catch {\n return 'https://cube.tobit.cloud/image-service/v3/Images';\n }\n})();\n\n/**\n * URL of the image resizer service used to upload images larger than 10 MB.\n *\n * Can be overridden via the `PUBLIC_IMAGE_RESIZER_URL` environment variable\n * (e.g. for OnPremise deployments with a self-hosted image service). See\n * {@link IMAGE_SERVICE_URL} for details on the substitution mechanism.\n */\nexport const IMAGE_RESIZER_URL = ((): string => {\n try {\n return (\n process.env.PUBLIC_IMAGE_RESIZER_URL ??\n 'https://cube.tobit.cloud/image-resizer-backend/api/v1.0/image'\n );\n } catch {\n return 'https://cube.tobit.cloud/image-resizer-backend/api/v1.0/image';\n }\n})();\n\n/**\n * URL of the streaming service used to upload videos.\n *\n * Can be overridden via the `PUBLIC_VIDEO_SERVICE_URL` environment variable\n * (e.g. for OnPremise deployments with a self-hosted video service). See\n * {@link IMAGE_SERVICE_URL} for details on the substitution mechanism.\n */\nexport const VIDEO_SERVICE_URL = ((): string => {\n try {\n return (\n process.env.PUBLIC_VIDEO_SERVICE_URL ?? 'https://streamingservice.chayns.space/video'\n );\n } catch {\n return 'https://streamingservice.chayns.space/video';\n }\n})();\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,iBAAiB,GAAG,CAAC,MAAc;EAC5C,IAAI;IACA,OACIC,OAAO,CAACC,GAAG,CAACC,wBAAwB,IACpC,kDAAkD;EAE1D,CAAC,CAAC,MAAM;IACJ,OAAO,kDAAkD;EAC7D;AACJ,CAAC,EAAE,CAAC;;AAEJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,iBAAiB,GAAG,CAAC,MAAc;EAC5C,IAAI;IACA,OACIH,OAAO,CAACC,GAAG,CAACG,wBAAwB,IACpC,+DAA+D;EAEvE,CAAC,CAAC,MAAM;IACJ,OAAO,+DAA+D;EAC1E;AACJ,CAAC,EAAE,CAAC;;AAEJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,iBAAiB,GAAG,CAAC,MAAc;EAC5C,IAAI;IACA,OACIL,OAAO,CAACC,GAAG,CAACK,wBAAwB,IAAI,6CAA6C;EAE7F,CAAC,CAAC,MAAM;IACJ,OAAO,6CAA6C;EACxD;AACJ,CAAC,EAAE,CAAC","ignoreList":[]}
|