@yangsaiyam/helper 1.14.0 → 1.16.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/README.md CHANGED
@@ -76,6 +76,7 @@ src/
76
76
  - `routeLabelKey`
77
77
  - `routePathKey`
78
78
  - `CONTACT_FORM_ENQUIRY_TYPE`
79
+ - `CONTACT_FORM_ENQUIRY_TYPE_BY_SITE`
79
80
  - `FILE_STATUS`
80
81
  - `FILE_ORIGIN`
81
82
  - `getOptionByKey`
package/dist/index.cjs CHANGED
@@ -36,6 +36,7 @@ __export(index_exports, {
36
36
  CAREER_LOCATION: () => CAREER_LOCATION,
37
37
  CAREER_MODE: () => CAREER_MODE,
38
38
  CONTACT_FORM_ENQUIRY_TYPE: () => CONTACT_FORM_ENQUIRY_TYPE,
39
+ CONTACT_FORM_ENQUIRY_TYPE_BY_SITE: () => CONTACT_FORM_ENQUIRY_TYPE_BY_SITE,
39
40
  COUNTRY_CODE: () => COUNTRY_CODE,
40
41
  EMAIL_HISTORY_STATUS: () => EMAIL_HISTORY_STATUS,
41
42
  EMAIL_TEMPLATE_ROLES: () => EMAIL_TEMPLATE_ROLES,
@@ -146,8 +147,33 @@ var CAREER_LOCATION = [
146
147
  { key: 15, value: "Labuan", i18nKey: "career.location.15" }
147
148
  ];
148
149
 
150
+ // src/website/index.js
151
+ var Website;
152
+ (function(Website3) {
153
+ Website3[Website3["KORRE"] = 1] = "KORRE";
154
+ Website3[Website3["KORRE_LABS"] = 2] = "KORRE_LABS";
155
+ Website3[Website3["MCOM_MEDIA"] = 3] = "MCOM_MEDIA";
156
+ })(Website || (Website = {}));
157
+ var WEBSITES = {
158
+ [Website.KORRE]: {
159
+ id: Website.KORRE,
160
+ name: "Korre Evolution",
161
+ url: "https://public.korre.site/images/korre-evo.png"
162
+ },
163
+ [Website.KORRE_LABS]: {
164
+ id: Website.KORRE_LABS,
165
+ name: "Korre Labs",
166
+ url: "https://public.korre.site/images/korre-labs.png"
167
+ },
168
+ [Website.MCOM_MEDIA]: {
169
+ id: Website.MCOM_MEDIA,
170
+ name: "MCOM Media",
171
+ url: "https://public.korre.site/images/mcom-media.png"
172
+ }
173
+ };
174
+
149
175
  // src/contact-form/index.ts
150
- var CONTACT_FORM_ENQUIRY_TYPE = [
176
+ var KORRE_ENQUIRY_TYPE = [
151
177
  {
152
178
  key: 1,
153
179
  value: "Software Development",
@@ -160,6 +186,44 @@ var CONTACT_FORM_ENQUIRY_TYPE = [
160
186
  },
161
187
  { key: 3, value: "MCN Business", i18nKey: "contactForm.enquiryType.3" }
162
188
  ];
189
+ var MCOM_MEDIA_ENQUIRY_TYPE = [
190
+ {
191
+ key: 1,
192
+ value: "Media Buying",
193
+ i18nKey: "contactForm.enquiryType.mcomMedia.1"
194
+ },
195
+ {
196
+ key: 2,
197
+ value: "Creative Production",
198
+ i18nKey: "contactForm.enquiryType.mcomMedia.2"
199
+ },
200
+ {
201
+ key: 3,
202
+ value: "Influencer Marketing",
203
+ i18nKey: "contactForm.enquiryType.mcomMedia.3"
204
+ },
205
+ {
206
+ key: 4,
207
+ value: "Landing Page Optimization",
208
+ i18nKey: "contactForm.enquiryType.mcomMedia.4"
209
+ },
210
+ {
211
+ key: 5,
212
+ value: "Full Service",
213
+ i18nKey: "contactForm.enquiryType.mcomMedia.5"
214
+ },
215
+ {
216
+ key: 6,
217
+ value: "Not Sure",
218
+ i18nKey: "contactForm.enquiryType.mcomMedia.6"
219
+ }
220
+ ];
221
+ var CONTACT_FORM_ENQUIRY_TYPE = KORRE_ENQUIRY_TYPE;
222
+ var CONTACT_FORM_ENQUIRY_TYPE_BY_SITE = {
223
+ [Website.KORRE]: KORRE_ENQUIRY_TYPE,
224
+ [Website.KORRE_LABS]: [],
225
+ [Website.MCOM_MEDIA]: MCOM_MEDIA_ENQUIRY_TYPE
226
+ };
163
227
 
164
228
  // src/files/index.ts
165
229
  var FILE_STATUS = [
@@ -248,6 +312,8 @@ var Permission = {
248
312
  CAREERS_DELETE: "careers:delete",
249
313
  CONTACT_FORM_READ: "contact-form:read",
250
314
  CONTACT_FORM_DELETE: "contact-form:delete",
315
+ NEWSLETTER_READ: "newsletter:read",
316
+ NEWSLETTER_DELETE: "newsletter:delete",
251
317
  JOB_APPLICATIONS_READ: "job-applications:read",
252
318
  OTP_ATTEMPTS_READ: "otp-attempts:read",
253
319
  OTP_ATTEMPTS_WRITE: "otp-attempts:write",
@@ -272,6 +338,8 @@ var PERMISSION_I18N_KEY = {
272
338
  [Permission.CAREERS_DELETE]: "permissions.careersDelete",
273
339
  [Permission.CONTACT_FORM_READ]: "permissions.contactFormRead",
274
340
  [Permission.CONTACT_FORM_DELETE]: "permissions.contactFormDelete",
341
+ [Permission.NEWSLETTER_READ]: "permissions.newsletterRead",
342
+ [Permission.NEWSLETTER_DELETE]: "permissions.newsletterDelete",
275
343
  [Permission.JOB_APPLICATIONS_READ]: "permissions.jobApplicationsRead",
276
344
  [Permission.OTP_ATTEMPTS_READ]: "permissions.otpAttemptsRead",
277
345
  [Permission.OTP_ATTEMPTS_WRITE]: "permissions.otpAttemptsWrite",
@@ -297,6 +365,8 @@ var ROLE_PERMISSIONS = {
297
365
  Permission.CAREERS_DELETE,
298
366
  Permission.CONTACT_FORM_READ,
299
367
  Permission.CONTACT_FORM_DELETE,
368
+ Permission.NEWSLETTER_READ,
369
+ Permission.NEWSLETTER_DELETE,
300
370
  Permission.JOB_APPLICATIONS_READ,
301
371
  Permission.OTP_ATTEMPTS_READ,
302
372
  Permission.OTP_ATTEMPTS_WRITE,
@@ -319,6 +389,8 @@ var ROLE_PERMISSIONS = {
319
389
  Permission.CAREERS_DELETE,
320
390
  Permission.CONTACT_FORM_READ,
321
391
  Permission.CONTACT_FORM_DELETE,
392
+ Permission.NEWSLETTER_READ,
393
+ Permission.NEWSLETTER_DELETE,
322
394
  Permission.JOB_APPLICATIONS_READ,
323
395
  Permission.VIEWS_READ,
324
396
  Permission.LOGS_READ,
@@ -659,31 +731,6 @@ var ORIGIN = [
659
731
  { key: 3, value: "Maukerja", i18nKey: "track.origin.3" }
660
732
  ];
661
733
 
662
- // src/website/index.js
663
- var Website;
664
- (function(Website3) {
665
- Website3[Website3["KORRE"] = 1] = "KORRE";
666
- Website3[Website3["KORRE_LABS"] = 2] = "KORRE_LABS";
667
- Website3[Website3["MCOM_MEDIA"] = 3] = "MCOM_MEDIA";
668
- })(Website || (Website = {}));
669
- var WEBSITES = {
670
- [Website.KORRE]: {
671
- id: Website.KORRE,
672
- name: "Korre Evolution",
673
- url: "https://public.korre.site/images/korre-evo.png"
674
- },
675
- [Website.KORRE_LABS]: {
676
- id: Website.KORRE_LABS,
677
- name: "Korre Labs",
678
- url: "https://public.korre.site/images/korre-labs.png"
679
- },
680
- [Website.MCOM_MEDIA]: {
681
- id: Website.MCOM_MEDIA,
682
- name: "MCOM Media",
683
- url: "https://public.korre.site/images/mcom-media.png"
684
- }
685
- };
686
-
687
734
  // src/url-prefix/index.ts
688
735
  var URL_PREFIXES = {
689
736
  [Website.KORRE]: {
@@ -780,6 +827,7 @@ var EMAIL_HISTORY_STATUS = [
780
827
  CAREER_LOCATION,
781
828
  CAREER_MODE,
782
829
  CONTACT_FORM_ENQUIRY_TYPE,
830
+ CONTACT_FORM_ENQUIRY_TYPE_BY_SITE,
783
831
  COUNTRY_CODE,
784
832
  EMAIL_HISTORY_STATUS,
785
833
  EMAIL_TEMPLATE_ROLES,
package/dist/index.d.cts CHANGED
@@ -151,7 +151,30 @@ declare const CAREER_LOCATION: readonly [{
151
151
  readonly i18nKey: "career.location.15";
152
152
  }];
153
153
 
154
- declare const CONTACT_FORM_ENQUIRY_TYPE: readonly [{
154
+ declare enum Website {
155
+ KORRE = 1,
156
+ KORRE_LABS = 2,
157
+ MCOM_MEDIA = 3
158
+ }
159
+ declare const WEBSITES: {
160
+ 1: {
161
+ id: Website;
162
+ name: string;
163
+ url: string;
164
+ };
165
+ 2: {
166
+ id: Website;
167
+ name: string;
168
+ url: string;
169
+ };
170
+ 3: {
171
+ id: Website;
172
+ name: string;
173
+ url: string;
174
+ };
175
+ };
176
+
177
+ declare const KORRE_ENQUIRY_TYPE: readonly [{
155
178
  readonly key: 1;
156
179
  readonly value: "Software Development";
157
180
  readonly i18nKey: "contactForm.enquiryType.1";
@@ -164,14 +187,45 @@ declare const CONTACT_FORM_ENQUIRY_TYPE: readonly [{
164
187
  readonly value: "MCN Business";
165
188
  readonly i18nKey: "contactForm.enquiryType.3";
166
189
  }];
190
+ declare const MCOM_MEDIA_ENQUIRY_TYPE: readonly [{
191
+ readonly key: 1;
192
+ readonly value: "Media Buying";
193
+ readonly i18nKey: "contactForm.enquiryType.mcomMedia.1";
194
+ }, {
195
+ readonly key: 2;
196
+ readonly value: "Creative Production";
197
+ readonly i18nKey: "contactForm.enquiryType.mcomMedia.2";
198
+ }, {
199
+ readonly key: 3;
200
+ readonly value: "Influencer Marketing";
201
+ readonly i18nKey: "contactForm.enquiryType.mcomMedia.3";
202
+ }, {
203
+ readonly key: 4;
204
+ readonly value: "Landing Page Optimization";
205
+ readonly i18nKey: "contactForm.enquiryType.mcomMedia.4";
206
+ }, {
207
+ readonly key: 5;
208
+ readonly value: "Full Service";
209
+ readonly i18nKey: "contactForm.enquiryType.mcomMedia.5";
210
+ }, {
211
+ readonly key: 6;
212
+ readonly value: "Not Sure";
213
+ readonly i18nKey: "contactForm.enquiryType.mcomMedia.6";
214
+ }];
215
+ declare const CONTACT_FORM_ENQUIRY_TYPE: typeof KORRE_ENQUIRY_TYPE;
216
+ declare const CONTACT_FORM_ENQUIRY_TYPE_BY_SITE: {
217
+ readonly [Website.KORRE]: typeof KORRE_ENQUIRY_TYPE;
218
+ readonly [Website.KORRE_LABS]: readonly [];
219
+ readonly [Website.MCOM_MEDIA]: typeof MCOM_MEDIA_ENQUIRY_TYPE;
220
+ };
167
221
  /** Korre Evolution (site 1): every field maps to a standard column. */
168
222
  type KorreContactFormData = Record<string, never>;
169
223
  /** Korre Labs (site 2): no contact form yet. */
170
224
  type KorreLabsContactFormData = Record<string, never>;
171
225
  /**
172
226
  * 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.
227
+ * The "Service Interested" dropdown is the standard `enquiry_type` column
228
+ * (see CONTACT_FORM_ENQUIRY_TYPE_BY_SITE), not a form_data field.
175
229
  */
176
230
  interface McomMediaContactFormData {
177
231
  company_name?: string;
@@ -180,7 +234,6 @@ interface McomMediaContactFormData {
180
234
  website?: string;
181
235
  country?: string;
182
236
  budget?: string;
183
- service?: string;
184
237
  timeline?: string;
185
238
  }
186
239
  /**
@@ -266,6 +319,8 @@ declare const Permission: {
266
319
  readonly CAREERS_DELETE: "careers:delete";
267
320
  readonly CONTACT_FORM_READ: "contact-form:read";
268
321
  readonly CONTACT_FORM_DELETE: "contact-form:delete";
322
+ readonly NEWSLETTER_READ: "newsletter:read";
323
+ readonly NEWSLETTER_DELETE: "newsletter:delete";
269
324
  readonly JOB_APPLICATIONS_READ: "job-applications:read";
270
325
  readonly OTP_ATTEMPTS_READ: "otp-attempts:read";
271
326
  readonly OTP_ATTEMPTS_WRITE: "otp-attempts:write";
@@ -478,29 +533,6 @@ declare const URL_PREFIXES: {
478
533
  2: {};
479
534
  };
480
535
 
481
- declare enum Website {
482
- KORRE = 1,
483
- KORRE_LABS = 2,
484
- MCOM_MEDIA = 3
485
- }
486
- declare const WEBSITES: {
487
- 1: {
488
- id: Website;
489
- name: string;
490
- url: string;
491
- };
492
- 2: {
493
- id: Website;
494
- name: string;
495
- url: string;
496
- };
497
- 3: {
498
- id: Website;
499
- name: string;
500
- url: string;
501
- };
502
- };
503
-
504
536
  declare const COUNTRY_CODE: readonly [{
505
537
  readonly key: 1;
506
538
  readonly value: "MY";
@@ -709,4 +741,4 @@ declare const EMAIL_HISTORY_STATUS: readonly [{
709
741
  readonly i18nKey: "emailHistory.status.4";
710
742
  }];
711
743
 
712
- 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 };
744
+ export { ASSESSMENT_QUESTION_TYPE, CAREER_CATEGORY, CAREER_JOB_TYPE, CAREER_LOCATION, CAREER_MODE, CONTACT_FORM_ENQUIRY_TYPE, CONTACT_FORM_ENQUIRY_TYPE_BY_SITE, 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
@@ -151,7 +151,30 @@ declare const CAREER_LOCATION: readonly [{
151
151
  readonly i18nKey: "career.location.15";
152
152
  }];
153
153
 
154
- declare const CONTACT_FORM_ENQUIRY_TYPE: readonly [{
154
+ declare enum Website {
155
+ KORRE = 1,
156
+ KORRE_LABS = 2,
157
+ MCOM_MEDIA = 3
158
+ }
159
+ declare const WEBSITES: {
160
+ 1: {
161
+ id: Website;
162
+ name: string;
163
+ url: string;
164
+ };
165
+ 2: {
166
+ id: Website;
167
+ name: string;
168
+ url: string;
169
+ };
170
+ 3: {
171
+ id: Website;
172
+ name: string;
173
+ url: string;
174
+ };
175
+ };
176
+
177
+ declare const KORRE_ENQUIRY_TYPE: readonly [{
155
178
  readonly key: 1;
156
179
  readonly value: "Software Development";
157
180
  readonly i18nKey: "contactForm.enquiryType.1";
@@ -164,14 +187,45 @@ declare const CONTACT_FORM_ENQUIRY_TYPE: readonly [{
164
187
  readonly value: "MCN Business";
165
188
  readonly i18nKey: "contactForm.enquiryType.3";
166
189
  }];
190
+ declare const MCOM_MEDIA_ENQUIRY_TYPE: readonly [{
191
+ readonly key: 1;
192
+ readonly value: "Media Buying";
193
+ readonly i18nKey: "contactForm.enquiryType.mcomMedia.1";
194
+ }, {
195
+ readonly key: 2;
196
+ readonly value: "Creative Production";
197
+ readonly i18nKey: "contactForm.enquiryType.mcomMedia.2";
198
+ }, {
199
+ readonly key: 3;
200
+ readonly value: "Influencer Marketing";
201
+ readonly i18nKey: "contactForm.enquiryType.mcomMedia.3";
202
+ }, {
203
+ readonly key: 4;
204
+ readonly value: "Landing Page Optimization";
205
+ readonly i18nKey: "contactForm.enquiryType.mcomMedia.4";
206
+ }, {
207
+ readonly key: 5;
208
+ readonly value: "Full Service";
209
+ readonly i18nKey: "contactForm.enquiryType.mcomMedia.5";
210
+ }, {
211
+ readonly key: 6;
212
+ readonly value: "Not Sure";
213
+ readonly i18nKey: "contactForm.enquiryType.mcomMedia.6";
214
+ }];
215
+ declare const CONTACT_FORM_ENQUIRY_TYPE: typeof KORRE_ENQUIRY_TYPE;
216
+ declare const CONTACT_FORM_ENQUIRY_TYPE_BY_SITE: {
217
+ readonly [Website.KORRE]: typeof KORRE_ENQUIRY_TYPE;
218
+ readonly [Website.KORRE_LABS]: readonly [];
219
+ readonly [Website.MCOM_MEDIA]: typeof MCOM_MEDIA_ENQUIRY_TYPE;
220
+ };
167
221
  /** Korre Evolution (site 1): every field maps to a standard column. */
168
222
  type KorreContactFormData = Record<string, never>;
169
223
  /** Korre Labs (site 2): no contact form yet. */
170
224
  type KorreLabsContactFormData = Record<string, never>;
171
225
  /**
172
226
  * 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.
227
+ * The "Service Interested" dropdown is the standard `enquiry_type` column
228
+ * (see CONTACT_FORM_ENQUIRY_TYPE_BY_SITE), not a form_data field.
175
229
  */
176
230
  interface McomMediaContactFormData {
177
231
  company_name?: string;
@@ -180,7 +234,6 @@ interface McomMediaContactFormData {
180
234
  website?: string;
181
235
  country?: string;
182
236
  budget?: string;
183
- service?: string;
184
237
  timeline?: string;
185
238
  }
186
239
  /**
@@ -266,6 +319,8 @@ declare const Permission: {
266
319
  readonly CAREERS_DELETE: "careers:delete";
267
320
  readonly CONTACT_FORM_READ: "contact-form:read";
268
321
  readonly CONTACT_FORM_DELETE: "contact-form:delete";
322
+ readonly NEWSLETTER_READ: "newsletter:read";
323
+ readonly NEWSLETTER_DELETE: "newsletter:delete";
269
324
  readonly JOB_APPLICATIONS_READ: "job-applications:read";
270
325
  readonly OTP_ATTEMPTS_READ: "otp-attempts:read";
271
326
  readonly OTP_ATTEMPTS_WRITE: "otp-attempts:write";
@@ -478,29 +533,6 @@ declare const URL_PREFIXES: {
478
533
  2: {};
479
534
  };
480
535
 
481
- declare enum Website {
482
- KORRE = 1,
483
- KORRE_LABS = 2,
484
- MCOM_MEDIA = 3
485
- }
486
- declare const WEBSITES: {
487
- 1: {
488
- id: Website;
489
- name: string;
490
- url: string;
491
- };
492
- 2: {
493
- id: Website;
494
- name: string;
495
- url: string;
496
- };
497
- 3: {
498
- id: Website;
499
- name: string;
500
- url: string;
501
- };
502
- };
503
-
504
536
  declare const COUNTRY_CODE: readonly [{
505
537
  readonly key: 1;
506
538
  readonly value: "MY";
@@ -709,4 +741,4 @@ declare const EMAIL_HISTORY_STATUS: readonly [{
709
741
  readonly i18nKey: "emailHistory.status.4";
710
742
  }];
711
743
 
712
- 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 };
744
+ export { ASSESSMENT_QUESTION_TYPE, CAREER_CATEGORY, CAREER_JOB_TYPE, CAREER_LOCATION, CAREER_MODE, CONTACT_FORM_ENQUIRY_TYPE, CONTACT_FORM_ENQUIRY_TYPE_BY_SITE, 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
@@ -64,8 +64,33 @@ var CAREER_LOCATION = [
64
64
  { key: 15, value: "Labuan", i18nKey: "career.location.15" }
65
65
  ];
66
66
 
67
+ // src/website/index.js
68
+ var Website;
69
+ (function(Website3) {
70
+ Website3[Website3["KORRE"] = 1] = "KORRE";
71
+ Website3[Website3["KORRE_LABS"] = 2] = "KORRE_LABS";
72
+ Website3[Website3["MCOM_MEDIA"] = 3] = "MCOM_MEDIA";
73
+ })(Website || (Website = {}));
74
+ var WEBSITES = {
75
+ [Website.KORRE]: {
76
+ id: Website.KORRE,
77
+ name: "Korre Evolution",
78
+ url: "https://public.korre.site/images/korre-evo.png"
79
+ },
80
+ [Website.KORRE_LABS]: {
81
+ id: Website.KORRE_LABS,
82
+ name: "Korre Labs",
83
+ url: "https://public.korre.site/images/korre-labs.png"
84
+ },
85
+ [Website.MCOM_MEDIA]: {
86
+ id: Website.MCOM_MEDIA,
87
+ name: "MCOM Media",
88
+ url: "https://public.korre.site/images/mcom-media.png"
89
+ }
90
+ };
91
+
67
92
  // src/contact-form/index.ts
68
- var CONTACT_FORM_ENQUIRY_TYPE = [
93
+ var KORRE_ENQUIRY_TYPE = [
69
94
  {
70
95
  key: 1,
71
96
  value: "Software Development",
@@ -78,6 +103,44 @@ var CONTACT_FORM_ENQUIRY_TYPE = [
78
103
  },
79
104
  { key: 3, value: "MCN Business", i18nKey: "contactForm.enquiryType.3" }
80
105
  ];
106
+ var MCOM_MEDIA_ENQUIRY_TYPE = [
107
+ {
108
+ key: 1,
109
+ value: "Media Buying",
110
+ i18nKey: "contactForm.enquiryType.mcomMedia.1"
111
+ },
112
+ {
113
+ key: 2,
114
+ value: "Creative Production",
115
+ i18nKey: "contactForm.enquiryType.mcomMedia.2"
116
+ },
117
+ {
118
+ key: 3,
119
+ value: "Influencer Marketing",
120
+ i18nKey: "contactForm.enquiryType.mcomMedia.3"
121
+ },
122
+ {
123
+ key: 4,
124
+ value: "Landing Page Optimization",
125
+ i18nKey: "contactForm.enquiryType.mcomMedia.4"
126
+ },
127
+ {
128
+ key: 5,
129
+ value: "Full Service",
130
+ i18nKey: "contactForm.enquiryType.mcomMedia.5"
131
+ },
132
+ {
133
+ key: 6,
134
+ value: "Not Sure",
135
+ i18nKey: "contactForm.enquiryType.mcomMedia.6"
136
+ }
137
+ ];
138
+ var CONTACT_FORM_ENQUIRY_TYPE = KORRE_ENQUIRY_TYPE;
139
+ var CONTACT_FORM_ENQUIRY_TYPE_BY_SITE = {
140
+ [Website.KORRE]: KORRE_ENQUIRY_TYPE,
141
+ [Website.KORRE_LABS]: [],
142
+ [Website.MCOM_MEDIA]: MCOM_MEDIA_ENQUIRY_TYPE
143
+ };
81
144
 
82
145
  // src/files/index.ts
83
146
  var FILE_STATUS = [
@@ -166,6 +229,8 @@ var Permission = {
166
229
  CAREERS_DELETE: "careers:delete",
167
230
  CONTACT_FORM_READ: "contact-form:read",
168
231
  CONTACT_FORM_DELETE: "contact-form:delete",
232
+ NEWSLETTER_READ: "newsletter:read",
233
+ NEWSLETTER_DELETE: "newsletter:delete",
169
234
  JOB_APPLICATIONS_READ: "job-applications:read",
170
235
  OTP_ATTEMPTS_READ: "otp-attempts:read",
171
236
  OTP_ATTEMPTS_WRITE: "otp-attempts:write",
@@ -190,6 +255,8 @@ var PERMISSION_I18N_KEY = {
190
255
  [Permission.CAREERS_DELETE]: "permissions.careersDelete",
191
256
  [Permission.CONTACT_FORM_READ]: "permissions.contactFormRead",
192
257
  [Permission.CONTACT_FORM_DELETE]: "permissions.contactFormDelete",
258
+ [Permission.NEWSLETTER_READ]: "permissions.newsletterRead",
259
+ [Permission.NEWSLETTER_DELETE]: "permissions.newsletterDelete",
193
260
  [Permission.JOB_APPLICATIONS_READ]: "permissions.jobApplicationsRead",
194
261
  [Permission.OTP_ATTEMPTS_READ]: "permissions.otpAttemptsRead",
195
262
  [Permission.OTP_ATTEMPTS_WRITE]: "permissions.otpAttemptsWrite",
@@ -215,6 +282,8 @@ var ROLE_PERMISSIONS = {
215
282
  Permission.CAREERS_DELETE,
216
283
  Permission.CONTACT_FORM_READ,
217
284
  Permission.CONTACT_FORM_DELETE,
285
+ Permission.NEWSLETTER_READ,
286
+ Permission.NEWSLETTER_DELETE,
218
287
  Permission.JOB_APPLICATIONS_READ,
219
288
  Permission.OTP_ATTEMPTS_READ,
220
289
  Permission.OTP_ATTEMPTS_WRITE,
@@ -237,6 +306,8 @@ var ROLE_PERMISSIONS = {
237
306
  Permission.CAREERS_DELETE,
238
307
  Permission.CONTACT_FORM_READ,
239
308
  Permission.CONTACT_FORM_DELETE,
309
+ Permission.NEWSLETTER_READ,
310
+ Permission.NEWSLETTER_DELETE,
240
311
  Permission.JOB_APPLICATIONS_READ,
241
312
  Permission.VIEWS_READ,
242
313
  Permission.LOGS_READ,
@@ -577,31 +648,6 @@ var ORIGIN = [
577
648
  { key: 3, value: "Maukerja", i18nKey: "track.origin.3" }
578
649
  ];
579
650
 
580
- // src/website/index.js
581
- var Website;
582
- (function(Website3) {
583
- Website3[Website3["KORRE"] = 1] = "KORRE";
584
- Website3[Website3["KORRE_LABS"] = 2] = "KORRE_LABS";
585
- Website3[Website3["MCOM_MEDIA"] = 3] = "MCOM_MEDIA";
586
- })(Website || (Website = {}));
587
- var WEBSITES = {
588
- [Website.KORRE]: {
589
- id: Website.KORRE,
590
- name: "Korre Evolution",
591
- url: "https://public.korre.site/images/korre-evo.png"
592
- },
593
- [Website.KORRE_LABS]: {
594
- id: Website.KORRE_LABS,
595
- name: "Korre Labs",
596
- url: "https://public.korre.site/images/korre-labs.png"
597
- },
598
- [Website.MCOM_MEDIA]: {
599
- id: Website.MCOM_MEDIA,
600
- name: "MCOM Media",
601
- url: "https://public.korre.site/images/mcom-media.png"
602
- }
603
- };
604
-
605
651
  // src/url-prefix/index.ts
606
652
  var URL_PREFIXES = {
607
653
  [Website.KORRE]: {
@@ -697,6 +743,7 @@ export {
697
743
  CAREER_LOCATION,
698
744
  CAREER_MODE,
699
745
  CONTACT_FORM_ENQUIRY_TYPE,
746
+ CONTACT_FORM_ENQUIRY_TYPE_BY_SITE,
700
747
  COUNTRY_CODE,
701
748
  EMAIL_HISTORY_STATUS,
702
749
  EMAIL_TEMPLATE_ROLES,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yangsaiyam/helper",
3
- "version": "1.14.0",
3
+ "version": "1.16.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
@@ -1,4 +1,5 @@
1
- export declare const CONTACT_FORM_ENQUIRY_TYPE: readonly [{
1
+ import { Website } from "../website/index.js";
2
+ declare const KORRE_ENQUIRY_TYPE: readonly [{
2
3
  readonly key: 1;
3
4
  readonly value: "Software Development";
4
5
  readonly i18nKey: "contactForm.enquiryType.1";
@@ -11,14 +12,45 @@ export declare const CONTACT_FORM_ENQUIRY_TYPE: readonly [{
11
12
  readonly value: "MCN Business";
12
13
  readonly i18nKey: "contactForm.enquiryType.3";
13
14
  }];
15
+ declare const MCOM_MEDIA_ENQUIRY_TYPE: readonly [{
16
+ readonly key: 1;
17
+ readonly value: "Media Buying";
18
+ readonly i18nKey: "contactForm.enquiryType.mcomMedia.1";
19
+ }, {
20
+ readonly key: 2;
21
+ readonly value: "Creative Production";
22
+ readonly i18nKey: "contactForm.enquiryType.mcomMedia.2";
23
+ }, {
24
+ readonly key: 3;
25
+ readonly value: "Influencer Marketing";
26
+ readonly i18nKey: "contactForm.enquiryType.mcomMedia.3";
27
+ }, {
28
+ readonly key: 4;
29
+ readonly value: "Landing Page Optimization";
30
+ readonly i18nKey: "contactForm.enquiryType.mcomMedia.4";
31
+ }, {
32
+ readonly key: 5;
33
+ readonly value: "Full Service";
34
+ readonly i18nKey: "contactForm.enquiryType.mcomMedia.5";
35
+ }, {
36
+ readonly key: 6;
37
+ readonly value: "Not Sure";
38
+ readonly i18nKey: "contactForm.enquiryType.mcomMedia.6";
39
+ }];
40
+ export declare const CONTACT_FORM_ENQUIRY_TYPE: typeof KORRE_ENQUIRY_TYPE;
41
+ export declare const CONTACT_FORM_ENQUIRY_TYPE_BY_SITE: {
42
+ readonly [Website.KORRE]: typeof KORRE_ENQUIRY_TYPE;
43
+ readonly [Website.KORRE_LABS]: readonly [];
44
+ readonly [Website.MCOM_MEDIA]: typeof MCOM_MEDIA_ENQUIRY_TYPE;
45
+ };
14
46
  /** Korre Evolution (site 1): every field maps to a standard column. */
15
47
  export type KorreContactFormData = Record<string, never>;
16
48
  /** Korre Labs (site 2): no contact form yet. */
17
49
  export type KorreLabsContactFormData = Record<string, never>;
18
50
  /**
19
51
  * 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.
52
+ * The "Service Interested" dropdown is the standard `enquiry_type` column
53
+ * (see CONTACT_FORM_ENQUIRY_TYPE_BY_SITE), not a form_data field.
22
54
  */
23
55
  export interface McomMediaContactFormData {
24
56
  company_name?: string;
@@ -27,7 +59,6 @@ export interface McomMediaContactFormData {
27
59
  website?: string;
28
60
  country?: string;
29
61
  budget?: string;
30
- service?: string;
31
62
  timeline?: string;
32
63
  }
33
64
  /**
@@ -40,3 +71,4 @@ export interface ContactFormDataBySite {
40
71
  3: McomMediaContactFormData;
41
72
  }
42
73
  export type ContactFormData = ContactFormDataBySite[keyof ContactFormDataBySite];
74
+ export {};
@@ -1,4 +1,5 @@
1
- export const CONTACT_FORM_ENQUIRY_TYPE = [
1
+ import { Website } from "../website/index.js";
2
+ const KORRE_ENQUIRY_TYPE = [
2
3
  {
3
4
  key: 1,
4
5
  value: "Software Development",
@@ -11,3 +12,41 @@ export const CONTACT_FORM_ENQUIRY_TYPE = [
11
12
  },
12
13
  { key: 3, value: "MCN Business", i18nKey: "contactForm.enquiryType.3" },
13
14
  ];
15
+ const MCOM_MEDIA_ENQUIRY_TYPE = [
16
+ {
17
+ key: 1,
18
+ value: "Media Buying",
19
+ i18nKey: "contactForm.enquiryType.mcomMedia.1",
20
+ },
21
+ {
22
+ key: 2,
23
+ value: "Creative Production",
24
+ i18nKey: "contactForm.enquiryType.mcomMedia.2",
25
+ },
26
+ {
27
+ key: 3,
28
+ value: "Influencer Marketing",
29
+ i18nKey: "contactForm.enquiryType.mcomMedia.3",
30
+ },
31
+ {
32
+ key: 4,
33
+ value: "Landing Page Optimization",
34
+ i18nKey: "contactForm.enquiryType.mcomMedia.4",
35
+ },
36
+ {
37
+ key: 5,
38
+ value: "Full Service",
39
+ i18nKey: "contactForm.enquiryType.mcomMedia.5",
40
+ },
41
+ {
42
+ key: 6,
43
+ value: "Not Sure",
44
+ i18nKey: "contactForm.enquiryType.mcomMedia.6",
45
+ },
46
+ ];
47
+ export const CONTACT_FORM_ENQUIRY_TYPE = KORRE_ENQUIRY_TYPE;
48
+ export const CONTACT_FORM_ENQUIRY_TYPE_BY_SITE = {
49
+ [Website.KORRE]: KORRE_ENQUIRY_TYPE,
50
+ [Website.KORRE_LABS]: [],
51
+ [Website.MCOM_MEDIA]: MCOM_MEDIA_ENQUIRY_TYPE,
52
+ };
@@ -1,6 +1,13 @@
1
1
  import type { MappingOption } from "../shared/types.js";
2
+ import { Website } from "../website/index.js";
2
3
 
3
- export const CONTACT_FORM_ENQUIRY_TYPE = [
4
+ /**
5
+ * Korre Evolution (site 1) enquiry types.
6
+ *
7
+ * Also re-exported flat as {@link CONTACT_FORM_ENQUIRY_TYPE} for backward
8
+ * compatibility with consumers that predate per-site enquiry types.
9
+ */
10
+ const KORRE_ENQUIRY_TYPE = [
4
11
  {
5
12
  key: 1,
6
13
  value: "Software Development",
@@ -14,6 +21,71 @@ export const CONTACT_FORM_ENQUIRY_TYPE = [
14
21
  { key: 3, value: "MCN Business", i18nKey: "contactForm.enquiryType.3" },
15
22
  ] as const satisfies readonly MappingOption[];
16
23
 
24
+ /**
25
+ * MCOM Media (site 3) enquiry types — the website's "Service Interested"
26
+ * dropdown (`form_data.service`), which is the site's `enquiry_type`.
27
+ *
28
+ * Keys restart at 1 per site, so a value only identifies a type together with
29
+ * its `site_id`. i18n keys are namespaced under `mcomMedia` rather than nested
30
+ * beneath `contactForm.enquiryType.3` because that key is already site 1's
31
+ * "MCN Business" label (a string cannot also be an object in the locale JSON).
32
+ */
33
+ const MCOM_MEDIA_ENQUIRY_TYPE = [
34
+ {
35
+ key: 1,
36
+ value: "Media Buying",
37
+ i18nKey: "contactForm.enquiryType.mcomMedia.1",
38
+ },
39
+ {
40
+ key: 2,
41
+ value: "Creative Production",
42
+ i18nKey: "contactForm.enquiryType.mcomMedia.2",
43
+ },
44
+ {
45
+ key: 3,
46
+ value: "Influencer Marketing",
47
+ i18nKey: "contactForm.enquiryType.mcomMedia.3",
48
+ },
49
+ {
50
+ key: 4,
51
+ value: "Landing Page Optimization",
52
+ i18nKey: "contactForm.enquiryType.mcomMedia.4",
53
+ },
54
+ {
55
+ key: 5,
56
+ value: "Full Service",
57
+ i18nKey: "contactForm.enquiryType.mcomMedia.5",
58
+ },
59
+ {
60
+ key: 6,
61
+ value: "Not Sure",
62
+ i18nKey: "contactForm.enquiryType.mcomMedia.6",
63
+ },
64
+ ] as const satisfies readonly MappingOption[];
65
+
66
+ /**
67
+ * Korre Evolution (site 1) enquiry types, exported flat for backward
68
+ * compatibility.
69
+ *
70
+ * New code should prefer {@link CONTACT_FORM_ENQUIRY_TYPE_BY_SITE}, which
71
+ * resolves enquiry types per site. Because per-site keys restart at 1, this
72
+ * flat list cannot represent every site at once — it remains site 1 only.
73
+ */
74
+ export const CONTACT_FORM_ENQUIRY_TYPE = KORRE_ENQUIRY_TYPE;
75
+
76
+ /**
77
+ * Enquiry-type options keyed by `site_id`.
78
+ *
79
+ * Keys restart at 1 within each site, so an `enquiry_type` value identifies a
80
+ * type only together with its `site_id`. 1 = KORRE, 2 = KORRE_LABS (no contact
81
+ * form yet), 3 = MCOM_MEDIA (see the {@link Website} enum).
82
+ */
83
+ export const CONTACT_FORM_ENQUIRY_TYPE_BY_SITE = {
84
+ [Website.KORRE]: KORRE_ENQUIRY_TYPE,
85
+ [Website.KORRE_LABS]: [],
86
+ [Website.MCOM_MEDIA]: MCOM_MEDIA_ENQUIRY_TYPE,
87
+ } as const satisfies Record<Website, readonly MappingOption[]>;
88
+
17
89
  /**
18
90
  * Per-site shape of `contact_form.form_data` (jsonb).
19
91
  *
@@ -30,8 +102,10 @@ export type KorreLabsContactFormData = Record<string, never>;
30
102
 
31
103
  /**
32
104
  * 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.
105
+ *
106
+ * The site's "Service Interested" dropdown is the standard `enquiry_type`
107
+ * column (see {@link CONTACT_FORM_ENQUIRY_TYPE_BY_SITE}), not a form_data field,
108
+ * so it no longer appears here.
35
109
  */
36
110
  export interface McomMediaContactFormData {
37
111
  company_name?: string;
@@ -40,7 +114,6 @@ export interface McomMediaContactFormData {
40
114
  website?: string;
41
115
  country?: string;
42
116
  budget?: string;
43
- service?: string;
44
117
  timeline?: string;
45
118
  }
46
119
 
@@ -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";
@@ -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,
@@ -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);
@@ -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);
@@ -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,