@thejob/schema 2.3.0 → 2.4.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 +31 -0
- package/dist/index.d.cts +26 -1
- package/dist/index.d.ts +26 -1
- package/dist/index.js +28 -0
- package/package.json +1 -1
- package/src/billing/billing.constant.ts +27 -0
- package/src/billing/billing.schema.ts +17 -0
package/dist/index.cjs
CHANGED
|
@@ -109,6 +109,7 @@ __export(index_exports, {
|
|
|
109
109
|
JobStatus: () => JobStatus,
|
|
110
110
|
JobSubCategory: () => JobSubCategory,
|
|
111
111
|
LanguageFilterSchema: () => LanguageFilterSchema,
|
|
112
|
+
LiveSubscriptionStatuses: () => LiveSubscriptionStatuses,
|
|
112
113
|
LocationSchema: () => LocationSchema,
|
|
113
114
|
MIN_SALARY_LOWER_BOUND: () => MIN_SALARY_LOWER_BOUND,
|
|
114
115
|
MIN_SALARY_UPPER_BOUND: () => MIN_SALARY_UPPER_BOUND,
|
|
@@ -126,6 +127,7 @@ __export(index_exports, {
|
|
|
126
127
|
PageStatus: () => PageStatus,
|
|
127
128
|
PageType: () => PageType,
|
|
128
129
|
PaginationSchema: () => PaginationSchema,
|
|
130
|
+
PlanAudience: () => PlanAudience,
|
|
129
131
|
PlanGrantSchema: () => PlanGrantSchema,
|
|
130
132
|
PlanKind: () => PlanKind,
|
|
131
133
|
PlanSchema: () => PlanSchema,
|
|
@@ -194,6 +196,7 @@ __export(index_exports, {
|
|
|
194
196
|
SupportedPaddleEnvironments: () => SupportedPaddleEnvironments,
|
|
195
197
|
SupportedPageStatuses: () => SupportedPageStatuses,
|
|
196
198
|
SupportedPageTypes: () => SupportedPageTypes,
|
|
199
|
+
SupportedPlanAudiences: () => SupportedPlanAudiences,
|
|
197
200
|
SupportedPlanKinds: () => SupportedPlanKinds,
|
|
198
201
|
SupportedPlanStatuses: () => SupportedPlanStatuses,
|
|
199
202
|
SupportedPostStatuses: () => SupportedPostStatuses,
|
|
@@ -3854,6 +3857,14 @@ var PlanStatus = /* @__PURE__ */ ((PlanStatus2) => {
|
|
|
3854
3857
|
return PlanStatus2;
|
|
3855
3858
|
})(PlanStatus || {});
|
|
3856
3859
|
var SupportedPlanStatuses = Object.values(PlanStatus);
|
|
3860
|
+
var PlanAudience = /* @__PURE__ */ ((PlanAudience2) => {
|
|
3861
|
+
PlanAudience2["Employer"] = "employer";
|
|
3862
|
+
PlanAudience2["JobSeeker"] = "job-seeker";
|
|
3863
|
+
PlanAudience2["Recruiter"] = "recruiter";
|
|
3864
|
+
PlanAudience2["Company"] = "company";
|
|
3865
|
+
return PlanAudience2;
|
|
3866
|
+
})(PlanAudience || {});
|
|
3867
|
+
var SupportedPlanAudiences = Object.values(PlanAudience);
|
|
3857
3868
|
var GrantType = /* @__PURE__ */ ((GrantType2) => {
|
|
3858
3869
|
GrantType2["Boolean"] = "boolean";
|
|
3859
3870
|
GrantType2["Quota"] = "quota";
|
|
@@ -3888,6 +3899,10 @@ var EntitlingSubscriptionStatuses = [
|
|
|
3888
3899
|
"trialing" /* Trialing */,
|
|
3889
3900
|
"past_due" /* PastDue */
|
|
3890
3901
|
];
|
|
3902
|
+
var LiveSubscriptionStatuses = [
|
|
3903
|
+
...EntitlingSubscriptionStatuses,
|
|
3904
|
+
"paused" /* Paused */
|
|
3905
|
+
];
|
|
3891
3906
|
var TransactionStatus = /* @__PURE__ */ ((TransactionStatus2) => {
|
|
3892
3907
|
TransactionStatus2["Draft"] = "draft";
|
|
3893
3908
|
TransactionStatus2["Ready"] = "ready";
|
|
@@ -3972,6 +3987,12 @@ var PlanSchema = (0, import_yup40.object)({
|
|
|
3972
3987
|
name: (0, import_yup40.string)().required().min(1).max(120).label("Name"),
|
|
3973
3988
|
description: (0, import_yup40.string)().optional().max(500).label("Description"),
|
|
3974
3989
|
kind: (0, import_yup40.string)().oneOf(SupportedPlanKinds).required().default("subscription" /* Subscription */).label("Kind"),
|
|
3990
|
+
/**
|
|
3991
|
+
* The line this plan belongs to; a user holds one live subscription per line.
|
|
3992
|
+
* Optional on purpose: absent is the default line, so existing plans need no
|
|
3993
|
+
* migration and together still read as "one plan at a time".
|
|
3994
|
+
*/
|
|
3995
|
+
audience: (0, import_yup40.string)().oneOf(SupportedPlanAudiences).optional().label("Audience"),
|
|
3975
3996
|
status: (0, import_yup40.string)().oneOf(SupportedPlanStatuses).required().default("draft" /* Draft */).label("Status"),
|
|
3976
3997
|
paddlePriceIds: PaddlePriceIdsSchema.default(
|
|
3977
3998
|
() => PaddlePriceIdsSchema.getDefault()
|
|
@@ -4007,6 +4028,13 @@ var BillingSubscriptionSchema = (0, import_yup40.object)({
|
|
|
4007
4028
|
currentPeriodEnd: (0, import_yup40.number)().optional().label("Current Period End"),
|
|
4008
4029
|
/** Set when a cancellation is scheduled; access continues until the period ends. */
|
|
4009
4030
|
canceledAt: (0, import_yup40.number)().optional().label("Canceled At"),
|
|
4031
|
+
/**
|
|
4032
|
+
* A downgrade booked for the end of the current period: the plan key it moves
|
|
4033
|
+
* to at renewal. Upgrades never set this; they apply immediately. Mirrored
|
|
4034
|
+
* from the Paddle subscription's own `customData`, so Paddle stays the source
|
|
4035
|
+
* of truth.
|
|
4036
|
+
*/
|
|
4037
|
+
pendingPlanKey: (0, import_yup40.string)().optional().label("Pending Plan Key"),
|
|
4010
4038
|
/** `occurred_at` of the newest Paddle event applied. Guards out-of-order writes. */
|
|
4011
4039
|
lastEventAt: (0, import_yup40.number)().required().default(0).label("Last Event At"),
|
|
4012
4040
|
createdAt: (0, import_yup40.number)().optional().label("Created At"),
|
|
@@ -4688,6 +4716,7 @@ var StudentCompletenessSchema = UserCompletenessSchema.omit([
|
|
|
4688
4716
|
JobStatus,
|
|
4689
4717
|
JobSubCategory,
|
|
4690
4718
|
LanguageFilterSchema,
|
|
4719
|
+
LiveSubscriptionStatuses,
|
|
4691
4720
|
LocationSchema,
|
|
4692
4721
|
MIN_SALARY_LOWER_BOUND,
|
|
4693
4722
|
MIN_SALARY_UPPER_BOUND,
|
|
@@ -4705,6 +4734,7 @@ var StudentCompletenessSchema = UserCompletenessSchema.omit([
|
|
|
4705
4734
|
PageStatus,
|
|
4706
4735
|
PageType,
|
|
4707
4736
|
PaginationSchema,
|
|
4737
|
+
PlanAudience,
|
|
4708
4738
|
PlanGrantSchema,
|
|
4709
4739
|
PlanKind,
|
|
4710
4740
|
PlanSchema,
|
|
@@ -4773,6 +4803,7 @@ var StudentCompletenessSchema = UserCompletenessSchema.omit([
|
|
|
4773
4803
|
SupportedPaddleEnvironments,
|
|
4774
4804
|
SupportedPageStatuses,
|
|
4775
4805
|
SupportedPageTypes,
|
|
4806
|
+
SupportedPlanAudiences,
|
|
4776
4807
|
SupportedPlanKinds,
|
|
4777
4808
|
SupportedPlanStatuses,
|
|
4778
4809
|
SupportedPostStatuses,
|
package/dist/index.d.cts
CHANGED
|
@@ -3286,6 +3286,21 @@ declare enum PlanStatus {
|
|
|
3286
3286
|
Archived = "archived"
|
|
3287
3287
|
}
|
|
3288
3288
|
declare const SupportedPlanStatuses: PlanStatus[];
|
|
3289
|
+
/**
|
|
3290
|
+
* The product line a plan belongs to. A user holds at most ONE live
|
|
3291
|
+
* subscription per audience: switching within a line updates that subscription,
|
|
3292
|
+
* it never adds a second one. Different audiences may be held side by side.
|
|
3293
|
+
*
|
|
3294
|
+
* A plan with no audience belongs to the single default line, which is every
|
|
3295
|
+
* plan seeded before this existed.
|
|
3296
|
+
*/
|
|
3297
|
+
declare enum PlanAudience {
|
|
3298
|
+
Employer = "employer",
|
|
3299
|
+
JobSeeker = "job-seeker",
|
|
3300
|
+
Recruiter = "recruiter",
|
|
3301
|
+
Company = "company"
|
|
3302
|
+
}
|
|
3303
|
+
declare const SupportedPlanAudiences: PlanAudience[];
|
|
3289
3304
|
/**
|
|
3290
3305
|
* How a grant gives access to a feature.
|
|
3291
3306
|
*
|
|
@@ -3344,6 +3359,12 @@ declare enum SubscriptionStatus {
|
|
|
3344
3359
|
declare const SupportedSubscriptionStatuses: SubscriptionStatus[];
|
|
3345
3360
|
/** Subscription statuses that currently entitle the holder to their plan's grants. */
|
|
3346
3361
|
declare const EntitlingSubscriptionStatuses: SubscriptionStatus[];
|
|
3362
|
+
/**
|
|
3363
|
+
* Subscription statuses that still occupy the user's slot in a plan audience.
|
|
3364
|
+
* Wider than `EntitlingSubscriptionStatuses`: a paused subscription grants
|
|
3365
|
+
* nothing, but buying again would still leave two subscriptions to one plan.
|
|
3366
|
+
*/
|
|
3367
|
+
declare const LiveSubscriptionStatuses: SubscriptionStatus[];
|
|
3347
3368
|
/** Paddle transaction status, verbatim. `completed` is where a one-off is fulfilled. */
|
|
3348
3369
|
declare enum TransactionStatus {
|
|
3349
3370
|
Draft = "draft",
|
|
@@ -3468,6 +3489,7 @@ declare const PlanSchema: yup.ObjectSchema<{
|
|
|
3468
3489
|
name: string;
|
|
3469
3490
|
description: string | undefined;
|
|
3470
3491
|
kind: NonNullable<PlanKind | undefined>;
|
|
3492
|
+
audience: PlanAudience | undefined;
|
|
3471
3493
|
status: NonNullable<PlanStatus | undefined>;
|
|
3472
3494
|
paddlePriceIds: {
|
|
3473
3495
|
sandbox: string[];
|
|
@@ -3493,6 +3515,7 @@ declare const PlanSchema: yup.ObjectSchema<{
|
|
|
3493
3515
|
name: undefined;
|
|
3494
3516
|
description: undefined;
|
|
3495
3517
|
kind: PlanKind.Subscription;
|
|
3518
|
+
audience: undefined;
|
|
3496
3519
|
status: PlanStatus.Draft;
|
|
3497
3520
|
paddlePriceIds: {
|
|
3498
3521
|
sandbox: never[];
|
|
@@ -3523,6 +3546,7 @@ declare const BillingSubscriptionSchema: yup.ObjectSchema<{
|
|
|
3523
3546
|
currentPeriodStart: number | undefined;
|
|
3524
3547
|
currentPeriodEnd: number | undefined;
|
|
3525
3548
|
canceledAt: number | undefined;
|
|
3549
|
+
pendingPlanKey: string | undefined;
|
|
3526
3550
|
lastEventAt: number;
|
|
3527
3551
|
createdAt: number | undefined;
|
|
3528
3552
|
updatedAt: number | undefined;
|
|
@@ -3536,6 +3560,7 @@ declare const BillingSubscriptionSchema: yup.ObjectSchema<{
|
|
|
3536
3560
|
currentPeriodStart: undefined;
|
|
3537
3561
|
currentPeriodEnd: undefined;
|
|
3538
3562
|
canceledAt: undefined;
|
|
3563
|
+
pendingPlanKey: undefined;
|
|
3539
3564
|
lastEventAt: 0;
|
|
3540
3565
|
createdAt: undefined;
|
|
3541
3566
|
updatedAt: undefined;
|
|
@@ -5316,4 +5341,4 @@ declare const StudentCompletenessSchema: yup.ObjectSchema<{
|
|
|
5316
5341
|
};
|
|
5317
5342
|
}, "">;
|
|
5318
5343
|
|
|
5319
|
-
export { AnswerChoiceType, ApplicationReceivePreference, BillingPeriod, BillingSubscriptionSchema, BillingTransactionSchema, CAMPAIGN_MAX_RECIPIENTS_CEILING, CONSUME_MAX_UNITS, CampaignDataSourceSchema, CampaignEndKind, CampaignIntervalUnit, CampaignSchema, CampaignStatus, CampaignStatusTransitions, CampaignTriggerKind, CampaignTriggerSchema, ChoiceQuestionSchema, type City, CityFilterSchema, CitySchema, Common, CompensationType, CompletenessScoreSchema, ContactTypes, CoordinatorPageLinkSchema, type Country, CountryFilterSchema, CountrySchema, type CountryTimezone, DISPLAY_DATE_FORMAT, DISPLAY_DATE_FORMAT_SHORT, DateStringSchema, DbDefaultSchema, DefaultPaginatedResponse, DefaultPaginationOptions, DefaultUserRoles, DurationSchema, EMPTY_STRING, EducationLevel, EducationSchema, EmployeeCount, EmploymentType, EntitlementConsumeSchema, EntitlementDenialReason, EntitlementDenialSchema, EntitlingSubscriptionStatuses, ExperienceLevel, FEEDBACK_MESSAGE_MAX, FeatureEntitlementSchema, FeatureKey, FeedbackFilterSchema, FeedbackSchema, FeedbackStatus, FeedbackType, GEO_COLLECTIONS, GEO_SEARCH_MAX, GRANT_MAX_LIMIT, GeneraDetailFields, GeoKind, type GeoSyncCounts, GeoSyncPhase, type GeoSyncRun, GeoSyncRunSchema, GeoSyncStatus, GeoSyncTrigger, type GeoTranslations, GrantType, GroupFilterSchema, GroupManagedBy, GroupMembershipSchema, GroupMembershipStatus, GroupSchema, GroupStatus, GroupTranslationSchema, GroupVisibility, InputQuestionSchema, JOB_TAXONOMY, JobAlertFrequency, JobCategory, JobFilterSchema, JobIndustry, JobSchema, JobSearchUrgency, JobStatus, JobSubCategory, LanguageFilterSchema, LocationSchema, MIN_SALARY_LOWER_BOUND, MIN_SALARY_UPPER_BOUND, MailingListFilterSchema, MailingListSchema, MoneySchema, NotificationType, OccurrenceStatus, PREFILL_MIRRORED_KEYS, PRIVATE_PROFILE_FIELDS, PaddleEnvironment, PaddlePriceIdsSchema, PageFilterSchema, PageSchema, PageStatus, PageType, type PaginatedResponse, PaginationSchema, PlanGrantSchema, PlanKind, PlanSchema, PlanStatus, PostSchema, PostStatus, type PrefillMirroredKey, type PrivateProfileField, ProficiencyLevel, type PushSubscriptionRecord, PushSubscriptionSchema, QuestionSchema, QuestionType, QuotaPeriod, ReadAndAcknowledgeQuestionSchema, RecruiterPageLinkSchema, ReferralSource, ReportReason, ReportSchema, ResourceType, SITEMAP_FORMAT, SYSTEM_DATE_FORMAT, SavedSearchSchema, SavedSearchStatus, SignupContextSource, SkillFilterSchema, SkillSchema, SocialAccount, SocialAccountSchema, type State, StateFilterSchema, StateSchema, StudentCompletenessSchema, StudyType, SubscriptionStatus, SupportedAnswerChoiceTypes, SupportedApplicationReceivePreferences, SupportedBillingPeriods, SupportedCampaignEndKinds, SupportedCampaignIntervalUnits, SupportedCampaignStatuses, SupportedCampaignTriggerKinds, SupportedCompensationTypes, SupportedContactTypes, SupportedEducationLevels, SupportedEmployeeCounts, SupportedEmploymentTypes, SupportedEntitlementDenialReasons, SupportedExperienceLevels, SupportedFeatureKeys, SupportedFeedbackStatuses, SupportedFeedbackTypes, SupportedGeoKinds, SupportedGeoSyncPhases, SupportedGeoSyncStatuses, SupportedGeoSyncTriggers, SupportedGrantTypes, SupportedGroupManagedBy, SupportedGroupMembershipStatuses, SupportedGroupStatuses, SupportedGroupVisibilities, SupportedJobAlertFrequencies, SupportedJobCategories, SupportedJobIndustries, SupportedJobSearchUrgencies, SupportedJobStatuses, SupportedJobSubCategories, SupportedNotificationTypes, SupportedOccurrenceStatuses, SupportedPaddleEnvironments, SupportedPageStatuses, SupportedPageTypes, SupportedPlanKinds, SupportedPlanStatuses, SupportedPostStatuses, SupportedProficiencyLevels, SupportedQuestionTypes, SupportedQuotaPeriods, SupportedReferralSources, SupportedReportReasons, SupportedResourceTypes, SupportedSalaryCurrencies, type SupportedSalaryCurrency, SupportedSavedSearchStatuses, SupportedSignupContextSources, SupportedSocialAccounts, SupportedStudyTypes, SupportedSubscriptionStatuses, SupportedTemplateVariableBindingKinds, SupportedTransactionStatuses, SupportedUserProfileVisibilities, SupportedUserRoles, SupportedUserStatuses, SupportedWorkModes, TAXONOMY_LABELS, type TChoiceQuestionSchema, type TDurationSchema, type TInputQuestionSchema, type TJobSchema, type TPostSchema, type TQuestionSchema, type TReadAndAcknowledgeQuestionSchema, type TUserIdAndCreatedAtSchema, TemplateVariableBindingKind, TemplateVariableBindingSchema, TerminalCampaignStatuses, TerminalGeoSyncStatuses, TermsAcceptedSchema, TransactionStatus, type User, UserAdditionalInfoSchema, UserCertificationSchema, UserCompletenessSchema, UserCoordinatorProfileSchema, UserDetailType, UserFilterSchema, UserGeneralDetailSchema, UserIdAndCreatedAtSchema, UserInterestSchema, UserJobPreferencesSchema, UserLanguageSchema, type UserProfileOverview, UserProfileVisibility, UserProjectSchema, UserRecruiterProfileSchema, UserRole, UserSchema, UserSkillSchema, UserStatus, WorkExperienceSchema, WorkMode, canTransitionCampaign, categoryOfIndustry, categoryOfSubCategory, codeTokens, conjunction, currencyBound, dateString, days, deriveIndustry, enumFacet, epoch, getSchemaByQuestion, industriesOfCategory, industryOfSubCategory, months, percent, qualified, rejectUnknownKeys, subCategoriesOfIndustry, tokens };
|
|
5344
|
+
export { AnswerChoiceType, ApplicationReceivePreference, BillingPeriod, BillingSubscriptionSchema, BillingTransactionSchema, CAMPAIGN_MAX_RECIPIENTS_CEILING, CONSUME_MAX_UNITS, CampaignDataSourceSchema, CampaignEndKind, CampaignIntervalUnit, CampaignSchema, CampaignStatus, CampaignStatusTransitions, CampaignTriggerKind, CampaignTriggerSchema, ChoiceQuestionSchema, type City, CityFilterSchema, CitySchema, Common, CompensationType, CompletenessScoreSchema, ContactTypes, CoordinatorPageLinkSchema, type Country, CountryFilterSchema, CountrySchema, type CountryTimezone, DISPLAY_DATE_FORMAT, DISPLAY_DATE_FORMAT_SHORT, DateStringSchema, DbDefaultSchema, DefaultPaginatedResponse, DefaultPaginationOptions, DefaultUserRoles, DurationSchema, EMPTY_STRING, EducationLevel, EducationSchema, EmployeeCount, EmploymentType, EntitlementConsumeSchema, EntitlementDenialReason, EntitlementDenialSchema, EntitlingSubscriptionStatuses, ExperienceLevel, FEEDBACK_MESSAGE_MAX, FeatureEntitlementSchema, FeatureKey, FeedbackFilterSchema, FeedbackSchema, FeedbackStatus, FeedbackType, GEO_COLLECTIONS, GEO_SEARCH_MAX, GRANT_MAX_LIMIT, GeneraDetailFields, GeoKind, type GeoSyncCounts, GeoSyncPhase, type GeoSyncRun, GeoSyncRunSchema, GeoSyncStatus, GeoSyncTrigger, type GeoTranslations, GrantType, GroupFilterSchema, GroupManagedBy, GroupMembershipSchema, GroupMembershipStatus, GroupSchema, GroupStatus, GroupTranslationSchema, GroupVisibility, InputQuestionSchema, JOB_TAXONOMY, JobAlertFrequency, JobCategory, JobFilterSchema, JobIndustry, JobSchema, JobSearchUrgency, JobStatus, JobSubCategory, LanguageFilterSchema, LiveSubscriptionStatuses, LocationSchema, MIN_SALARY_LOWER_BOUND, MIN_SALARY_UPPER_BOUND, MailingListFilterSchema, MailingListSchema, MoneySchema, NotificationType, OccurrenceStatus, PREFILL_MIRRORED_KEYS, PRIVATE_PROFILE_FIELDS, PaddleEnvironment, PaddlePriceIdsSchema, PageFilterSchema, PageSchema, PageStatus, PageType, type PaginatedResponse, PaginationSchema, PlanAudience, PlanGrantSchema, PlanKind, PlanSchema, PlanStatus, PostSchema, PostStatus, type PrefillMirroredKey, type PrivateProfileField, ProficiencyLevel, type PushSubscriptionRecord, PushSubscriptionSchema, QuestionSchema, QuestionType, QuotaPeriod, ReadAndAcknowledgeQuestionSchema, RecruiterPageLinkSchema, ReferralSource, ReportReason, ReportSchema, ResourceType, SITEMAP_FORMAT, SYSTEM_DATE_FORMAT, SavedSearchSchema, SavedSearchStatus, SignupContextSource, SkillFilterSchema, SkillSchema, SocialAccount, SocialAccountSchema, type State, StateFilterSchema, StateSchema, StudentCompletenessSchema, StudyType, SubscriptionStatus, SupportedAnswerChoiceTypes, SupportedApplicationReceivePreferences, SupportedBillingPeriods, SupportedCampaignEndKinds, SupportedCampaignIntervalUnits, SupportedCampaignStatuses, SupportedCampaignTriggerKinds, SupportedCompensationTypes, SupportedContactTypes, SupportedEducationLevels, SupportedEmployeeCounts, SupportedEmploymentTypes, SupportedEntitlementDenialReasons, SupportedExperienceLevels, SupportedFeatureKeys, SupportedFeedbackStatuses, SupportedFeedbackTypes, SupportedGeoKinds, SupportedGeoSyncPhases, SupportedGeoSyncStatuses, SupportedGeoSyncTriggers, SupportedGrantTypes, SupportedGroupManagedBy, SupportedGroupMembershipStatuses, SupportedGroupStatuses, SupportedGroupVisibilities, SupportedJobAlertFrequencies, SupportedJobCategories, SupportedJobIndustries, SupportedJobSearchUrgencies, SupportedJobStatuses, SupportedJobSubCategories, SupportedNotificationTypes, SupportedOccurrenceStatuses, SupportedPaddleEnvironments, SupportedPageStatuses, SupportedPageTypes, SupportedPlanAudiences, SupportedPlanKinds, SupportedPlanStatuses, SupportedPostStatuses, SupportedProficiencyLevels, SupportedQuestionTypes, SupportedQuotaPeriods, SupportedReferralSources, SupportedReportReasons, SupportedResourceTypes, SupportedSalaryCurrencies, type SupportedSalaryCurrency, SupportedSavedSearchStatuses, SupportedSignupContextSources, SupportedSocialAccounts, SupportedStudyTypes, SupportedSubscriptionStatuses, SupportedTemplateVariableBindingKinds, SupportedTransactionStatuses, SupportedUserProfileVisibilities, SupportedUserRoles, SupportedUserStatuses, SupportedWorkModes, TAXONOMY_LABELS, type TChoiceQuestionSchema, type TDurationSchema, type TInputQuestionSchema, type TJobSchema, type TPostSchema, type TQuestionSchema, type TReadAndAcknowledgeQuestionSchema, type TUserIdAndCreatedAtSchema, TemplateVariableBindingKind, TemplateVariableBindingSchema, TerminalCampaignStatuses, TerminalGeoSyncStatuses, TermsAcceptedSchema, TransactionStatus, type User, UserAdditionalInfoSchema, UserCertificationSchema, UserCompletenessSchema, UserCoordinatorProfileSchema, UserDetailType, UserFilterSchema, UserGeneralDetailSchema, UserIdAndCreatedAtSchema, UserInterestSchema, UserJobPreferencesSchema, UserLanguageSchema, type UserProfileOverview, UserProfileVisibility, UserProjectSchema, UserRecruiterProfileSchema, UserRole, UserSchema, UserSkillSchema, UserStatus, WorkExperienceSchema, WorkMode, canTransitionCampaign, categoryOfIndustry, categoryOfSubCategory, codeTokens, conjunction, currencyBound, dateString, days, deriveIndustry, enumFacet, epoch, getSchemaByQuestion, industriesOfCategory, industryOfSubCategory, months, percent, qualified, rejectUnknownKeys, subCategoriesOfIndustry, tokens };
|
package/dist/index.d.ts
CHANGED
|
@@ -3286,6 +3286,21 @@ declare enum PlanStatus {
|
|
|
3286
3286
|
Archived = "archived"
|
|
3287
3287
|
}
|
|
3288
3288
|
declare const SupportedPlanStatuses: PlanStatus[];
|
|
3289
|
+
/**
|
|
3290
|
+
* The product line a plan belongs to. A user holds at most ONE live
|
|
3291
|
+
* subscription per audience: switching within a line updates that subscription,
|
|
3292
|
+
* it never adds a second one. Different audiences may be held side by side.
|
|
3293
|
+
*
|
|
3294
|
+
* A plan with no audience belongs to the single default line, which is every
|
|
3295
|
+
* plan seeded before this existed.
|
|
3296
|
+
*/
|
|
3297
|
+
declare enum PlanAudience {
|
|
3298
|
+
Employer = "employer",
|
|
3299
|
+
JobSeeker = "job-seeker",
|
|
3300
|
+
Recruiter = "recruiter",
|
|
3301
|
+
Company = "company"
|
|
3302
|
+
}
|
|
3303
|
+
declare const SupportedPlanAudiences: PlanAudience[];
|
|
3289
3304
|
/**
|
|
3290
3305
|
* How a grant gives access to a feature.
|
|
3291
3306
|
*
|
|
@@ -3344,6 +3359,12 @@ declare enum SubscriptionStatus {
|
|
|
3344
3359
|
declare const SupportedSubscriptionStatuses: SubscriptionStatus[];
|
|
3345
3360
|
/** Subscription statuses that currently entitle the holder to their plan's grants. */
|
|
3346
3361
|
declare const EntitlingSubscriptionStatuses: SubscriptionStatus[];
|
|
3362
|
+
/**
|
|
3363
|
+
* Subscription statuses that still occupy the user's slot in a plan audience.
|
|
3364
|
+
* Wider than `EntitlingSubscriptionStatuses`: a paused subscription grants
|
|
3365
|
+
* nothing, but buying again would still leave two subscriptions to one plan.
|
|
3366
|
+
*/
|
|
3367
|
+
declare const LiveSubscriptionStatuses: SubscriptionStatus[];
|
|
3347
3368
|
/** Paddle transaction status, verbatim. `completed` is where a one-off is fulfilled. */
|
|
3348
3369
|
declare enum TransactionStatus {
|
|
3349
3370
|
Draft = "draft",
|
|
@@ -3468,6 +3489,7 @@ declare const PlanSchema: yup.ObjectSchema<{
|
|
|
3468
3489
|
name: string;
|
|
3469
3490
|
description: string | undefined;
|
|
3470
3491
|
kind: NonNullable<PlanKind | undefined>;
|
|
3492
|
+
audience: PlanAudience | undefined;
|
|
3471
3493
|
status: NonNullable<PlanStatus | undefined>;
|
|
3472
3494
|
paddlePriceIds: {
|
|
3473
3495
|
sandbox: string[];
|
|
@@ -3493,6 +3515,7 @@ declare const PlanSchema: yup.ObjectSchema<{
|
|
|
3493
3515
|
name: undefined;
|
|
3494
3516
|
description: undefined;
|
|
3495
3517
|
kind: PlanKind.Subscription;
|
|
3518
|
+
audience: undefined;
|
|
3496
3519
|
status: PlanStatus.Draft;
|
|
3497
3520
|
paddlePriceIds: {
|
|
3498
3521
|
sandbox: never[];
|
|
@@ -3523,6 +3546,7 @@ declare const BillingSubscriptionSchema: yup.ObjectSchema<{
|
|
|
3523
3546
|
currentPeriodStart: number | undefined;
|
|
3524
3547
|
currentPeriodEnd: number | undefined;
|
|
3525
3548
|
canceledAt: number | undefined;
|
|
3549
|
+
pendingPlanKey: string | undefined;
|
|
3526
3550
|
lastEventAt: number;
|
|
3527
3551
|
createdAt: number | undefined;
|
|
3528
3552
|
updatedAt: number | undefined;
|
|
@@ -3536,6 +3560,7 @@ declare const BillingSubscriptionSchema: yup.ObjectSchema<{
|
|
|
3536
3560
|
currentPeriodStart: undefined;
|
|
3537
3561
|
currentPeriodEnd: undefined;
|
|
3538
3562
|
canceledAt: undefined;
|
|
3563
|
+
pendingPlanKey: undefined;
|
|
3539
3564
|
lastEventAt: 0;
|
|
3540
3565
|
createdAt: undefined;
|
|
3541
3566
|
updatedAt: undefined;
|
|
@@ -5316,4 +5341,4 @@ declare const StudentCompletenessSchema: yup.ObjectSchema<{
|
|
|
5316
5341
|
};
|
|
5317
5342
|
}, "">;
|
|
5318
5343
|
|
|
5319
|
-
export { AnswerChoiceType, ApplicationReceivePreference, BillingPeriod, BillingSubscriptionSchema, BillingTransactionSchema, CAMPAIGN_MAX_RECIPIENTS_CEILING, CONSUME_MAX_UNITS, CampaignDataSourceSchema, CampaignEndKind, CampaignIntervalUnit, CampaignSchema, CampaignStatus, CampaignStatusTransitions, CampaignTriggerKind, CampaignTriggerSchema, ChoiceQuestionSchema, type City, CityFilterSchema, CitySchema, Common, CompensationType, CompletenessScoreSchema, ContactTypes, CoordinatorPageLinkSchema, type Country, CountryFilterSchema, CountrySchema, type CountryTimezone, DISPLAY_DATE_FORMAT, DISPLAY_DATE_FORMAT_SHORT, DateStringSchema, DbDefaultSchema, DefaultPaginatedResponse, DefaultPaginationOptions, DefaultUserRoles, DurationSchema, EMPTY_STRING, EducationLevel, EducationSchema, EmployeeCount, EmploymentType, EntitlementConsumeSchema, EntitlementDenialReason, EntitlementDenialSchema, EntitlingSubscriptionStatuses, ExperienceLevel, FEEDBACK_MESSAGE_MAX, FeatureEntitlementSchema, FeatureKey, FeedbackFilterSchema, FeedbackSchema, FeedbackStatus, FeedbackType, GEO_COLLECTIONS, GEO_SEARCH_MAX, GRANT_MAX_LIMIT, GeneraDetailFields, GeoKind, type GeoSyncCounts, GeoSyncPhase, type GeoSyncRun, GeoSyncRunSchema, GeoSyncStatus, GeoSyncTrigger, type GeoTranslations, GrantType, GroupFilterSchema, GroupManagedBy, GroupMembershipSchema, GroupMembershipStatus, GroupSchema, GroupStatus, GroupTranslationSchema, GroupVisibility, InputQuestionSchema, JOB_TAXONOMY, JobAlertFrequency, JobCategory, JobFilterSchema, JobIndustry, JobSchema, JobSearchUrgency, JobStatus, JobSubCategory, LanguageFilterSchema, LocationSchema, MIN_SALARY_LOWER_BOUND, MIN_SALARY_UPPER_BOUND, MailingListFilterSchema, MailingListSchema, MoneySchema, NotificationType, OccurrenceStatus, PREFILL_MIRRORED_KEYS, PRIVATE_PROFILE_FIELDS, PaddleEnvironment, PaddlePriceIdsSchema, PageFilterSchema, PageSchema, PageStatus, PageType, type PaginatedResponse, PaginationSchema, PlanGrantSchema, PlanKind, PlanSchema, PlanStatus, PostSchema, PostStatus, type PrefillMirroredKey, type PrivateProfileField, ProficiencyLevel, type PushSubscriptionRecord, PushSubscriptionSchema, QuestionSchema, QuestionType, QuotaPeriod, ReadAndAcknowledgeQuestionSchema, RecruiterPageLinkSchema, ReferralSource, ReportReason, ReportSchema, ResourceType, SITEMAP_FORMAT, SYSTEM_DATE_FORMAT, SavedSearchSchema, SavedSearchStatus, SignupContextSource, SkillFilterSchema, SkillSchema, SocialAccount, SocialAccountSchema, type State, StateFilterSchema, StateSchema, StudentCompletenessSchema, StudyType, SubscriptionStatus, SupportedAnswerChoiceTypes, SupportedApplicationReceivePreferences, SupportedBillingPeriods, SupportedCampaignEndKinds, SupportedCampaignIntervalUnits, SupportedCampaignStatuses, SupportedCampaignTriggerKinds, SupportedCompensationTypes, SupportedContactTypes, SupportedEducationLevels, SupportedEmployeeCounts, SupportedEmploymentTypes, SupportedEntitlementDenialReasons, SupportedExperienceLevels, SupportedFeatureKeys, SupportedFeedbackStatuses, SupportedFeedbackTypes, SupportedGeoKinds, SupportedGeoSyncPhases, SupportedGeoSyncStatuses, SupportedGeoSyncTriggers, SupportedGrantTypes, SupportedGroupManagedBy, SupportedGroupMembershipStatuses, SupportedGroupStatuses, SupportedGroupVisibilities, SupportedJobAlertFrequencies, SupportedJobCategories, SupportedJobIndustries, SupportedJobSearchUrgencies, SupportedJobStatuses, SupportedJobSubCategories, SupportedNotificationTypes, SupportedOccurrenceStatuses, SupportedPaddleEnvironments, SupportedPageStatuses, SupportedPageTypes, SupportedPlanKinds, SupportedPlanStatuses, SupportedPostStatuses, SupportedProficiencyLevels, SupportedQuestionTypes, SupportedQuotaPeriods, SupportedReferralSources, SupportedReportReasons, SupportedResourceTypes, SupportedSalaryCurrencies, type SupportedSalaryCurrency, SupportedSavedSearchStatuses, SupportedSignupContextSources, SupportedSocialAccounts, SupportedStudyTypes, SupportedSubscriptionStatuses, SupportedTemplateVariableBindingKinds, SupportedTransactionStatuses, SupportedUserProfileVisibilities, SupportedUserRoles, SupportedUserStatuses, SupportedWorkModes, TAXONOMY_LABELS, type TChoiceQuestionSchema, type TDurationSchema, type TInputQuestionSchema, type TJobSchema, type TPostSchema, type TQuestionSchema, type TReadAndAcknowledgeQuestionSchema, type TUserIdAndCreatedAtSchema, TemplateVariableBindingKind, TemplateVariableBindingSchema, TerminalCampaignStatuses, TerminalGeoSyncStatuses, TermsAcceptedSchema, TransactionStatus, type User, UserAdditionalInfoSchema, UserCertificationSchema, UserCompletenessSchema, UserCoordinatorProfileSchema, UserDetailType, UserFilterSchema, UserGeneralDetailSchema, UserIdAndCreatedAtSchema, UserInterestSchema, UserJobPreferencesSchema, UserLanguageSchema, type UserProfileOverview, UserProfileVisibility, UserProjectSchema, UserRecruiterProfileSchema, UserRole, UserSchema, UserSkillSchema, UserStatus, WorkExperienceSchema, WorkMode, canTransitionCampaign, categoryOfIndustry, categoryOfSubCategory, codeTokens, conjunction, currencyBound, dateString, days, deriveIndustry, enumFacet, epoch, getSchemaByQuestion, industriesOfCategory, industryOfSubCategory, months, percent, qualified, rejectUnknownKeys, subCategoriesOfIndustry, tokens };
|
|
5344
|
+
export { AnswerChoiceType, ApplicationReceivePreference, BillingPeriod, BillingSubscriptionSchema, BillingTransactionSchema, CAMPAIGN_MAX_RECIPIENTS_CEILING, CONSUME_MAX_UNITS, CampaignDataSourceSchema, CampaignEndKind, CampaignIntervalUnit, CampaignSchema, CampaignStatus, CampaignStatusTransitions, CampaignTriggerKind, CampaignTriggerSchema, ChoiceQuestionSchema, type City, CityFilterSchema, CitySchema, Common, CompensationType, CompletenessScoreSchema, ContactTypes, CoordinatorPageLinkSchema, type Country, CountryFilterSchema, CountrySchema, type CountryTimezone, DISPLAY_DATE_FORMAT, DISPLAY_DATE_FORMAT_SHORT, DateStringSchema, DbDefaultSchema, DefaultPaginatedResponse, DefaultPaginationOptions, DefaultUserRoles, DurationSchema, EMPTY_STRING, EducationLevel, EducationSchema, EmployeeCount, EmploymentType, EntitlementConsumeSchema, EntitlementDenialReason, EntitlementDenialSchema, EntitlingSubscriptionStatuses, ExperienceLevel, FEEDBACK_MESSAGE_MAX, FeatureEntitlementSchema, FeatureKey, FeedbackFilterSchema, FeedbackSchema, FeedbackStatus, FeedbackType, GEO_COLLECTIONS, GEO_SEARCH_MAX, GRANT_MAX_LIMIT, GeneraDetailFields, GeoKind, type GeoSyncCounts, GeoSyncPhase, type GeoSyncRun, GeoSyncRunSchema, GeoSyncStatus, GeoSyncTrigger, type GeoTranslations, GrantType, GroupFilterSchema, GroupManagedBy, GroupMembershipSchema, GroupMembershipStatus, GroupSchema, GroupStatus, GroupTranslationSchema, GroupVisibility, InputQuestionSchema, JOB_TAXONOMY, JobAlertFrequency, JobCategory, JobFilterSchema, JobIndustry, JobSchema, JobSearchUrgency, JobStatus, JobSubCategory, LanguageFilterSchema, LiveSubscriptionStatuses, LocationSchema, MIN_SALARY_LOWER_BOUND, MIN_SALARY_UPPER_BOUND, MailingListFilterSchema, MailingListSchema, MoneySchema, NotificationType, OccurrenceStatus, PREFILL_MIRRORED_KEYS, PRIVATE_PROFILE_FIELDS, PaddleEnvironment, PaddlePriceIdsSchema, PageFilterSchema, PageSchema, PageStatus, PageType, type PaginatedResponse, PaginationSchema, PlanAudience, PlanGrantSchema, PlanKind, PlanSchema, PlanStatus, PostSchema, PostStatus, type PrefillMirroredKey, type PrivateProfileField, ProficiencyLevel, type PushSubscriptionRecord, PushSubscriptionSchema, QuestionSchema, QuestionType, QuotaPeriod, ReadAndAcknowledgeQuestionSchema, RecruiterPageLinkSchema, ReferralSource, ReportReason, ReportSchema, ResourceType, SITEMAP_FORMAT, SYSTEM_DATE_FORMAT, SavedSearchSchema, SavedSearchStatus, SignupContextSource, SkillFilterSchema, SkillSchema, SocialAccount, SocialAccountSchema, type State, StateFilterSchema, StateSchema, StudentCompletenessSchema, StudyType, SubscriptionStatus, SupportedAnswerChoiceTypes, SupportedApplicationReceivePreferences, SupportedBillingPeriods, SupportedCampaignEndKinds, SupportedCampaignIntervalUnits, SupportedCampaignStatuses, SupportedCampaignTriggerKinds, SupportedCompensationTypes, SupportedContactTypes, SupportedEducationLevels, SupportedEmployeeCounts, SupportedEmploymentTypes, SupportedEntitlementDenialReasons, SupportedExperienceLevels, SupportedFeatureKeys, SupportedFeedbackStatuses, SupportedFeedbackTypes, SupportedGeoKinds, SupportedGeoSyncPhases, SupportedGeoSyncStatuses, SupportedGeoSyncTriggers, SupportedGrantTypes, SupportedGroupManagedBy, SupportedGroupMembershipStatuses, SupportedGroupStatuses, SupportedGroupVisibilities, SupportedJobAlertFrequencies, SupportedJobCategories, SupportedJobIndustries, SupportedJobSearchUrgencies, SupportedJobStatuses, SupportedJobSubCategories, SupportedNotificationTypes, SupportedOccurrenceStatuses, SupportedPaddleEnvironments, SupportedPageStatuses, SupportedPageTypes, SupportedPlanAudiences, SupportedPlanKinds, SupportedPlanStatuses, SupportedPostStatuses, SupportedProficiencyLevels, SupportedQuestionTypes, SupportedQuotaPeriods, SupportedReferralSources, SupportedReportReasons, SupportedResourceTypes, SupportedSalaryCurrencies, type SupportedSalaryCurrency, SupportedSavedSearchStatuses, SupportedSignupContextSources, SupportedSocialAccounts, SupportedStudyTypes, SupportedSubscriptionStatuses, SupportedTemplateVariableBindingKinds, SupportedTransactionStatuses, SupportedUserProfileVisibilities, SupportedUserRoles, SupportedUserStatuses, SupportedWorkModes, TAXONOMY_LABELS, type TChoiceQuestionSchema, type TDurationSchema, type TInputQuestionSchema, type TJobSchema, type TPostSchema, type TQuestionSchema, type TReadAndAcknowledgeQuestionSchema, type TUserIdAndCreatedAtSchema, TemplateVariableBindingKind, TemplateVariableBindingSchema, TerminalCampaignStatuses, TerminalGeoSyncStatuses, TermsAcceptedSchema, TransactionStatus, type User, UserAdditionalInfoSchema, UserCertificationSchema, UserCompletenessSchema, UserCoordinatorProfileSchema, UserDetailType, UserFilterSchema, UserGeneralDetailSchema, UserIdAndCreatedAtSchema, UserInterestSchema, UserJobPreferencesSchema, UserLanguageSchema, type UserProfileOverview, UserProfileVisibility, UserProjectSchema, UserRecruiterProfileSchema, UserRole, UserSchema, UserSkillSchema, UserStatus, WorkExperienceSchema, WorkMode, canTransitionCampaign, categoryOfIndustry, categoryOfSubCategory, codeTokens, conjunction, currencyBound, dateString, days, deriveIndustry, enumFacet, epoch, getSchemaByQuestion, industriesOfCategory, industryOfSubCategory, months, percent, qualified, rejectUnknownKeys, subCategoriesOfIndustry, tokens };
|
package/dist/index.js
CHANGED
|
@@ -3587,6 +3587,14 @@ var PlanStatus = /* @__PURE__ */ ((PlanStatus2) => {
|
|
|
3587
3587
|
return PlanStatus2;
|
|
3588
3588
|
})(PlanStatus || {});
|
|
3589
3589
|
var SupportedPlanStatuses = Object.values(PlanStatus);
|
|
3590
|
+
var PlanAudience = /* @__PURE__ */ ((PlanAudience2) => {
|
|
3591
|
+
PlanAudience2["Employer"] = "employer";
|
|
3592
|
+
PlanAudience2["JobSeeker"] = "job-seeker";
|
|
3593
|
+
PlanAudience2["Recruiter"] = "recruiter";
|
|
3594
|
+
PlanAudience2["Company"] = "company";
|
|
3595
|
+
return PlanAudience2;
|
|
3596
|
+
})(PlanAudience || {});
|
|
3597
|
+
var SupportedPlanAudiences = Object.values(PlanAudience);
|
|
3590
3598
|
var GrantType = /* @__PURE__ */ ((GrantType2) => {
|
|
3591
3599
|
GrantType2["Boolean"] = "boolean";
|
|
3592
3600
|
GrantType2["Quota"] = "quota";
|
|
@@ -3621,6 +3629,10 @@ var EntitlingSubscriptionStatuses = [
|
|
|
3621
3629
|
"trialing" /* Trialing */,
|
|
3622
3630
|
"past_due" /* PastDue */
|
|
3623
3631
|
];
|
|
3632
|
+
var LiveSubscriptionStatuses = [
|
|
3633
|
+
...EntitlingSubscriptionStatuses,
|
|
3634
|
+
"paused" /* Paused */
|
|
3635
|
+
];
|
|
3624
3636
|
var TransactionStatus = /* @__PURE__ */ ((TransactionStatus2) => {
|
|
3625
3637
|
TransactionStatus2["Draft"] = "draft";
|
|
3626
3638
|
TransactionStatus2["Ready"] = "ready";
|
|
@@ -3705,6 +3717,12 @@ var PlanSchema = object38({
|
|
|
3705
3717
|
name: string27().required().min(1).max(120).label("Name"),
|
|
3706
3718
|
description: string27().optional().max(500).label("Description"),
|
|
3707
3719
|
kind: string27().oneOf(SupportedPlanKinds).required().default("subscription" /* Subscription */).label("Kind"),
|
|
3720
|
+
/**
|
|
3721
|
+
* The line this plan belongs to; a user holds one live subscription per line.
|
|
3722
|
+
* Optional on purpose: absent is the default line, so existing plans need no
|
|
3723
|
+
* migration and together still read as "one plan at a time".
|
|
3724
|
+
*/
|
|
3725
|
+
audience: string27().oneOf(SupportedPlanAudiences).optional().label("Audience"),
|
|
3708
3726
|
status: string27().oneOf(SupportedPlanStatuses).required().default("draft" /* Draft */).label("Status"),
|
|
3709
3727
|
paddlePriceIds: PaddlePriceIdsSchema.default(
|
|
3710
3728
|
() => PaddlePriceIdsSchema.getDefault()
|
|
@@ -3740,6 +3758,13 @@ var BillingSubscriptionSchema = object38({
|
|
|
3740
3758
|
currentPeriodEnd: number17().optional().label("Current Period End"),
|
|
3741
3759
|
/** Set when a cancellation is scheduled; access continues until the period ends. */
|
|
3742
3760
|
canceledAt: number17().optional().label("Canceled At"),
|
|
3761
|
+
/**
|
|
3762
|
+
* A downgrade booked for the end of the current period: the plan key it moves
|
|
3763
|
+
* to at renewal. Upgrades never set this; they apply immediately. Mirrored
|
|
3764
|
+
* from the Paddle subscription's own `customData`, so Paddle stays the source
|
|
3765
|
+
* of truth.
|
|
3766
|
+
*/
|
|
3767
|
+
pendingPlanKey: string27().optional().label("Pending Plan Key"),
|
|
3743
3768
|
/** `occurred_at` of the newest Paddle event applied. Guards out-of-order writes. */
|
|
3744
3769
|
lastEventAt: number17().required().default(0).label("Last Event At"),
|
|
3745
3770
|
createdAt: number17().optional().label("Created At"),
|
|
@@ -4420,6 +4445,7 @@ export {
|
|
|
4420
4445
|
JobStatus,
|
|
4421
4446
|
JobSubCategory,
|
|
4422
4447
|
LanguageFilterSchema,
|
|
4448
|
+
LiveSubscriptionStatuses,
|
|
4423
4449
|
LocationSchema,
|
|
4424
4450
|
MIN_SALARY_LOWER_BOUND,
|
|
4425
4451
|
MIN_SALARY_UPPER_BOUND,
|
|
@@ -4437,6 +4463,7 @@ export {
|
|
|
4437
4463
|
PageStatus,
|
|
4438
4464
|
PageType,
|
|
4439
4465
|
PaginationSchema,
|
|
4466
|
+
PlanAudience,
|
|
4440
4467
|
PlanGrantSchema,
|
|
4441
4468
|
PlanKind,
|
|
4442
4469
|
PlanSchema,
|
|
@@ -4505,6 +4532,7 @@ export {
|
|
|
4505
4532
|
SupportedPaddleEnvironments,
|
|
4506
4533
|
SupportedPageStatuses,
|
|
4507
4534
|
SupportedPageTypes,
|
|
4535
|
+
SupportedPlanAudiences,
|
|
4508
4536
|
SupportedPlanKinds,
|
|
4509
4537
|
SupportedPlanStatuses,
|
|
4510
4538
|
SupportedPostStatuses,
|
package/package.json
CHANGED
|
@@ -34,6 +34,23 @@ export enum PlanStatus {
|
|
|
34
34
|
|
|
35
35
|
export const SupportedPlanStatuses = Object.values(PlanStatus);
|
|
36
36
|
|
|
37
|
+
/**
|
|
38
|
+
* The product line a plan belongs to. A user holds at most ONE live
|
|
39
|
+
* subscription per audience: switching within a line updates that subscription,
|
|
40
|
+
* it never adds a second one. Different audiences may be held side by side.
|
|
41
|
+
*
|
|
42
|
+
* A plan with no audience belongs to the single default line, which is every
|
|
43
|
+
* plan seeded before this existed.
|
|
44
|
+
*/
|
|
45
|
+
export enum PlanAudience {
|
|
46
|
+
Employer = "employer",
|
|
47
|
+
JobSeeker = "job-seeker",
|
|
48
|
+
Recruiter = "recruiter",
|
|
49
|
+
Company = "company",
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export const SupportedPlanAudiences = Object.values(PlanAudience);
|
|
53
|
+
|
|
37
54
|
/**
|
|
38
55
|
* How a grant gives access to a feature.
|
|
39
56
|
*
|
|
@@ -107,6 +124,16 @@ export const EntitlingSubscriptionStatuses = [
|
|
|
107
124
|
SubscriptionStatus.PastDue,
|
|
108
125
|
];
|
|
109
126
|
|
|
127
|
+
/**
|
|
128
|
+
* Subscription statuses that still occupy the user's slot in a plan audience.
|
|
129
|
+
* Wider than `EntitlingSubscriptionStatuses`: a paused subscription grants
|
|
130
|
+
* nothing, but buying again would still leave two subscriptions to one plan.
|
|
131
|
+
*/
|
|
132
|
+
export const LiveSubscriptionStatuses = [
|
|
133
|
+
...EntitlingSubscriptionStatuses,
|
|
134
|
+
SubscriptionStatus.Paused,
|
|
135
|
+
];
|
|
136
|
+
|
|
110
137
|
/** Paddle transaction status, verbatim. `completed` is where a one-off is fulfilled. */
|
|
111
138
|
export enum TransactionStatus {
|
|
112
139
|
Draft = "draft",
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
SupportedBillingPeriods,
|
|
10
10
|
SupportedEntitlementDenialReasons,
|
|
11
11
|
SupportedGrantTypes,
|
|
12
|
+
SupportedPlanAudiences,
|
|
12
13
|
SupportedPlanKinds,
|
|
13
14
|
SupportedPlanStatuses,
|
|
14
15
|
SupportedQuotaPeriods,
|
|
@@ -137,6 +138,15 @@ export const PlanSchema = object({
|
|
|
137
138
|
.required()
|
|
138
139
|
.default(PlanKind.Subscription)
|
|
139
140
|
.label("Kind"),
|
|
141
|
+
/**
|
|
142
|
+
* The line this plan belongs to; a user holds one live subscription per line.
|
|
143
|
+
* Optional on purpose: absent is the default line, so existing plans need no
|
|
144
|
+
* migration and together still read as "one plan at a time".
|
|
145
|
+
*/
|
|
146
|
+
audience: string()
|
|
147
|
+
.oneOf(SupportedPlanAudiences)
|
|
148
|
+
.optional()
|
|
149
|
+
.label("Audience"),
|
|
140
150
|
status: string()
|
|
141
151
|
.oneOf(SupportedPlanStatuses)
|
|
142
152
|
.required()
|
|
@@ -197,6 +207,13 @@ export const BillingSubscriptionSchema = object({
|
|
|
197
207
|
currentPeriodEnd: number().optional().label("Current Period End"),
|
|
198
208
|
/** Set when a cancellation is scheduled; access continues until the period ends. */
|
|
199
209
|
canceledAt: number().optional().label("Canceled At"),
|
|
210
|
+
/**
|
|
211
|
+
* A downgrade booked for the end of the current period: the plan key it moves
|
|
212
|
+
* to at renewal. Upgrades never set this; they apply immediately. Mirrored
|
|
213
|
+
* from the Paddle subscription's own `customData`, so Paddle stays the source
|
|
214
|
+
* of truth.
|
|
215
|
+
*/
|
|
216
|
+
pendingPlanKey: string().optional().label("Pending Plan Key"),
|
|
200
217
|
/** `occurred_at` of the newest Paddle event applied. Guards out-of-order writes. */
|
|
201
218
|
lastEventAt: number().required().default(0).label("Last Event At"),
|
|
202
219
|
createdAt: number().optional().label("Created At"),
|