@flipdish/portal-library 8.5.1 → 8.5.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.
@@ -1,2 +1,2 @@
1
- "use strict";var s=require("../../../../utilities/apiUtils.cjs.js"),t=require("@flipdish/asset-management");const e=new t.Configuration({basePath:(()=>{const s=window.location?.host?.includes("portal.flipdish.com");return s?"https://api.portal.flipdish.com/assets":"https://api-prod-staging.portal.flipdishdev.com/assets"})(),baseOptions:{withCredentials:!0}}),r=new t.AssetsApi(e);exports.getAssets=async(t,e)=>{if(!t)throw console.error("Organization ID is required to fetch assets"),new Error("Organization ID is required to fetch assets");try{return(await r.listAssets(t,e)).data}catch(t){const e=s.getErrorMessage(t,"Failed to fetch assets");throw new Error(e)}},exports.uploadAsset=async t=>{const{orgId:e,brandId:a,files:i}=t;if(!e)throw new Error("Organization ID is required to upload assets");if(!i||0===i.length)throw new Error("At least one file is required to upload");try{return(await r.uploadAsset(e,i,a)).data}catch(t){const e=s.getErrorMessage(t,"Failed to upload assets");throw new Error(e)}};
1
+ "use strict";var s=require("../../../../utilities/apiUtils.cjs.js"),t=require("@flipdish/asset-management"),e=require("../../../../utilities/fileUtils.cjs.js");const r=new t.Configuration({basePath:(()=>{const s=window.location?.host?.includes("portal.flipdish.com");return s?"https://api.portal.flipdish.com/assets":"https://api-prod-staging.portal.flipdishdev.com/assets"})(),baseOptions:{withCredentials:!0}}),i=new t.AssetsApi(r);exports.getAssets=async(t,e)=>{if(!t)throw console.error("Organization ID is required to fetch assets"),new Error("Organization ID is required to fetch assets");try{return(await i.listAssets(t,e)).data}catch(t){const e=s.getErrorMessage(t,"Failed to fetch assets");throw new Error(e)}},exports.uploadAsset=async t=>{const{orgId:r,brandId:a,files:o}=t;if(!r)throw new Error("Organization ID is required to upload assets");if(!o||0===o.length)throw new Error("At least one file is required to upload");const n=o.map(e.sanitizeFile);try{return(await i.uploadAsset(r,n,a)).data}catch(t){const e=s.getErrorMessage(t,"Failed to upload assets");throw new Error(e)}};
2
2
  //# sourceMappingURL=asset.service.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"asset.service.cjs.js","sources":["../../../../../src/components/organisms/AssetManager/services/asset.service.ts"],"sourcesContent":["import { getErrorMessage } from '@fd/utilities/apiUtils';\nimport { AssetsApi, Configuration } from '@flipdish/asset-management';\n\nimport type { ListAssetsResponse, UploadAssetResponse } from '../types/assets.type';\n\nconst PROD_API_URL = 'https://api.portal.flipdish.com/assets';\nconst DEV_STAGING_API_URL = 'https://api-prod-staging.portal.flipdishdev.com/assets';\n\n/**\n * Gets the asset management API base URL based on the current environment\n * @returns The appropriate API URL for the current environment\n */\nconst getAssetManagementApiUrl = (): string => {\n const isProd = window.location?.host?.includes('portal.flipdish.com');\n\n if (isProd) {\n return PROD_API_URL;\n }\n\n return DEV_STAGING_API_URL;\n};\n\n/**\n * Configuration for the asset management API client\n * - basePath: API base URL based on environment\n * - baseOptions.withCredentials: Send cookies/credentials with requests\n */\nconst configuration = new Configuration({\n basePath: getAssetManagementApiUrl(),\n baseOptions: {\n withCredentials: true,\n },\n});\n\nconst assetsApi = new AssetsApi(configuration);\n\n/**\n * Fetches assets from the asset management service API\n * @param orgId - organization ID.\n * @param brandId - brand ID.\n * @returns Promise resolving to an array of assets\n */\nexport const getAssets = async (orgId: string, brandId?: string): Promise<ListAssetsResponse> => {\n if (!orgId) {\n console.error('Organization ID is required to fetch assets');\n throw new Error('Organization ID is required to fetch assets');\n }\n\n try {\n const response = await assetsApi.listAssets(orgId, brandId);\n return response.data;\n } catch (error: unknown) {\n const errorMessage = getErrorMessage(error, 'Failed to fetch assets');\n throw new Error(errorMessage);\n }\n};\n\n/**\n * Upload parameters for asset upload\n */\nexport interface UploadAssetParams {\n /** Organization ID */\n orgId: string;\n /** Optional brand ID */\n brandId?: string;\n /** The files to upload */\n files: File[];\n}\n\n/**\n * Uploads multiple assets to the asset management service API\n * @param params - Upload parameters containing orgId, brandId, and files\n * @returns Promise resolving to an array of uploaded assets\n */\nexport const uploadAsset = async (params: UploadAssetParams): Promise<UploadAssetResponse> => {\n const { orgId, brandId, files } = params;\n\n if (!orgId) {\n throw new Error('Organization ID is required to upload assets');\n }\n\n if (!files || files.length === 0) {\n throw new Error('At least one file is required to upload');\n }\n\n try {\n const response = await assetsApi.uploadAsset(orgId, files, brandId);\n return response.data;\n } catch (error: unknown) {\n const errorMessage = getErrorMessage(error, 'Failed to upload assets');\n throw new Error(errorMessage);\n }\n};\n"],"names":["configuration","Configuration","basePath","isProd","window","location","host","includes","getAssetManagementApiUrl","baseOptions","withCredentials","assetsApi","AssetsApi","async","orgId","brandId","console","error","Error","listAssets","data","errorMessage","getErrorMessage","params","files","length","uploadAsset"],"mappings":"4GAKA,MAsBMA,EAAgB,IAAIC,EAAAA,cAAc,CACtCC,SAhB+B,MAC/B,MAAMC,EAASC,OAAOC,UAAUC,MAAMC,SAAS,uBAE/C,OAAIJ,EAVe,yCACO,0DAsBhBK,GACVC,YAAa,CACXC,iBAAiB,KAIfC,EAAY,IAAIC,EAAAA,UAAUZ,qBAQPa,MAAOC,EAAeC,KAC7C,IAAKD,EAEH,MADAE,QAAQC,MAAM,+CACR,IAAIC,MAAM,+CAGlB,IAEE,aADuBP,EAAUQ,WAAWL,EAAOC,IACnCK,IAClB,CAAE,MAAOH,GACP,MAAMI,EAAeC,EAAAA,gBAAgBL,EAAO,0BAC5C,MAAM,IAAIC,MAAMG,EAClB,uBAoByBR,MAAOU,IAChC,MAAMT,MAAEA,EAAKC,QAAEA,EAAOS,MAAEA,GAAUD,EAElC,IAAKT,EACH,MAAM,IAAII,MAAM,gDAGlB,IAAKM,GAA0B,IAAjBA,EAAMC,OAClB,MAAM,IAAIP,MAAM,2CAGlB,IAEE,aADuBP,EAAUe,YAAYZ,EAAOU,EAAOT,IAC3CK,IAClB,CAAE,MAAOH,GACP,MAAMI,EAAeC,EAAAA,gBAAgBL,EAAO,2BAC5C,MAAM,IAAIC,MAAMG,EAClB"}
1
+ {"version":3,"file":"asset.service.cjs.js","sources":["../../../../../src/components/organisms/AssetManager/services/asset.service.ts"],"sourcesContent":["import { getErrorMessage } from '@fd/utilities/apiUtils';\nimport { AssetsApi, Configuration } from '@flipdish/asset-management';\n\nimport { sanitizeFile } from '../../../../utilities/fileUtils';\nimport type { ListAssetsResponse, UploadAssetResponse } from '../types/assets.type';\n\nconst PROD_API_URL = 'https://api.portal.flipdish.com/assets';\nconst DEV_STAGING_API_URL = 'https://api-prod-staging.portal.flipdishdev.com/assets';\n\n/**\n * Gets the asset management API base URL based on the current environment\n * @returns The appropriate API URL for the current environment\n */\nconst getAssetManagementApiUrl = (): string => {\n const isProd = window.location?.host?.includes('portal.flipdish.com');\n\n if (isProd) {\n return PROD_API_URL;\n }\n\n return DEV_STAGING_API_URL;\n};\n\n/**\n * Configuration for the asset management API client\n * - basePath: API base URL based on environment\n * - baseOptions.withCredentials: Send cookies/credentials with requests\n */\nconst configuration = new Configuration({\n basePath: getAssetManagementApiUrl(),\n baseOptions: {\n withCredentials: true,\n },\n});\n\nconst assetsApi = new AssetsApi(configuration);\n\n/**\n * Fetches assets from the asset management service API\n * @param orgId - organization ID.\n * @param brandId - brand ID.\n * @returns Promise resolving to an array of assets\n */\nexport const getAssets = async (orgId: string, brandId?: string): Promise<ListAssetsResponse> => {\n if (!orgId) {\n console.error('Organization ID is required to fetch assets');\n throw new Error('Organization ID is required to fetch assets');\n }\n\n try {\n const response = await assetsApi.listAssets(orgId, brandId);\n return response.data;\n } catch (error: unknown) {\n const errorMessage = getErrorMessage(error, 'Failed to fetch assets');\n throw new Error(errorMessage);\n }\n};\n\n/**\n * Upload parameters for asset upload\n */\nexport interface UploadAssetParams {\n /** Organization ID */\n orgId: string;\n /** Optional brand ID */\n brandId?: string;\n /** The files to upload */\n files: File[];\n}\n\n/**\n * Uploads multiple assets to the asset management service API\n * Sanitizes filenames by replacing spaces with dashes before uploading\n * @param params - Upload parameters containing orgId, brandId, and files\n * @returns Promise resolving to an array of uploaded assets\n */\nexport const uploadAsset = async (params: UploadAssetParams): Promise<UploadAssetResponse> => {\n const { orgId, brandId, files } = params;\n\n if (!orgId) {\n throw new Error('Organization ID is required to upload assets');\n }\n\n if (!files || files.length === 0) {\n throw new Error('At least one file is required to upload');\n }\n\n // Sanitize filenames by replacing spaces with dashes\n const sanitizedFiles = files.map(sanitizeFile);\n\n try {\n const response = await assetsApi.uploadAsset(orgId, sanitizedFiles, brandId);\n return response.data;\n } catch (error: unknown) {\n const errorMessage = getErrorMessage(error, 'Failed to upload assets');\n throw new Error(errorMessage);\n }\n};\n"],"names":["configuration","Configuration","basePath","isProd","window","location","host","includes","getAssetManagementApiUrl","baseOptions","withCredentials","assetsApi","AssetsApi","async","orgId","brandId","console","error","Error","listAssets","data","errorMessage","getErrorMessage","params","files","length","sanitizedFiles","map","sanitizeFile","uploadAsset"],"mappings":"gKAMA,MAsBMA,EAAgB,IAAIC,EAAAA,cAAc,CACtCC,SAhB+B,MAC/B,MAAMC,EAASC,OAAOC,UAAUC,MAAMC,SAAS,uBAE/C,OAAIJ,EAVe,yCACO,0DAsBhBK,GACVC,YAAa,CACXC,iBAAiB,KAIfC,EAAY,IAAIC,EAAAA,UAAUZ,qBAQPa,MAAOC,EAAeC,KAC7C,IAAKD,EAEH,MADAE,QAAQC,MAAM,+CACR,IAAIC,MAAM,+CAGlB,IAEE,aADuBP,EAAUQ,WAAWL,EAAOC,IACnCK,IAClB,CAAE,MAAOH,GACP,MAAMI,EAAeC,EAAAA,gBAAgBL,EAAO,0BAC5C,MAAM,IAAIC,MAAMG,EAClB,uBAqByBR,MAAOU,IAChC,MAAMT,MAAEA,EAAKC,QAAEA,EAAOS,MAAEA,GAAUD,EAElC,IAAKT,EACH,MAAM,IAAII,MAAM,gDAGlB,IAAKM,GAA0B,IAAjBA,EAAMC,OAClB,MAAM,IAAIP,MAAM,2CAIlB,MAAMQ,EAAiBF,EAAMG,IAAIC,gBAEjC,IAEE,aADuBjB,EAAUkB,YAAYf,EAAOY,EAAgBX,IACpDK,IAClB,CAAE,MAAOH,GACP,MAAMI,EAAeC,EAAAA,gBAAgBL,EAAO,2BAC5C,MAAM,IAAIC,MAAMG,EAClB"}
@@ -20,6 +20,7 @@ interface UploadAssetParams {
20
20
  }
21
21
  /**
22
22
  * Uploads multiple assets to the asset management service API
23
+ * Sanitizes filenames by replacing spaces with dashes before uploading
23
24
  * @param params - Upload parameters containing orgId, brandId, and files
24
25
  * @returns Promise resolving to an array of uploaded assets
25
26
  */
@@ -1,2 +1,2 @@
1
- import{getErrorMessage as t}from"../../../../utilities/apiUtils.js";import{Configuration as s,AssetsApi as r}from"@flipdish/asset-management";const e=new r(new s({basePath:(()=>{const t=window.location?.host?.includes("portal.flipdish.com");return t?"https://api.portal.flipdish.com/assets":"https://api-prod-staging.portal.flipdishdev.com/assets"})(),baseOptions:{withCredentials:!0}})),o=async(s,r)=>{if(!s)throw console.error("Organization ID is required to fetch assets"),new Error("Organization ID is required to fetch assets");try{return(await e.listAssets(s,r)).data}catch(s){const r=t(s,"Failed to fetch assets");throw new Error(r)}},a=async s=>{const{orgId:r,brandId:o,files:a}=s;if(!r)throw new Error("Organization ID is required to upload assets");if(!a||0===a.length)throw new Error("At least one file is required to upload");try{return(await e.uploadAsset(r,a,o)).data}catch(s){const r=t(s,"Failed to upload assets");throw new Error(r)}};export{o as getAssets,a as uploadAsset};
1
+ import{getErrorMessage as t}from"../../../../utilities/apiUtils.js";import{Configuration as s,AssetsApi as r}from"@flipdish/asset-management";import{sanitizeFile as i}from"../../../../utilities/fileUtils.js";const o=new r(new s({basePath:(()=>{const t=window.location?.host?.includes("portal.flipdish.com");return t?"https://api.portal.flipdish.com/assets":"https://api-prod-staging.portal.flipdishdev.com/assets"})(),baseOptions:{withCredentials:!0}})),e=async(s,r)=>{if(!s)throw console.error("Organization ID is required to fetch assets"),new Error("Organization ID is required to fetch assets");try{return(await o.listAssets(s,r)).data}catch(s){const r=t(s,"Failed to fetch assets");throw new Error(r)}},a=async s=>{const{orgId:r,brandId:e,files:a}=s;if(!r)throw new Error("Organization ID is required to upload assets");if(!a||0===a.length)throw new Error("At least one file is required to upload");const n=a.map(i);try{return(await o.uploadAsset(r,n,e)).data}catch(s){const r=t(s,"Failed to upload assets");throw new Error(r)}};export{e as getAssets,a as uploadAsset};
2
2
  //# sourceMappingURL=asset.service.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"asset.service.js","sources":["../../../../../src/components/organisms/AssetManager/services/asset.service.ts"],"sourcesContent":["import { getErrorMessage } from '@fd/utilities/apiUtils';\nimport { AssetsApi, Configuration } from '@flipdish/asset-management';\n\nimport type { ListAssetsResponse, UploadAssetResponse } from '../types/assets.type';\n\nconst PROD_API_URL = 'https://api.portal.flipdish.com/assets';\nconst DEV_STAGING_API_URL = 'https://api-prod-staging.portal.flipdishdev.com/assets';\n\n/**\n * Gets the asset management API base URL based on the current environment\n * @returns The appropriate API URL for the current environment\n */\nconst getAssetManagementApiUrl = (): string => {\n const isProd = window.location?.host?.includes('portal.flipdish.com');\n\n if (isProd) {\n return PROD_API_URL;\n }\n\n return DEV_STAGING_API_URL;\n};\n\n/**\n * Configuration for the asset management API client\n * - basePath: API base URL based on environment\n * - baseOptions.withCredentials: Send cookies/credentials with requests\n */\nconst configuration = new Configuration({\n basePath: getAssetManagementApiUrl(),\n baseOptions: {\n withCredentials: true,\n },\n});\n\nconst assetsApi = new AssetsApi(configuration);\n\n/**\n * Fetches assets from the asset management service API\n * @param orgId - organization ID.\n * @param brandId - brand ID.\n * @returns Promise resolving to an array of assets\n */\nexport const getAssets = async (orgId: string, brandId?: string): Promise<ListAssetsResponse> => {\n if (!orgId) {\n console.error('Organization ID is required to fetch assets');\n throw new Error('Organization ID is required to fetch assets');\n }\n\n try {\n const response = await assetsApi.listAssets(orgId, brandId);\n return response.data;\n } catch (error: unknown) {\n const errorMessage = getErrorMessage(error, 'Failed to fetch assets');\n throw new Error(errorMessage);\n }\n};\n\n/**\n * Upload parameters for asset upload\n */\nexport interface UploadAssetParams {\n /** Organization ID */\n orgId: string;\n /** Optional brand ID */\n brandId?: string;\n /** The files to upload */\n files: File[];\n}\n\n/**\n * Uploads multiple assets to the asset management service API\n * @param params - Upload parameters containing orgId, brandId, and files\n * @returns Promise resolving to an array of uploaded assets\n */\nexport const uploadAsset = async (params: UploadAssetParams): Promise<UploadAssetResponse> => {\n const { orgId, brandId, files } = params;\n\n if (!orgId) {\n throw new Error('Organization ID is required to upload assets');\n }\n\n if (!files || files.length === 0) {\n throw new Error('At least one file is required to upload');\n }\n\n try {\n const response = await assetsApi.uploadAsset(orgId, files, brandId);\n return response.data;\n } catch (error: unknown) {\n const errorMessage = getErrorMessage(error, 'Failed to upload assets');\n throw new Error(errorMessage);\n }\n};\n"],"names":["assetsApi","AssetsApi","Configuration","basePath","isProd","window","location","host","includes","getAssetManagementApiUrl","baseOptions","withCredentials","getAssets","async","orgId","brandId","console","error","Error","listAssets","data","errorMessage","getErrorMessage","uploadAsset","params","files","length"],"mappings":"8IAKA,MA6BMA,EAAY,IAAIC,EAPA,IAAIC,EAAc,CACtCC,SAhB+B,MAC/B,MAAMC,EAASC,OAAOC,UAAUC,MAAMC,SAAS,uBAE/C,OAAIJ,EAVe,yCACO,0DAsBhBK,GACVC,YAAa,CACXC,iBAAiB,MAYRC,EAAYC,MAAOC,EAAeC,KAC7C,IAAKD,EAEH,MADAE,QAAQC,MAAM,+CACR,IAAIC,MAAM,+CAGlB,IAEE,aADuBlB,EAAUmB,WAAWL,EAAOC,IACnCK,IAClB,CAAE,MAAOH,GACP,MAAMI,EAAeC,EAAgBL,EAAO,0BAC5C,MAAM,IAAIC,MAAMG,EAClB,GAoBWE,EAAcV,MAAOW,IAChC,MAAMV,MAAEA,EAAKC,QAAEA,EAAOU,MAAEA,GAAUD,EAElC,IAAKV,EACH,MAAM,IAAII,MAAM,gDAGlB,IAAKO,GAA0B,IAAjBA,EAAMC,OAClB,MAAM,IAAIR,MAAM,2CAGlB,IAEE,aADuBlB,EAAUuB,YAAYT,EAAOW,EAAOV,IAC3CK,IAClB,CAAE,MAAOH,GACP,MAAMI,EAAeC,EAAgBL,EAAO,2BAC5C,MAAM,IAAIC,MAAMG,EAClB"}
1
+ {"version":3,"file":"asset.service.js","sources":["../../../../../src/components/organisms/AssetManager/services/asset.service.ts"],"sourcesContent":["import { getErrorMessage } from '@fd/utilities/apiUtils';\nimport { AssetsApi, Configuration } from '@flipdish/asset-management';\n\nimport { sanitizeFile } from '../../../../utilities/fileUtils';\nimport type { ListAssetsResponse, UploadAssetResponse } from '../types/assets.type';\n\nconst PROD_API_URL = 'https://api.portal.flipdish.com/assets';\nconst DEV_STAGING_API_URL = 'https://api-prod-staging.portal.flipdishdev.com/assets';\n\n/**\n * Gets the asset management API base URL based on the current environment\n * @returns The appropriate API URL for the current environment\n */\nconst getAssetManagementApiUrl = (): string => {\n const isProd = window.location?.host?.includes('portal.flipdish.com');\n\n if (isProd) {\n return PROD_API_URL;\n }\n\n return DEV_STAGING_API_URL;\n};\n\n/**\n * Configuration for the asset management API client\n * - basePath: API base URL based on environment\n * - baseOptions.withCredentials: Send cookies/credentials with requests\n */\nconst configuration = new Configuration({\n basePath: getAssetManagementApiUrl(),\n baseOptions: {\n withCredentials: true,\n },\n});\n\nconst assetsApi = new AssetsApi(configuration);\n\n/**\n * Fetches assets from the asset management service API\n * @param orgId - organization ID.\n * @param brandId - brand ID.\n * @returns Promise resolving to an array of assets\n */\nexport const getAssets = async (orgId: string, brandId?: string): Promise<ListAssetsResponse> => {\n if (!orgId) {\n console.error('Organization ID is required to fetch assets');\n throw new Error('Organization ID is required to fetch assets');\n }\n\n try {\n const response = await assetsApi.listAssets(orgId, brandId);\n return response.data;\n } catch (error: unknown) {\n const errorMessage = getErrorMessage(error, 'Failed to fetch assets');\n throw new Error(errorMessage);\n }\n};\n\n/**\n * Upload parameters for asset upload\n */\nexport interface UploadAssetParams {\n /** Organization ID */\n orgId: string;\n /** Optional brand ID */\n brandId?: string;\n /** The files to upload */\n files: File[];\n}\n\n/**\n * Uploads multiple assets to the asset management service API\n * Sanitizes filenames by replacing spaces with dashes before uploading\n * @param params - Upload parameters containing orgId, brandId, and files\n * @returns Promise resolving to an array of uploaded assets\n */\nexport const uploadAsset = async (params: UploadAssetParams): Promise<UploadAssetResponse> => {\n const { orgId, brandId, files } = params;\n\n if (!orgId) {\n throw new Error('Organization ID is required to upload assets');\n }\n\n if (!files || files.length === 0) {\n throw new Error('At least one file is required to upload');\n }\n\n // Sanitize filenames by replacing spaces with dashes\n const sanitizedFiles = files.map(sanitizeFile);\n\n try {\n const response = await assetsApi.uploadAsset(orgId, sanitizedFiles, brandId);\n return response.data;\n } catch (error: unknown) {\n const errorMessage = getErrorMessage(error, 'Failed to upload assets');\n throw new Error(errorMessage);\n }\n};\n"],"names":["assetsApi","AssetsApi","Configuration","basePath","isProd","window","location","host","includes","getAssetManagementApiUrl","baseOptions","withCredentials","getAssets","async","orgId","brandId","console","error","Error","listAssets","data","errorMessage","getErrorMessage","uploadAsset","params","files","length","sanitizedFiles","map","sanitizeFile"],"mappings":"gNAMA,MA6BMA,EAAY,IAAIC,EAPA,IAAIC,EAAc,CACtCC,SAhB+B,MAC/B,MAAMC,EAASC,OAAOC,UAAUC,MAAMC,SAAS,uBAE/C,OAAIJ,EAVe,yCACO,0DAsBhBK,GACVC,YAAa,CACXC,iBAAiB,MAYRC,EAAYC,MAAOC,EAAeC,KAC7C,IAAKD,EAEH,MADAE,QAAQC,MAAM,+CACR,IAAIC,MAAM,+CAGlB,IAEE,aADuBlB,EAAUmB,WAAWL,EAAOC,IACnCK,IAClB,CAAE,MAAOH,GACP,MAAMI,EAAeC,EAAgBL,EAAO,0BAC5C,MAAM,IAAIC,MAAMG,EAClB,GAqBWE,EAAcV,MAAOW,IAChC,MAAMV,MAAEA,EAAKC,QAAEA,EAAOU,MAAEA,GAAUD,EAElC,IAAKV,EACH,MAAM,IAAII,MAAM,gDAGlB,IAAKO,GAA0B,IAAjBA,EAAMC,OAClB,MAAM,IAAIR,MAAM,2CAIlB,MAAMS,EAAiBF,EAAMG,IAAIC,GAEjC,IAEE,aADuB7B,EAAUuB,YAAYT,EAAOa,EAAgBZ,IACpDK,IAClB,CAAE,MAAOH,GACP,MAAMI,EAAeC,EAAgBL,EAAO,2BAC5C,MAAM,IAAIC,MAAMG,EAClB"}
@@ -1,2 +1,2 @@
1
- "use strict";exports.TEN_MB_IN_BYTES=10485760;
1
+ "use strict";const e=e=>e.replace(/\s+/g,"-");exports.TEN_MB_IN_BYTES=10485760,exports.sanitizeFile=t=>{const s=e(t.name);return new File([t],s,{type:t.type})},exports.sanitizeFileName=e;
2
2
  //# sourceMappingURL=fileUtils.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fileUtils.cjs.js","sources":["../../src/utilities/fileUtils.ts"],"sourcesContent":["export const TEN_MB_IN_BYTES = 10 * 1024 * 1024;\n"],"names":[],"mappings":"qCAA+B"}
1
+ {"version":3,"file":"fileUtils.cjs.js","sources":["../../src/utilities/fileUtils.ts"],"sourcesContent":["export const TEN_MB_IN_BYTES = 10 * 1024 * 1024;\n\n/**\n * Sanitizes a filename by replacing spaces with dashes\n * @param filename - The original filename\n * @returns The sanitized filename with spaces replaced by dashes\n * @example\n * sanitizeFileName('my file.jpg') // returns 'my-file.jpg'\n * sanitizeFileName('already-good.png') // returns 'already-good.png'\n */\nexport const sanitizeFileName = (filename: string): string => {\n return filename.replace(/\\s+/g, '-');\n};\n\n/**\n * Creates a new File object with a sanitized filename\n * @param file - The original File object\n * @returns A new File object with spaces replaced by dashes in the filename\n */\nexport const sanitizeFile = (file: File): File => {\n const sanitizedName = sanitizeFileName(file.name);\n return new File([file], sanitizedName, { type: file.type });\n};\n"],"names":["sanitizeFileName","filename","replace","file","sanitizedName","name","File","type"],"mappings":"mBAUaA,EAAoBC,GACxBA,EAASC,QAAQ,OAAQ,6BAXH,8BAmBFC,IAC3B,MAAMC,EAAgBJ,EAAiBG,EAAKE,MAC5C,OAAO,IAAIC,KAAK,CAACH,GAAOC,EAAe,CAAEG,KAAMJ,EAAKI"}
@@ -1,3 +1,18 @@
1
1
  declare const TEN_MB_IN_BYTES: number;
2
+ /**
3
+ * Sanitizes a filename by replacing spaces with dashes
4
+ * @param filename - The original filename
5
+ * @returns The sanitized filename with spaces replaced by dashes
6
+ * @example
7
+ * sanitizeFileName('my file.jpg') // returns 'my-file.jpg'
8
+ * sanitizeFileName('already-good.png') // returns 'already-good.png'
9
+ */
10
+ declare const sanitizeFileName: (filename: string) => string;
11
+ /**
12
+ * Creates a new File object with a sanitized filename
13
+ * @param file - The original File object
14
+ * @returns A new File object with spaces replaced by dashes in the filename
15
+ */
16
+ declare const sanitizeFile: (file: File) => File;
2
17
 
3
- export { TEN_MB_IN_BYTES };
18
+ export { TEN_MB_IN_BYTES, sanitizeFile, sanitizeFileName };
@@ -1,2 +1,2 @@
1
- const o=10485760;export{o as TEN_MB_IN_BYTES};
1
+ const e=10485760,t=e=>e.replace(/\s+/g,"-"),n=e=>{const n=t(e.name);return new File([e],n,{type:e.type})};export{e as TEN_MB_IN_BYTES,n as sanitizeFile,t as sanitizeFileName};
2
2
  //# sourceMappingURL=fileUtils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fileUtils.js","sources":["../../src/utilities/fileUtils.ts"],"sourcesContent":["export const TEN_MB_IN_BYTES = 10 * 1024 * 1024;\n"],"names":["TEN_MB_IN_BYTES"],"mappings":"MAAaA,EAAkB"}
1
+ {"version":3,"file":"fileUtils.js","sources":["../../src/utilities/fileUtils.ts"],"sourcesContent":["export const TEN_MB_IN_BYTES = 10 * 1024 * 1024;\n\n/**\n * Sanitizes a filename by replacing spaces with dashes\n * @param filename - The original filename\n * @returns The sanitized filename with spaces replaced by dashes\n * @example\n * sanitizeFileName('my file.jpg') // returns 'my-file.jpg'\n * sanitizeFileName('already-good.png') // returns 'already-good.png'\n */\nexport const sanitizeFileName = (filename: string): string => {\n return filename.replace(/\\s+/g, '-');\n};\n\n/**\n * Creates a new File object with a sanitized filename\n * @param file - The original File object\n * @returns A new File object with spaces replaced by dashes in the filename\n */\nexport const sanitizeFile = (file: File): File => {\n const sanitizedName = sanitizeFileName(file.name);\n return new File([file], sanitizedName, { type: file.type });\n};\n"],"names":["TEN_MB_IN_BYTES","sanitizeFileName","filename","replace","sanitizeFile","file","sanitizedName","name","File","type"],"mappings":"MAAaA,EAAkB,SAUlBC,EAAoBC,GACxBA,EAASC,QAAQ,OAAQ,KAQrBC,EAAgBC,IAC3B,MAAMC,EAAgBL,EAAiBI,EAAKE,MAC5C,OAAO,IAAIC,KAAK,CAACH,GAAOC,EAAe,CAAEG,KAAMJ,EAAKI"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flipdish/portal-library",
3
- "version": "8.5.1",
3
+ "version": "8.5.2",
4
4
  "files": [
5
5
  "dist"
6
6
  ],