@yangsaiyam/helper 1.13.0 → 1.15.0
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/index.cjs +8 -0
- package/dist/index.d.cts +32 -1
- package/dist/index.d.ts +32 -1
- package/dist/index.js +8 -0
- package/package.json +1 -1
- package/src/contact-form/index.d.ts +29 -0
- package/src/contact-form/index.ts +43 -0
- package/src/roles/index.d.ts +2 -0
- package/src/roles/index.js +8 -0
- package/src/roles/index.test.js +8 -0
- package/src/roles/index.test.ts +14 -0
- package/src/roles/index.ts +8 -0
package/dist/index.cjs
CHANGED
|
@@ -248,6 +248,8 @@ var Permission = {
|
|
|
248
248
|
CAREERS_DELETE: "careers:delete",
|
|
249
249
|
CONTACT_FORM_READ: "contact-form:read",
|
|
250
250
|
CONTACT_FORM_DELETE: "contact-form:delete",
|
|
251
|
+
NEWSLETTER_READ: "newsletter:read",
|
|
252
|
+
NEWSLETTER_DELETE: "newsletter:delete",
|
|
251
253
|
JOB_APPLICATIONS_READ: "job-applications:read",
|
|
252
254
|
OTP_ATTEMPTS_READ: "otp-attempts:read",
|
|
253
255
|
OTP_ATTEMPTS_WRITE: "otp-attempts:write",
|
|
@@ -272,6 +274,8 @@ var PERMISSION_I18N_KEY = {
|
|
|
272
274
|
[Permission.CAREERS_DELETE]: "permissions.careersDelete",
|
|
273
275
|
[Permission.CONTACT_FORM_READ]: "permissions.contactFormRead",
|
|
274
276
|
[Permission.CONTACT_FORM_DELETE]: "permissions.contactFormDelete",
|
|
277
|
+
[Permission.NEWSLETTER_READ]: "permissions.newsletterRead",
|
|
278
|
+
[Permission.NEWSLETTER_DELETE]: "permissions.newsletterDelete",
|
|
275
279
|
[Permission.JOB_APPLICATIONS_READ]: "permissions.jobApplicationsRead",
|
|
276
280
|
[Permission.OTP_ATTEMPTS_READ]: "permissions.otpAttemptsRead",
|
|
277
281
|
[Permission.OTP_ATTEMPTS_WRITE]: "permissions.otpAttemptsWrite",
|
|
@@ -297,6 +301,8 @@ var ROLE_PERMISSIONS = {
|
|
|
297
301
|
Permission.CAREERS_DELETE,
|
|
298
302
|
Permission.CONTACT_FORM_READ,
|
|
299
303
|
Permission.CONTACT_FORM_DELETE,
|
|
304
|
+
Permission.NEWSLETTER_READ,
|
|
305
|
+
Permission.NEWSLETTER_DELETE,
|
|
300
306
|
Permission.JOB_APPLICATIONS_READ,
|
|
301
307
|
Permission.OTP_ATTEMPTS_READ,
|
|
302
308
|
Permission.OTP_ATTEMPTS_WRITE,
|
|
@@ -319,6 +325,8 @@ var ROLE_PERMISSIONS = {
|
|
|
319
325
|
Permission.CAREERS_DELETE,
|
|
320
326
|
Permission.CONTACT_FORM_READ,
|
|
321
327
|
Permission.CONTACT_FORM_DELETE,
|
|
328
|
+
Permission.NEWSLETTER_READ,
|
|
329
|
+
Permission.NEWSLETTER_DELETE,
|
|
322
330
|
Permission.JOB_APPLICATIONS_READ,
|
|
323
331
|
Permission.VIEWS_READ,
|
|
324
332
|
Permission.LOGS_READ,
|
package/dist/index.d.cts
CHANGED
|
@@ -164,6 +164,35 @@ declare const CONTACT_FORM_ENQUIRY_TYPE: readonly [{
|
|
|
164
164
|
readonly value: "MCN Business";
|
|
165
165
|
readonly i18nKey: "contactForm.enquiryType.3";
|
|
166
166
|
}];
|
|
167
|
+
/** Korre Evolution (site 1): every field maps to a standard column. */
|
|
168
|
+
type KorreContactFormData = Record<string, never>;
|
|
169
|
+
/** Korre Labs (site 2): no contact form yet. */
|
|
170
|
+
type KorreLabsContactFormData = Record<string, never>;
|
|
171
|
+
/**
|
|
172
|
+
* MCOM Media (site 3): agency-intake extras beyond the standard columns.
|
|
173
|
+
* `service` is provisional — it may move to `enquiry_type` once the site-3
|
|
174
|
+
* enquiry-type mapping is defined.
|
|
175
|
+
*/
|
|
176
|
+
interface McomMediaContactFormData {
|
|
177
|
+
company_name?: string;
|
|
178
|
+
job_title?: string;
|
|
179
|
+
phone?: string;
|
|
180
|
+
website?: string;
|
|
181
|
+
country?: string;
|
|
182
|
+
budget?: string;
|
|
183
|
+
service?: string;
|
|
184
|
+
timeline?: string;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* `contact_form.form_data` shape keyed by `site_id`.
|
|
188
|
+
* 1 = KORRE, 2 = KORRE_LABS, 3 = MCOM_MEDIA (see the `Website` enum).
|
|
189
|
+
*/
|
|
190
|
+
interface ContactFormDataBySite {
|
|
191
|
+
1: KorreContactFormData;
|
|
192
|
+
2: KorreLabsContactFormData;
|
|
193
|
+
3: McomMediaContactFormData;
|
|
194
|
+
}
|
|
195
|
+
type ContactFormData = ContactFormDataBySite[keyof ContactFormDataBySite];
|
|
167
196
|
|
|
168
197
|
declare const FILE_STATUS: readonly [{
|
|
169
198
|
readonly key: 1;
|
|
@@ -237,6 +266,8 @@ declare const Permission: {
|
|
|
237
266
|
readonly CAREERS_DELETE: "careers:delete";
|
|
238
267
|
readonly CONTACT_FORM_READ: "contact-form:read";
|
|
239
268
|
readonly CONTACT_FORM_DELETE: "contact-form:delete";
|
|
269
|
+
readonly NEWSLETTER_READ: "newsletter:read";
|
|
270
|
+
readonly NEWSLETTER_DELETE: "newsletter:delete";
|
|
240
271
|
readonly JOB_APPLICATIONS_READ: "job-applications:read";
|
|
241
272
|
readonly OTP_ATTEMPTS_READ: "otp-attempts:read";
|
|
242
273
|
readonly OTP_ATTEMPTS_WRITE: "otp-attempts:write";
|
|
@@ -680,4 +711,4 @@ declare const EMAIL_HISTORY_STATUS: readonly [{
|
|
|
680
711
|
readonly i18nKey: "emailHistory.status.4";
|
|
681
712
|
}];
|
|
682
713
|
|
|
683
|
-
export { ASSESSMENT_QUESTION_TYPE, CAREER_CATEGORY, CAREER_JOB_TYPE, CAREER_LOCATION, CAREER_MODE, CONTACT_FORM_ENQUIRY_TYPE, COUNTRY_CODE, type CanonicalRole, type CanonicalTimezone, EMAIL_HISTORY_STATUS, EMAIL_TEMPLATE_ROLES, FILE_ORIGIN, FILE_STATUS, JOB_APPLICATION_STATUS, LOCALE, MALAYSIA_STATE, type MappingOption, ORIGIN, PERMISSION_I18N_KEY, Permission, QuestionType, ROLE, ROLE_MAP, ROLE_PERMISSIONS, ROUTE, ROUTES, type RoleInput, type RoleValue, type RouteKey, type RouteMapping, STATES, TIMEZONE, TIMEZONE_CURRENT_UTC_OFFSET, TIMEZONE_TO_UTC, type TimezoneInput, URL_PREFIXES, WEBSITES, Website, buildLocalizedRoute, buildRoutePathName, convertTimestampToTimezone, getI18nKeyByKey, getLabelByKey, getOptionByKey, hasPermission, normalizeRole, normalizeTimezone, permissionLabelKey, roleLabelKey, roleToId, routeLabelKey, routePathKey, timezoneLabelKey, timezoneToUtc, toRecord };
|
|
714
|
+
export { ASSESSMENT_QUESTION_TYPE, CAREER_CATEGORY, CAREER_JOB_TYPE, CAREER_LOCATION, CAREER_MODE, CONTACT_FORM_ENQUIRY_TYPE, COUNTRY_CODE, type CanonicalRole, type CanonicalTimezone, type ContactFormData, type ContactFormDataBySite, EMAIL_HISTORY_STATUS, EMAIL_TEMPLATE_ROLES, FILE_ORIGIN, FILE_STATUS, JOB_APPLICATION_STATUS, type KorreContactFormData, type KorreLabsContactFormData, LOCALE, MALAYSIA_STATE, type MappingOption, type McomMediaContactFormData, ORIGIN, PERMISSION_I18N_KEY, Permission, QuestionType, ROLE, ROLE_MAP, ROLE_PERMISSIONS, ROUTE, ROUTES, type RoleInput, type RoleValue, type RouteKey, type RouteMapping, STATES, TIMEZONE, TIMEZONE_CURRENT_UTC_OFFSET, TIMEZONE_TO_UTC, type TimezoneInput, URL_PREFIXES, WEBSITES, Website, buildLocalizedRoute, buildRoutePathName, convertTimestampToTimezone, getI18nKeyByKey, getLabelByKey, getOptionByKey, hasPermission, normalizeRole, normalizeTimezone, permissionLabelKey, roleLabelKey, roleToId, routeLabelKey, routePathKey, timezoneLabelKey, timezoneToUtc, toRecord };
|
package/dist/index.d.ts
CHANGED
|
@@ -164,6 +164,35 @@ declare const CONTACT_FORM_ENQUIRY_TYPE: readonly [{
|
|
|
164
164
|
readonly value: "MCN Business";
|
|
165
165
|
readonly i18nKey: "contactForm.enquiryType.3";
|
|
166
166
|
}];
|
|
167
|
+
/** Korre Evolution (site 1): every field maps to a standard column. */
|
|
168
|
+
type KorreContactFormData = Record<string, never>;
|
|
169
|
+
/** Korre Labs (site 2): no contact form yet. */
|
|
170
|
+
type KorreLabsContactFormData = Record<string, never>;
|
|
171
|
+
/**
|
|
172
|
+
* MCOM Media (site 3): agency-intake extras beyond the standard columns.
|
|
173
|
+
* `service` is provisional — it may move to `enquiry_type` once the site-3
|
|
174
|
+
* enquiry-type mapping is defined.
|
|
175
|
+
*/
|
|
176
|
+
interface McomMediaContactFormData {
|
|
177
|
+
company_name?: string;
|
|
178
|
+
job_title?: string;
|
|
179
|
+
phone?: string;
|
|
180
|
+
website?: string;
|
|
181
|
+
country?: string;
|
|
182
|
+
budget?: string;
|
|
183
|
+
service?: string;
|
|
184
|
+
timeline?: string;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* `contact_form.form_data` shape keyed by `site_id`.
|
|
188
|
+
* 1 = KORRE, 2 = KORRE_LABS, 3 = MCOM_MEDIA (see the `Website` enum).
|
|
189
|
+
*/
|
|
190
|
+
interface ContactFormDataBySite {
|
|
191
|
+
1: KorreContactFormData;
|
|
192
|
+
2: KorreLabsContactFormData;
|
|
193
|
+
3: McomMediaContactFormData;
|
|
194
|
+
}
|
|
195
|
+
type ContactFormData = ContactFormDataBySite[keyof ContactFormDataBySite];
|
|
167
196
|
|
|
168
197
|
declare const FILE_STATUS: readonly [{
|
|
169
198
|
readonly key: 1;
|
|
@@ -237,6 +266,8 @@ declare const Permission: {
|
|
|
237
266
|
readonly CAREERS_DELETE: "careers:delete";
|
|
238
267
|
readonly CONTACT_FORM_READ: "contact-form:read";
|
|
239
268
|
readonly CONTACT_FORM_DELETE: "contact-form:delete";
|
|
269
|
+
readonly NEWSLETTER_READ: "newsletter:read";
|
|
270
|
+
readonly NEWSLETTER_DELETE: "newsletter:delete";
|
|
240
271
|
readonly JOB_APPLICATIONS_READ: "job-applications:read";
|
|
241
272
|
readonly OTP_ATTEMPTS_READ: "otp-attempts:read";
|
|
242
273
|
readonly OTP_ATTEMPTS_WRITE: "otp-attempts:write";
|
|
@@ -680,4 +711,4 @@ declare const EMAIL_HISTORY_STATUS: readonly [{
|
|
|
680
711
|
readonly i18nKey: "emailHistory.status.4";
|
|
681
712
|
}];
|
|
682
713
|
|
|
683
|
-
export { ASSESSMENT_QUESTION_TYPE, CAREER_CATEGORY, CAREER_JOB_TYPE, CAREER_LOCATION, CAREER_MODE, CONTACT_FORM_ENQUIRY_TYPE, COUNTRY_CODE, type CanonicalRole, type CanonicalTimezone, EMAIL_HISTORY_STATUS, EMAIL_TEMPLATE_ROLES, FILE_ORIGIN, FILE_STATUS, JOB_APPLICATION_STATUS, LOCALE, MALAYSIA_STATE, type MappingOption, ORIGIN, PERMISSION_I18N_KEY, Permission, QuestionType, ROLE, ROLE_MAP, ROLE_PERMISSIONS, ROUTE, ROUTES, type RoleInput, type RoleValue, type RouteKey, type RouteMapping, STATES, TIMEZONE, TIMEZONE_CURRENT_UTC_OFFSET, TIMEZONE_TO_UTC, type TimezoneInput, URL_PREFIXES, WEBSITES, Website, buildLocalizedRoute, buildRoutePathName, convertTimestampToTimezone, getI18nKeyByKey, getLabelByKey, getOptionByKey, hasPermission, normalizeRole, normalizeTimezone, permissionLabelKey, roleLabelKey, roleToId, routeLabelKey, routePathKey, timezoneLabelKey, timezoneToUtc, toRecord };
|
|
714
|
+
export { ASSESSMENT_QUESTION_TYPE, CAREER_CATEGORY, CAREER_JOB_TYPE, CAREER_LOCATION, CAREER_MODE, CONTACT_FORM_ENQUIRY_TYPE, COUNTRY_CODE, type CanonicalRole, type CanonicalTimezone, type ContactFormData, type ContactFormDataBySite, EMAIL_HISTORY_STATUS, EMAIL_TEMPLATE_ROLES, FILE_ORIGIN, FILE_STATUS, JOB_APPLICATION_STATUS, type KorreContactFormData, type KorreLabsContactFormData, LOCALE, MALAYSIA_STATE, type MappingOption, type McomMediaContactFormData, ORIGIN, PERMISSION_I18N_KEY, Permission, QuestionType, ROLE, ROLE_MAP, ROLE_PERMISSIONS, ROUTE, ROUTES, type RoleInput, type RoleValue, type RouteKey, type RouteMapping, STATES, TIMEZONE, TIMEZONE_CURRENT_UTC_OFFSET, TIMEZONE_TO_UTC, type TimezoneInput, URL_PREFIXES, WEBSITES, Website, buildLocalizedRoute, buildRoutePathName, convertTimestampToTimezone, getI18nKeyByKey, getLabelByKey, getOptionByKey, hasPermission, normalizeRole, normalizeTimezone, permissionLabelKey, roleLabelKey, roleToId, routeLabelKey, routePathKey, timezoneLabelKey, timezoneToUtc, toRecord };
|
package/dist/index.js
CHANGED
|
@@ -166,6 +166,8 @@ var Permission = {
|
|
|
166
166
|
CAREERS_DELETE: "careers:delete",
|
|
167
167
|
CONTACT_FORM_READ: "contact-form:read",
|
|
168
168
|
CONTACT_FORM_DELETE: "contact-form:delete",
|
|
169
|
+
NEWSLETTER_READ: "newsletter:read",
|
|
170
|
+
NEWSLETTER_DELETE: "newsletter:delete",
|
|
169
171
|
JOB_APPLICATIONS_READ: "job-applications:read",
|
|
170
172
|
OTP_ATTEMPTS_READ: "otp-attempts:read",
|
|
171
173
|
OTP_ATTEMPTS_WRITE: "otp-attempts:write",
|
|
@@ -190,6 +192,8 @@ var PERMISSION_I18N_KEY = {
|
|
|
190
192
|
[Permission.CAREERS_DELETE]: "permissions.careersDelete",
|
|
191
193
|
[Permission.CONTACT_FORM_READ]: "permissions.contactFormRead",
|
|
192
194
|
[Permission.CONTACT_FORM_DELETE]: "permissions.contactFormDelete",
|
|
195
|
+
[Permission.NEWSLETTER_READ]: "permissions.newsletterRead",
|
|
196
|
+
[Permission.NEWSLETTER_DELETE]: "permissions.newsletterDelete",
|
|
193
197
|
[Permission.JOB_APPLICATIONS_READ]: "permissions.jobApplicationsRead",
|
|
194
198
|
[Permission.OTP_ATTEMPTS_READ]: "permissions.otpAttemptsRead",
|
|
195
199
|
[Permission.OTP_ATTEMPTS_WRITE]: "permissions.otpAttemptsWrite",
|
|
@@ -215,6 +219,8 @@ var ROLE_PERMISSIONS = {
|
|
|
215
219
|
Permission.CAREERS_DELETE,
|
|
216
220
|
Permission.CONTACT_FORM_READ,
|
|
217
221
|
Permission.CONTACT_FORM_DELETE,
|
|
222
|
+
Permission.NEWSLETTER_READ,
|
|
223
|
+
Permission.NEWSLETTER_DELETE,
|
|
218
224
|
Permission.JOB_APPLICATIONS_READ,
|
|
219
225
|
Permission.OTP_ATTEMPTS_READ,
|
|
220
226
|
Permission.OTP_ATTEMPTS_WRITE,
|
|
@@ -237,6 +243,8 @@ var ROLE_PERMISSIONS = {
|
|
|
237
243
|
Permission.CAREERS_DELETE,
|
|
238
244
|
Permission.CONTACT_FORM_READ,
|
|
239
245
|
Permission.CONTACT_FORM_DELETE,
|
|
246
|
+
Permission.NEWSLETTER_READ,
|
|
247
|
+
Permission.NEWSLETTER_DELETE,
|
|
240
248
|
Permission.JOB_APPLICATIONS_READ,
|
|
241
249
|
Permission.VIEWS_READ,
|
|
242
250
|
Permission.LOGS_READ,
|
package/package.json
CHANGED
|
@@ -11,3 +11,32 @@ export declare const CONTACT_FORM_ENQUIRY_TYPE: readonly [{
|
|
|
11
11
|
readonly value: "MCN Business";
|
|
12
12
|
readonly i18nKey: "contactForm.enquiryType.3";
|
|
13
13
|
}];
|
|
14
|
+
/** Korre Evolution (site 1): every field maps to a standard column. */
|
|
15
|
+
export type KorreContactFormData = Record<string, never>;
|
|
16
|
+
/** Korre Labs (site 2): no contact form yet. */
|
|
17
|
+
export type KorreLabsContactFormData = Record<string, never>;
|
|
18
|
+
/**
|
|
19
|
+
* MCOM Media (site 3): agency-intake extras beyond the standard columns.
|
|
20
|
+
* `service` is provisional — it may move to `enquiry_type` once the site-3
|
|
21
|
+
* enquiry-type mapping is defined.
|
|
22
|
+
*/
|
|
23
|
+
export interface McomMediaContactFormData {
|
|
24
|
+
company_name?: string;
|
|
25
|
+
job_title?: string;
|
|
26
|
+
phone?: string;
|
|
27
|
+
website?: string;
|
|
28
|
+
country?: string;
|
|
29
|
+
budget?: string;
|
|
30
|
+
service?: string;
|
|
31
|
+
timeline?: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* `contact_form.form_data` shape keyed by `site_id`.
|
|
35
|
+
* 1 = KORRE, 2 = KORRE_LABS, 3 = MCOM_MEDIA (see the `Website` enum).
|
|
36
|
+
*/
|
|
37
|
+
export interface ContactFormDataBySite {
|
|
38
|
+
1: KorreContactFormData;
|
|
39
|
+
2: KorreLabsContactFormData;
|
|
40
|
+
3: McomMediaContactFormData;
|
|
41
|
+
}
|
|
42
|
+
export type ContactFormData = ContactFormDataBySite[keyof ContactFormDataBySite];
|
|
@@ -13,3 +13,46 @@ export const CONTACT_FORM_ENQUIRY_TYPE = [
|
|
|
13
13
|
},
|
|
14
14
|
{ key: 3, value: "MCN Business", i18nKey: "contactForm.enquiryType.3" },
|
|
15
15
|
] as const satisfies readonly MappingOption[];
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Per-site shape of `contact_form.form_data` (jsonb).
|
|
19
|
+
*
|
|
20
|
+
* The standard columns — sender_name, email, enquiry_type, message — live on
|
|
21
|
+
* the row itself. Only the site-specific extra fields are stored in form_data.
|
|
22
|
+
* Keys are snake_case to match the `contact_form` columns.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/** Korre Evolution (site 1): every field maps to a standard column. */
|
|
26
|
+
export type KorreContactFormData = Record<string, never>;
|
|
27
|
+
|
|
28
|
+
/** Korre Labs (site 2): no contact form yet. */
|
|
29
|
+
export type KorreLabsContactFormData = Record<string, never>;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* MCOM Media (site 3): agency-intake extras beyond the standard columns.
|
|
33
|
+
* `service` is provisional — it may move to `enquiry_type` once the site-3
|
|
34
|
+
* enquiry-type mapping is defined.
|
|
35
|
+
*/
|
|
36
|
+
export interface McomMediaContactFormData {
|
|
37
|
+
company_name?: string;
|
|
38
|
+
job_title?: string;
|
|
39
|
+
phone?: string;
|
|
40
|
+
website?: string;
|
|
41
|
+
country?: string;
|
|
42
|
+
budget?: string;
|
|
43
|
+
service?: string;
|
|
44
|
+
timeline?: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* `contact_form.form_data` shape keyed by `site_id`.
|
|
49
|
+
* 1 = KORRE, 2 = KORRE_LABS, 3 = MCOM_MEDIA (see the `Website` enum).
|
|
50
|
+
*/
|
|
51
|
+
export interface ContactFormDataBySite {
|
|
52
|
+
1: KorreContactFormData;
|
|
53
|
+
2: KorreLabsContactFormData;
|
|
54
|
+
3: McomMediaContactFormData;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export type ContactFormData =
|
|
58
|
+
ContactFormDataBySite[keyof ContactFormDataBySite];
|
package/src/roles/index.d.ts
CHANGED
|
@@ -41,6 +41,8 @@ export declare const Permission: {
|
|
|
41
41
|
readonly CAREERS_DELETE: "careers:delete";
|
|
42
42
|
readonly CONTACT_FORM_READ: "contact-form:read";
|
|
43
43
|
readonly CONTACT_FORM_DELETE: "contact-form:delete";
|
|
44
|
+
readonly NEWSLETTER_READ: "newsletter:read";
|
|
45
|
+
readonly NEWSLETTER_DELETE: "newsletter:delete";
|
|
44
46
|
readonly JOB_APPLICATIONS_READ: "job-applications:read";
|
|
45
47
|
readonly OTP_ATTEMPTS_READ: "otp-attempts:read";
|
|
46
48
|
readonly OTP_ATTEMPTS_WRITE: "otp-attempts:write";
|
package/src/roles/index.js
CHANGED
|
@@ -68,6 +68,8 @@ export const Permission = {
|
|
|
68
68
|
CAREERS_DELETE: "careers:delete",
|
|
69
69
|
CONTACT_FORM_READ: "contact-form:read",
|
|
70
70
|
CONTACT_FORM_DELETE: "contact-form:delete",
|
|
71
|
+
NEWSLETTER_READ: "newsletter:read",
|
|
72
|
+
NEWSLETTER_DELETE: "newsletter:delete",
|
|
71
73
|
JOB_APPLICATIONS_READ: "job-applications:read",
|
|
72
74
|
OTP_ATTEMPTS_READ: "otp-attempts:read",
|
|
73
75
|
OTP_ATTEMPTS_WRITE: "otp-attempts:write",
|
|
@@ -92,6 +94,8 @@ export const PERMISSION_I18N_KEY = {
|
|
|
92
94
|
[Permission.CAREERS_DELETE]: "permissions.careersDelete",
|
|
93
95
|
[Permission.CONTACT_FORM_READ]: "permissions.contactFormRead",
|
|
94
96
|
[Permission.CONTACT_FORM_DELETE]: "permissions.contactFormDelete",
|
|
97
|
+
[Permission.NEWSLETTER_READ]: "permissions.newsletterRead",
|
|
98
|
+
[Permission.NEWSLETTER_DELETE]: "permissions.newsletterDelete",
|
|
95
99
|
[Permission.JOB_APPLICATIONS_READ]: "permissions.jobApplicationsRead",
|
|
96
100
|
[Permission.OTP_ATTEMPTS_READ]: "permissions.otpAttemptsRead",
|
|
97
101
|
[Permission.OTP_ATTEMPTS_WRITE]: "permissions.otpAttemptsWrite",
|
|
@@ -117,6 +121,8 @@ export const ROLE_PERMISSIONS = {
|
|
|
117
121
|
Permission.CAREERS_DELETE,
|
|
118
122
|
Permission.CONTACT_FORM_READ,
|
|
119
123
|
Permission.CONTACT_FORM_DELETE,
|
|
124
|
+
Permission.NEWSLETTER_READ,
|
|
125
|
+
Permission.NEWSLETTER_DELETE,
|
|
120
126
|
Permission.JOB_APPLICATIONS_READ,
|
|
121
127
|
Permission.OTP_ATTEMPTS_READ,
|
|
122
128
|
Permission.OTP_ATTEMPTS_WRITE,
|
|
@@ -139,6 +145,8 @@ export const ROLE_PERMISSIONS = {
|
|
|
139
145
|
Permission.CAREERS_DELETE,
|
|
140
146
|
Permission.CONTACT_FORM_READ,
|
|
141
147
|
Permission.CONTACT_FORM_DELETE,
|
|
148
|
+
Permission.NEWSLETTER_READ,
|
|
149
|
+
Permission.NEWSLETTER_DELETE,
|
|
142
150
|
Permission.JOB_APPLICATIONS_READ,
|
|
143
151
|
Permission.VIEWS_READ,
|
|
144
152
|
Permission.LOGS_READ,
|
package/src/roles/index.test.js
CHANGED
|
@@ -40,6 +40,8 @@ assert.deepEqual(ROLE[5], {
|
|
|
40
40
|
});
|
|
41
41
|
assert.equal(PERMISSION_I18N_KEY[Permission.ALLOWED_EMAILS_READ], "permissions.allowedEmailsRead");
|
|
42
42
|
assert.equal(permissionLabelKey(Permission.CONTACT_FORM_DELETE), "permissions.contactFormDelete");
|
|
43
|
+
assert.equal(permissionLabelKey(Permission.NEWSLETTER_READ), "permissions.newsletterRead");
|
|
44
|
+
assert.equal(permissionLabelKey(Permission.NEWSLETTER_DELETE), "permissions.newsletterDelete");
|
|
43
45
|
assert.equal(permissionLabelKey(Permission.OTP_ATTEMPTS_READ), "permissions.otpAttemptsRead");
|
|
44
46
|
assert.equal(permissionLabelKey(Permission.TWO_FACTOR_AUTH_WRITE), "permissions.twoFactorAuthWrite");
|
|
45
47
|
assert.equal(permissionLabelKey(Permission.VIEWS_READ), "permissions.viewsRead");
|
|
@@ -56,7 +58,11 @@ assert.ok(ROLE_PERMISSIONS["super-admin"].includes(Permission.VIEWS_READ));
|
|
|
56
58
|
assert.ok(ROLE_PERMISSIONS["super-admin"].includes(Permission.LOGS_READ));
|
|
57
59
|
assert.ok(ROLE_PERMISSIONS["super-admin"].includes(Permission.UTM_RECORDS_WRITE));
|
|
58
60
|
assert.ok(ROLE_PERMISSIONS["super-admin"].includes(Permission.ORIGIN_DELETE));
|
|
61
|
+
assert.ok(ROLE_PERMISSIONS["super-admin"].includes(Permission.NEWSLETTER_READ));
|
|
62
|
+
assert.ok(ROLE_PERMISSIONS["super-admin"].includes(Permission.NEWSLETTER_DELETE));
|
|
59
63
|
assert.ok(ROLE_PERMISSIONS.admin.includes(Permission.CONTACT_FORM_DELETE));
|
|
64
|
+
assert.ok(ROLE_PERMISSIONS.admin.includes(Permission.NEWSLETTER_READ));
|
|
65
|
+
assert.ok(ROLE_PERMISSIONS.admin.includes(Permission.NEWSLETTER_DELETE));
|
|
60
66
|
assert.ok(ROLE_PERMISSIONS.admin.includes(Permission.VIEWS_READ));
|
|
61
67
|
assert.ok(ROLE_PERMISSIONS.admin.includes(Permission.LOGS_READ));
|
|
62
68
|
assert.ok(ROLE_PERMISSIONS.admin.includes(Permission.UTM_RECORDS_WRITE));
|
|
@@ -75,6 +81,8 @@ assert.equal(hasPermission("staff", Permission.CONTACT_FORM_READ), true);
|
|
|
75
81
|
assert.equal(hasPermission("admin", Permission.VIEWS_READ), true);
|
|
76
82
|
assert.equal(hasPermission("admin", Permission.UTM_RECORDS_WRITE), true);
|
|
77
83
|
assert.equal(hasPermission("admin", Permission.ORIGIN_DELETE), true);
|
|
84
|
+
assert.equal(hasPermission("admin", Permission.NEWSLETTER_DELETE), true);
|
|
85
|
+
assert.equal(hasPermission("staff", Permission.NEWSLETTER_READ), false);
|
|
78
86
|
assert.equal(hasPermission("visitor", Permission.VIEWS_READ), false);
|
|
79
87
|
assert.equal(hasPermission(32767, Permission.LOGS_READ), false);
|
|
80
88
|
assert.equal(hasPermission(undefined, Permission.CAREERS_READ), false);
|
package/src/roles/index.test.ts
CHANGED
|
@@ -62,6 +62,14 @@ assert.equal(
|
|
|
62
62
|
permissionLabelKey(Permission.CONTACT_FORM_DELETE),
|
|
63
63
|
"permissions.contactFormDelete",
|
|
64
64
|
);
|
|
65
|
+
assert.equal(
|
|
66
|
+
permissionLabelKey(Permission.NEWSLETTER_READ),
|
|
67
|
+
"permissions.newsletterRead",
|
|
68
|
+
);
|
|
69
|
+
assert.equal(
|
|
70
|
+
permissionLabelKey(Permission.NEWSLETTER_DELETE),
|
|
71
|
+
"permissions.newsletterDelete",
|
|
72
|
+
);
|
|
65
73
|
assert.equal(
|
|
66
74
|
permissionLabelKey(Permission.OTP_ATTEMPTS_READ),
|
|
67
75
|
"permissions.otpAttemptsRead",
|
|
@@ -101,7 +109,11 @@ assert.ok(
|
|
|
101
109
|
ROLE_PERMISSIONS["super-admin"].includes(Permission.UTM_RECORDS_WRITE),
|
|
102
110
|
);
|
|
103
111
|
assert.ok(ROLE_PERMISSIONS["super-admin"].includes(Permission.ORIGIN_DELETE));
|
|
112
|
+
assert.ok(ROLE_PERMISSIONS["super-admin"].includes(Permission.NEWSLETTER_READ));
|
|
113
|
+
assert.ok(ROLE_PERMISSIONS["super-admin"].includes(Permission.NEWSLETTER_DELETE));
|
|
104
114
|
assert.ok(ROLE_PERMISSIONS.admin.includes(Permission.CONTACT_FORM_DELETE));
|
|
115
|
+
assert.ok(ROLE_PERMISSIONS.admin.includes(Permission.NEWSLETTER_READ));
|
|
116
|
+
assert.ok(ROLE_PERMISSIONS.admin.includes(Permission.NEWSLETTER_DELETE));
|
|
105
117
|
assert.ok(ROLE_PERMISSIONS.admin.includes(Permission.VIEWS_READ));
|
|
106
118
|
assert.ok(ROLE_PERMISSIONS.admin.includes(Permission.LOGS_READ));
|
|
107
119
|
assert.ok(ROLE_PERMISSIONS.admin.includes(Permission.UTM_RECORDS_WRITE));
|
|
@@ -124,6 +136,8 @@ assert.equal(hasPermission("staff", Permission.CONTACT_FORM_READ), true);
|
|
|
124
136
|
assert.equal(hasPermission("admin", Permission.VIEWS_READ), true);
|
|
125
137
|
assert.equal(hasPermission("admin", Permission.UTM_RECORDS_WRITE), true);
|
|
126
138
|
assert.equal(hasPermission("admin", Permission.ORIGIN_DELETE), true);
|
|
139
|
+
assert.equal(hasPermission("admin", Permission.NEWSLETTER_DELETE), true);
|
|
140
|
+
assert.equal(hasPermission("staff", Permission.NEWSLETTER_READ), false);
|
|
127
141
|
assert.equal(hasPermission("visitor", Permission.VIEWS_READ), false);
|
|
128
142
|
assert.equal(hasPermission(32767, Permission.LOGS_READ), false);
|
|
129
143
|
assert.equal(hasPermission(undefined, Permission.CAREERS_READ), false);
|
package/src/roles/index.ts
CHANGED
|
@@ -88,6 +88,8 @@ export const Permission = {
|
|
|
88
88
|
CAREERS_DELETE: "careers:delete",
|
|
89
89
|
CONTACT_FORM_READ: "contact-form:read",
|
|
90
90
|
CONTACT_FORM_DELETE: "contact-form:delete",
|
|
91
|
+
NEWSLETTER_READ: "newsletter:read",
|
|
92
|
+
NEWSLETTER_DELETE: "newsletter:delete",
|
|
91
93
|
JOB_APPLICATIONS_READ: "job-applications:read",
|
|
92
94
|
OTP_ATTEMPTS_READ: "otp-attempts:read",
|
|
93
95
|
OTP_ATTEMPTS_WRITE: "otp-attempts:write",
|
|
@@ -115,6 +117,8 @@ export const PERMISSION_I18N_KEY: Record<Permission, string> = {
|
|
|
115
117
|
[Permission.CAREERS_DELETE]: "permissions.careersDelete",
|
|
116
118
|
[Permission.CONTACT_FORM_READ]: "permissions.contactFormRead",
|
|
117
119
|
[Permission.CONTACT_FORM_DELETE]: "permissions.contactFormDelete",
|
|
120
|
+
[Permission.NEWSLETTER_READ]: "permissions.newsletterRead",
|
|
121
|
+
[Permission.NEWSLETTER_DELETE]: "permissions.newsletterDelete",
|
|
118
122
|
[Permission.JOB_APPLICATIONS_READ]: "permissions.jobApplicationsRead",
|
|
119
123
|
[Permission.OTP_ATTEMPTS_READ]: "permissions.otpAttemptsRead",
|
|
120
124
|
[Permission.OTP_ATTEMPTS_WRITE]: "permissions.otpAttemptsWrite",
|
|
@@ -141,6 +145,8 @@ export const ROLE_PERMISSIONS: Record<CanonicalRole, Permission[]> = {
|
|
|
141
145
|
Permission.CAREERS_DELETE,
|
|
142
146
|
Permission.CONTACT_FORM_READ,
|
|
143
147
|
Permission.CONTACT_FORM_DELETE,
|
|
148
|
+
Permission.NEWSLETTER_READ,
|
|
149
|
+
Permission.NEWSLETTER_DELETE,
|
|
144
150
|
Permission.JOB_APPLICATIONS_READ,
|
|
145
151
|
Permission.OTP_ATTEMPTS_READ,
|
|
146
152
|
Permission.OTP_ATTEMPTS_WRITE,
|
|
@@ -163,6 +169,8 @@ export const ROLE_PERMISSIONS: Record<CanonicalRole, Permission[]> = {
|
|
|
163
169
|
Permission.CAREERS_DELETE,
|
|
164
170
|
Permission.CONTACT_FORM_READ,
|
|
165
171
|
Permission.CONTACT_FORM_DELETE,
|
|
172
|
+
Permission.NEWSLETTER_READ,
|
|
173
|
+
Permission.NEWSLETTER_DELETE,
|
|
166
174
|
Permission.JOB_APPLICATIONS_READ,
|
|
167
175
|
Permission.VIEWS_READ,
|
|
168
176
|
Permission.LOGS_READ,
|