@thejob/schema 2.0.10 → 2.1.1

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 CHANGED
@@ -64,6 +64,7 @@ __export(index_exports, {
64
64
  GroupVisibility: () => GroupVisibility,
65
65
  InputQuestionSchema: () => InputQuestionSchema,
66
66
  JOB_TAXONOMY: () => JOB_TAXONOMY,
67
+ JobAlertFrequency: () => JobAlertFrequency,
67
68
  JobCategory: () => JobCategory,
68
69
  JobIndustry: () => JobIndustry,
69
70
  JobSchema: () => JobSchema,
@@ -108,6 +109,7 @@ __export(index_exports, {
108
109
  SupportedEmployeeCounts: () => SupportedEmployeeCounts,
109
110
  SupportedEmploymentTypes: () => SupportedEmploymentTypes,
110
111
  SupportedExperienceLevels: () => SupportedExperienceLevels,
112
+ SupportedJobAlertFrequencies: () => SupportedJobAlertFrequencies,
111
113
  SupportedJobCategories: () => SupportedJobCategories,
112
114
  SupportedJobIndustries: () => SupportedJobIndustries,
113
115
  SupportedJobSearchUrgencies: () => SupportedJobSearchUrgencies,
@@ -2140,6 +2142,13 @@ var ReferralSource = /* @__PURE__ */ ((ReferralSource2) => {
2140
2142
  return ReferralSource2;
2141
2143
  })(ReferralSource || {});
2142
2144
  var SupportedReferralSources = Object.values(ReferralSource);
2145
+ var JobAlertFrequency = /* @__PURE__ */ ((JobAlertFrequency2) => {
2146
+ JobAlertFrequency2["Off"] = "off";
2147
+ JobAlertFrequency2["Daily"] = "daily";
2148
+ JobAlertFrequency2["Weekly"] = "weekly";
2149
+ return JobAlertFrequency2;
2150
+ })(JobAlertFrequency || {});
2151
+ var SupportedJobAlertFrequencies = Object.values(JobAlertFrequency);
2143
2152
  var SupportedSalaryCurrencies = ["USD", "EUR", "GBP", "SEK", "INR"];
2144
2153
  var MIN_SALARY_LOWER_BOUND = 0;
2145
2154
  var MIN_SALARY_UPPER_BOUND = 1e6;
@@ -2609,6 +2618,30 @@ var UserSchema = (0, import_yup35.object)({
2609
2618
  * Roles assigned to the user
2610
2619
  */
2611
2620
  roles: (0, import_yup35.array)().of((0, import_yup35.string)().oneOf(SupportedUserRoles)).required().default(DefaultUserRoles).label("Roles"),
2621
+ /**
2622
+ * Explicit consent to receive marketing email (newsletters, job alerts by
2623
+ * broadcast, product updates). Marketing sends are HARD-GATED on
2624
+ * `subscribed === true`: a user with no consent (existing users, anyone who
2625
+ * hasn't finished onboarding) is NOT a valid marketing recipient. Transactional
2626
+ * mail (verification, magic-link, account) is unaffected — it is not marketing.
2627
+ *
2628
+ * Captured at onboarding and flippable by the user; a one-click / footer
2629
+ * unsubscribe sets `subscribed=false` so consent and the email-service
2630
+ * suppression list stay consistent. Defaults to NOT subscribed (opt-in).
2631
+ */
2632
+ marketingConsent: (0, import_yup35.object)({
2633
+ subscribed: (0, import_yup35.boolean)().default(false).label("Subscribed to marketing email"),
2634
+ /** Epoch ms of the last consent change (opt-in or opt-out). */
2635
+ updatedAt: (0, import_yup35.number)().optional().label("Consent updated at"),
2636
+ /** Where the consent change originated, e.g. `onboarding`, `unsubscribe`, `settings`. */
2637
+ source: (0, import_yup35.string)().optional().label("Consent source"),
2638
+ /**
2639
+ * How often the user receives job-alert emails. `off` disables job alerts
2640
+ * only; other marketing stays governed by `subscribed`. Unset means the
2641
+ * user has not chosen a cadence yet.
2642
+ */
2643
+ jobAlertFrequency: (0, import_yup35.string)().oneOf(SupportedJobAlertFrequencies).optional().label("Job alert frequency")
2644
+ }).default({ subscribed: false }).label("Marketing Consent"),
2612
2645
  /**
2613
2646
  * Vector embedding of the user's profile for semantic/hybrid search.
2614
2647
  * Generated from a structured summary of skills, experience, education, etc.
@@ -2679,6 +2712,7 @@ var StudentCompletenessSchema = UserCompletenessSchema.omit([
2679
2712
  GroupVisibility,
2680
2713
  InputQuestionSchema,
2681
2714
  JOB_TAXONOMY,
2715
+ JobAlertFrequency,
2682
2716
  JobCategory,
2683
2717
  JobIndustry,
2684
2718
  JobSchema,
@@ -2723,6 +2757,7 @@ var StudentCompletenessSchema = UserCompletenessSchema.omit([
2723
2757
  SupportedEmployeeCounts,
2724
2758
  SupportedEmploymentTypes,
2725
2759
  SupportedExperienceLevels,
2760
+ SupportedJobAlertFrequencies,
2726
2761
  SupportedJobCategories,
2727
2762
  SupportedJobIndustries,
2728
2763
  SupportedJobSearchUrgencies,
package/dist/index.d.cts CHANGED
@@ -1640,6 +1640,17 @@ declare enum ReferralSource {
1640
1640
  Other = "other"
1641
1641
  }
1642
1642
  declare const SupportedReferralSources: ReferralSource[];
1643
+ /**
1644
+ * How often a subscribed user receives job-alert emails. `Off` disables job
1645
+ * alerts specifically while leaving other marketing (newsletters, product
1646
+ * updates) governed by `marketingConsent.subscribed`.
1647
+ */
1648
+ declare enum JobAlertFrequency {
1649
+ Off = "off",
1650
+ Daily = "daily",
1651
+ Weekly = "weekly"
1652
+ }
1653
+ declare const SupportedJobAlertFrequencies: JobAlertFrequency[];
1643
1654
  /** ISO-4217 currency codes accepted for the salary preference (extend as needed). */
1644
1655
  declare const SupportedSalaryCurrencies: readonly ["USD", "EUR", "GBP", "SEK", "INR"];
1645
1656
  type SupportedSalaryCurrency = (typeof SupportedSalaryCurrencies)[number];
@@ -1768,6 +1779,12 @@ declare const UserSchema: yup.ObjectSchema<{
1768
1779
  }[];
1769
1780
  status: NonNullable<UserStatus | undefined>;
1770
1781
  roles: (UserRole | undefined)[];
1782
+ marketingConsent: {
1783
+ updatedAt?: number | undefined;
1784
+ source?: string | undefined;
1785
+ jobAlertFrequency?: JobAlertFrequency | undefined;
1786
+ subscribed: boolean;
1787
+ };
1771
1788
  embedding: {
1772
1789
  vector?: number[] | undefined;
1773
1790
  model?: string | undefined;
@@ -1964,6 +1981,9 @@ declare const UserSchema: yup.ObjectSchema<{
1964
1981
  additionalInfo: never[];
1965
1982
  status: undefined;
1966
1983
  roles: UserRole[];
1984
+ marketingConsent: {
1985
+ subscribed: boolean;
1986
+ };
1967
1987
  embedding: {
1968
1988
  vector: undefined;
1969
1989
  model: undefined;
@@ -2852,4 +2872,4 @@ declare const StudentCompletenessSchema: yup.ObjectSchema<{
2852
2872
  };
2853
2873
  }, "">;
2854
2874
 
2855
- export { AnswerChoiceType, ApplicationReceivePreference, CampaignSchema, CampaignStatus, ChoiceQuestionSchema, Common, CompensationType, CompletenessScoreSchema, ContactTypes, CoordinatorPageLinkSchema, DISPLAY_DATE_FORMAT, DISPLAY_DATE_FORMAT_SHORT, DateStringSchema, DbDefaultSchema, DefaultPaginatedResponse, DefaultPaginationOptions, DefaultUserRoles, DurationSchema, EMPTY_STRING, EducationLevel, EducationSchema, EmployeeCount, EmploymentType, ExperienceLevel, GeneraDetailFields, GroupManagedBy, GroupMembershipSchema, GroupMembershipStatus, GroupSchema, GroupStatus, GroupTranslationSchema, GroupVisibility, InputQuestionSchema, JOB_TAXONOMY, JobCategory, JobIndustry, JobSchema, JobSearchUrgency, JobStatus, JobSubCategory, ListFilterSchema, LocationSchema, MIN_SALARY_LOWER_BOUND, MIN_SALARY_UPPER_BOUND, MailingListSchema, PREFILL_MIRRORED_KEYS, PRIVATE_PROFILE_FIELDS, PageSchema, PageStatus, PageType, type PaginatedResponse, PaginationSchema, PostSchema, PostStatus, type PrefillMirroredKey, type PrivateProfileField, ProficiencyLevel, QuestionSchema, QuestionType, ReadAndAcknowledgeQuestionSchema, RecruiterPageLinkSchema, ReferralSource, ReportReason, ReportSchema, ResourceType, SITEMAP_FORMAT, SYSTEM_DATE_FORMAT, SkillSchema, SocialAccount, SocialAccountSchema, StudentCompletenessSchema, StudyType, SupportedAnswerChoiceTypes, SupportedApplicationReceivePreferences, SupportedCampaignStatuses, SupportedCompensationTypes, SupportedContactTypes, SupportedEducationLevels, SupportedEmployeeCounts, SupportedEmploymentTypes, SupportedExperienceLevels, SupportedJobCategories, SupportedJobIndustries, SupportedJobSearchUrgencies, SupportedJobStatuses, SupportedJobSubCategories, SupportedPageStatuses, SupportedPageTypes, SupportedPostStatuses, SupportedProficiencyLevels, SupportedQuestionTypes, SupportedReferralSources, SupportedReportReasons, SupportedResourceTypes, SupportedSalaryCurrencies, type SupportedSalaryCurrency, SupportedSocialAccounts, SupportedStudyTypes, SupportedUserProfileVisibilities, SupportedUserRoles, SupportedUserStatuses, SupportedWorkModes, TAXONOMY_LABELS, type TChoiceQuestionSchema, type TDurationSchema, type TInputQuestionSchema, type TJobSchema, type TPostSchema, type TQuestionSchema, type TReadAndAcknowledgeQuestionSchema, type TUserIdAndCreatedAtSchema, TermsAcceptedSchema, UserAdditionalInfoSchema, UserCertificationSchema, UserCompletenessSchema, UserCoordinatorProfileSchema, UserDetailType, UserGeneralDetailSchema, UserIdAndCreatedAtSchema, UserInterestSchema, UserJobPreferencesSchema, UserLanguageSchema, type UserProfileOverview, UserProfileVisibility, UserProjectSchema, UserRecruiterProfileSchema, UserRole, UserSchema, UserSkillSchema, UserStatus, WorkExperienceSchema, WorkMode, categoryOfIndustry, categoryOfSubCategory, dateString, deriveIndustry, getSchemaByQuestion, industriesOfCategory, industryOfSubCategory, subCategoriesOfIndustry };
2875
+ export { AnswerChoiceType, ApplicationReceivePreference, CampaignSchema, CampaignStatus, ChoiceQuestionSchema, Common, CompensationType, CompletenessScoreSchema, ContactTypes, CoordinatorPageLinkSchema, DISPLAY_DATE_FORMAT, DISPLAY_DATE_FORMAT_SHORT, DateStringSchema, DbDefaultSchema, DefaultPaginatedResponse, DefaultPaginationOptions, DefaultUserRoles, DurationSchema, EMPTY_STRING, EducationLevel, EducationSchema, EmployeeCount, EmploymentType, ExperienceLevel, GeneraDetailFields, GroupManagedBy, GroupMembershipSchema, GroupMembershipStatus, GroupSchema, GroupStatus, GroupTranslationSchema, GroupVisibility, InputQuestionSchema, JOB_TAXONOMY, JobAlertFrequency, JobCategory, JobIndustry, JobSchema, JobSearchUrgency, JobStatus, JobSubCategory, ListFilterSchema, LocationSchema, MIN_SALARY_LOWER_BOUND, MIN_SALARY_UPPER_BOUND, MailingListSchema, PREFILL_MIRRORED_KEYS, PRIVATE_PROFILE_FIELDS, PageSchema, PageStatus, PageType, type PaginatedResponse, PaginationSchema, PostSchema, PostStatus, type PrefillMirroredKey, type PrivateProfileField, ProficiencyLevel, QuestionSchema, QuestionType, ReadAndAcknowledgeQuestionSchema, RecruiterPageLinkSchema, ReferralSource, ReportReason, ReportSchema, ResourceType, SITEMAP_FORMAT, SYSTEM_DATE_FORMAT, SkillSchema, SocialAccount, SocialAccountSchema, StudentCompletenessSchema, StudyType, SupportedAnswerChoiceTypes, SupportedApplicationReceivePreferences, SupportedCampaignStatuses, SupportedCompensationTypes, SupportedContactTypes, SupportedEducationLevels, SupportedEmployeeCounts, SupportedEmploymentTypes, SupportedExperienceLevels, SupportedJobAlertFrequencies, SupportedJobCategories, SupportedJobIndustries, SupportedJobSearchUrgencies, SupportedJobStatuses, SupportedJobSubCategories, SupportedPageStatuses, SupportedPageTypes, SupportedPostStatuses, SupportedProficiencyLevels, SupportedQuestionTypes, SupportedReferralSources, SupportedReportReasons, SupportedResourceTypes, SupportedSalaryCurrencies, type SupportedSalaryCurrency, SupportedSocialAccounts, SupportedStudyTypes, SupportedUserProfileVisibilities, SupportedUserRoles, SupportedUserStatuses, SupportedWorkModes, TAXONOMY_LABELS, type TChoiceQuestionSchema, type TDurationSchema, type TInputQuestionSchema, type TJobSchema, type TPostSchema, type TQuestionSchema, type TReadAndAcknowledgeQuestionSchema, type TUserIdAndCreatedAtSchema, TermsAcceptedSchema, UserAdditionalInfoSchema, UserCertificationSchema, UserCompletenessSchema, UserCoordinatorProfileSchema, UserDetailType, UserGeneralDetailSchema, UserIdAndCreatedAtSchema, UserInterestSchema, UserJobPreferencesSchema, UserLanguageSchema, type UserProfileOverview, UserProfileVisibility, UserProjectSchema, UserRecruiterProfileSchema, UserRole, UserSchema, UserSkillSchema, UserStatus, WorkExperienceSchema, WorkMode, categoryOfIndustry, categoryOfSubCategory, dateString, deriveIndustry, getSchemaByQuestion, industriesOfCategory, industryOfSubCategory, subCategoriesOfIndustry };
package/dist/index.d.ts CHANGED
@@ -1640,6 +1640,17 @@ declare enum ReferralSource {
1640
1640
  Other = "other"
1641
1641
  }
1642
1642
  declare const SupportedReferralSources: ReferralSource[];
1643
+ /**
1644
+ * How often a subscribed user receives job-alert emails. `Off` disables job
1645
+ * alerts specifically while leaving other marketing (newsletters, product
1646
+ * updates) governed by `marketingConsent.subscribed`.
1647
+ */
1648
+ declare enum JobAlertFrequency {
1649
+ Off = "off",
1650
+ Daily = "daily",
1651
+ Weekly = "weekly"
1652
+ }
1653
+ declare const SupportedJobAlertFrequencies: JobAlertFrequency[];
1643
1654
  /** ISO-4217 currency codes accepted for the salary preference (extend as needed). */
1644
1655
  declare const SupportedSalaryCurrencies: readonly ["USD", "EUR", "GBP", "SEK", "INR"];
1645
1656
  type SupportedSalaryCurrency = (typeof SupportedSalaryCurrencies)[number];
@@ -1768,6 +1779,12 @@ declare const UserSchema: yup.ObjectSchema<{
1768
1779
  }[];
1769
1780
  status: NonNullable<UserStatus | undefined>;
1770
1781
  roles: (UserRole | undefined)[];
1782
+ marketingConsent: {
1783
+ updatedAt?: number | undefined;
1784
+ source?: string | undefined;
1785
+ jobAlertFrequency?: JobAlertFrequency | undefined;
1786
+ subscribed: boolean;
1787
+ };
1771
1788
  embedding: {
1772
1789
  vector?: number[] | undefined;
1773
1790
  model?: string | undefined;
@@ -1964,6 +1981,9 @@ declare const UserSchema: yup.ObjectSchema<{
1964
1981
  additionalInfo: never[];
1965
1982
  status: undefined;
1966
1983
  roles: UserRole[];
1984
+ marketingConsent: {
1985
+ subscribed: boolean;
1986
+ };
1967
1987
  embedding: {
1968
1988
  vector: undefined;
1969
1989
  model: undefined;
@@ -2852,4 +2872,4 @@ declare const StudentCompletenessSchema: yup.ObjectSchema<{
2852
2872
  };
2853
2873
  }, "">;
2854
2874
 
2855
- export { AnswerChoiceType, ApplicationReceivePreference, CampaignSchema, CampaignStatus, ChoiceQuestionSchema, Common, CompensationType, CompletenessScoreSchema, ContactTypes, CoordinatorPageLinkSchema, DISPLAY_DATE_FORMAT, DISPLAY_DATE_FORMAT_SHORT, DateStringSchema, DbDefaultSchema, DefaultPaginatedResponse, DefaultPaginationOptions, DefaultUserRoles, DurationSchema, EMPTY_STRING, EducationLevel, EducationSchema, EmployeeCount, EmploymentType, ExperienceLevel, GeneraDetailFields, GroupManagedBy, GroupMembershipSchema, GroupMembershipStatus, GroupSchema, GroupStatus, GroupTranslationSchema, GroupVisibility, InputQuestionSchema, JOB_TAXONOMY, JobCategory, JobIndustry, JobSchema, JobSearchUrgency, JobStatus, JobSubCategory, ListFilterSchema, LocationSchema, MIN_SALARY_LOWER_BOUND, MIN_SALARY_UPPER_BOUND, MailingListSchema, PREFILL_MIRRORED_KEYS, PRIVATE_PROFILE_FIELDS, PageSchema, PageStatus, PageType, type PaginatedResponse, PaginationSchema, PostSchema, PostStatus, type PrefillMirroredKey, type PrivateProfileField, ProficiencyLevel, QuestionSchema, QuestionType, ReadAndAcknowledgeQuestionSchema, RecruiterPageLinkSchema, ReferralSource, ReportReason, ReportSchema, ResourceType, SITEMAP_FORMAT, SYSTEM_DATE_FORMAT, SkillSchema, SocialAccount, SocialAccountSchema, StudentCompletenessSchema, StudyType, SupportedAnswerChoiceTypes, SupportedApplicationReceivePreferences, SupportedCampaignStatuses, SupportedCompensationTypes, SupportedContactTypes, SupportedEducationLevels, SupportedEmployeeCounts, SupportedEmploymentTypes, SupportedExperienceLevels, SupportedJobCategories, SupportedJobIndustries, SupportedJobSearchUrgencies, SupportedJobStatuses, SupportedJobSubCategories, SupportedPageStatuses, SupportedPageTypes, SupportedPostStatuses, SupportedProficiencyLevels, SupportedQuestionTypes, SupportedReferralSources, SupportedReportReasons, SupportedResourceTypes, SupportedSalaryCurrencies, type SupportedSalaryCurrency, SupportedSocialAccounts, SupportedStudyTypes, SupportedUserProfileVisibilities, SupportedUserRoles, SupportedUserStatuses, SupportedWorkModes, TAXONOMY_LABELS, type TChoiceQuestionSchema, type TDurationSchema, type TInputQuestionSchema, type TJobSchema, type TPostSchema, type TQuestionSchema, type TReadAndAcknowledgeQuestionSchema, type TUserIdAndCreatedAtSchema, TermsAcceptedSchema, UserAdditionalInfoSchema, UserCertificationSchema, UserCompletenessSchema, UserCoordinatorProfileSchema, UserDetailType, UserGeneralDetailSchema, UserIdAndCreatedAtSchema, UserInterestSchema, UserJobPreferencesSchema, UserLanguageSchema, type UserProfileOverview, UserProfileVisibility, UserProjectSchema, UserRecruiterProfileSchema, UserRole, UserSchema, UserSkillSchema, UserStatus, WorkExperienceSchema, WorkMode, categoryOfIndustry, categoryOfSubCategory, dateString, deriveIndustry, getSchemaByQuestion, industriesOfCategory, industryOfSubCategory, subCategoriesOfIndustry };
2875
+ export { AnswerChoiceType, ApplicationReceivePreference, CampaignSchema, CampaignStatus, ChoiceQuestionSchema, Common, CompensationType, CompletenessScoreSchema, ContactTypes, CoordinatorPageLinkSchema, DISPLAY_DATE_FORMAT, DISPLAY_DATE_FORMAT_SHORT, DateStringSchema, DbDefaultSchema, DefaultPaginatedResponse, DefaultPaginationOptions, DefaultUserRoles, DurationSchema, EMPTY_STRING, EducationLevel, EducationSchema, EmployeeCount, EmploymentType, ExperienceLevel, GeneraDetailFields, GroupManagedBy, GroupMembershipSchema, GroupMembershipStatus, GroupSchema, GroupStatus, GroupTranslationSchema, GroupVisibility, InputQuestionSchema, JOB_TAXONOMY, JobAlertFrequency, JobCategory, JobIndustry, JobSchema, JobSearchUrgency, JobStatus, JobSubCategory, ListFilterSchema, LocationSchema, MIN_SALARY_LOWER_BOUND, MIN_SALARY_UPPER_BOUND, MailingListSchema, PREFILL_MIRRORED_KEYS, PRIVATE_PROFILE_FIELDS, PageSchema, PageStatus, PageType, type PaginatedResponse, PaginationSchema, PostSchema, PostStatus, type PrefillMirroredKey, type PrivateProfileField, ProficiencyLevel, QuestionSchema, QuestionType, ReadAndAcknowledgeQuestionSchema, RecruiterPageLinkSchema, ReferralSource, ReportReason, ReportSchema, ResourceType, SITEMAP_FORMAT, SYSTEM_DATE_FORMAT, SkillSchema, SocialAccount, SocialAccountSchema, StudentCompletenessSchema, StudyType, SupportedAnswerChoiceTypes, SupportedApplicationReceivePreferences, SupportedCampaignStatuses, SupportedCompensationTypes, SupportedContactTypes, SupportedEducationLevels, SupportedEmployeeCounts, SupportedEmploymentTypes, SupportedExperienceLevels, SupportedJobAlertFrequencies, SupportedJobCategories, SupportedJobIndustries, SupportedJobSearchUrgencies, SupportedJobStatuses, SupportedJobSubCategories, SupportedPageStatuses, SupportedPageTypes, SupportedPostStatuses, SupportedProficiencyLevels, SupportedQuestionTypes, SupportedReferralSources, SupportedReportReasons, SupportedResourceTypes, SupportedSalaryCurrencies, type SupportedSalaryCurrency, SupportedSocialAccounts, SupportedStudyTypes, SupportedUserProfileVisibilities, SupportedUserRoles, SupportedUserStatuses, SupportedWorkModes, TAXONOMY_LABELS, type TChoiceQuestionSchema, type TDurationSchema, type TInputQuestionSchema, type TJobSchema, type TPostSchema, type TQuestionSchema, type TReadAndAcknowledgeQuestionSchema, type TUserIdAndCreatedAtSchema, TermsAcceptedSchema, UserAdditionalInfoSchema, UserCertificationSchema, UserCompletenessSchema, UserCoordinatorProfileSchema, UserDetailType, UserGeneralDetailSchema, UserIdAndCreatedAtSchema, UserInterestSchema, UserJobPreferencesSchema, UserLanguageSchema, type UserProfileOverview, UserProfileVisibility, UserProjectSchema, UserRecruiterProfileSchema, UserRole, UserSchema, UserSkillSchema, UserStatus, WorkExperienceSchema, WorkMode, categoryOfIndustry, categoryOfSubCategory, dateString, deriveIndustry, getSchemaByQuestion, industriesOfCategory, industryOfSubCategory, subCategoriesOfIndustry };
package/dist/index.js CHANGED
@@ -1978,6 +1978,13 @@ var ReferralSource = /* @__PURE__ */ ((ReferralSource2) => {
1978
1978
  return ReferralSource2;
1979
1979
  })(ReferralSource || {});
1980
1980
  var SupportedReferralSources = Object.values(ReferralSource);
1981
+ var JobAlertFrequency = /* @__PURE__ */ ((JobAlertFrequency2) => {
1982
+ JobAlertFrequency2["Off"] = "off";
1983
+ JobAlertFrequency2["Daily"] = "daily";
1984
+ JobAlertFrequency2["Weekly"] = "weekly";
1985
+ return JobAlertFrequency2;
1986
+ })(JobAlertFrequency || {});
1987
+ var SupportedJobAlertFrequencies = Object.values(JobAlertFrequency);
1981
1988
  var SupportedSalaryCurrencies = ["USD", "EUR", "GBP", "SEK", "INR"];
1982
1989
  var MIN_SALARY_LOWER_BOUND = 0;
1983
1990
  var MIN_SALARY_UPPER_BOUND = 1e6;
@@ -2145,7 +2152,7 @@ var ReportSchema = object20({
2145
2152
  }).label("Report Schema");
2146
2153
 
2147
2154
  // src/user/user.schema.ts
2148
- import { array as array14, number as number10, object as object32, string as string30 } from "yup";
2155
+ import { array as array14, boolean as boolean15, number as number10, object as object32, string as string30 } from "yup";
2149
2156
 
2150
2157
  // src/user/work-experience.schema.ts
2151
2158
  import { boolean as boolean12, object as object21, string as string18 } from "yup";
@@ -2447,6 +2454,30 @@ var UserSchema = object32({
2447
2454
  * Roles assigned to the user
2448
2455
  */
2449
2456
  roles: array14().of(string30().oneOf(SupportedUserRoles)).required().default(DefaultUserRoles).label("Roles"),
2457
+ /**
2458
+ * Explicit consent to receive marketing email (newsletters, job alerts by
2459
+ * broadcast, product updates). Marketing sends are HARD-GATED on
2460
+ * `subscribed === true`: a user with no consent (existing users, anyone who
2461
+ * hasn't finished onboarding) is NOT a valid marketing recipient. Transactional
2462
+ * mail (verification, magic-link, account) is unaffected — it is not marketing.
2463
+ *
2464
+ * Captured at onboarding and flippable by the user; a one-click / footer
2465
+ * unsubscribe sets `subscribed=false` so consent and the email-service
2466
+ * suppression list stay consistent. Defaults to NOT subscribed (opt-in).
2467
+ */
2468
+ marketingConsent: object32({
2469
+ subscribed: boolean15().default(false).label("Subscribed to marketing email"),
2470
+ /** Epoch ms of the last consent change (opt-in or opt-out). */
2471
+ updatedAt: number10().optional().label("Consent updated at"),
2472
+ /** Where the consent change originated, e.g. `onboarding`, `unsubscribe`, `settings`. */
2473
+ source: string30().optional().label("Consent source"),
2474
+ /**
2475
+ * How often the user receives job-alert emails. `off` disables job alerts
2476
+ * only; other marketing stays governed by `subscribed`. Unset means the
2477
+ * user has not chosen a cadence yet.
2478
+ */
2479
+ jobAlertFrequency: string30().oneOf(SupportedJobAlertFrequencies).optional().label("Job alert frequency")
2480
+ }).default({ subscribed: false }).label("Marketing Consent"),
2450
2481
  /**
2451
2482
  * Vector embedding of the user's profile for semantic/hybrid search.
2452
2483
  * Generated from a structured summary of skills, experience, education, etc.
@@ -2516,6 +2547,7 @@ export {
2516
2547
  GroupVisibility,
2517
2548
  InputQuestionSchema,
2518
2549
  JOB_TAXONOMY,
2550
+ JobAlertFrequency,
2519
2551
  JobCategory,
2520
2552
  JobIndustry,
2521
2553
  JobSchema,
@@ -2560,6 +2592,7 @@ export {
2560
2592
  SupportedEmployeeCounts,
2561
2593
  SupportedEmploymentTypes,
2562
2594
  SupportedExperienceLevels,
2595
+ SupportedJobAlertFrequencies,
2563
2596
  SupportedJobCategories,
2564
2597
  SupportedJobIndustries,
2565
2598
  SupportedJobSearchUrgencies,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thejob/schema",
3
- "version": "2.0.10",
3
+ "version": "2.1.1",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
@@ -84,6 +84,19 @@ export enum ReferralSource {
84
84
 
85
85
  export const SupportedReferralSources = Object.values(ReferralSource);
86
86
 
87
+ /**
88
+ * How often a subscribed user receives job-alert emails. `Off` disables job
89
+ * alerts specifically while leaving other marketing (newsletters, product
90
+ * updates) governed by `marketingConsent.subscribed`.
91
+ */
92
+ export enum JobAlertFrequency {
93
+ Off = "off",
94
+ Daily = "daily",
95
+ Weekly = "weekly",
96
+ }
97
+
98
+ export const SupportedJobAlertFrequencies = Object.values(JobAlertFrequency);
99
+
87
100
  /** ISO-4217 currency codes accepted for the salary preference (extend as needed). */
88
101
  export const SupportedSalaryCurrencies = ["USD", "EUR", "GBP", "SEK", "INR"] as const;
89
102
  export type SupportedSalaryCurrency = (typeof SupportedSalaryCurrencies)[number];
@@ -1,7 +1,8 @@
1
- import { array, number, object, string } from "yup";
1
+ import { array, boolean, number, object, string } from "yup";
2
2
 
3
3
  import {
4
4
  DefaultUserRoles,
5
+ SupportedJobAlertFrequencies,
5
6
  SupportedUserRoles,
6
7
  SupportedUserStatuses,
7
8
  } from "./user.constant.js";
@@ -110,6 +111,36 @@ export const UserSchema = object({
110
111
  .default(DefaultUserRoles)
111
112
  .label("Roles"),
112
113
 
114
+ /**
115
+ * Explicit consent to receive marketing email (newsletters, job alerts by
116
+ * broadcast, product updates). Marketing sends are HARD-GATED on
117
+ * `subscribed === true`: a user with no consent (existing users, anyone who
118
+ * hasn't finished onboarding) is NOT a valid marketing recipient. Transactional
119
+ * mail (verification, magic-link, account) is unaffected — it is not marketing.
120
+ *
121
+ * Captured at onboarding and flippable by the user; a one-click / footer
122
+ * unsubscribe sets `subscribed=false` so consent and the email-service
123
+ * suppression list stay consistent. Defaults to NOT subscribed (opt-in).
124
+ */
125
+ marketingConsent: object({
126
+ subscribed: boolean().default(false).label("Subscribed to marketing email"),
127
+ /** Epoch ms of the last consent change (opt-in or opt-out). */
128
+ updatedAt: number().optional().label("Consent updated at"),
129
+ /** Where the consent change originated, e.g. `onboarding`, `unsubscribe`, `settings`. */
130
+ source: string().optional().label("Consent source"),
131
+ /**
132
+ * How often the user receives job-alert emails. `off` disables job alerts
133
+ * only; other marketing stays governed by `subscribed`. Unset means the
134
+ * user has not chosen a cadence yet.
135
+ */
136
+ jobAlertFrequency: string()
137
+ .oneOf(SupportedJobAlertFrequencies)
138
+ .optional()
139
+ .label("Job alert frequency"),
140
+ })
141
+ .default({ subscribed: false })
142
+ .label("Marketing Consent"),
143
+
113
144
  /**
114
145
  * Vector embedding of the user's profile for semantic/hybrid search.
115
146
  * Generated from a structured summary of skills, experience, education, etc.