spotlibs-components 0.1.9 → 0.1.11

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.
Files changed (88) hide show
  1. package/dist/{chunk-J3F77MZN.mjs → chunk-F6KSEYVB.mjs} +4 -35
  2. package/dist/chunk-F6KSEYVB.mjs.map +1 -0
  3. package/dist/chunk-UFE7HFT2.mjs +60 -0
  4. package/dist/chunk-UFE7HFT2.mjs.map +1 -0
  5. package/dist/chunk-YOSPWY5K.mjs +36 -0
  6. package/dist/chunk-YOSPWY5K.mjs.map +1 -0
  7. package/dist/{atoms → components/atoms}/icons/index.mjs +2 -1
  8. package/dist/components/index.d.mts +449 -0
  9. package/dist/components/index.mjs +7241 -0
  10. package/dist/components/index.mjs.map +1 -0
  11. package/dist/components/mui/index.d.mts +23 -0
  12. package/dist/components/mui/index.mjs +27 -0
  13. package/dist/components/mui/index.mjs.map +1 -0
  14. package/dist/components/types.d.mts +4 -0
  15. package/dist/{types-qsnVqq6_.d.mts → types-BkrxwBFm.d.mts} +443 -292
  16. package/dist/utils/index.d.mts +186 -0
  17. package/dist/utils/index.mjs +477 -0
  18. package/dist/utils/index.mjs.map +1 -0
  19. package/package.json +17 -2
  20. package/src/utils/admin-kuota-nasional/constant.js +95 -0
  21. package/src/utils/asset.js +10 -0
  22. package/src/utils/booleanUtils.js +19 -0
  23. package/src/utils/briguna-digital/constant.js +12 -0
  24. package/src/utils/compress.js +24 -0
  25. package/src/utils/compressImage.js +20 -0
  26. package/src/utils/constants.js +20 -0
  27. package/src/utils/cookies.js +102 -0
  28. package/src/utils/crypto.js +104 -0
  29. package/src/utils/decodeString.js +17 -0
  30. package/src/utils/disableFormElements.js +19 -0
  31. package/src/utils/excelUtils.js +60 -0
  32. package/src/utils/exception.js +86 -0
  33. package/src/utils/formatString.js +151 -0
  34. package/src/utils/formatters/account.js +98 -0
  35. package/src/utils/formatters/currency.js +125 -0
  36. package/src/utils/formatters/date.js +219 -0
  37. package/src/utils/formatters/index.js +47 -0
  38. package/src/utils/formatters/string.js +114 -0
  39. package/src/utils/generateImportExcel.js +546 -0
  40. package/src/utils/generateTimestamp.js +4 -0
  41. package/src/utils/handleApiError.js +17 -0
  42. package/src/utils/index.js +92 -0
  43. package/src/utils/json.js +55 -0
  44. package/src/utils/localStorage.js +8 -0
  45. package/src/utils/logger.js +46 -0
  46. package/src/utils/schema/globalSchema.js +10 -0
  47. package/src/utils/signature.js +75 -0
  48. package/src/utils/specifics/korporasi/prakarsaKorporasiUtils.js +87 -0
  49. package/src/utils/specifics/mikro/validationMaintenanceAgunanUtils.js +214 -0
  50. package/src/utils/static-data/korporasi/prakarsa/analisa-risiko-kredit-nasabah/analisa-kinerja-keuangan/listStaticData.js +290 -0
  51. package/src/utils/static-data/korporasi/prakarsa/appendix/proyeksi-laporan-arus-kas/listStaticData.js +7 -0
  52. package/src/utils/static-data/korporasi/prakarsa/appendix/proyeksi-laporan-keuangan/listStaticData.js +75 -0
  53. package/src/utils/static-data/korporasi/prakarsa/appendix/total-exposure-group/listStaticData.js +7 -0
  54. package/src/utils/static-data/korporasi/prakarsa/create/listStaticData.js +21 -0
  55. package/src/utils/static-data/korporasi/prakarsa/generals/listExcelConfigData.js +11 -0
  56. package/src/utils/static-data/korporasi/prakarsa/pengajuan-fasilitas-kredit/fasilitas-kredit/listStaticData.js +69 -0
  57. package/src/utils/static-data/korporasi-internasional/eksternal/listStaticData.js +193 -0
  58. package/src/utils/static-data/korporasi-internasional/master/listStaticData.js +24 -0
  59. package/src/utils/static-data/korporasi-internasional/uji-kepatuhan/listStaticData.js +250 -0
  60. package/src/utils/status.js +160 -0
  61. package/src/utils/store/adminKuotaNasional.js +7 -0
  62. package/src/utils/store/authStore.js +13 -0
  63. package/src/utils/store/bankGaransiStore.js +10 -0
  64. package/src/utils/store/korporasi/approval/interface/interfaceStore.js +10 -0
  65. package/src/utils/store/korporasi/general/generalKorporasiStore.js +13 -0
  66. package/src/utils/store/korporasi/loan-disbursement/loanDisbursementStore.js +77 -0
  67. package/src/utils/store/korporasi/prakarsa/fasilitas-kredit/fasilitasKreditStore.js +141 -0
  68. package/src/utils/store/migrasi-mandiri/migrasiMandiriStore.js +53 -0
  69. package/src/utils/store/monitoring-konsumer/monitoring-leads-KPP/monitoring-leads-kpp-internal.js +34 -0
  70. package/src/utils/store/prakarsaBankGaransiStore.js +21 -0
  71. package/src/utils/store/prognosa-crr/settingPrognosaROStore.js +9 -0
  72. package/src/utils/store/prognosaRMStore.js +30 -0
  73. package/src/utils/store/restrukStore.js +26 -0
  74. package/src/utils/store/verificationAccessLink.js +11 -0
  75. package/src/utils/store/warkat-bg-wholesale/warkatBgWholesaleStore.js +22 -0
  76. package/src/utils/stringUtils.js +226 -0
  77. package/src/utils/tipeBank.js +14 -0
  78. package/dist/chunk-J3F77MZN.mjs.map +0 -1
  79. package/dist/index.css +0 -32
  80. package/dist/index.css.map +0 -1
  81. package/dist/index.d.mts +0 -1726
  82. package/dist/index.mjs +0 -18584
  83. package/dist/index.mjs.map +0 -1
  84. package/dist/types.d.mts +0 -4
  85. /package/dist/{atoms → components/atoms}/icons/index.d.mts +0 -0
  86. /package/dist/{atoms → components/atoms}/icons/index.mjs.map +0 -0
  87. /package/dist/{types.mjs → components/types.mjs} +0 -0
  88. /package/dist/{types.mjs.map → components/types.mjs.map} +0 -0
@@ -0,0 +1,219 @@
1
+ /**
2
+ * Date Formatting Utilities
3
+ *
4
+ * Konsolidasi dari:
5
+ * - stringUtils.js (semua date formatter functions)
6
+ *
7
+ * Konvensi penamaan:
8
+ * - "Dash" = separator "-" (e.g., 2024-07-19)
9
+ * - "Slash" = separator "/" (e.g., 19/07/2024)
10
+ * - "YearFirst" = format YYYY-MM-DD
11
+ * - "DateFirst" = format DD-MM-YYYY atau DD/MM/YYYY
12
+ */
13
+
14
+ /**
15
+ * Konversi Date object ke format YYYY-MM-DD.
16
+ * @param {Date|string} value - Date object atau date string
17
+ * @returns {string} Format "YYYY-MM-DD"
18
+ *
19
+ * @example
20
+ * toYearFirstDash(new Date(2024, 6, 19)) // "2024-07-19"
21
+ * toYearFirstDash("2024-07-19T00:00:00") // "2024-07-19"
22
+ */
23
+ export const toYearFirstDash = (value) => {
24
+ const date = new Date(value);
25
+ const year = date.getFullYear();
26
+ const month = String(date.getMonth() + 1).padStart(2, "0");
27
+ const day = String(date.getDate()).padStart(2, "0");
28
+ return `${year}-${month}-${day}`;
29
+ };
30
+
31
+ /**
32
+ * Konversi Date object ke format DD/MM/YYYY.
33
+ * @param {Date|string} value - Date object atau date string
34
+ * @returns {string} Format "DD/MM/YYYY"
35
+ *
36
+ * @example
37
+ * toDateFirstSlash(new Date(2024, 1, 1)) // "01/02/2024"
38
+ * toDateFirstSlash("2024-02-01") // "01/02/2024"
39
+ */
40
+ export const toDateFirstSlash = (value) => {
41
+ const date = new Date(value);
42
+ const year = date.getFullYear();
43
+ const month = String(date.getMonth() + 1).padStart(2, "0");
44
+ const day = String(date.getDate()).padStart(2, "0");
45
+ return `${day}/${month}/${year}`;
46
+ };
47
+
48
+ /**
49
+ * Konversi Date object ke format DD/MM/YYYY (alias).
50
+ * @param {Date} date - Date object
51
+ * @returns {string} Format "DD/MM/YYYY"
52
+ *
53
+ * @example
54
+ * formatDateToDDSlashMMSlashYYYY(new Date(2025, 2, 31)) // "31/03/2025"
55
+ */
56
+ export const formatDateToDDSlashMMSlashYYYY = (date) => {
57
+ const day = String(date.getDate()).padStart(2, "0");
58
+ const month = String(date.getMonth() + 1).padStart(2, "0");
59
+ const year = date.getFullYear();
60
+ return `${day}/${month}/${year}`;
61
+ };
62
+
63
+ /**
64
+ * Konversi Date object ke format DDMMYYYY (tanpa separator).
65
+ * @param {Date} date - Date object
66
+ * @returns {string} Format "DDMMYYYY"
67
+ *
68
+ * @example
69
+ * formatDateToDDMMYYYY(new Date(2025, 2, 31)) // "31032025"
70
+ */
71
+ export const formatDateToDDMMYYYY = (date) => {
72
+ const day = String(date.getDate()).padStart(2, "0");
73
+ const month = String(date.getMonth() + 1).padStart(2, "0");
74
+ const year = date.getFullYear();
75
+ return `${day}${month}${year}`;
76
+ };
77
+
78
+ /**
79
+ * Konversi format YYYY-MM-DD ke DD-MM-YYYY.
80
+ * @param {string} value - Date string format "YYYY-MM-DD"
81
+ * @returns {string} Format "DD-MM-YYYY"
82
+ *
83
+ * @example
84
+ * yearFirstDashToDateFirstDash("2024-07-26") // "26-07-2024"
85
+ */
86
+ export const yearFirstDashToDateFirstDash = (value) => {
87
+ if (!value) return "";
88
+ const [year, month, day] = value.split("-");
89
+ return `${day}-${month}-${year}`;
90
+ };
91
+
92
+ /**
93
+ * Konversi format YYYY-MM-DD ke DD/MM/YYYY.
94
+ * @param {string} value - Date string format "YYYY-MM-DD"
95
+ * @returns {string} Format "DD/MM/YYYY"
96
+ *
97
+ * @example
98
+ * yearFirstDashToDateFirstSlash("2024-07-19") // "19/07/2024"
99
+ */
100
+ export const yearFirstDashToDateFirstSlash = (value) => {
101
+ if (!value) return "";
102
+ const parts = value.split("-");
103
+ if (parts.length === 3) {
104
+ const [year, month, day] = parts;
105
+ return `${day}/${month}/${year}`;
106
+ }
107
+ return value;
108
+ };
109
+
110
+ /**
111
+ * Konversi format DD/MM/YYYY ke YYYY-MM-DD.
112
+ * @param {string} value - Date string format "DD/MM/YYYY"
113
+ * @returns {string} Format "YYYY-MM-DD"
114
+ *
115
+ * @example
116
+ * dateFirstSlashToYearFirstDash("19/07/2024") // "2024-07-19"
117
+ */
118
+ export const dateFirstSlashToYearFirstDash = (value) => {
119
+ if (!value) return "";
120
+ const [day, month, year] = value.split("/");
121
+ return `${year}-${month.padStart(2, "0")}-${day.padStart(2, "0")}`;
122
+ };
123
+
124
+ /**
125
+ * Konversi format 7 digit (e.g., "0041125") ke DD/MM/YYYY.
126
+ * Format: [prefix 1 digit][DD][MM][YY atau YYYY]
127
+ * @param {string} value - 7-digit date string
128
+ * @returns {string} Format "DD/MM/YYYY"
129
+ *
130
+ * @example
131
+ * sevenDigitToDateFirstSlash("0190724") // "19/07/2024"
132
+ * sevenDigitToDateFirstSlash("0041125") // "04/11/2025"
133
+ */
134
+ export const sevenDigitToDateFirstSlash = (value) => {
135
+ if (!value) return "";
136
+ const actualDate = value.substring(1);
137
+ const day = actualDate.substring(0, 2);
138
+ const month = actualDate.substring(2, 4);
139
+ const yearLastTwoDigits = actualDate.substring(4, 8);
140
+ const yearPrefix = parseInt(yearLastTwoDigits, 10) >= 70 ? "19" : "20";
141
+ const year = yearPrefix + yearLastTwoDigits;
142
+ return `${day}/${month}/${year}`;
143
+ };
144
+
145
+ /**
146
+ * Konversi format 7 digit ke YYYY-MM-DD.
147
+ * @param {string} value - 7-digit date string
148
+ * @returns {string} Format "YYYY-MM-DD"
149
+ *
150
+ * @example
151
+ * sevenDigitToYearFirstDash("0190724") // "2024-07-19"
152
+ */
153
+ export const sevenDigitToYearFirstDash = (value) => {
154
+ if (!value) return "";
155
+ const actualDate = value.substring(1);
156
+ const day = actualDate.slice(0, 2);
157
+ const month = actualDate.slice(2, 4);
158
+ const yearLastTwoDigits = actualDate.slice(4, 8);
159
+ const yearPrefix = parseInt(yearLastTwoDigits, 10) >= 70 ? "19" : "20";
160
+ const year = yearPrefix + yearLastTwoDigits;
161
+ return `${year}-${month}-${day}`;
162
+ };
163
+
164
+ /**
165
+ * Konversi format 7 digit ke DD-MM-YYYY.
166
+ * @param {string} value - 7-digit date string
167
+ * @returns {string} Format "DD-MM-YYYY"
168
+ *
169
+ * @example
170
+ * sevenDigitToDateFirstDash("0041125") // "04-11-2025"
171
+ */
172
+ export const sevenDigitToDateFirstDash = (value) => {
173
+ if (!value) return "";
174
+ const actualDate = value.substring(1);
175
+ const day = actualDate.slice(0, 2);
176
+ const month = actualDate.slice(2, 4);
177
+ const yearLastTwoDigits = actualDate.slice(4, 8);
178
+ const yearPrefix = parseInt(yearLastTwoDigits, 10) >= 70 ? "19" : "20";
179
+ const year = yearPrefix + yearLastTwoDigits;
180
+ return `${day}-${month}-${year}`;
181
+ };
182
+
183
+ /**
184
+ * Konversi datetime string ke format DD-MM-YYYY HH:mm.
185
+ * @param {string} value - DateTime string (e.g., "2025-01-13 16:39:39")
186
+ * @returns {string} Format "DD-MM-YYYY HH:mm"
187
+ *
188
+ * @example
189
+ * toDateTimeHourMinute("2025-01-13 16:39:39") // "13-01-2025 16:39"
190
+ */
191
+ export const toDateTimeHourMinute = (value) => {
192
+ if (!value) return "";
193
+ const date = new Date(value);
194
+ const day = String(date.getDate()).padStart(2, "0");
195
+ const month = String(date.getMonth() + 1).padStart(2, "0");
196
+ const year = date.getFullYear();
197
+ const hours = String(date.getHours()).padStart(2, "0");
198
+ const minutes = String(date.getMinutes()).padStart(2, "0");
199
+ return `${day}-${month}-${year} ${hours}:${minutes}`;
200
+ };
201
+
202
+ /**
203
+ * Konversi format DDMMYY (6 digit) ke DD/MM/YYYY.
204
+ * @param {string} value - 6-digit date string (DDMMYY)
205
+ * @returns {string} Format "DD/MM/YYYY"
206
+ *
207
+ * @example
208
+ * ddmmyyToSlashDate("190724") // "19/07/2024"
209
+ * ddmmyyToSlashDate("010170") // "01/01/1970"
210
+ */
211
+ export const ddmmyyToSlashDate = (value) => {
212
+ if (!value || value.length !== 6) return "";
213
+ const day = value.substring(0, 2);
214
+ const month = value.substring(2, 4);
215
+ const yearSuffix = value.substring(4, 6);
216
+ const year =
217
+ parseInt(yearSuffix, 10) >= 70 ? "19" + yearSuffix : "20" + yearSuffix;
218
+ return `${day}/${month}/${year}`;
219
+ };
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Consolidated Formatters
3
+ *
4
+ * Barrel export untuk semua formatting utilities.
5
+ * Menggantikan fungsi-fungsi yang tersebar di:
6
+ * - formatString.js
7
+ * - formatCurrency.js
8
+ * - formatters.js
9
+ * - stringUtils.js
10
+ * - convertSnakeToCamelWithSpace.js
11
+ */
12
+
13
+ export {
14
+ formatAccountNumber,
15
+ formatNPWP,
16
+ } from "./account";
17
+
18
+ export {
19
+ formatCurrency,
20
+ formatRupiah,
21
+ formatNominal,
22
+ formatDigit,
23
+ } from "./currency";
24
+
25
+ export {
26
+ toYearFirstDash,
27
+ toDateFirstSlash,
28
+ formatDateToDDSlashMMSlashYYYY,
29
+ formatDateToDDMMYYYY,
30
+ yearFirstDashToDateFirstDash,
31
+ yearFirstDashToDateFirstSlash,
32
+ dateFirstSlashToYearFirstDash,
33
+ sevenDigitToDateFirstSlash,
34
+ sevenDigitToYearFirstDash,
35
+ sevenDigitToDateFirstDash,
36
+ toDateTimeHourMinute,
37
+ ddmmyyToSlashDate,
38
+ } from "./date";
39
+
40
+ export {
41
+ formatResponseDesc,
42
+ titleCase,
43
+ snakeToCamelWithSpace,
44
+ stringToBoolean,
45
+ matchWiths,
46
+ maskString,
47
+ } from "./string";
@@ -0,0 +1,114 @@
1
+ /**
2
+ * String Formatting & Transformation Utilities
3
+ *
4
+ * Konsolidasi dari:
5
+ * - formatString.js (formatResponseDesc, titleCase, stringToBoolean)
6
+ * - convertSnakeToCamelWithSpace.js (snakeToCamelWithSpace)
7
+ * - stringUtils.js (matchWiths, needToHide)
8
+ */
9
+
10
+ /**
11
+ * Format response description: replace underscores with spaces dan capitalize.
12
+ * @param {string} desc - Description string dari API response
13
+ * @returns {string} Formatted description
14
+ *
15
+ * @example
16
+ * formatResponseDesc("invalid_request_data") // "Invalid Request Data"
17
+ * formatResponseDesc("brispot_error") // "BRISPOT Error"
18
+ */
19
+ export const formatResponseDesc = (desc) => {
20
+ if (!desc) return "";
21
+ return desc
22
+ .replace(/_(\w)/g, (_match, p1) => " " + p1.toUpperCase())
23
+ .replace(/brispot/gi, "BRISPOT");
24
+ };
25
+
26
+ /**
27
+ * Konversi string ke Title Case.
28
+ * @param {string} str - Input string
29
+ * @returns {string} Title cased string
30
+ *
31
+ * @example
32
+ * titleCase("hello world") // "Hello World"
33
+ * titleCase("JOHN DOE") // "John Doe"
34
+ */
35
+ export const titleCase = (str) => {
36
+ if (!str) return "";
37
+ return str
38
+ .toLowerCase()
39
+ .split(" ")
40
+ .map((word) => word.charAt(0).toUpperCase() + word.slice(1))
41
+ .join(" ");
42
+ };
43
+
44
+ /**
45
+ * Konversi snake_case ke Title Case With Spaces.
46
+ * @param {string} snakeStr - Snake case string
47
+ * @returns {string} Title case with spaces
48
+ *
49
+ * @example
50
+ * snakeToCamelWithSpace("hello_world") // "Hello World"
51
+ * snakeToCamelWithSpace("user_full_name") // "User Full Name"
52
+ */
53
+ export function snakeToCamelWithSpace(snakeStr) {
54
+ if (!snakeStr) return "";
55
+ return snakeStr
56
+ .toLowerCase()
57
+ .replace(/_([a-z])/g, (_match, letter) => ` ${letter.toUpperCase()}`)
58
+ .replace(/^([a-z])/, (_, letter) => letter.toUpperCase());
59
+ }
60
+
61
+ /**
62
+ * Konversi string "true"/"false" ke boolean.
63
+ * @param {string} str - String "true" atau "false"
64
+ * @returns {boolean|undefined} Boolean value atau undefined jika bukan "true"/"false"
65
+ *
66
+ * @example
67
+ * stringToBoolean("true") // true
68
+ * stringToBoolean("false") // false
69
+ * stringToBoolean("other") // undefined
70
+ */
71
+ export const stringToBoolean = (str) => {
72
+ if (str === "true" || str === "false") {
73
+ return str === "true";
74
+ }
75
+ return undefined;
76
+ };
77
+
78
+ /**
79
+ * Cek apakah target string mengandung salah satu dari values.
80
+ * @param {string} targetStr - String yang akan dicek
81
+ * @param {string[]} values - Array of substrings to match
82
+ * @returns {boolean} True jika salah satu value ditemukan
83
+ *
84
+ * @example
85
+ * matchWiths("hello world", ["hello", "foo"]) // true
86
+ * matchWiths("hello world", ["foo", "bar"]) // false
87
+ */
88
+ export function matchWiths(targetStr, values = []) {
89
+ if (!targetStr) return false;
90
+ return values.some((v) => targetStr.includes(v));
91
+ }
92
+
93
+ /**
94
+ * Mask/hide sebagian karakter dari string (untuk privasi).
95
+ * @param {string} value - String yang akan di-mask
96
+ * @param {string} type - Tipe masking: "email" atau default
97
+ * @returns {string} Masked string
98
+ *
99
+ * @example
100
+ * maskString("johndoe@email.com", "email") // "joh****@email.com"
101
+ * maskString("081234567890") // "081*****890"
102
+ */
103
+ export const maskString = (value, type) => {
104
+ if (!value) return "";
105
+ const tempArr = value.split("");
106
+ let len = tempArr.length - 3;
107
+
108
+ if (type === "email") {
109
+ len = tempArr.indexOf("@");
110
+ }
111
+
112
+ tempArr.splice(3 - tempArr.length, len - 3, ..."*".repeat(len - 3).split(""));
113
+ return tempArr.join("");
114
+ };