@odla-ai/chapter 0.32.3 → 0.33.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 +79 -0
- package/dist/{chunk-NYMLKPQF.js → chunk-UJIVBGL5.js} +65 -5
- package/dist/chunk-UJIVBGL5.js.map +1 -0
- package/dist/{copy-context-BXBEdp4p.d.ts → copy-context-c1tqPXOR.d.ts} +20 -0
- package/dist/index.cjs +277 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +120 -2
- package/dist/index.d.ts +120 -2
- package/dist/index.js +277 -15
- package/dist/index.js.map +1 -1
- package/dist/ui/admin/index.d.ts +2 -2
- package/dist/ui/index.d.ts +2 -2
- package/dist/ui/index.js +1 -1
- package/dist/ui/member/index.d.ts +74 -42
- package/dist/ui/member/index.js +1 -1
- package/dist/worker/index.cjs +623 -23
- package/dist/worker/index.cjs.map +1 -1
- package/dist/worker/index.d.cts +145 -1
- package/dist/worker/index.d.ts +145 -1
- package/dist/worker/index.js +618 -18
- package/dist/worker/index.js.map +1 -1
- package/package.json +1 -1
- package/runbooks/adopt-existing.md +3 -0
- package/runbooks/greenfield.md +11 -0
- package/dist/chunk-NYMLKPQF.js.map +0 -1
package/dist/worker/index.d.cts
CHANGED
|
@@ -72,6 +72,22 @@ type DeepPartial<T> = T extends readonly (infer Item)[] ? readonly Item[] : T ex
|
|
|
72
72
|
/** Recursively partial copy overrides accepted by `defineChapter({ copy })`. */
|
|
73
73
|
type ChapterCopyInput = DeepPartial<ChapterCopy>;
|
|
74
74
|
|
|
75
|
+
/** Explicit authority a chapter grants to one Built Not Found-style hub. */
|
|
76
|
+
interface ChapterSignupControl {
|
|
77
|
+
/** Stable app id expected in the signed delivery envelope. */
|
|
78
|
+
sourceId: string;
|
|
79
|
+
/** Follower-vault key holding the dedicated edge secret. */
|
|
80
|
+
secretName?: string;
|
|
81
|
+
/** Stripe mode this deployed environment accepts. */
|
|
82
|
+
stripeMode: "test" | "live";
|
|
83
|
+
}
|
|
84
|
+
/** Validated signup-control authority carried on a resolved Chapter. */
|
|
85
|
+
interface ResolvedSignupControl {
|
|
86
|
+
sourceId: string;
|
|
87
|
+
secretName: string;
|
|
88
|
+
stripeMode: "test" | "live";
|
|
89
|
+
}
|
|
90
|
+
|
|
75
91
|
/** One follower site a leader can push CRM records to. The secret VALUE never
|
|
76
92
|
* lives in config: `secretName` names the leader tenant's vaulted copy of the
|
|
77
93
|
* follower's `network_share_secret`. */
|
|
@@ -441,6 +457,8 @@ interface ChapterConfig {
|
|
|
441
457
|
/** Signed network edges: leader delivery targets and follower-owned,
|
|
442
458
|
* privacy-bounded record readers. Secret values stay in tenant vaults. */
|
|
443
459
|
network?: ChapterNetwork;
|
|
460
|
+
/** A separate signed edge that may control this chapter's complete signup. */
|
|
461
|
+
signupControl?: ChapterSignupControl;
|
|
444
462
|
/** Enable a public, host-rendered formation application workflow. */
|
|
445
463
|
formation?: LeaderFormationConfig;
|
|
446
464
|
thesis?: unknown;
|
|
@@ -535,6 +553,8 @@ interface Chapter {
|
|
|
535
553
|
copy: ChapterCopy;
|
|
536
554
|
/** Validated follower targets for leader-driven record pushes. */
|
|
537
555
|
network: ResolvedNetwork;
|
|
556
|
+
/** Null unless this follower explicitly delegates signup authority. */
|
|
557
|
+
signupControl: ResolvedSignupControl | null;
|
|
538
558
|
/** Resolved public formation intake contract (disabled when omitted). */
|
|
539
559
|
formation: ResolvedLeaderFormation;
|
|
540
560
|
/** Resolved CRM engine (from `defineCrm`). */
|
|
@@ -646,6 +666,130 @@ type WorkerContext = ReturnType<typeof createWorkerContext>;
|
|
|
646
666
|
* {@link WorkerContext} the built-ins receive. */
|
|
647
667
|
type Route = (req: Request, url: URL, env: ChapterEnv, ctx: WorkerContext) => Promise<Response | null>;
|
|
648
668
|
|
|
669
|
+
/** The first stable, shared Chapter membership-page renderer contract. */
|
|
670
|
+
declare const MEMBERSHIP_PAGE_RENDERER: "membership-cards-v1";
|
|
671
|
+
/** Fixed visual emphasis choices supported by the versioned card renderer. */
|
|
672
|
+
type MembershipTierVariant = "standard" | "featured" | "supporting";
|
|
673
|
+
/** A bounded, token-rendered aside within one membership card. */
|
|
674
|
+
interface MembershipTierCallout {
|
|
675
|
+
label?: string;
|
|
676
|
+
bodyMarkdown: string;
|
|
677
|
+
}
|
|
678
|
+
/** Scarcity copy displayed without changing tier availability or checkout. */
|
|
679
|
+
interface MembershipTierCapacity {
|
|
680
|
+
total: number;
|
|
681
|
+
label?: string;
|
|
682
|
+
}
|
|
683
|
+
/**
|
|
684
|
+
* Presentation attached to one server-authoritative membership tier.
|
|
685
|
+
*
|
|
686
|
+
* Price, free/paid state, identity, and application targeting deliberately do
|
|
687
|
+
* not live here. They are resolved from the public Chapter join config so
|
|
688
|
+
* authored marketing copy can never change what checkout charges.
|
|
689
|
+
*/
|
|
690
|
+
interface MembershipTierPresentation {
|
|
691
|
+
tierId: string;
|
|
692
|
+
variant?: MembershipTierVariant;
|
|
693
|
+
badge?: string;
|
|
694
|
+
summaryMarkdown?: string;
|
|
695
|
+
priceEyebrow?: string;
|
|
696
|
+
compareAtPriceCents?: number;
|
|
697
|
+
billingLabel?: string;
|
|
698
|
+
priceNoteMarkdown?: string;
|
|
699
|
+
capacity?: MembershipTierCapacity;
|
|
700
|
+
benefits?: readonly string[];
|
|
701
|
+
callout?: MembershipTierCallout;
|
|
702
|
+
ctaLabel?: string;
|
|
703
|
+
}
|
|
704
|
+
/** A bounded document that can be reviewed once and rendered by any Chapter host. */
|
|
705
|
+
interface MembershipPageDocument {
|
|
706
|
+
schemaVersion: 1;
|
|
707
|
+
renderer: typeof MEMBERSHIP_PAGE_RENDERER;
|
|
708
|
+
tiers: readonly MembershipTierPresentation[];
|
|
709
|
+
footnoteMarkdown?: string;
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
/** Current wire-format version for complete signup-control documents. */
|
|
713
|
+
declare const SIGNUP_CONTROL_SCHEMA_VERSION: 1;
|
|
714
|
+
/** One authoritative membership tier in a signup-control revision. */
|
|
715
|
+
interface SignupControlTier {
|
|
716
|
+
id: string;
|
|
717
|
+
name: string;
|
|
718
|
+
available: boolean;
|
|
719
|
+
sortOrder: number;
|
|
720
|
+
priceCents: number;
|
|
721
|
+
stripePriceId?: string;
|
|
722
|
+
blurb?: string;
|
|
723
|
+
}
|
|
724
|
+
/** A bounded application contract. Fields must already exist in the follower schema. */
|
|
725
|
+
interface SignupControlApplication {
|
|
726
|
+
required: readonly string[];
|
|
727
|
+
optional: readonly string[];
|
|
728
|
+
conditions?: Readonly<Record<string, FieldConditions>>;
|
|
729
|
+
copy?: Readonly<Record<string, string>>;
|
|
730
|
+
}
|
|
731
|
+
/** Delegated legal and trust copy used by the packaged join journey. */
|
|
732
|
+
interface SignupControlPolicy {
|
|
733
|
+
disclaimerText: string;
|
|
734
|
+
refundPolicyText: string;
|
|
735
|
+
trustCopy?: string;
|
|
736
|
+
commitmentText?: string;
|
|
737
|
+
normsText?: string;
|
|
738
|
+
}
|
|
739
|
+
/** Bounded semantic design tokens delegated to the chapter signup surface. */
|
|
740
|
+
interface SignupControlTheme {
|
|
741
|
+
/** Includes color, spacing, and typography tokens such as font families. */
|
|
742
|
+
tokens: Readonly<Record<string, string | number>>;
|
|
743
|
+
}
|
|
744
|
+
/** Complete desired state delivered by a controlling hub. */
|
|
745
|
+
interface SignupControlDocument {
|
|
746
|
+
schemaVersion: typeof SIGNUP_CONTROL_SCHEMA_VERSION;
|
|
747
|
+
revision: number;
|
|
748
|
+
generatedAt: number;
|
|
749
|
+
source: {
|
|
750
|
+
appId: string;
|
|
751
|
+
};
|
|
752
|
+
target: {
|
|
753
|
+
chapterId: string;
|
|
754
|
+
environment: string;
|
|
755
|
+
stripeMode: "test" | "live";
|
|
756
|
+
};
|
|
757
|
+
tiers: readonly SignupControlTier[];
|
|
758
|
+
membershipPage: MembershipPageDocument;
|
|
759
|
+
application?: SignupControlApplication;
|
|
760
|
+
policy?: SignupControlPolicy;
|
|
761
|
+
scheduling?: ChapterScheduling;
|
|
762
|
+
theme?: SignupControlTheme;
|
|
763
|
+
}
|
|
764
|
+
/** Digest travels beside the document so the exact desired state is attestable. */
|
|
765
|
+
interface SignupControlEnvelope {
|
|
766
|
+
digest: string;
|
|
767
|
+
document: SignupControlDocument;
|
|
768
|
+
}
|
|
769
|
+
/** Exact follower acknowledgement for one accepted or replayed revision. */
|
|
770
|
+
interface SignupControlReceipt {
|
|
771
|
+
ok: true;
|
|
772
|
+
target: {
|
|
773
|
+
chapterId: string;
|
|
774
|
+
environment: string;
|
|
775
|
+
};
|
|
776
|
+
revision: number;
|
|
777
|
+
digest: string;
|
|
778
|
+
status: "accepted" | "replayed";
|
|
779
|
+
acknowledgedAt: number;
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
/** Inputs for one signed hub-to-follower signup-control request. */
|
|
783
|
+
interface SignupControlDeliveryOptions {
|
|
784
|
+
secret: string;
|
|
785
|
+
sender: string;
|
|
786
|
+
targetUrl: string | URL;
|
|
787
|
+
envelope: SignupControlEnvelope;
|
|
788
|
+
fetch?: typeof globalThis.fetch;
|
|
789
|
+
}
|
|
790
|
+
/** Build and send one signed desired-state delivery. Durable retry belongs to the hub outbox. */
|
|
791
|
+
declare function deliverSignupControl(options: SignupControlDeliveryOptions): Promise<SignupControlReceipt>;
|
|
792
|
+
|
|
649
793
|
/**
|
|
650
794
|
* Build the Cloudflare `ExportedHandler` for a chapter/hub site: Clerk-JWT
|
|
651
795
|
* verification, the source-aware admin gate, the mounted @odla-ai/crm routes, the
|
|
@@ -668,4 +812,4 @@ declare function chapterWorker(options: ChapterWorkerOptions): {
|
|
|
668
812
|
fetch(req: Request, env: ChapterEnv): Promise<Response>;
|
|
669
813
|
};
|
|
670
814
|
|
|
671
|
-
export { type ChapterEnv, type ChapterWorkerOptions, type Route, type WorkerContext, chapterWorker, createWorkerContext };
|
|
815
|
+
export { type ChapterEnv, type ChapterWorkerOptions, type Route, type SignupControlDeliveryOptions, type WorkerContext, chapterWorker, createWorkerContext, deliverSignupControl };
|
package/dist/worker/index.d.ts
CHANGED
|
@@ -72,6 +72,22 @@ type DeepPartial<T> = T extends readonly (infer Item)[] ? readonly Item[] : T ex
|
|
|
72
72
|
/** Recursively partial copy overrides accepted by `defineChapter({ copy })`. */
|
|
73
73
|
type ChapterCopyInput = DeepPartial<ChapterCopy>;
|
|
74
74
|
|
|
75
|
+
/** Explicit authority a chapter grants to one Built Not Found-style hub. */
|
|
76
|
+
interface ChapterSignupControl {
|
|
77
|
+
/** Stable app id expected in the signed delivery envelope. */
|
|
78
|
+
sourceId: string;
|
|
79
|
+
/** Follower-vault key holding the dedicated edge secret. */
|
|
80
|
+
secretName?: string;
|
|
81
|
+
/** Stripe mode this deployed environment accepts. */
|
|
82
|
+
stripeMode: "test" | "live";
|
|
83
|
+
}
|
|
84
|
+
/** Validated signup-control authority carried on a resolved Chapter. */
|
|
85
|
+
interface ResolvedSignupControl {
|
|
86
|
+
sourceId: string;
|
|
87
|
+
secretName: string;
|
|
88
|
+
stripeMode: "test" | "live";
|
|
89
|
+
}
|
|
90
|
+
|
|
75
91
|
/** One follower site a leader can push CRM records to. The secret VALUE never
|
|
76
92
|
* lives in config: `secretName` names the leader tenant's vaulted copy of the
|
|
77
93
|
* follower's `network_share_secret`. */
|
|
@@ -441,6 +457,8 @@ interface ChapterConfig {
|
|
|
441
457
|
/** Signed network edges: leader delivery targets and follower-owned,
|
|
442
458
|
* privacy-bounded record readers. Secret values stay in tenant vaults. */
|
|
443
459
|
network?: ChapterNetwork;
|
|
460
|
+
/** A separate signed edge that may control this chapter's complete signup. */
|
|
461
|
+
signupControl?: ChapterSignupControl;
|
|
444
462
|
/** Enable a public, host-rendered formation application workflow. */
|
|
445
463
|
formation?: LeaderFormationConfig;
|
|
446
464
|
thesis?: unknown;
|
|
@@ -535,6 +553,8 @@ interface Chapter {
|
|
|
535
553
|
copy: ChapterCopy;
|
|
536
554
|
/** Validated follower targets for leader-driven record pushes. */
|
|
537
555
|
network: ResolvedNetwork;
|
|
556
|
+
/** Null unless this follower explicitly delegates signup authority. */
|
|
557
|
+
signupControl: ResolvedSignupControl | null;
|
|
538
558
|
/** Resolved public formation intake contract (disabled when omitted). */
|
|
539
559
|
formation: ResolvedLeaderFormation;
|
|
540
560
|
/** Resolved CRM engine (from `defineCrm`). */
|
|
@@ -646,6 +666,130 @@ type WorkerContext = ReturnType<typeof createWorkerContext>;
|
|
|
646
666
|
* {@link WorkerContext} the built-ins receive. */
|
|
647
667
|
type Route = (req: Request, url: URL, env: ChapterEnv, ctx: WorkerContext) => Promise<Response | null>;
|
|
648
668
|
|
|
669
|
+
/** The first stable, shared Chapter membership-page renderer contract. */
|
|
670
|
+
declare const MEMBERSHIP_PAGE_RENDERER: "membership-cards-v1";
|
|
671
|
+
/** Fixed visual emphasis choices supported by the versioned card renderer. */
|
|
672
|
+
type MembershipTierVariant = "standard" | "featured" | "supporting";
|
|
673
|
+
/** A bounded, token-rendered aside within one membership card. */
|
|
674
|
+
interface MembershipTierCallout {
|
|
675
|
+
label?: string;
|
|
676
|
+
bodyMarkdown: string;
|
|
677
|
+
}
|
|
678
|
+
/** Scarcity copy displayed without changing tier availability or checkout. */
|
|
679
|
+
interface MembershipTierCapacity {
|
|
680
|
+
total: number;
|
|
681
|
+
label?: string;
|
|
682
|
+
}
|
|
683
|
+
/**
|
|
684
|
+
* Presentation attached to one server-authoritative membership tier.
|
|
685
|
+
*
|
|
686
|
+
* Price, free/paid state, identity, and application targeting deliberately do
|
|
687
|
+
* not live here. They are resolved from the public Chapter join config so
|
|
688
|
+
* authored marketing copy can never change what checkout charges.
|
|
689
|
+
*/
|
|
690
|
+
interface MembershipTierPresentation {
|
|
691
|
+
tierId: string;
|
|
692
|
+
variant?: MembershipTierVariant;
|
|
693
|
+
badge?: string;
|
|
694
|
+
summaryMarkdown?: string;
|
|
695
|
+
priceEyebrow?: string;
|
|
696
|
+
compareAtPriceCents?: number;
|
|
697
|
+
billingLabel?: string;
|
|
698
|
+
priceNoteMarkdown?: string;
|
|
699
|
+
capacity?: MembershipTierCapacity;
|
|
700
|
+
benefits?: readonly string[];
|
|
701
|
+
callout?: MembershipTierCallout;
|
|
702
|
+
ctaLabel?: string;
|
|
703
|
+
}
|
|
704
|
+
/** A bounded document that can be reviewed once and rendered by any Chapter host. */
|
|
705
|
+
interface MembershipPageDocument {
|
|
706
|
+
schemaVersion: 1;
|
|
707
|
+
renderer: typeof MEMBERSHIP_PAGE_RENDERER;
|
|
708
|
+
tiers: readonly MembershipTierPresentation[];
|
|
709
|
+
footnoteMarkdown?: string;
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
/** Current wire-format version for complete signup-control documents. */
|
|
713
|
+
declare const SIGNUP_CONTROL_SCHEMA_VERSION: 1;
|
|
714
|
+
/** One authoritative membership tier in a signup-control revision. */
|
|
715
|
+
interface SignupControlTier {
|
|
716
|
+
id: string;
|
|
717
|
+
name: string;
|
|
718
|
+
available: boolean;
|
|
719
|
+
sortOrder: number;
|
|
720
|
+
priceCents: number;
|
|
721
|
+
stripePriceId?: string;
|
|
722
|
+
blurb?: string;
|
|
723
|
+
}
|
|
724
|
+
/** A bounded application contract. Fields must already exist in the follower schema. */
|
|
725
|
+
interface SignupControlApplication {
|
|
726
|
+
required: readonly string[];
|
|
727
|
+
optional: readonly string[];
|
|
728
|
+
conditions?: Readonly<Record<string, FieldConditions>>;
|
|
729
|
+
copy?: Readonly<Record<string, string>>;
|
|
730
|
+
}
|
|
731
|
+
/** Delegated legal and trust copy used by the packaged join journey. */
|
|
732
|
+
interface SignupControlPolicy {
|
|
733
|
+
disclaimerText: string;
|
|
734
|
+
refundPolicyText: string;
|
|
735
|
+
trustCopy?: string;
|
|
736
|
+
commitmentText?: string;
|
|
737
|
+
normsText?: string;
|
|
738
|
+
}
|
|
739
|
+
/** Bounded semantic design tokens delegated to the chapter signup surface. */
|
|
740
|
+
interface SignupControlTheme {
|
|
741
|
+
/** Includes color, spacing, and typography tokens such as font families. */
|
|
742
|
+
tokens: Readonly<Record<string, string | number>>;
|
|
743
|
+
}
|
|
744
|
+
/** Complete desired state delivered by a controlling hub. */
|
|
745
|
+
interface SignupControlDocument {
|
|
746
|
+
schemaVersion: typeof SIGNUP_CONTROL_SCHEMA_VERSION;
|
|
747
|
+
revision: number;
|
|
748
|
+
generatedAt: number;
|
|
749
|
+
source: {
|
|
750
|
+
appId: string;
|
|
751
|
+
};
|
|
752
|
+
target: {
|
|
753
|
+
chapterId: string;
|
|
754
|
+
environment: string;
|
|
755
|
+
stripeMode: "test" | "live";
|
|
756
|
+
};
|
|
757
|
+
tiers: readonly SignupControlTier[];
|
|
758
|
+
membershipPage: MembershipPageDocument;
|
|
759
|
+
application?: SignupControlApplication;
|
|
760
|
+
policy?: SignupControlPolicy;
|
|
761
|
+
scheduling?: ChapterScheduling;
|
|
762
|
+
theme?: SignupControlTheme;
|
|
763
|
+
}
|
|
764
|
+
/** Digest travels beside the document so the exact desired state is attestable. */
|
|
765
|
+
interface SignupControlEnvelope {
|
|
766
|
+
digest: string;
|
|
767
|
+
document: SignupControlDocument;
|
|
768
|
+
}
|
|
769
|
+
/** Exact follower acknowledgement for one accepted or replayed revision. */
|
|
770
|
+
interface SignupControlReceipt {
|
|
771
|
+
ok: true;
|
|
772
|
+
target: {
|
|
773
|
+
chapterId: string;
|
|
774
|
+
environment: string;
|
|
775
|
+
};
|
|
776
|
+
revision: number;
|
|
777
|
+
digest: string;
|
|
778
|
+
status: "accepted" | "replayed";
|
|
779
|
+
acknowledgedAt: number;
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
/** Inputs for one signed hub-to-follower signup-control request. */
|
|
783
|
+
interface SignupControlDeliveryOptions {
|
|
784
|
+
secret: string;
|
|
785
|
+
sender: string;
|
|
786
|
+
targetUrl: string | URL;
|
|
787
|
+
envelope: SignupControlEnvelope;
|
|
788
|
+
fetch?: typeof globalThis.fetch;
|
|
789
|
+
}
|
|
790
|
+
/** Build and send one signed desired-state delivery. Durable retry belongs to the hub outbox. */
|
|
791
|
+
declare function deliverSignupControl(options: SignupControlDeliveryOptions): Promise<SignupControlReceipt>;
|
|
792
|
+
|
|
649
793
|
/**
|
|
650
794
|
* Build the Cloudflare `ExportedHandler` for a chapter/hub site: Clerk-JWT
|
|
651
795
|
* verification, the source-aware admin gate, the mounted @odla-ai/crm routes, the
|
|
@@ -668,4 +812,4 @@ declare function chapterWorker(options: ChapterWorkerOptions): {
|
|
|
668
812
|
fetch(req: Request, env: ChapterEnv): Promise<Response>;
|
|
669
813
|
};
|
|
670
814
|
|
|
671
|
-
export { type ChapterEnv, type ChapterWorkerOptions, type Route, type WorkerContext, chapterWorker, createWorkerContext };
|
|
815
|
+
export { type ChapterEnv, type ChapterWorkerOptions, type Route, type SignupControlDeliveryOptions, type WorkerContext, chapterWorker, createWorkerContext, deliverSignupControl };
|