@yangsaiyam/helper 1.12.3 → 1.12.4
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/dist/addressess/index.d.ts +137 -0
- package/dist/addressess/index.js +24 -0
- package/dist/addressess/index.test.d.ts +1 -0
- package/dist/addressess/index.test.js +16 -0
- package/dist/assessment-question/index.d.ts +19 -0
- package/dist/assessment-question/index.js +22 -0
- package/dist/assessment-question/index.test.d.ts +1 -0
- package/dist/assessment-question/index.test.js +27 -0
- package/dist/career/index.d.ts +132 -0
- package/dist/career/index.js +40 -0
- package/dist/contact-form/index.d.ts +13 -0
- package/dist/contact-form/index.js +13 -0
- package/dist/email-history/index.d.ts +17 -0
- package/dist/email-history/index.js +6 -0
- package/dist/email-template/index.d.ts +13 -0
- package/dist/email-template/index.js +5 -0
- package/dist/files/index.d.ts +18 -0
- package/dist/files/index.js +8 -0
- package/dist/index.d.ts +17 -655
- package/dist/index.js +17 -703
- package/dist/job-applications/index.d.ts +33 -0
- package/dist/job-applications/index.js +10 -0
- package/dist/locale/index.d.ts +9 -0
- package/dist/locale/index.js +4 -0
- package/dist/roles/index.d.ts +61 -0
- package/dist/roles/index.js +170 -0
- package/dist/roles/index.test.d.ts +1 -0
- package/dist/roles/index.test.js +80 -0
- package/dist/routes/index.d.ts +80 -0
- package/dist/routes/index.js +106 -0
- package/dist/routes/index.test.d.ts +1 -0
- package/dist/routes/index.test.js +92 -0
- package/dist/shared/helpers.d.ts +5 -0
- package/dist/shared/helpers.js +15 -0
- package/dist/shared/types.d.ts +5 -0
- package/dist/shared/types.js +1 -0
- package/dist/time/index.d.ts +73 -0
- package/dist/time/index.js +161 -0
- package/dist/time/index.test.d.ts +1 -0
- package/dist/time/index.test.js +35 -0
- package/dist/track/index.d.ts +17 -0
- package/dist/track/index.js +14 -0
- package/dist/track/index.test.d.ts +1 -0
- package/dist/track/index.test.js +7 -0
- package/dist/url-prefix/index.d.ts +8 -0
- package/dist/url-prefix/index.js +9 -0
- package/dist/website/index.d.ts +16 -0
- package/dist/website/index.js +17 -0
- package/package.json +1 -1
- package/src/email-history/index.ts +1 -0
package/dist/index.js
CHANGED
|
@@ -1,703 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
{
|
|
19
|
-
key: QuestionType.MultipleChoice,
|
|
20
|
-
value: "MultipleChoice",
|
|
21
|
-
i18nKey: "assessmentQuestion.questionType.3"
|
|
22
|
-
}
|
|
23
|
-
];
|
|
24
|
-
|
|
25
|
-
// src/career/index.js
|
|
26
|
-
var CAREER_JOB_TYPE = [
|
|
27
|
-
{ key: 1, value: "Full-time", i18nKey: "career.jobType.1" },
|
|
28
|
-
{ key: 2, value: "Part-time", i18nKey: "career.jobType.2" },
|
|
29
|
-
{ key: 3, value: "Contract", i18nKey: "career.jobType.3" },
|
|
30
|
-
{ key: 4, value: "Internship", i18nKey: "career.jobType.4" }
|
|
31
|
-
];
|
|
32
|
-
var CAREER_CATEGORY = [
|
|
33
|
-
{ key: 1, value: "Technology", i18nKey: "career.category.1" },
|
|
34
|
-
{ key: 2, value: "Design", i18nKey: "career.category.2" },
|
|
35
|
-
{ key: 3, value: "Business", i18nKey: "career.category.3" },
|
|
36
|
-
{ key: 4, value: "Marketing", i18nKey: "career.category.4" },
|
|
37
|
-
{ key: 5, value: "Operations", i18nKey: "career.category.5" },
|
|
38
|
-
{ key: 6, value: "Finance", i18nKey: "career.category.6" },
|
|
39
|
-
{ key: 7, value: "Human Resources", i18nKey: "career.category.7" },
|
|
40
|
-
{ key: 8, value: "Legal", i18nKey: "career.category.8" },
|
|
41
|
-
{ key: 9, value: "Customer Support", i18nKey: "career.category.9" },
|
|
42
|
-
{ key: 10, value: "Management", i18nKey: "career.category.10" }
|
|
43
|
-
];
|
|
44
|
-
var CAREER_MODE = [
|
|
45
|
-
{ key: 1, value: "On-site", i18nKey: "career.mode.1" },
|
|
46
|
-
{ key: 2, value: "Remote", i18nKey: "career.mode.2" },
|
|
47
|
-
{ key: 3, value: "Hybrid", i18nKey: "career.mode.3" }
|
|
48
|
-
];
|
|
49
|
-
var CAREER_LOCATION = [
|
|
50
|
-
{ key: 1, value: "KualaLumpur", i18nKey: "career.location.1" },
|
|
51
|
-
{ key: 2, value: "Selangor", i18nKey: "career.location.2" },
|
|
52
|
-
{ key: 3, value: "Johor", i18nKey: "career.location.3" },
|
|
53
|
-
{ key: 4, value: "Penang", i18nKey: "career.location.4" },
|
|
54
|
-
{ key: 5, value: "Sabah", i18nKey: "career.location.5" },
|
|
55
|
-
{ key: 6, value: "Sarawak", i18nKey: "career.location.6" },
|
|
56
|
-
{ key: 7, value: "NegeriSembilan", i18nKey: "career.location.7" },
|
|
57
|
-
{ key: 8, value: "Kedah", i18nKey: "career.location.8" },
|
|
58
|
-
{ key: 9, value: "Kelantan", i18nKey: "career.location.9" },
|
|
59
|
-
{ key: 10, value: "Perak", i18nKey: "career.location.10" },
|
|
60
|
-
{ key: 11, value: "Terengganu", i18nKey: "career.location.11" },
|
|
61
|
-
{ key: 12, value: "Perlis", i18nKey: "career.location.12" },
|
|
62
|
-
{ key: 13, value: "Melaka", i18nKey: "career.location.13" },
|
|
63
|
-
{ key: 14, value: "Putrajaya", i18nKey: "career.location.14" },
|
|
64
|
-
{ key: 15, value: "Labuan", i18nKey: "career.location.15" }
|
|
65
|
-
];
|
|
66
|
-
|
|
67
|
-
// src/contact-form/index.js
|
|
68
|
-
var CONTACT_FORM_ENQUIRY_TYPE = [
|
|
69
|
-
{
|
|
70
|
-
key: 1,
|
|
71
|
-
value: "Software Development",
|
|
72
|
-
i18nKey: "contactForm.enquiryType.1"
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
key: 2,
|
|
76
|
-
value: "Advertising Platform",
|
|
77
|
-
i18nKey: "contactForm.enquiryType.2"
|
|
78
|
-
},
|
|
79
|
-
{ key: 3, value: "MCN Business", i18nKey: "contactForm.enquiryType.3" }
|
|
80
|
-
];
|
|
81
|
-
|
|
82
|
-
// src/files/index.js
|
|
83
|
-
var FILE_STATUS = [
|
|
84
|
-
{ key: 1, value: "pending", i18nKey: "files.status.1" },
|
|
85
|
-
{ key: 2, value: "submitted", i18nKey: "files.status.2" }
|
|
86
|
-
];
|
|
87
|
-
var FILE_ORIGIN = [
|
|
88
|
-
{ key: 1, value: "job applications", i18nKey: "files.origin.1" },
|
|
89
|
-
{ key: 2, value: "submitted", i18nKey: "files.origin.2" }
|
|
90
|
-
];
|
|
91
|
-
|
|
92
|
-
// src/locale/index.js
|
|
93
|
-
var LOCALE = [
|
|
94
|
-
{ key: 1, value: "en", i18nKey: "locale.en" },
|
|
95
|
-
{ key: 2, value: "zh", i18nKey: "locale.zh" }
|
|
96
|
-
];
|
|
97
|
-
|
|
98
|
-
// src/roles/index.js
|
|
99
|
-
var ROLE_MAP = {
|
|
100
|
-
0: "super-admin",
|
|
101
|
-
1: "admin",
|
|
102
|
-
2: "staff",
|
|
103
|
-
3: "hr",
|
|
104
|
-
32766: "visitor",
|
|
105
|
-
32767: "none"
|
|
106
|
-
};
|
|
107
|
-
var ROLE = [
|
|
108
|
-
{ key: 0, value: "super-admin", i18nKey: "users.roleSuperAdmin" },
|
|
109
|
-
{ key: 1, value: "admin", i18nKey: "users.roleAdmin" },
|
|
110
|
-
{ key: 2, value: "staff", i18nKey: "users.roleStaff" },
|
|
111
|
-
{ key: 3, value: "hr", i18nKey: "users.roleHr" },
|
|
112
|
-
{ key: 32766, value: "visitor", i18nKey: "users.roleVisitor" },
|
|
113
|
-
{ key: 32767, value: "none", i18nKey: "users.roleNone" }
|
|
114
|
-
];
|
|
115
|
-
function normalizeRole(role) {
|
|
116
|
-
if (typeof role === "number") {
|
|
117
|
-
return ROLE_MAP[role];
|
|
118
|
-
}
|
|
119
|
-
switch (role) {
|
|
120
|
-
case "super-admin":
|
|
121
|
-
return "super-admin";
|
|
122
|
-
case "admin":
|
|
123
|
-
return "admin";
|
|
124
|
-
case "staff":
|
|
125
|
-
return "staff";
|
|
126
|
-
case "hr":
|
|
127
|
-
return "hr";
|
|
128
|
-
case "visitor":
|
|
129
|
-
return "visitor";
|
|
130
|
-
case "none":
|
|
131
|
-
return "none";
|
|
132
|
-
default:
|
|
133
|
-
return void 0;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
function roleLabelKey(role) {
|
|
137
|
-
switch (normalizeRole(role)) {
|
|
138
|
-
case "super-admin":
|
|
139
|
-
return "users.roleSuperAdmin";
|
|
140
|
-
case "admin":
|
|
141
|
-
return "users.roleAdmin";
|
|
142
|
-
case "hr":
|
|
143
|
-
return "users.roleHr";
|
|
144
|
-
case "staff":
|
|
145
|
-
return "users.roleStaff";
|
|
146
|
-
case "visitor":
|
|
147
|
-
return "users.roleVisitor";
|
|
148
|
-
case "none":
|
|
149
|
-
return "users.roleNone";
|
|
150
|
-
default:
|
|
151
|
-
return "users.roleStaff";
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
function roleToId(role) {
|
|
155
|
-
const normalizedRole = normalizeRole(role);
|
|
156
|
-
return ROLE.find((option) => option.value === normalizedRole)?.key;
|
|
157
|
-
}
|
|
158
|
-
var Permission = {
|
|
159
|
-
ALLOWED_EMAILS_READ: "allowed-emails:read",
|
|
160
|
-
ALLOWED_EMAILS_WRITE: "allowed-emails:write",
|
|
161
|
-
USERS_READ: "users:read",
|
|
162
|
-
USERS_WRITE: "users:write",
|
|
163
|
-
USERS_DELETE: "users:delete",
|
|
164
|
-
CAREERS_READ: "careers:read",
|
|
165
|
-
CAREERS_WRITE: "careers:write",
|
|
166
|
-
CAREERS_DELETE: "careers:delete",
|
|
167
|
-
CONTACT_FORM_READ: "contact-form:read",
|
|
168
|
-
CONTACT_FORM_DELETE: "contact-form:delete",
|
|
169
|
-
JOB_APPLICATIONS_READ: "job-applications:read",
|
|
170
|
-
OTP_ATTEMPTS_READ: "otp-attempts:read",
|
|
171
|
-
OTP_ATTEMPTS_WRITE: "otp-attempts:write",
|
|
172
|
-
TWO_FACTOR_AUTH_READ: "two-factor-auth:read",
|
|
173
|
-
TWO_FACTOR_AUTH_WRITE: "two-factor-auth:write",
|
|
174
|
-
VIEWS_READ: "views:read",
|
|
175
|
-
LOGS_READ: "logs:read",
|
|
176
|
-
UTM_RECORDS_READ: "utm-records:read",
|
|
177
|
-
UTM_RECORDS_WRITE: "utm-records:write",
|
|
178
|
-
ORIGIN_READ: "origin:read",
|
|
179
|
-
ORIGIN_WRITE: "origin:write",
|
|
180
|
-
ORIGIN_DELETE: "origin:delete"
|
|
181
|
-
};
|
|
182
|
-
var PERMISSION_I18N_KEY = {
|
|
183
|
-
[Permission.ALLOWED_EMAILS_READ]: "permissions.allowedEmailsRead",
|
|
184
|
-
[Permission.ALLOWED_EMAILS_WRITE]: "permissions.allowedEmailsWrite",
|
|
185
|
-
[Permission.USERS_READ]: "permissions.usersRead",
|
|
186
|
-
[Permission.USERS_WRITE]: "permissions.usersWrite",
|
|
187
|
-
[Permission.USERS_DELETE]: "permissions.usersDelete",
|
|
188
|
-
[Permission.CAREERS_READ]: "permissions.careersRead",
|
|
189
|
-
[Permission.CAREERS_WRITE]: "permissions.careersWrite",
|
|
190
|
-
[Permission.CAREERS_DELETE]: "permissions.careersDelete",
|
|
191
|
-
[Permission.CONTACT_FORM_READ]: "permissions.contactFormRead",
|
|
192
|
-
[Permission.CONTACT_FORM_DELETE]: "permissions.contactFormDelete",
|
|
193
|
-
[Permission.JOB_APPLICATIONS_READ]: "permissions.jobApplicationsRead",
|
|
194
|
-
[Permission.OTP_ATTEMPTS_READ]: "permissions.otpAttemptsRead",
|
|
195
|
-
[Permission.OTP_ATTEMPTS_WRITE]: "permissions.otpAttemptsWrite",
|
|
196
|
-
[Permission.TWO_FACTOR_AUTH_READ]: "permissions.twoFactorAuthRead",
|
|
197
|
-
[Permission.TWO_FACTOR_AUTH_WRITE]: "permissions.twoFactorAuthWrite",
|
|
198
|
-
[Permission.VIEWS_READ]: "permissions.viewsRead",
|
|
199
|
-
[Permission.LOGS_READ]: "permissions.logsRead",
|
|
200
|
-
[Permission.UTM_RECORDS_READ]: "permissions.utmRecordsRead",
|
|
201
|
-
[Permission.UTM_RECORDS_WRITE]: "permissions.utmRecordsWrite",
|
|
202
|
-
[Permission.ORIGIN_READ]: "permissions.originRead",
|
|
203
|
-
[Permission.ORIGIN_WRITE]: "permissions.originWrite",
|
|
204
|
-
[Permission.ORIGIN_DELETE]: "permissions.originDelete"
|
|
205
|
-
};
|
|
206
|
-
var ROLE_PERMISSIONS = {
|
|
207
|
-
"super-admin": [
|
|
208
|
-
Permission.ALLOWED_EMAILS_READ,
|
|
209
|
-
Permission.ALLOWED_EMAILS_WRITE,
|
|
210
|
-
Permission.USERS_READ,
|
|
211
|
-
Permission.USERS_WRITE,
|
|
212
|
-
Permission.USERS_DELETE,
|
|
213
|
-
Permission.CAREERS_READ,
|
|
214
|
-
Permission.CAREERS_WRITE,
|
|
215
|
-
Permission.CAREERS_DELETE,
|
|
216
|
-
Permission.CONTACT_FORM_READ,
|
|
217
|
-
Permission.CONTACT_FORM_DELETE,
|
|
218
|
-
Permission.JOB_APPLICATIONS_READ,
|
|
219
|
-
Permission.OTP_ATTEMPTS_READ,
|
|
220
|
-
Permission.OTP_ATTEMPTS_WRITE,
|
|
221
|
-
Permission.TWO_FACTOR_AUTH_READ,
|
|
222
|
-
Permission.TWO_FACTOR_AUTH_WRITE,
|
|
223
|
-
Permission.VIEWS_READ,
|
|
224
|
-
Permission.LOGS_READ,
|
|
225
|
-
Permission.UTM_RECORDS_READ,
|
|
226
|
-
Permission.UTM_RECORDS_WRITE,
|
|
227
|
-
Permission.ORIGIN_READ,
|
|
228
|
-
Permission.ORIGIN_WRITE,
|
|
229
|
-
Permission.ORIGIN_DELETE
|
|
230
|
-
],
|
|
231
|
-
admin: [
|
|
232
|
-
Permission.ALLOWED_EMAILS_READ,
|
|
233
|
-
Permission.ALLOWED_EMAILS_WRITE,
|
|
234
|
-
Permission.USERS_READ,
|
|
235
|
-
Permission.CAREERS_READ,
|
|
236
|
-
Permission.CAREERS_WRITE,
|
|
237
|
-
Permission.CAREERS_DELETE,
|
|
238
|
-
Permission.CONTACT_FORM_READ,
|
|
239
|
-
Permission.CONTACT_FORM_DELETE,
|
|
240
|
-
Permission.JOB_APPLICATIONS_READ,
|
|
241
|
-
Permission.VIEWS_READ,
|
|
242
|
-
Permission.LOGS_READ,
|
|
243
|
-
Permission.UTM_RECORDS_READ,
|
|
244
|
-
Permission.UTM_RECORDS_WRITE,
|
|
245
|
-
Permission.ORIGIN_READ,
|
|
246
|
-
Permission.ORIGIN_WRITE,
|
|
247
|
-
Permission.ORIGIN_DELETE
|
|
248
|
-
],
|
|
249
|
-
hr: [
|
|
250
|
-
Permission.CAREERS_READ,
|
|
251
|
-
Permission.CAREERS_WRITE,
|
|
252
|
-
Permission.CAREERS_DELETE,
|
|
253
|
-
Permission.JOB_APPLICATIONS_READ
|
|
254
|
-
],
|
|
255
|
-
staff: [Permission.CONTACT_FORM_READ],
|
|
256
|
-
visitor: [],
|
|
257
|
-
none: []
|
|
258
|
-
};
|
|
259
|
-
function hasPermission(role, permission) {
|
|
260
|
-
const normalizedRole = normalizeRole(role);
|
|
261
|
-
if (!normalizedRole) {
|
|
262
|
-
return false;
|
|
263
|
-
}
|
|
264
|
-
return ROLE_PERMISSIONS[normalizedRole].includes(permission);
|
|
265
|
-
}
|
|
266
|
-
function permissionLabelKey(permission) {
|
|
267
|
-
return PERMISSION_I18N_KEY[permission];
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
// src/routes/index.js
|
|
271
|
-
var ROUTES = [
|
|
272
|
-
{
|
|
273
|
-
key: "home",
|
|
274
|
-
path: "/[locale]",
|
|
275
|
-
path_name: "/",
|
|
276
|
-
path_key: "/",
|
|
277
|
-
i18nKey: "routes.home"
|
|
278
|
-
},
|
|
279
|
-
{
|
|
280
|
-
key: "about",
|
|
281
|
-
path: "/[locale]/about",
|
|
282
|
-
path_name: "/about",
|
|
283
|
-
path_key: "/about",
|
|
284
|
-
i18nKey: "routes.about"
|
|
285
|
-
},
|
|
286
|
-
{
|
|
287
|
-
key: "career",
|
|
288
|
-
path: "/[locale]/career",
|
|
289
|
-
path_name: "/career",
|
|
290
|
-
path_key: "/career",
|
|
291
|
-
i18nKey: "routes.career"
|
|
292
|
-
},
|
|
293
|
-
{
|
|
294
|
-
key: "careerDetail",
|
|
295
|
-
path: "/[locale]/career/[id]",
|
|
296
|
-
path_name: "/career/[id]",
|
|
297
|
-
path_key: "/career/[id]",
|
|
298
|
-
i18nKey: "routes.careerDetail"
|
|
299
|
-
},
|
|
300
|
-
{
|
|
301
|
-
key: "careerApply",
|
|
302
|
-
path: "/[locale]/career/[id]/apply",
|
|
303
|
-
path_name: "/career/[id]/apply",
|
|
304
|
-
path_key: "/career/[id]/apply",
|
|
305
|
-
i18nKey: "routes.careerApply"
|
|
306
|
-
},
|
|
307
|
-
{
|
|
308
|
-
key: "careerAssessment",
|
|
309
|
-
path: "/[locale]/career/[id]/apply/assessment",
|
|
310
|
-
path_name: "/career/[id]/apply/assessment",
|
|
311
|
-
path_key: "/career/[id]/apply/assessment",
|
|
312
|
-
i18nKey: "routes.careerAssessment"
|
|
313
|
-
},
|
|
314
|
-
{
|
|
315
|
-
key: "contact",
|
|
316
|
-
path: "/[locale]/contact",
|
|
317
|
-
path_name: "/contact",
|
|
318
|
-
path_key: "/contact",
|
|
319
|
-
i18nKey: "routes.contact"
|
|
320
|
-
},
|
|
321
|
-
{
|
|
322
|
-
key: "services",
|
|
323
|
-
path: "/[locale]/services",
|
|
324
|
-
path_name: "/services",
|
|
325
|
-
path_key: "/services",
|
|
326
|
-
i18nKey: "routes.services"
|
|
327
|
-
},
|
|
328
|
-
{
|
|
329
|
-
key: "servicesAdvertisingPlatform",
|
|
330
|
-
path: "/[locale]/services/advertising-platform",
|
|
331
|
-
path_name: "/services/advertising-platform",
|
|
332
|
-
path_key: "/services/advertising-platform",
|
|
333
|
-
i18nKey: "routes.servicesAdvertisingPlatform"
|
|
334
|
-
},
|
|
335
|
-
{
|
|
336
|
-
key: "servicesMcnBusiness",
|
|
337
|
-
path: "/[locale]/services/mcn-business",
|
|
338
|
-
path_name: "/services/mcn-business",
|
|
339
|
-
path_key: "/services/mcn-business",
|
|
340
|
-
i18nKey: "routes.servicesMcnBusiness"
|
|
341
|
-
},
|
|
342
|
-
{
|
|
343
|
-
key: "servicesSoftwareDevelopment",
|
|
344
|
-
path: "/[locale]/services/software-development",
|
|
345
|
-
path_name: "/services/software-development",
|
|
346
|
-
path_key: "/services/software-development",
|
|
347
|
-
i18nKey: "routes.servicesSoftwareDevelopment"
|
|
348
|
-
}
|
|
349
|
-
];
|
|
350
|
-
var ROUTE = Object.fromEntries(ROUTES.map((route) => [route.key, route.path]));
|
|
351
|
-
function routeLabelKey(route) {
|
|
352
|
-
return ROUTES.find((item) => item.key === route)?.i18nKey ?? "routes.home";
|
|
353
|
-
}
|
|
354
|
-
function routePathKey(route) {
|
|
355
|
-
return ROUTES.find((item) => item.key === route)?.path_key ?? "/";
|
|
356
|
-
}
|
|
357
|
-
function buildRoutePathName(route, params = {}) {
|
|
358
|
-
let pathName = ROUTES.find((item) => item.key === route)?.path_name ?? "/";
|
|
359
|
-
if (pathName.includes("[id]")) {
|
|
360
|
-
if (params.id === void 0 || params.id === null) {
|
|
361
|
-
throw new Error(`Route "${route}" requires an id parameter.`);
|
|
362
|
-
}
|
|
363
|
-
pathName = pathName.replace("[id]", encodeURIComponent(String(params.id)));
|
|
364
|
-
}
|
|
365
|
-
return pathName;
|
|
366
|
-
}
|
|
367
|
-
function buildLocalizedRoute(route, locale, params = {}) {
|
|
368
|
-
let path = ROUTE[route].replace("[locale]", encodeURIComponent(locale));
|
|
369
|
-
if (path.includes("[id]")) {
|
|
370
|
-
if (params.id === void 0 || params.id === null) {
|
|
371
|
-
throw new Error(`Route "${route}" requires an id parameter.`);
|
|
372
|
-
}
|
|
373
|
-
path = path.replace("[id]", encodeURIComponent(String(params.id)));
|
|
374
|
-
}
|
|
375
|
-
return path;
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
// src/shared/helpers.js
|
|
379
|
-
function getOptionByKey(options, key) {
|
|
380
|
-
if (key === null || key === void 0) {
|
|
381
|
-
return void 0;
|
|
382
|
-
}
|
|
383
|
-
return options.find((option) => option.key === key);
|
|
384
|
-
}
|
|
385
|
-
function getLabelByKey(options, key, fallback = "Unknown") {
|
|
386
|
-
return getOptionByKey(options, key)?.value ?? fallback;
|
|
387
|
-
}
|
|
388
|
-
function getI18nKeyByKey(options, key, fallback = "unknown") {
|
|
389
|
-
return getOptionByKey(options, key)?.i18nKey ?? fallback;
|
|
390
|
-
}
|
|
391
|
-
function toRecord(options) {
|
|
392
|
-
return Object.fromEntries(options.map((option) => [option.key, option.value]));
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
// src/time/index.js
|
|
396
|
-
import dayjs from "dayjs";
|
|
397
|
-
import timezone from "dayjs/plugin/timezone.js";
|
|
398
|
-
import utc from "dayjs/plugin/utc.js";
|
|
399
|
-
dayjs.extend(utc);
|
|
400
|
-
dayjs.extend(timezone);
|
|
401
|
-
var TIMEZONE = [
|
|
402
|
-
{ key: 1, value: "UTC", i18nKey: "time.timezone.utc" },
|
|
403
|
-
{
|
|
404
|
-
key: 2,
|
|
405
|
-
value: "Asia/Kuala_Lumpur",
|
|
406
|
-
i18nKey: "time.timezone.asiaKualaLumpur"
|
|
407
|
-
},
|
|
408
|
-
{
|
|
409
|
-
key: 3,
|
|
410
|
-
value: "Asia/Singapore",
|
|
411
|
-
i18nKey: "time.timezone.asiaSingapore"
|
|
412
|
-
},
|
|
413
|
-
{
|
|
414
|
-
key: 4,
|
|
415
|
-
value: "Asia/Bangkok",
|
|
416
|
-
i18nKey: "time.timezone.asiaBangkok"
|
|
417
|
-
},
|
|
418
|
-
{
|
|
419
|
-
key: 5,
|
|
420
|
-
value: "Asia/Jakarta",
|
|
421
|
-
i18nKey: "time.timezone.asiaJakarta"
|
|
422
|
-
},
|
|
423
|
-
{
|
|
424
|
-
key: 6,
|
|
425
|
-
value: "Asia/Manila",
|
|
426
|
-
i18nKey: "time.timezone.asiaManila"
|
|
427
|
-
},
|
|
428
|
-
{
|
|
429
|
-
key: 7,
|
|
430
|
-
value: "Asia/Hong_Kong",
|
|
431
|
-
i18nKey: "time.timezone.asiaHongKong"
|
|
432
|
-
},
|
|
433
|
-
{
|
|
434
|
-
key: 8,
|
|
435
|
-
value: "Asia/Shanghai",
|
|
436
|
-
i18nKey: "time.timezone.asiaShanghai"
|
|
437
|
-
},
|
|
438
|
-
{
|
|
439
|
-
key: 9,
|
|
440
|
-
value: "Asia/Tokyo",
|
|
441
|
-
i18nKey: "time.timezone.asiaTokyo"
|
|
442
|
-
},
|
|
443
|
-
{
|
|
444
|
-
key: 10,
|
|
445
|
-
value: "Australia/Sydney",
|
|
446
|
-
i18nKey: "time.timezone.australiaSydney"
|
|
447
|
-
},
|
|
448
|
-
{
|
|
449
|
-
key: 11,
|
|
450
|
-
value: "Europe/London",
|
|
451
|
-
i18nKey: "time.timezone.europeLondon"
|
|
452
|
-
},
|
|
453
|
-
{
|
|
454
|
-
key: 12,
|
|
455
|
-
value: "Europe/Berlin",
|
|
456
|
-
i18nKey: "time.timezone.europeBerlin"
|
|
457
|
-
},
|
|
458
|
-
{
|
|
459
|
-
key: 13,
|
|
460
|
-
value: "America/New_York",
|
|
461
|
-
i18nKey: "time.timezone.americaNewYork"
|
|
462
|
-
},
|
|
463
|
-
{
|
|
464
|
-
key: 14,
|
|
465
|
-
value: "America/Chicago",
|
|
466
|
-
i18nKey: "time.timezone.americaChicago"
|
|
467
|
-
},
|
|
468
|
-
{
|
|
469
|
-
key: 15,
|
|
470
|
-
value: "America/Denver",
|
|
471
|
-
i18nKey: "time.timezone.americaDenver"
|
|
472
|
-
},
|
|
473
|
-
{
|
|
474
|
-
key: 16,
|
|
475
|
-
value: "America/Los_Angeles",
|
|
476
|
-
i18nKey: "time.timezone.americaLosAngeles"
|
|
477
|
-
}
|
|
478
|
-
];
|
|
479
|
-
var TIMEZONE_ALIAS_TO_CANONICAL = {
|
|
480
|
-
utc: "UTC",
|
|
481
|
-
"etc/utc": "UTC",
|
|
482
|
-
"asia/kuala_lumpur": "Asia/Kuala_Lumpur",
|
|
483
|
-
"asia/kuala lumpur": "Asia/Kuala_Lumpur",
|
|
484
|
-
"kuala_lumpur": "Asia/Kuala_Lumpur",
|
|
485
|
-
"kuala lumpur": "Asia/Kuala_Lumpur",
|
|
486
|
-
"asia/singapore": "Asia/Singapore",
|
|
487
|
-
singapore: "Asia/Singapore",
|
|
488
|
-
"asia/bangkok": "Asia/Bangkok",
|
|
489
|
-
bangkok: "Asia/Bangkok",
|
|
490
|
-
"asia/jakarta": "Asia/Jakarta",
|
|
491
|
-
jakarta: "Asia/Jakarta",
|
|
492
|
-
"asia/manila": "Asia/Manila",
|
|
493
|
-
manila: "Asia/Manila",
|
|
494
|
-
"asia/hong_kong": "Asia/Hong_Kong",
|
|
495
|
-
"asia/hong kong": "Asia/Hong_Kong",
|
|
496
|
-
"hong_kong": "Asia/Hong_Kong",
|
|
497
|
-
"hong kong": "Asia/Hong_Kong",
|
|
498
|
-
"asia/shanghai": "Asia/Shanghai",
|
|
499
|
-
shanghai: "Asia/Shanghai",
|
|
500
|
-
"asia/tokyo": "Asia/Tokyo",
|
|
501
|
-
tokyo: "Asia/Tokyo",
|
|
502
|
-
"australia/sydney": "Australia/Sydney",
|
|
503
|
-
sydney: "Australia/Sydney",
|
|
504
|
-
"europe/london": "Europe/London",
|
|
505
|
-
london: "Europe/London",
|
|
506
|
-
"europe/berlin": "Europe/Berlin",
|
|
507
|
-
berlin: "Europe/Berlin",
|
|
508
|
-
"america/new_york": "America/New_York",
|
|
509
|
-
"america/new york": "America/New_York",
|
|
510
|
-
"new_york": "America/New_York",
|
|
511
|
-
"new york": "America/New_York",
|
|
512
|
-
"america/chicago": "America/Chicago",
|
|
513
|
-
chicago: "America/Chicago",
|
|
514
|
-
"america/denver": "America/Denver",
|
|
515
|
-
denver: "America/Denver",
|
|
516
|
-
"america/los_angeles": "America/Los_Angeles",
|
|
517
|
-
"america/los angeles": "America/Los_Angeles",
|
|
518
|
-
"los_angeles": "America/Los_Angeles",
|
|
519
|
-
"los angeles": "America/Los_Angeles"
|
|
520
|
-
};
|
|
521
|
-
var TIMEZONE_I18N_KEY = Object.fromEntries(TIMEZONE.map(({ value, i18nKey }) => [value, i18nKey]));
|
|
522
|
-
function toTimezoneAlias(timezone2) {
|
|
523
|
-
return timezone2.trim().toLowerCase().replace(/-/g, "_");
|
|
524
|
-
}
|
|
525
|
-
function normalizeTimezone(timezone2) {
|
|
526
|
-
if (!timezone2) {
|
|
527
|
-
return void 0;
|
|
528
|
-
}
|
|
529
|
-
return TIMEZONE_ALIAS_TO_CANONICAL[toTimezoneAlias(timezone2)];
|
|
530
|
-
}
|
|
531
|
-
function timezoneToUtc(timezone2, timestamp = Date.now()) {
|
|
532
|
-
const normalizedTimezone = normalizeTimezone(timezone2);
|
|
533
|
-
if (!normalizedTimezone) {
|
|
534
|
-
return void 0;
|
|
535
|
-
}
|
|
536
|
-
return `UTC${dayjs(timestamp).tz(normalizedTimezone).format("Z")}`;
|
|
537
|
-
}
|
|
538
|
-
var TIMEZONE_CURRENT_UTC_OFFSET = Object.fromEntries(TIMEZONE.map(({ value }) => [value, timezoneToUtc(value)]));
|
|
539
|
-
var TIMEZONE_TO_UTC = TIMEZONE_CURRENT_UTC_OFFSET;
|
|
540
|
-
function timezoneLabelKey(timezone2) {
|
|
541
|
-
const normalizedTimezone = normalizeTimezone(timezone2);
|
|
542
|
-
if (!normalizedTimezone) {
|
|
543
|
-
return "time.timezone.utc";
|
|
544
|
-
}
|
|
545
|
-
return TIMEZONE_I18N_KEY[normalizedTimezone];
|
|
546
|
-
}
|
|
547
|
-
function convertTimestampToTimezone(timestamp, sourceTimezone, targetTimezone) {
|
|
548
|
-
const normalizedSourceTimezone = normalizeTimezone(sourceTimezone);
|
|
549
|
-
const normalizedTargetTimezone = normalizeTimezone(targetTimezone);
|
|
550
|
-
if (!normalizedSourceTimezone || !normalizedTargetTimezone) {
|
|
551
|
-
return void 0;
|
|
552
|
-
}
|
|
553
|
-
const sourceDateTime = dayjs(timestamp).tz(normalizedSourceTimezone);
|
|
554
|
-
const preservedWallClock = sourceDateTime.format("YYYY-MM-DDTHH:mm:ss.SSS");
|
|
555
|
-
return dayjs.tz(preservedWallClock, normalizedTargetTimezone).valueOf();
|
|
556
|
-
}
|
|
557
|
-
|
|
558
|
-
// src/track/index.js
|
|
559
|
-
var ORIGIN = [
|
|
560
|
-
{
|
|
561
|
-
key: 0,
|
|
562
|
-
value: "Website",
|
|
563
|
-
i18nKey: "track.origin.0"
|
|
564
|
-
},
|
|
565
|
-
{
|
|
566
|
-
key: 1,
|
|
567
|
-
value: "Linkedin",
|
|
568
|
-
i18nKey: "track.origin.1"
|
|
569
|
-
},
|
|
570
|
-
{ key: 2, value: "Jobstreet", i18nKey: "track.origin.2" },
|
|
571
|
-
{ key: 3, value: "Maukerja", i18nKey: "track.origin.3" }
|
|
572
|
-
];
|
|
573
|
-
|
|
574
|
-
// src/url-prefix/index.js
|
|
575
|
-
var URL_PREFIXES = {
|
|
576
|
-
[1 /* KORRE */]: {
|
|
577
|
-
contact: "https://www.korre.site/contact",
|
|
578
|
-
careerDetail: "https://www.korre.site/career/[id]",
|
|
579
|
-
careerApply: "https://www.korre.site/career/[id]/apply"
|
|
580
|
-
},
|
|
581
|
-
[2 /* KORRE_LABS */]: {}
|
|
582
|
-
};
|
|
583
|
-
|
|
584
|
-
// src/website/index.js
|
|
585
|
-
var Website2;
|
|
586
|
-
(function(Website3) {
|
|
587
|
-
Website3[Website3["KORRE"] = 1] = "KORRE";
|
|
588
|
-
Website3[Website3["KORRE_LABS"] = 2] = "KORRE_LABS";
|
|
589
|
-
})(Website2 || (Website2 = {}));
|
|
590
|
-
var WEBSITES = {
|
|
591
|
-
[Website2.KORRE]: {
|
|
592
|
-
id: Website2.KORRE,
|
|
593
|
-
name: "Korre Evolution",
|
|
594
|
-
url: "https://public.korre.site/images/korre-evo.png"
|
|
595
|
-
},
|
|
596
|
-
[Website2.KORRE_LABS]: {
|
|
597
|
-
id: Website2.KORRE_LABS,
|
|
598
|
-
name: "Korre Labs",
|
|
599
|
-
url: "https://public.korre.site/images/korre-labs.png"
|
|
600
|
-
}
|
|
601
|
-
};
|
|
602
|
-
|
|
603
|
-
// src/addressess/index.js
|
|
604
|
-
var COUNTRY_CODE = [
|
|
605
|
-
{ key: 1, value: "MY", i18nKey: "country.code.1" }
|
|
606
|
-
];
|
|
607
|
-
var STATES = {
|
|
608
|
-
MY: [
|
|
609
|
-
{ key: 1, value: "Johor", i18nKey: "malaysia.state.1" },
|
|
610
|
-
{ key: 2, value: "Kedah", i18nKey: "malaysia.state.2" },
|
|
611
|
-
{ key: 3, value: "Kelantan", i18nKey: "malaysia.state.3" },
|
|
612
|
-
{ key: 4, value: "Melaka", i18nKey: "malaysia.state.4" },
|
|
613
|
-
{ key: 5, value: "Negeri Sembilan", i18nKey: "malaysia.state.5" },
|
|
614
|
-
{ key: 6, value: "Pahang", i18nKey: "malaysia.state.6" },
|
|
615
|
-
{ key: 7, value: "Penang", i18nKey: "malaysia.state.7" },
|
|
616
|
-
{ key: 8, value: "Perak", i18nKey: "malaysia.state.8" },
|
|
617
|
-
{ key: 9, value: "Perlis", i18nKey: "malaysia.state.9" },
|
|
618
|
-
{ key: 10, value: "Sabah", i18nKey: "malaysia.state.10" },
|
|
619
|
-
{ key: 11, value: "Sarawak", i18nKey: "malaysia.state.11" },
|
|
620
|
-
{ key: 12, value: "Selangor", i18nKey: "malaysia.state.12" },
|
|
621
|
-
{ key: 13, value: "Terengganu", i18nKey: "malaysia.state.13" },
|
|
622
|
-
{ key: 14, value: "Kuala Lumpur", i18nKey: "malaysia.state.14" },
|
|
623
|
-
{ key: 15, value: "Labuan", i18nKey: "malaysia.state.15" },
|
|
624
|
-
{ key: 16, value: "Putrajaya", i18nKey: "malaysia.state.16" }
|
|
625
|
-
]
|
|
626
|
-
};
|
|
627
|
-
var MALAYSIA_STATE = STATES.MY;
|
|
628
|
-
|
|
629
|
-
// src/job-applications/index.js
|
|
630
|
-
var JOB_APPLICATION_STATUS = [
|
|
631
|
-
{ key: 0, value: "Pending Review", i18nKey: "jobApplication.status.0" },
|
|
632
|
-
{ key: 1, value: "Shortlisted", i18nKey: "jobApplication.status.1" },
|
|
633
|
-
{ key: 2, value: "Interview", i18nKey: "jobApplication.status.2" },
|
|
634
|
-
{ key: 3, value: "Offered", i18nKey: "jobApplication.status.3" },
|
|
635
|
-
{ key: 4, value: "Hired", i18nKey: "jobApplication.status.4" },
|
|
636
|
-
{ key: 5, value: "Rejected", i18nKey: "jobApplication.status.5" },
|
|
637
|
-
{ key: 6, value: "Withdrawn", i18nKey: "jobApplication.status.6" },
|
|
638
|
-
{ key: 7, value: "Ghosted", i18nKey: "jobApplication.status.7" }
|
|
639
|
-
];
|
|
640
|
-
|
|
641
|
-
// src/email-template/index.js
|
|
642
|
-
var EMAIL_TEMPLATE_ROLES = [
|
|
643
|
-
{ key: 0, value: "Creator", i18nKey: "emailTemplate.role.0" },
|
|
644
|
-
{ key: 1, value: "Editor", i18nKey: "emailTemplate.role.1" },
|
|
645
|
-
{ key: 2, value: "Viewer", i18nKey: "emailTemplate.role.2" }
|
|
646
|
-
];
|
|
647
|
-
|
|
648
|
-
// src/email-history/index.ts
|
|
649
|
-
var EMAIL_HISTORY_STATUS = [
|
|
650
|
-
{ key: 0, value: "Scheduled", i18nKey: "emailHistory.status.0" },
|
|
651
|
-
{ key: 1, value: "Delivering", i18nKey: "emailHistory.status.1" },
|
|
652
|
-
{ key: 2, value: "Delivered", i18nKey: "emailHistory.status.2" },
|
|
653
|
-
{ key: 3, value: "Failed", i18nKey: "emailHistory.status.3" }
|
|
654
|
-
];
|
|
655
|
-
export {
|
|
656
|
-
ASSESSMENT_QUESTION_TYPE,
|
|
657
|
-
CAREER_CATEGORY,
|
|
658
|
-
CAREER_JOB_TYPE,
|
|
659
|
-
CAREER_LOCATION,
|
|
660
|
-
CAREER_MODE,
|
|
661
|
-
CONTACT_FORM_ENQUIRY_TYPE,
|
|
662
|
-
COUNTRY_CODE,
|
|
663
|
-
EMAIL_HISTORY_STATUS,
|
|
664
|
-
EMAIL_TEMPLATE_ROLES,
|
|
665
|
-
FILE_ORIGIN,
|
|
666
|
-
FILE_STATUS,
|
|
667
|
-
JOB_APPLICATION_STATUS,
|
|
668
|
-
LOCALE,
|
|
669
|
-
MALAYSIA_STATE,
|
|
670
|
-
ORIGIN,
|
|
671
|
-
PERMISSION_I18N_KEY,
|
|
672
|
-
Permission,
|
|
673
|
-
QuestionType,
|
|
674
|
-
ROLE,
|
|
675
|
-
ROLE_MAP,
|
|
676
|
-
ROLE_PERMISSIONS,
|
|
677
|
-
ROUTE,
|
|
678
|
-
ROUTES,
|
|
679
|
-
STATES,
|
|
680
|
-
TIMEZONE,
|
|
681
|
-
TIMEZONE_CURRENT_UTC_OFFSET,
|
|
682
|
-
TIMEZONE_TO_UTC,
|
|
683
|
-
URL_PREFIXES,
|
|
684
|
-
WEBSITES,
|
|
685
|
-
Website2 as Website,
|
|
686
|
-
buildLocalizedRoute,
|
|
687
|
-
buildRoutePathName,
|
|
688
|
-
convertTimestampToTimezone,
|
|
689
|
-
getI18nKeyByKey,
|
|
690
|
-
getLabelByKey,
|
|
691
|
-
getOptionByKey,
|
|
692
|
-
hasPermission,
|
|
693
|
-
normalizeRole,
|
|
694
|
-
normalizeTimezone,
|
|
695
|
-
permissionLabelKey,
|
|
696
|
-
roleLabelKey,
|
|
697
|
-
roleToId,
|
|
698
|
-
routeLabelKey,
|
|
699
|
-
routePathKey,
|
|
700
|
-
timezoneLabelKey,
|
|
701
|
-
timezoneToUtc,
|
|
702
|
-
toRecord
|
|
703
|
-
};
|
|
1
|
+
export * from "./assessment-question/index.js";
|
|
2
|
+
export * from "./career/index.js";
|
|
3
|
+
export * from "./contact-form/index.js";
|
|
4
|
+
export * from "./files/index.js";
|
|
5
|
+
export * from "./locale/index.js";
|
|
6
|
+
export * from "./roles/index.js";
|
|
7
|
+
export * from "./routes/index.js";
|
|
8
|
+
export * from "./shared/helpers.js";
|
|
9
|
+
export * from "./shared/types.js";
|
|
10
|
+
export * from "./time/index.js";
|
|
11
|
+
export * from "./track/index.js";
|
|
12
|
+
export * from "./url-prefix/index.js";
|
|
13
|
+
export * from "./website/index.js";
|
|
14
|
+
export * from "./addressess/index.js";
|
|
15
|
+
export * from "./job-applications/index.js";
|
|
16
|
+
export * from "./email-template/index.js";
|
|
17
|
+
export * from "./email-history/index.js";
|