@savantlink/sdk 2.1.29 → 2.1.30

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.
@@ -9,6 +9,8 @@ interface ApiError {
9
9
  message?: string;
10
10
  error?: string;
11
11
  }>;
12
+ message?: string;
13
+ error?: string;
12
14
  };
13
15
  };
14
16
  }
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var r=require("react/jsx-runtime"),e=require("./ValidationError.module.scss.js"),a=require("../Typography/Typography.js");exports.default=({error:l})=>{var s,o;if(!l)return null;const i=(null===(o=null===(s=l.response)||void 0===s?void 0:s.data)||void 0===o?void 0:o.errors)||[];return r.jsx(r.Fragment,{children:i.length?i.map((l,s)=>r.jsx(a.default,Object.assign({variant:"label",className:e.default.validationError},{children:(null==l?void 0:l.msg)||(null==l?void 0:l.message)||(null==l?void 0:l.error)||"An unknown error occurred."}),s)):r.jsx(a.default,Object.assign({variant:"label",className:e.default.validationError},{children:l.message||l.msg}),void 0)},void 0)};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var r=require("react/jsx-runtime"),e=require("./ValidationError.module.scss.js"),o=require("../Typography/Typography.js");exports.default=({error:l})=>{var a,n,s,i,d,u;if(!l)return null;const t=(null===(n=null===(a=l.response)||void 0===a?void 0:a.data)||void 0===n?void 0:n.errors)||[],v=(null===(i=null===(s=l.response)||void 0===s?void 0:s.data)||void 0===i?void 0:i.error)||(null===(u=null===(d=l.response)||void 0===d?void 0:d.data)||void 0===u?void 0:u.message);return r.jsx(r.Fragment,{children:t.length?t.map((l,a)=>r.jsx(o.default,Object.assign({variant:"label",className:e.default.validationError},{children:(null==l?void 0:l.msg)||(null==l?void 0:l.message)||(null==l?void 0:l.error)||"An unknown error occurred."}),a)):r.jsx(o.default,Object.assign({variant:"label",className:e.default.validationError},{children:v||l.msg||l.message||"An unknown error occurred."}),void 0)},void 0)};
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/ValidationError/index.tsx"],"sourcesContent":["import styles from './ValidationError.module.scss'\n\nimport Typography from '@/Typography'\n\ninterface ApiError {\n message: string\n msg?: string\n code?: string\n response?: {\n data?: {\n errors?: Array<{ msg?: string; message?: string; error?: string }>\n }\n }\n}\n\nconst ValidationError = ({ error }: { error?: ApiError | null }) => {\n if (!error) return null // Return nothing if there's no error\n const apiErrors = error.response?.data?.errors || []\n\n return (\n <>\n {apiErrors.length ? (\n apiErrors.map((err, index) => (\n <Typography key={index} variant=\"label\" className={styles.validationError}>\n {err?.msg || err?.message || err?.error || 'An unknown error occurred.'}\n </Typography>\n ))\n ) : (\n <Typography variant=\"label\" className={styles.validationError}>\n {error.message || error.msg}\n </Typography>\n )}\n </>\n )\n}\n\nexport default ValidationError\n"],"names":["error","apiErrors","response","data","errors","_jsx","length","map","err","index","Typography","variant","className","styles","validationError","msg","message"],"mappings":"8MAewB,EAAGA,oBACzB,IAAKA,EAAO,OAAO,KACnB,MAAMC,uBAAYD,EAAME,+BAAUC,2BAAMC,SAAU,GAElD,OACEC,2BACGJ,EAAUK,OACTL,EAAUM,IAAI,CAACC,EAAKC,IAClBJ,MAACK,yBAAuBC,QAAQ,QAAQC,UAAWC,UAAOC,4BACvDN,eAAAA,EAAKO,OAAOP,eAAAA,EAAKQ,WAAWR,eAAAA,EAAKR,QAAS,+BAD5BS,IAKnBJ,MAACK,yBAAWC,QAAQ,QAAQC,UAAWC,UAAOC,2BAC3Cd,EAAMgB,SAAWhB,EAAMe"}
1
+ {"version":3,"file":"index.js","sources":["../../src/ValidationError/index.tsx"],"sourcesContent":["import styles from './ValidationError.module.scss'\n\nimport Typography from '@/Typography'\n\ninterface ApiError {\n message: string\n msg?: string\n code?: string\n response?: {\n data?: {\n errors?: Array<{ msg?: string; message?: string; error?: string }>\n message?: string\n error?: string\n }\n }\n}\n\nconst ValidationError = ({ error }: { error?: ApiError | null }) => {\n if (!error) return null // Return nothing if there's no error\n const apiErrors = error.response?.data?.errors || []\n const apiError = error.response?.data?.error || error.response?.data?.message\n\n return (\n <>\n {apiErrors.length ? (\n apiErrors.map((err, index) => (\n <Typography key={index} variant=\"label\" className={styles.validationError}>\n {err?.msg || err?.message || err?.error || 'An unknown error occurred.'}\n </Typography>\n ))\n ) : (\n <Typography variant=\"label\" className={styles.validationError}>\n {apiError || error.msg || error.message || 'An unknown error occurred.'}\n </Typography>\n )}\n </>\n )\n}\n\nexport default ValidationError\n"],"names":["error","apiErrors","response","data","errors","apiError","message","_jsx","length","map","err","index","Typography","variant","className","styles","validationError","msg"],"mappings":"8MAiBwB,EAAGA,4BACzB,IAAKA,EAAO,OAAO,KACnB,MAAMC,uBAAYD,EAAME,+BAAUC,2BAAMC,SAAU,GAC5CC,uBAAWL,EAAME,+BAAUC,2BAAMH,6BAASA,EAAME,+BAAUC,2BAAMG,SAEtE,OACEC,2BACGN,EAAUO,OACTP,EAAUQ,IAAI,CAACC,EAAKC,IAClBJ,MAACK,yBAAuBC,QAAQ,QAAQC,UAAWC,UAAOC,4BACvDN,eAAAA,EAAKO,OAAOP,eAAAA,EAAKJ,WAAWI,eAAAA,EAAKV,QAAS,+BAD5BW,IAKnBJ,MAACK,yBAAWC,QAAQ,QAAQC,UAAWC,UAAOC,2BAC3CX,GAAYL,EAAMiB,KAAOjB,EAAMM,SAAW"}
@@ -1 +1,3 @@
1
1
  export { usePagination, ELLIPSIS } from './use-pagination';
2
+ export { DEFAULT_IDLE_TIMEOUT_MS, useIdleTimeout, useInactivityLogout } from './use-idle-timeout';
3
+ export type { UseIdleTimeoutOptions } from './use-idle-timeout';
@@ -0,0 +1,10 @@
1
+ declare const DEFAULT_IDLE_TIMEOUT_MS: number;
2
+ interface UseIdleTimeoutOptions {
3
+ onIdle: () => void;
4
+ enabled?: boolean;
5
+ timeoutMs?: number;
6
+ }
7
+ declare const useIdleTimeout: ({ onIdle, enabled, timeoutMs }: UseIdleTimeoutOptions) => void;
8
+ declare const useInactivityLogout: (options: UseIdleTimeoutOptions) => void;
9
+ export { DEFAULT_IDLE_TIMEOUT_MS, useIdleTimeout, useInactivityLogout };
10
+ export type { UseIdleTimeoutOptions };
@@ -0,0 +1,9 @@
1
+ export declare type DateFormat = 'short' | 'long';
2
+ export declare type DateInput = Date | string | number;
3
+ declare const titleCase: (value: string) => string;
4
+ declare const formatCurrency: (amount: number, currency?: string, locale?: string, options?: Omit<Intl.NumberFormatOptions, 'style' | 'currency'>) => string;
5
+ declare const formatDate: (value: DateInput, format?: DateFormat, locale?: string) => string;
6
+ declare const formatTime: (value: DateInput, locale?: string, options?: Intl.DateTimeFormatOptions) => string;
7
+ declare const currencyFormatter: (amount: number, currency?: string, locale?: string, options?: Omit<Intl.NumberFormatOptions, 'style' | 'currency'>) => string;
8
+ declare const currencyFormmater: (amount: number, currency?: string, locale?: string, options?: Omit<Intl.NumberFormatOptions, 'style' | 'currency'>) => string;
9
+ export { currencyFormmater, currencyFormatter, formatCurrency, formatDate, formatTime, titleCase };
@@ -1 +1,3 @@
1
1
  export { range } from './number';
2
+ export { currencyFormmater, currencyFormatter, formatCurrency, formatDate, formatTime, titleCase, } from './format';
3
+ export type { DateFormat, DateInput } from './format';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@savantlink/sdk",
3
- "version": "2.1.29",
3
+ "version": "2.1.30",
4
4
  "description": "A package that contains reusable components and services for the SavantLink design system and architecture.",
5
5
  "homepage": "https://github.com/savantlink/savantlink-sdk",
6
6
  "repository": {