@odla-ai/chapter 0.52.1 → 0.54.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 +45 -1
- package/dist/{chunk-WWF2TO3H.js → chunk-NDZCR3OW.js} +43 -9
- package/dist/chunk-NDZCR3OW.js.map +1 -0
- package/dist/{chunk-TEHCORNC.js → chunk-SPEL4OGE.js} +57 -23
- package/dist/chunk-SPEL4OGE.js.map +1 -0
- package/dist/index.cjs +227 -113
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +33 -10
- package/dist/index.d.ts +33 -10
- package/dist/index.js +227 -113
- package/dist/index.js.map +1 -1
- package/dist/ui/admin/index.d.ts +4 -3
- package/dist/ui/admin/index.js +1 -1
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/index.js +8 -2
- package/dist/ui/member/index.d.ts +32 -1
- package/dist/ui/member/index.js +7 -1
- package/dist/worker/index.cjs +595 -212
- package/dist/worker/index.cjs.map +1 -1
- package/dist/worker/index.d.cts +116 -9
- package/dist/worker/index.d.ts +116 -9
- package/dist/worker/index.js +588 -205
- package/dist/worker/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-TEHCORNC.js.map +0 -1
- package/dist/chunk-WWF2TO3H.js.map +0 -1
package/dist/worker/index.d.cts
CHANGED
|
@@ -847,6 +847,8 @@ interface MembershipOfferingVersion {
|
|
|
847
847
|
};
|
|
848
848
|
autoRenew: true;
|
|
849
849
|
paymentGraceDays: number;
|
|
850
|
+
/** Price of the one named additional seat, in cents. `0` means the membership includes the seat: it is granted
|
|
851
|
+
* without a provider payment or renewal line, and still needs a named recipient, acceptance and approval. */
|
|
850
852
|
seatPriceCents: number;
|
|
851
853
|
/** Calendar months after the initial payment during which a seat may be bought. Absent: no window; a seat
|
|
852
854
|
* may be bought whenever the primary membership is paid and active, renewals included. */
|
|
@@ -1007,6 +1009,55 @@ interface MembershipAccessReceipt {
|
|
|
1007
1009
|
restartEligible?: boolean;
|
|
1008
1010
|
}
|
|
1009
1011
|
|
|
1012
|
+
/** The adapter verifies the purchaser session and supplies its canonical email and the configured seat Price. */
|
|
1013
|
+
interface ReserveNamedMembershipSeatInput extends MembershipQuoteTarget {
|
|
1014
|
+
recipientName: string;
|
|
1015
|
+
recipientEmail: string;
|
|
1016
|
+
purchaserEmail: string;
|
|
1017
|
+
purchaserUserId: string;
|
|
1018
|
+
priceId: string;
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
/** A seat the frozen offering prices at zero: the membership includes it, so it has no provider payment and no renewal line. */
|
|
1022
|
+
declare const namedSeatIncluded: (seat: {
|
|
1023
|
+
amountCents?: unknown;
|
|
1024
|
+
}) => boolean;
|
|
1025
|
+
/** Where the named recipient stands, from the purchaser's side, folded from the seat's lifecycle status. */
|
|
1026
|
+
type NamedSeatRecipientState = "payment_pending" | "invited" | "accepted" | "joined" | "declined" | "refunded" | "canceled";
|
|
1027
|
+
/** Fold the seat status machine into the words a members page needs: whether the person was invited, accepted, joined or left. */
|
|
1028
|
+
declare function namedSeatRecipientState(seat: {
|
|
1029
|
+
status?: unknown;
|
|
1030
|
+
refundReason?: unknown;
|
|
1031
|
+
}): NamedSeatRecipientState;
|
|
1032
|
+
/** Receipt for a seat the membership includes; there is no PaymentIntent to confirm and nothing for a card to pay. */
|
|
1033
|
+
interface IncludedNamedSeatReceipt {
|
|
1034
|
+
seatId: string;
|
|
1035
|
+
amountCents: 0;
|
|
1036
|
+
currency: string;
|
|
1037
|
+
termEndsAt: number;
|
|
1038
|
+
status: string;
|
|
1039
|
+
included: true;
|
|
1040
|
+
}
|
|
1041
|
+
/** Grant the one included seat: reserve it, then move it straight to `pending_acceptance` with its entitlement and the
|
|
1042
|
+
* invitation effect, exactly where a paid seat lands after payment and renewal attachment. No provider object is created,
|
|
1043
|
+
* so nothing renews separately: the seat co-terminates with the primary through the renewal authority. Replays converge. */
|
|
1044
|
+
declare function grantIncludedNamedSeat(db: ChapterDb, input: ReserveNamedMembershipSeatInput, now: number): Promise<IncludedNamedSeatReceipt>;
|
|
1045
|
+
|
|
1046
|
+
/** The purchaser's one named seat as the members page shows it: who was named, and whether they accepted or joined. */
|
|
1047
|
+
interface NamedSeatOfferSeat {
|
|
1048
|
+
seatId: string;
|
|
1049
|
+
status: string;
|
|
1050
|
+
recipientName: string;
|
|
1051
|
+
recipientEmail: string;
|
|
1052
|
+
/** The recipient's standing from the purchaser's side; `joined` means the seat is active and the recipient is a member. */
|
|
1053
|
+
recipientState: NamedSeatRecipientState;
|
|
1054
|
+
/** When the seat was paid for or, for an included seat, granted. */
|
|
1055
|
+
purchasedAt?: number;
|
|
1056
|
+
/** When the named recipient accepted the invitation with their own account. */
|
|
1057
|
+
acceptedAt?: number;
|
|
1058
|
+
/** When the recipient's own application was approved; the seat is active from then, once the primary is. */
|
|
1059
|
+
joinedAt?: number;
|
|
1060
|
+
}
|
|
1010
1061
|
/** Named-seat offer for the authenticated purchaser, not a transferable gift or arbitrary quantity. */
|
|
1011
1062
|
interface NamedSeatOffer {
|
|
1012
1063
|
membershipId: string;
|
|
@@ -1018,15 +1069,14 @@ interface NamedSeatOffer {
|
|
|
1018
1069
|
autoRenew: boolean;
|
|
1019
1070
|
eligible: boolean;
|
|
1020
1071
|
digest: string;
|
|
1072
|
+
/** True when the frozen offering prices the seat at zero: the membership includes it, and checkout charges no card. */
|
|
1073
|
+
included: boolean;
|
|
1021
1074
|
/** False when the frozen offering sets no purchase window: seats may be bought for as long as the membership is paid. */
|
|
1022
1075
|
purchaseWindowed?: boolean;
|
|
1023
|
-
seat?:
|
|
1024
|
-
seatId: string;
|
|
1025
|
-
status: string;
|
|
1026
|
-
recipientName: string;
|
|
1027
|
-
recipientEmail: string;
|
|
1028
|
-
};
|
|
1076
|
+
seat?: NamedSeatOfferSeat;
|
|
1029
1077
|
}
|
|
1078
|
+
/** Read the frozen offering and any existing seat without reserving or charging anything. */
|
|
1079
|
+
declare function readNamedSeatOffer(db: ChapterDb, input: MembershipQuoteTarget, now: number): Promise<NamedSeatOffer>;
|
|
1030
1080
|
|
|
1031
1081
|
/** Identity attested by the recipient's chapter after checking Clerk's verified primary email. */
|
|
1032
1082
|
interface NamedSeatInvitationRequest {
|
|
@@ -1107,12 +1157,15 @@ type MembershipOfferPreviewScope = Pick<RequestMembershipOfferOptions, "appId" |
|
|
|
1107
1157
|
/** Only the named buyer's prepared payment details; no network credentials or canonical PII. */
|
|
1108
1158
|
interface NamedSeatCheckoutReceipt {
|
|
1109
1159
|
seatId: string;
|
|
1110
|
-
paymentIntentId: string;
|
|
1111
|
-
clientSecret: string;
|
|
1112
1160
|
amountCents: number;
|
|
1113
1161
|
currency: string;
|
|
1114
1162
|
termEndsAt: number;
|
|
1115
1163
|
status: string;
|
|
1164
|
+
/** Present for a priced seat: the PaymentIntent the purchaser's card confirms. Absent for an included seat. */
|
|
1165
|
+
paymentIntentId?: string;
|
|
1166
|
+
clientSecret?: string;
|
|
1167
|
+
/** True when the membership includes the seat: it was granted at checkout and no card is charged. */
|
|
1168
|
+
included?: true;
|
|
1116
1169
|
}
|
|
1117
1170
|
/** Result of attesting one verified recipient's acceptance or completed Journey. */
|
|
1118
1171
|
interface NamedSeatRecipientReceipt {
|
|
@@ -1414,9 +1467,63 @@ type NamedSeatOperatorRefundInput = MembershipQuoteTarget & {
|
|
|
1414
1467
|
*/
|
|
1415
1468
|
declare function refundNamedSeatByOperator(db: ChapterDb, input: NamedSeatOperatorRefundInput, stripeSecretKey: string, now: number): Promise<NamedSeatRefundReceipt>;
|
|
1416
1469
|
|
|
1470
|
+
/** Why one membership was left as it was. `would_not_widen` is the only-widens rule: the version would raise the renewal. */
|
|
1471
|
+
type MembershipRetermSkipReason = "not_found" | "scope_mismatch" | "status" | "not_founding" | "cohort_mismatch" | "sku_not_discounted" | "would_not_widen" | "provider_mismatch";
|
|
1472
|
+
/** What a re-term run did, member by member. Everything a super admin needs to read back is here; nothing is inferred later. */
|
|
1473
|
+
interface MembershipRetermReceipt {
|
|
1474
|
+
policyVersionId: string;
|
|
1475
|
+
retermed: {
|
|
1476
|
+
membershipId: string;
|
|
1477
|
+
previousPolicyVersionId?: string;
|
|
1478
|
+
previousRenewalAmountCents: number;
|
|
1479
|
+
renewalAmountCents: number;
|
|
1480
|
+
providerUpdated: boolean;
|
|
1481
|
+
}[];
|
|
1482
|
+
/** Already frozen on this version; nothing was read from or written to the provider. */
|
|
1483
|
+
unchanged: string[];
|
|
1484
|
+
skipped: {
|
|
1485
|
+
membershipId: string;
|
|
1486
|
+
reason: MembershipRetermSkipReason;
|
|
1487
|
+
}[];
|
|
1488
|
+
more: boolean;
|
|
1489
|
+
}
|
|
1490
|
+
/** Which memberships to move: every member in scope (bounded), or the named ones. */
|
|
1491
|
+
interface MembershipRetermInput {
|
|
1492
|
+
policyVersionId: string;
|
|
1493
|
+
membershipIds?: string[];
|
|
1494
|
+
limit?: number;
|
|
1495
|
+
}
|
|
1496
|
+
/** Move already-paid memberships onto a later discount policy version of the same cohort, so their next renewal carries
|
|
1497
|
+
* its while-active benefit. Only ever widens: a version that would raise a member's renewal is skipped, and a lapsed,
|
|
1498
|
+
* refunded, canceled, declined or restarting purchase is never revived. The provider is written first and the frozen row
|
|
1499
|
+
* second, under the row's revision, so a run that dies between the two is completed by running it again. Bounded. */
|
|
1500
|
+
declare function retermMembershipDiscount(db: ChapterDb, stripeSecretKey: string, scope: MembershipEffectScope, input: MembershipRetermInput, now: number): Promise<MembershipRetermReceipt>;
|
|
1501
|
+
|
|
1417
1502
|
/** Reasons a purchased seat may be refunded. No reason is time-driven: an unaccepted seat waits for a person. */
|
|
1418
1503
|
type NamedSeatRefundReason = "declined" | "operator" | "primary_closed" | "provider_refund";
|
|
1419
1504
|
|
|
1505
|
+
/** Scope of one reprice: a chapter's memberships of one SKU inside one exact runtime. */
|
|
1506
|
+
type SeatRepriceScope = MembershipEffectScope & {
|
|
1507
|
+
skuId: string;
|
|
1508
|
+
};
|
|
1509
|
+
/** What one bounded run did: memberships whose frozen seat price came down, and those left alone with the reason. */
|
|
1510
|
+
interface SeatRepriceReceipt {
|
|
1511
|
+
seatPriceCents: number;
|
|
1512
|
+
repriced: number;
|
|
1513
|
+
skipped: Array<{
|
|
1514
|
+
membershipId: string;
|
|
1515
|
+
reason: string;
|
|
1516
|
+
}>;
|
|
1517
|
+
more: boolean;
|
|
1518
|
+
}
|
|
1519
|
+
/** Lower the frozen seat price on a chapter's existing memberships of one SKU to what the SKU's current published
|
|
1520
|
+
* offering carries (`0` makes the seat included), so a member who paid before the change gets the new terms without
|
|
1521
|
+
* a new purchase. It only ever lowers, never raises: a frozen price at or below the current one, a seat already paid
|
|
1522
|
+
* for or in provider flight, and a lapsed or closed membership are left alone and named in the receipt. An unpaid,
|
|
1523
|
+
* never-started reservation follows the membership, so its checkout charges the new amount. Bounded and repeatable;
|
|
1524
|
+
* each row is fenced by revision. */
|
|
1525
|
+
declare function lowerSeatPrice(db: ChapterDb, scope: SeatRepriceScope, now: number, limit?: number): Promise<SeatRepriceReceipt>;
|
|
1526
|
+
|
|
1420
1527
|
type Row = Record<string, unknown>;
|
|
1421
1528
|
/** Host routes may reuse this gate after resolving a verified chapter/runtime account. */
|
|
1422
1529
|
declare function chapterMembershipAccess(db: ChapterDb, env: ChapterEnv, ctx: WorkerContext, app: Row): Promise<boolean>;
|
|
@@ -2038,4 +2145,4 @@ declare function chapterWorker(options: ChapterWorkerOptions): {
|
|
|
2038
2145
|
fetch(req: Request, env: ChapterEnv): Promise<Response>;
|
|
2039
2146
|
};
|
|
2040
2147
|
|
|
2041
|
-
export { type ActiveSignupControlHtml, type ActiveSignupControlThemeOptions, AdmissionGrantDeliveryError, type AdmissionGrantDeliveryOptions, type BuilderLibraryDeliveryOptions, type ChapterEnv, type ChapterErrorRecorder, type ChapterErrorReport, type ChapterWorkerOptions, type LeaderAdmissionAssignment, type LeaderAdmissionDelivery, type LeaderAdmissionDeliveryStatus, MEMBERSHIP_AUTHORITY_PATH, type MemberContentDeliveryOptions, type MembershipAuthorityHandlerOptions, type MembershipAuthorityPeer, type MembershipChapterEffect, type MembershipEffectScope, type MembershipWorkerAdapter, type MembershipWorkerAdapterOptions, type NamedSeatOperatorRefundInput, type NamedSeatRefundReason, type NetworkTargetTransport, NetworkTargetTransportError, type Route, type SignupControlDeliveryOptions, type WorkerContext, chapterMembershipAccess, chapterWorker, createMembershipAuthorityHandler, createMembershipAuthorityStorage, createMembershipChapterEffectRoute, createMembershipWorkerAdapter, createWorkerContext, deliverAdmissionGrants, deliverBuilderLibrary, deliverMemberContent, deliverMembershipChapterEffect, deliverSignupControl, drainMembershipEffects, refundNamedSeatByOperator, renderActiveSignupControlHtml, resolveNetworkTargetTransport, retryChapterApprovalEffects, retryLeaderAdmissionDeliveries, withActiveSignupControlTheme };
|
|
2148
|
+
export { type ActiveSignupControlHtml, type ActiveSignupControlThemeOptions, AdmissionGrantDeliveryError, type AdmissionGrantDeliveryOptions, type BuilderLibraryDeliveryOptions, type ChapterEnv, type ChapterErrorRecorder, type ChapterErrorReport, type ChapterWorkerOptions, type IncludedNamedSeatReceipt, type LeaderAdmissionAssignment, type LeaderAdmissionDelivery, type LeaderAdmissionDeliveryStatus, MEMBERSHIP_AUTHORITY_PATH, type MemberContentDeliveryOptions, type MembershipAuthorityHandlerOptions, type MembershipAuthorityPeer, type MembershipChapterEffect, type MembershipEffectScope, type MembershipRetermInput, type MembershipRetermReceipt, type MembershipRetermSkipReason, type MembershipWorkerAdapter, type MembershipWorkerAdapterOptions, type NamedSeatOffer, type NamedSeatOfferSeat, type NamedSeatOperatorRefundInput, type NamedSeatRecipientState, type NamedSeatRefundReason, type NetworkTargetTransport, NetworkTargetTransportError, type Route, type SeatRepriceReceipt, type SeatRepriceScope, type SignupControlDeliveryOptions, type WorkerContext, chapterMembershipAccess, chapterWorker, createMembershipAuthorityHandler, createMembershipAuthorityStorage, createMembershipChapterEffectRoute, createMembershipWorkerAdapter, createWorkerContext, deliverAdmissionGrants, deliverBuilderLibrary, deliverMemberContent, deliverMembershipChapterEffect, deliverSignupControl, drainMembershipEffects, grantIncludedNamedSeat, lowerSeatPrice, namedSeatIncluded, namedSeatRecipientState, readNamedSeatOffer, refundNamedSeatByOperator, renderActiveSignupControlHtml, resolveNetworkTargetTransport, retermMembershipDiscount, retryChapterApprovalEffects, retryLeaderAdmissionDeliveries, withActiveSignupControlTheme };
|
package/dist/worker/index.d.ts
CHANGED
|
@@ -847,6 +847,8 @@ interface MembershipOfferingVersion {
|
|
|
847
847
|
};
|
|
848
848
|
autoRenew: true;
|
|
849
849
|
paymentGraceDays: number;
|
|
850
|
+
/** Price of the one named additional seat, in cents. `0` means the membership includes the seat: it is granted
|
|
851
|
+
* without a provider payment or renewal line, and still needs a named recipient, acceptance and approval. */
|
|
850
852
|
seatPriceCents: number;
|
|
851
853
|
/** Calendar months after the initial payment during which a seat may be bought. Absent: no window; a seat
|
|
852
854
|
* may be bought whenever the primary membership is paid and active, renewals included. */
|
|
@@ -1007,6 +1009,55 @@ interface MembershipAccessReceipt {
|
|
|
1007
1009
|
restartEligible?: boolean;
|
|
1008
1010
|
}
|
|
1009
1011
|
|
|
1012
|
+
/** The adapter verifies the purchaser session and supplies its canonical email and the configured seat Price. */
|
|
1013
|
+
interface ReserveNamedMembershipSeatInput extends MembershipQuoteTarget {
|
|
1014
|
+
recipientName: string;
|
|
1015
|
+
recipientEmail: string;
|
|
1016
|
+
purchaserEmail: string;
|
|
1017
|
+
purchaserUserId: string;
|
|
1018
|
+
priceId: string;
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
/** A seat the frozen offering prices at zero: the membership includes it, so it has no provider payment and no renewal line. */
|
|
1022
|
+
declare const namedSeatIncluded: (seat: {
|
|
1023
|
+
amountCents?: unknown;
|
|
1024
|
+
}) => boolean;
|
|
1025
|
+
/** Where the named recipient stands, from the purchaser's side, folded from the seat's lifecycle status. */
|
|
1026
|
+
type NamedSeatRecipientState = "payment_pending" | "invited" | "accepted" | "joined" | "declined" | "refunded" | "canceled";
|
|
1027
|
+
/** Fold the seat status machine into the words a members page needs: whether the person was invited, accepted, joined or left. */
|
|
1028
|
+
declare function namedSeatRecipientState(seat: {
|
|
1029
|
+
status?: unknown;
|
|
1030
|
+
refundReason?: unknown;
|
|
1031
|
+
}): NamedSeatRecipientState;
|
|
1032
|
+
/** Receipt for a seat the membership includes; there is no PaymentIntent to confirm and nothing for a card to pay. */
|
|
1033
|
+
interface IncludedNamedSeatReceipt {
|
|
1034
|
+
seatId: string;
|
|
1035
|
+
amountCents: 0;
|
|
1036
|
+
currency: string;
|
|
1037
|
+
termEndsAt: number;
|
|
1038
|
+
status: string;
|
|
1039
|
+
included: true;
|
|
1040
|
+
}
|
|
1041
|
+
/** Grant the one included seat: reserve it, then move it straight to `pending_acceptance` with its entitlement and the
|
|
1042
|
+
* invitation effect, exactly where a paid seat lands after payment and renewal attachment. No provider object is created,
|
|
1043
|
+
* so nothing renews separately: the seat co-terminates with the primary through the renewal authority. Replays converge. */
|
|
1044
|
+
declare function grantIncludedNamedSeat(db: ChapterDb, input: ReserveNamedMembershipSeatInput, now: number): Promise<IncludedNamedSeatReceipt>;
|
|
1045
|
+
|
|
1046
|
+
/** The purchaser's one named seat as the members page shows it: who was named, and whether they accepted or joined. */
|
|
1047
|
+
interface NamedSeatOfferSeat {
|
|
1048
|
+
seatId: string;
|
|
1049
|
+
status: string;
|
|
1050
|
+
recipientName: string;
|
|
1051
|
+
recipientEmail: string;
|
|
1052
|
+
/** The recipient's standing from the purchaser's side; `joined` means the seat is active and the recipient is a member. */
|
|
1053
|
+
recipientState: NamedSeatRecipientState;
|
|
1054
|
+
/** When the seat was paid for or, for an included seat, granted. */
|
|
1055
|
+
purchasedAt?: number;
|
|
1056
|
+
/** When the named recipient accepted the invitation with their own account. */
|
|
1057
|
+
acceptedAt?: number;
|
|
1058
|
+
/** When the recipient's own application was approved; the seat is active from then, once the primary is. */
|
|
1059
|
+
joinedAt?: number;
|
|
1060
|
+
}
|
|
1010
1061
|
/** Named-seat offer for the authenticated purchaser, not a transferable gift or arbitrary quantity. */
|
|
1011
1062
|
interface NamedSeatOffer {
|
|
1012
1063
|
membershipId: string;
|
|
@@ -1018,15 +1069,14 @@ interface NamedSeatOffer {
|
|
|
1018
1069
|
autoRenew: boolean;
|
|
1019
1070
|
eligible: boolean;
|
|
1020
1071
|
digest: string;
|
|
1072
|
+
/** True when the frozen offering prices the seat at zero: the membership includes it, and checkout charges no card. */
|
|
1073
|
+
included: boolean;
|
|
1021
1074
|
/** False when the frozen offering sets no purchase window: seats may be bought for as long as the membership is paid. */
|
|
1022
1075
|
purchaseWindowed?: boolean;
|
|
1023
|
-
seat?:
|
|
1024
|
-
seatId: string;
|
|
1025
|
-
status: string;
|
|
1026
|
-
recipientName: string;
|
|
1027
|
-
recipientEmail: string;
|
|
1028
|
-
};
|
|
1076
|
+
seat?: NamedSeatOfferSeat;
|
|
1029
1077
|
}
|
|
1078
|
+
/** Read the frozen offering and any existing seat without reserving or charging anything. */
|
|
1079
|
+
declare function readNamedSeatOffer(db: ChapterDb, input: MembershipQuoteTarget, now: number): Promise<NamedSeatOffer>;
|
|
1030
1080
|
|
|
1031
1081
|
/** Identity attested by the recipient's chapter after checking Clerk's verified primary email. */
|
|
1032
1082
|
interface NamedSeatInvitationRequest {
|
|
@@ -1107,12 +1157,15 @@ type MembershipOfferPreviewScope = Pick<RequestMembershipOfferOptions, "appId" |
|
|
|
1107
1157
|
/** Only the named buyer's prepared payment details; no network credentials or canonical PII. */
|
|
1108
1158
|
interface NamedSeatCheckoutReceipt {
|
|
1109
1159
|
seatId: string;
|
|
1110
|
-
paymentIntentId: string;
|
|
1111
|
-
clientSecret: string;
|
|
1112
1160
|
amountCents: number;
|
|
1113
1161
|
currency: string;
|
|
1114
1162
|
termEndsAt: number;
|
|
1115
1163
|
status: string;
|
|
1164
|
+
/** Present for a priced seat: the PaymentIntent the purchaser's card confirms. Absent for an included seat. */
|
|
1165
|
+
paymentIntentId?: string;
|
|
1166
|
+
clientSecret?: string;
|
|
1167
|
+
/** True when the membership includes the seat: it was granted at checkout and no card is charged. */
|
|
1168
|
+
included?: true;
|
|
1116
1169
|
}
|
|
1117
1170
|
/** Result of attesting one verified recipient's acceptance or completed Journey. */
|
|
1118
1171
|
interface NamedSeatRecipientReceipt {
|
|
@@ -1414,9 +1467,63 @@ type NamedSeatOperatorRefundInput = MembershipQuoteTarget & {
|
|
|
1414
1467
|
*/
|
|
1415
1468
|
declare function refundNamedSeatByOperator(db: ChapterDb, input: NamedSeatOperatorRefundInput, stripeSecretKey: string, now: number): Promise<NamedSeatRefundReceipt>;
|
|
1416
1469
|
|
|
1470
|
+
/** Why one membership was left as it was. `would_not_widen` is the only-widens rule: the version would raise the renewal. */
|
|
1471
|
+
type MembershipRetermSkipReason = "not_found" | "scope_mismatch" | "status" | "not_founding" | "cohort_mismatch" | "sku_not_discounted" | "would_not_widen" | "provider_mismatch";
|
|
1472
|
+
/** What a re-term run did, member by member. Everything a super admin needs to read back is here; nothing is inferred later. */
|
|
1473
|
+
interface MembershipRetermReceipt {
|
|
1474
|
+
policyVersionId: string;
|
|
1475
|
+
retermed: {
|
|
1476
|
+
membershipId: string;
|
|
1477
|
+
previousPolicyVersionId?: string;
|
|
1478
|
+
previousRenewalAmountCents: number;
|
|
1479
|
+
renewalAmountCents: number;
|
|
1480
|
+
providerUpdated: boolean;
|
|
1481
|
+
}[];
|
|
1482
|
+
/** Already frozen on this version; nothing was read from or written to the provider. */
|
|
1483
|
+
unchanged: string[];
|
|
1484
|
+
skipped: {
|
|
1485
|
+
membershipId: string;
|
|
1486
|
+
reason: MembershipRetermSkipReason;
|
|
1487
|
+
}[];
|
|
1488
|
+
more: boolean;
|
|
1489
|
+
}
|
|
1490
|
+
/** Which memberships to move: every member in scope (bounded), or the named ones. */
|
|
1491
|
+
interface MembershipRetermInput {
|
|
1492
|
+
policyVersionId: string;
|
|
1493
|
+
membershipIds?: string[];
|
|
1494
|
+
limit?: number;
|
|
1495
|
+
}
|
|
1496
|
+
/** Move already-paid memberships onto a later discount policy version of the same cohort, so their next renewal carries
|
|
1497
|
+
* its while-active benefit. Only ever widens: a version that would raise a member's renewal is skipped, and a lapsed,
|
|
1498
|
+
* refunded, canceled, declined or restarting purchase is never revived. The provider is written first and the frozen row
|
|
1499
|
+
* second, under the row's revision, so a run that dies between the two is completed by running it again. Bounded. */
|
|
1500
|
+
declare function retermMembershipDiscount(db: ChapterDb, stripeSecretKey: string, scope: MembershipEffectScope, input: MembershipRetermInput, now: number): Promise<MembershipRetermReceipt>;
|
|
1501
|
+
|
|
1417
1502
|
/** Reasons a purchased seat may be refunded. No reason is time-driven: an unaccepted seat waits for a person. */
|
|
1418
1503
|
type NamedSeatRefundReason = "declined" | "operator" | "primary_closed" | "provider_refund";
|
|
1419
1504
|
|
|
1505
|
+
/** Scope of one reprice: a chapter's memberships of one SKU inside one exact runtime. */
|
|
1506
|
+
type SeatRepriceScope = MembershipEffectScope & {
|
|
1507
|
+
skuId: string;
|
|
1508
|
+
};
|
|
1509
|
+
/** What one bounded run did: memberships whose frozen seat price came down, and those left alone with the reason. */
|
|
1510
|
+
interface SeatRepriceReceipt {
|
|
1511
|
+
seatPriceCents: number;
|
|
1512
|
+
repriced: number;
|
|
1513
|
+
skipped: Array<{
|
|
1514
|
+
membershipId: string;
|
|
1515
|
+
reason: string;
|
|
1516
|
+
}>;
|
|
1517
|
+
more: boolean;
|
|
1518
|
+
}
|
|
1519
|
+
/** Lower the frozen seat price on a chapter's existing memberships of one SKU to what the SKU's current published
|
|
1520
|
+
* offering carries (`0` makes the seat included), so a member who paid before the change gets the new terms without
|
|
1521
|
+
* a new purchase. It only ever lowers, never raises: a frozen price at or below the current one, a seat already paid
|
|
1522
|
+
* for or in provider flight, and a lapsed or closed membership are left alone and named in the receipt. An unpaid,
|
|
1523
|
+
* never-started reservation follows the membership, so its checkout charges the new amount. Bounded and repeatable;
|
|
1524
|
+
* each row is fenced by revision. */
|
|
1525
|
+
declare function lowerSeatPrice(db: ChapterDb, scope: SeatRepriceScope, now: number, limit?: number): Promise<SeatRepriceReceipt>;
|
|
1526
|
+
|
|
1420
1527
|
type Row = Record<string, unknown>;
|
|
1421
1528
|
/** Host routes may reuse this gate after resolving a verified chapter/runtime account. */
|
|
1422
1529
|
declare function chapterMembershipAccess(db: ChapterDb, env: ChapterEnv, ctx: WorkerContext, app: Row): Promise<boolean>;
|
|
@@ -2038,4 +2145,4 @@ declare function chapterWorker(options: ChapterWorkerOptions): {
|
|
|
2038
2145
|
fetch(req: Request, env: ChapterEnv): Promise<Response>;
|
|
2039
2146
|
};
|
|
2040
2147
|
|
|
2041
|
-
export { type ActiveSignupControlHtml, type ActiveSignupControlThemeOptions, AdmissionGrantDeliveryError, type AdmissionGrantDeliveryOptions, type BuilderLibraryDeliveryOptions, type ChapterEnv, type ChapterErrorRecorder, type ChapterErrorReport, type ChapterWorkerOptions, type LeaderAdmissionAssignment, type LeaderAdmissionDelivery, type LeaderAdmissionDeliveryStatus, MEMBERSHIP_AUTHORITY_PATH, type MemberContentDeliveryOptions, type MembershipAuthorityHandlerOptions, type MembershipAuthorityPeer, type MembershipChapterEffect, type MembershipEffectScope, type MembershipWorkerAdapter, type MembershipWorkerAdapterOptions, type NamedSeatOperatorRefundInput, type NamedSeatRefundReason, type NetworkTargetTransport, NetworkTargetTransportError, type Route, type SignupControlDeliveryOptions, type WorkerContext, chapterMembershipAccess, chapterWorker, createMembershipAuthorityHandler, createMembershipAuthorityStorage, createMembershipChapterEffectRoute, createMembershipWorkerAdapter, createWorkerContext, deliverAdmissionGrants, deliverBuilderLibrary, deliverMemberContent, deliverMembershipChapterEffect, deliverSignupControl, drainMembershipEffects, refundNamedSeatByOperator, renderActiveSignupControlHtml, resolveNetworkTargetTransport, retryChapterApprovalEffects, retryLeaderAdmissionDeliveries, withActiveSignupControlTheme };
|
|
2148
|
+
export { type ActiveSignupControlHtml, type ActiveSignupControlThemeOptions, AdmissionGrantDeliveryError, type AdmissionGrantDeliveryOptions, type BuilderLibraryDeliveryOptions, type ChapterEnv, type ChapterErrorRecorder, type ChapterErrorReport, type ChapterWorkerOptions, type IncludedNamedSeatReceipt, type LeaderAdmissionAssignment, type LeaderAdmissionDelivery, type LeaderAdmissionDeliveryStatus, MEMBERSHIP_AUTHORITY_PATH, type MemberContentDeliveryOptions, type MembershipAuthorityHandlerOptions, type MembershipAuthorityPeer, type MembershipChapterEffect, type MembershipEffectScope, type MembershipRetermInput, type MembershipRetermReceipt, type MembershipRetermSkipReason, type MembershipWorkerAdapter, type MembershipWorkerAdapterOptions, type NamedSeatOffer, type NamedSeatOfferSeat, type NamedSeatOperatorRefundInput, type NamedSeatRecipientState, type NamedSeatRefundReason, type NetworkTargetTransport, NetworkTargetTransportError, type Route, type SeatRepriceReceipt, type SeatRepriceScope, type SignupControlDeliveryOptions, type WorkerContext, chapterMembershipAccess, chapterWorker, createMembershipAuthorityHandler, createMembershipAuthorityStorage, createMembershipChapterEffectRoute, createMembershipWorkerAdapter, createWorkerContext, deliverAdmissionGrants, deliverBuilderLibrary, deliverMemberContent, deliverMembershipChapterEffect, deliverSignupControl, drainMembershipEffects, grantIncludedNamedSeat, lowerSeatPrice, namedSeatIncluded, namedSeatRecipientState, readNamedSeatOffer, refundNamedSeatByOperator, renderActiveSignupControlHtml, resolveNetworkTargetTransport, retermMembershipDiscount, retryChapterApprovalEffects, retryLeaderAdmissionDeliveries, withActiveSignupControlTheme };
|