@fixefy/fixefy-ui-utils 0.2.75 → 0.2.77

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.
@@ -235,7 +235,7 @@ declare module '@mui/material/styles' {
235
235
  active: StatusColorOption;
236
236
  approve: StatusColorOption;
237
237
  approved: StatusColorOption;
238
- billed: StatusColorOption;
238
+ paid: StatusColorOption;
239
239
  challenge: StatusColorOption;
240
240
  challenged: StatusColorOption;
241
241
  closed: StatusColorOption;
@@ -256,10 +256,9 @@ declare module '@mui/material/styles' {
256
256
  pending_credit: StatusColorOption;
257
257
  pending_resolution: StatusColorOption;
258
258
  pending_review: StatusColorOption;
259
- pending_refund: StatusColorOption;
260
259
  rejected: StatusColorOption;
261
260
  resolved: StatusColorOption;
262
- submitted_for_billing: StatusColorOption;
261
+ submitted_for_payment: StatusColorOption;
263
262
  }
264
263
  interface TagPaletteColorOptions {
265
264
  approved: StatusColorOption;
@@ -270,23 +269,20 @@ declare module '@mui/material/styles' {
270
269
  in_dispute: StatusColorOption;
271
270
  in_progress: StatusColorOption;
272
271
  paid: StatusColorOption;
273
- paid_and_refunded: StatusColorOption;
272
+ paid_and_credited: StatusColorOption;
274
273
  partially_approved: StatusColorOption;
275
274
  partially_credited: StatusColorOption;
276
275
  pending: StatusColorOption;
277
276
  pending_credit: StatusColorOption;
278
277
  pending_resolution: StatusColorOption;
279
278
  pending_review: StatusColorOption;
280
- pending_refund: StatusColorOption;
281
279
  closed: StatusColorOption;
282
- refunded: StatusColorOption;
283
280
  rejected: StatusColorOption;
284
281
  resolved: StatusColorOption;
285
282
  low: StatusColorOption;
286
283
  }
287
284
  interface InvoiceStatesPaletteColorOptions {
288
285
  approved: StatusColorOption;
289
- billed: StatusColorOption;
290
286
  created: StatusColorOption;
291
287
  credited: StatusColorOption;
292
288
  credit_invoices: StatusColorOption;
@@ -294,20 +290,19 @@ declare module '@mui/material/styles' {
294
290
  in_dispute: StatusColorOption;
295
291
  in_progress: StatusColorOption;
296
292
  paid: StatusColorOption;
297
- paid_and_refunded: StatusColorOption;
293
+ paid_and_credited: StatusColorOption;
298
294
  partially_approved: StatusColorOption;
299
295
  partially_credited: StatusColorOption;
300
296
  pending: StatusColorOption;
301
297
  pending_credit: StatusColorOption;
302
298
  pending_resolution: StatusColorOption;
303
299
  pending_review: StatusColorOption;
304
- pending_refund: StatusColorOption;
305
300
  closed: StatusColorOption;
306
301
  resolved: StatusColorOption;
307
- submitted_for_billing: StatusColorOption;
302
+ submitted_for_payment: StatusColorOption;
308
303
  }
309
304
  interface RecosStatesPaletteColorOptions {
310
- billed: StatusColorOption;
305
+ paid: StatusColorOption;
311
306
  created: StatusColorOption;
312
307
  credited: StatusColorOption;
313
308
  in_progress: StatusColorOption;
@@ -318,11 +313,10 @@ declare module '@mui/material/styles' {
318
313
  pending: StatusColorOption;
319
314
  pending_credit: StatusColorOption;
320
315
  pending_resolution: StatusColorOption;
321
- refunded: StatusColorOption;
322
316
  rejected: StatusColorOption;
323
317
  closed: StatusColorOption;
324
318
  resolved: StatusColorOption;
325
- submitted_for_billing: StatusColorOption;
319
+ submitted_for_payment: StatusColorOption;
326
320
  }
327
321
  interface SnackbarPaletteColorOptions {
328
322
  info: SnackbarColorOption;
@@ -385,11 +385,8 @@ const palette = {
385
385
  border: '#2D9CDB',
386
386
  background: '#F1FBFE'
387
387
  },
388
- pending_refund: {
389
- border: '#2D9CDB',
390
- background: '#F1FBFE',
391
- light: '#F1FBFE'
392
- },
388
+ // DEPRECATED per US#6 — 'pending_refund' renamed to 'pending_credit' (already above as pending_credit)
389
+ // pending_refund : { border: '#2D9CDB', background: '#F1FBFE', light: '#F1FBFE' },
393
390
  rejected: {
394
391
  border: '#EB5757',
395
392
  background: '#FEF6F6'
@@ -398,11 +395,15 @@ const palette = {
398
395
  border: '#BB6BD9',
399
396
  background: '#FAF6FE'
400
397
  },
401
- submitted_for_billing: {
398
+ // DEPRECATED per US#6 — 'submitted_for_billing' renamed to 'submitted_for_payment'
399
+ // submitted_for_billing : { border: '#88C00D', background: '#F1FBFE' },
400
+ submitted_for_payment: {
402
401
  border: '#88C00D',
403
402
  background: '#F1FBFE'
404
403
  },
405
- billed: {
404
+ // DEPRECATED per US#6 — 'billed' renamed to 'paid'
405
+ // billed : { border: '#C4A603', background: '#FEFDF3' },
406
+ paid: {
406
407
  border: '#C4A603',
407
408
  background: '#FEFDF3'
408
409
  }
@@ -456,7 +457,9 @@ const palette = {
456
457
  border: '#BB6BD9',
457
458
  background: '#BB6BD9'
458
459
  },
459
- paid_and_refunded: {
460
+ // DEPRECATED per US#6 — 'paid_and_refunded' renamed to 'paid_and_credited'
461
+ // paid_and_refunded : { border: '#BB6BD9', background: '#BB6BD9' },
462
+ paid_and_credited: {
460
463
  border: '#BB6BD9',
461
464
  background: '#BB6BD9'
462
465
  },
@@ -468,19 +471,14 @@ const palette = {
468
471
  border: '#EC6AC8',
469
472
  background: '#EC6AC8'
470
473
  },
471
- pending_refund: {
472
- border: '#2D9CDB',
473
- background: '#2D9CDB',
474
- light: '#F1FBFE'
475
- },
474
+ // DEPRECATED per US#6 — 'pending_refund' renamed to 'pending_credit' (already above)
475
+ // pending_refund : { border: '#2D9CDB', background: '#2D9CDB', light: '#F1FBFE' },
476
476
  closed: {
477
477
  border: '#8B9092',
478
478
  background: '#8B9092'
479
479
  },
480
- refunded: {
481
- border: '#BB6BD9',
482
- background: '#BB6BD9'
483
- },
480
+ // DEPRECATED per US#6 — 'refunded' renamed to 'credited' (already above)
481
+ // refunded : { border: '#BB6BD9', background: '#BB6BD9' },
484
482
  rejected: {
485
483
  border: '#EB5757',
486
484
  background: '#EB5757'
@@ -535,7 +533,9 @@ const palette = {
535
533
  background: '#BB6BD9',
536
534
  light: '#FBF6FD'
537
535
  },
538
- paid_and_refunded: {
536
+ // DEPRECATED per US#6 — 'paid_and_refunded' renamed to 'paid_and_credited'
537
+ // paid_and_refunded : { border: '#BB6BD9', background: '#BB6BD9', light: '#FBF6FD' },
538
+ paid_and_credited: {
539
539
  border: '#BB6BD9',
540
540
  background: '#BB6BD9',
541
541
  light: '#FBF6FD'
@@ -570,11 +570,8 @@ const palette = {
570
570
  background: '#568793',
571
571
  light: '#F3F9FD'
572
572
  },
573
- pending_refund: {
574
- border: '#88C00D',
575
- background: '#88C00D',
576
- light: '#F1FBFE'
577
- },
573
+ // DEPRECATED per US#6 — 'pending_refund' renamed to 'pending_credit' (already above)
574
+ // pending_refund : { border: '#88C00D', background: '#88C00D', light: '#F1FBFE' },
578
575
  closed: {
579
576
  border: '#8B9092',
580
577
  background: '#8B9092',
@@ -585,15 +582,12 @@ const palette = {
585
582
  background: '#6FCF97',
586
583
  light: '#EEF9F2'
587
584
  },
588
- submitted_for_billing: {
585
+ // DEPRECATED per US#6 — 'submitted_for_billing' renamed to 'submitted_for_payment'
586
+ // submitted_for_billing : { border: '#88C00D', background: '#88C00D', light: '#F1FBFE' },
587
+ submitted_for_payment: {
589
588
  border: '#88C00D',
590
589
  background: '#88C00D',
591
590
  light: '#F1FBFE'
592
- },
593
- billed: {
594
- border: '#C4A603',
595
- background: '#C4A603',
596
- light: '#FEFDF3'
597
591
  }
598
592
  },
599
593
  recoState: {
@@ -646,11 +640,8 @@ const palette = {
646
640
  background: '#AE5395',
647
641
  light: '#FBF6FD'
648
642
  },
649
- refunded: {
650
- border: '#EC6AC8',
651
- background: '#EC6AC8',
652
- light: '#FBF6FD'
653
- },
643
+ // DEPRECATED per US#6 — 'refunded' renamed to 'credited' (already above)
644
+ // refunded : { border: '#EC6AC8', background: '#EC6AC8', light: '#FBF6FD' },
654
645
  rejected: {
655
646
  border: '#C42A20',
656
647
  background: '#C42A20',
@@ -665,12 +656,16 @@ const palette = {
665
656
  background: '#6FCF97',
666
657
  light: '#EEF9F2'
667
658
  },
668
- submitted_for_billing: {
659
+ // DEPRECATED per US#6 — 'submitted_for_billing' renamed to 'submitted_for_payment'
660
+ // submitted_for_billing : { border: '#88C00D', background: '#88C00D', light: '#F1FBFE' },
661
+ submitted_for_payment: {
669
662
  border: '#88C00D',
670
663
  background: '#88C00D',
671
664
  light: '#F1FBFE'
672
665
  },
673
- billed: {
666
+ // DEPRECATED per US#6 — 'billed' renamed to 'paid'
667
+ // billed : { border: '#C4A603', background: '#C4A603', light: '#FEFDF3' },
668
+ paid: {
674
669
  border: '#C4A603',
675
670
  background: '#C4A603',
676
671
  light: '#FEFDF3'
@@ -0,0 +1,23 @@
1
+ type StorageType = 'localStorage' | 'sessionStorage';
2
+ export declare const useStorage: () => {
3
+ getItem: ({ key, type }: {
4
+ key: string;
5
+ type: StorageType;
6
+ }) => any;
7
+ setItem: ({ key, value, type }: {
8
+ key: string;
9
+ value: unknown;
10
+ type: StorageType;
11
+ }) => void;
12
+ removeItem: ({ key, type }: {
13
+ key: string;
14
+ type: StorageType;
15
+ }) => void;
16
+ clear: ({ type }: {
17
+ type: StorageType;
18
+ }) => void;
19
+ getStorageLength: ({ type }: {
20
+ type: StorageType;
21
+ }) => number | null;
22
+ };
23
+ export {};
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "useStorage", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return useStorage;
9
+ }
10
+ });
11
+ const isWindow = typeof window !== 'undefined';
12
+ const useStorage = ()=>{
13
+ const isStorageTypeProvided = (type)=>{
14
+ if (!type) {
15
+ throw new Error('Provide type of storage: localStorage or sessionStorage.');
16
+ }
17
+ };
18
+ const getItem = ({ key, type })=>{
19
+ try {
20
+ if (isWindow) {
21
+ isStorageTypeProvided(type);
22
+ //@ts-ignore
23
+ const item = JSON.parse(window[type].getItem(key));
24
+ if (!item) return null;
25
+ return item;
26
+ }
27
+ } catch (error) {
28
+ // console.log(error)
29
+ }
30
+ };
31
+ const setItem = ({ key, value, type })=>{
32
+ try {
33
+ if (isWindow) {
34
+ isStorageTypeProvided(type);
35
+ window[type].setItem(key, JSON.stringify(value));
36
+ }
37
+ } catch (error) {
38
+ // console.log(error)
39
+ }
40
+ };
41
+ const removeItem = ({ key, type })=>{
42
+ try {
43
+ if (isWindow) {
44
+ isStorageTypeProvided(type);
45
+ window[type].removeItem(key);
46
+ }
47
+ } catch (error) {
48
+ // console.log(error)
49
+ }
50
+ };
51
+ const clear = ({ type })=>{
52
+ try {
53
+ if (isWindow) {
54
+ isStorageTypeProvided(type);
55
+ window[type].clear();
56
+ }
57
+ } catch (error) {
58
+ // console.log(error)
59
+ }
60
+ };
61
+ const getStorageLength = ({ type })=>{
62
+ try {
63
+ if (isWindow) {
64
+ isStorageTypeProvided(type);
65
+ return window[type].length;
66
+ }
67
+ } catch (error) {
68
+ // console.log(error)
69
+ }
70
+ return null;
71
+ };
72
+ return {
73
+ getItem,
74
+ setItem,
75
+ removeItem,
76
+ clear,
77
+ getStorageLength
78
+ };
79
+ };
@@ -0,0 +1 @@
1
+ export { useStorage } from './hooks/use-storage';
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "useStorage", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return _usestorage.useStorage;
9
+ }
10
+ });
11
+ const _usestorage = require("./hooks/use-storage");
@@ -16,7 +16,7 @@ export type ChargeStateType = {
16
16
  pending: string;
17
17
  pending_credit: string;
18
18
  pending_resolution: string;
19
- refunded: string;
19
+ credited: string;
20
20
  rejected: string;
21
21
  };
22
22
  export type InvoiceStateType = {
@@ -47,7 +47,6 @@ export type RecoStateType = {
47
47
  pending: string;
48
48
  pending_credit: string;
49
49
  pending_resolution: string;
50
- refunded: string;
51
50
  rejected: string;
52
51
  resolved: string;
53
52
  };
@@ -0,0 +1,6 @@
1
+ import { MaybeN } from '@fixefy/fixefy-entities';
2
+ export declare const is_array_valid: (arr: unknown, min_length?: MaybeN<number>, max_length?: MaybeN<number>) => arr is Array<unknown>;
3
+ export declare const is_date_valid: (d: unknown) => d is Date;
4
+ export declare const is_object_valid: (obj: unknown) => obj is Record<string, unknown>;
5
+ export declare const is_string_valid: (str: unknown, minLength?: MaybeN<number>, maxLength?: MaybeN<number>) => str is string;
6
+ export declare const is_object_id: (value: unknown) => value is string;
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ is_array_valid: function() {
13
+ return is_array_valid;
14
+ },
15
+ is_date_valid: function() {
16
+ return is_date_valid;
17
+ },
18
+ is_object_id: function() {
19
+ return is_object_id;
20
+ },
21
+ is_object_valid: function() {
22
+ return is_object_valid;
23
+ },
24
+ is_string_valid: function() {
25
+ return is_string_valid;
26
+ }
27
+ });
28
+ const is_array_valid = (arr, min_length = 1, max_length = null)=>{
29
+ if (null == arr) return false;
30
+ if (false == Array.isArray(arr)) return false;
31
+ if (min_length) {
32
+ if (arr.length < min_length) return false;
33
+ }
34
+ if (max_length) {
35
+ if (arr.length > max_length) return false;
36
+ }
37
+ return true;
38
+ };
39
+ const is_date_valid = (d)=>{
40
+ if (!d) return false;
41
+ if (Object.prototype.toString.call(d) != '[object Date]') return false;
42
+ return true;
43
+ };
44
+ const is_object_valid = (obj)=>{
45
+ if (null == obj) return false;
46
+ if (typeof obj != 'object') return false;
47
+ if (Object.keys(obj).length == 0) return false;
48
+ if (Object.getOwnPropertyNames(obj).length == 0) return false;
49
+ const rv = true;
50
+ return rv;
51
+ };
52
+ const is_string_valid = (str, minLength = null, maxLength = null)=>{
53
+ if (str == null) return false;
54
+ if (typeof str != 'string') return false;
55
+ if (str.length == 0) return false;
56
+ let rv = true;
57
+ if (minLength && minLength > 0 && isNaN(minLength) == false) {
58
+ rv = rv && str.length >= minLength;
59
+ }
60
+ if (rv == false) return false;
61
+ if (maxLength && maxLength > 0 && isNaN(maxLength) == false) {
62
+ rv = rv && str.length <= maxLength;
63
+ }
64
+ return rv;
65
+ };
66
+ const is_object_id = (value)=>{
67
+ ///!* input check - if value is invalid - return false *!/
68
+ if (false == is_string_valid(value, 1, 24)) return false;
69
+ ///!* set the regex *!/
70
+ const regex = /^[0-9a-fA-F]{24}$/;
71
+ //!* get the match *!/
72
+ const matches = regex.exec(value);
73
+ //!* check is null *!/
74
+ const rv = matches != null && is_array_valid(matches);
75
+ return rv;
76
+ };
package/package.json CHANGED
@@ -26,13 +26,11 @@
26
26
  "date-fns": "^4.1.0"
27
27
  },
28
28
  "devDependencies": {
29
- "@swc/cli": "0.3.12",
30
- "@swc/core": "1.5.24",
31
29
  "@types/convert-excel-to-json": "1.7.4",
32
30
  "@types/node": "20.14.0",
33
31
  "@types/react": "18.3.3",
34
32
  "eslint": "9.34.0",
35
- "eslint-config-next": "16.1.6",
33
+ "eslint-config-next": "15.5.2",
36
34
  "eslint-plugin-jsx-a11y": "6.10.2",
37
35
  "eslint-plugin-react": "7.37.5",
38
36
  "eslint-plugin-react-hooks": "5.2.0",
@@ -49,7 +47,7 @@
49
47
  "build": "swc src -d dist --strip-leading-paths && tsc --declaration --emitDeclarationOnly --outDir dist",
50
48
  "pre_release": "yarn clean && yarn && yarn build",
51
49
  "raw_publish": "npm publish --userconfig ./.npmrc --otp 000000",
52
- "clean": "rm -rf build && rm -rf dist && yarn clean:node",
50
+ "clean": "rm -rf build && rm -rf dist-* && yarn clean:node",
53
51
  "clean:node": "rm -rf node_modules",
54
52
  "lint": "eslint \"src/**/*.{ts,tsx}\"",
55
53
  "lint:fix": "eslint \"src/**/*.{ts,tsx}\" --fix",
@@ -69,5 +67,5 @@
69
67
  "require": "./dist/index.js"
70
68
  }
71
69
  },
72
- "version": "0.2.75"
70
+ "version": "0.2.77"
73
71
  }