@odla-ai/chapter 0.15.1 → 0.17.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.
@@ -60,12 +60,81 @@ interface PeopleSectionOptions {
60
60
  /** The record type to list. Default "person". */
61
61
  type?: string;
62
62
  }
63
+ /** Options for {@link collectionSection}. */
64
+ interface CollectionSectionOptions {
65
+ /** The chapter's resolved CRM engine — `chapter.crm` from defineChapter. */
66
+ crm: Crm;
67
+ /** The CRM record type to list (e.g. `"person"`, `"deal"`, `"investment"`). */
68
+ type: string;
69
+ /** Section id / route segment. Defaults to `type`. */
70
+ id?: string;
71
+ /** Nav label. Defaults to the type's plural label from the CRM config. */
72
+ label?: string;
73
+ }
74
+ /**
75
+ * Build a CRM collection admin section for ANY declared record type: a
76
+ * server-driven records table plus a facet-composed detail drawer (fields,
77
+ * pipeline stage, tags) over the token-bound CrmClient. This is the generic kit —
78
+ * call it once per collection a site runs (members, deals, investments), and each
79
+ * renders with the same UX. Every action goes through `/api/crm/*`, never a direct
80
+ * db write, so the CRM invariants hold.
81
+ */
82
+ declare function collectionSection(options: CollectionSectionOptions): AdminSection;
63
83
  /**
64
- * Build the People/CRM admin section: a server-driven records table plus a
65
- * facet-composed detail drawer (fields, pipeline stage, tags) over the
66
- * token-bound CrmClient. Drop the result into `ChapterAdmin`'s `sections`.
67
- * (Notes/activity feed and saved-view navigation are noted follow-ups.)
84
+ * Build the People/CRM admin section {@link collectionSection} preset to the
85
+ * `person` type. Kept as a convenience; new collections use `collectionSection`.
68
86
  */
69
87
  declare function peopleSection(options: PeopleSectionOptions): AdminSection;
70
88
 
71
- export { type AdminSection, type AdminSectionContext, ChapterAdmin, type ChapterAdminProps, type PeopleSectionOptions, peopleSection };
89
+ /** Options for {@link dashboardSection}. */
90
+ interface DashboardSectionOptions {
91
+ id?: string;
92
+ label?: string;
93
+ }
94
+ /** Build the Dashboard admin section over `GET /api/admin/dashboard`. Drop the
95
+ * result into `ChapterAdmin`'s `sections`. */
96
+ declare function dashboardSection(options?: DashboardSectionOptions): AdminSection;
97
+
98
+ /** Options for {@link billingSection}. */
99
+ interface BillingSectionOptions {
100
+ id?: string;
101
+ label?: string;
102
+ }
103
+ /** Build the Billing admin section over `GET /api/admin/billing`. Renders a
104
+ * "not configured" note when the group has no Stripe key vaulted. */
105
+ declare function billingSection(options?: BillingSectionOptions): AdminSection;
106
+
107
+ /** Options for {@link emailSection}. */
108
+ interface EmailSectionOptions {
109
+ id?: string;
110
+ label?: string;
111
+ }
112
+ /** Build the Email admin section: template + address editor over
113
+ * `GET/PUT /api/admin/group/email`, the send log, and per-template test sends. */
114
+ declare function emailSection(options?: EmailSectionOptions): AdminSection;
115
+
116
+ /** Options for {@link meetingsSection}. */
117
+ interface MeetingsSectionOptions {
118
+ id?: string;
119
+ label?: string;
120
+ }
121
+ /** Build the Meetings admin section: the reconciled agenda over
122
+ * `GET /api/admin/meetings`, with reschedule/cancel actions. */
123
+ declare function meetingsSection(options?: MeetingsSectionOptions): AdminSection;
124
+
125
+ /** Fetch a JSON `/api/admin/*` route with the admin bearer token. Throws on a
126
+ * non-2xx (the body's `error`, else the status). */
127
+ declare function adminFetch<T = unknown>(getToken: () => Promise<string | null>, path: string, init?: RequestInit): Promise<T>;
128
+ /** The state of one admin resource load. */
129
+ interface AdminResource<T> {
130
+ data: T | null;
131
+ loading: boolean;
132
+ error: string | null;
133
+ /** Re-fetch (e.g. after a mutation). */
134
+ refresh: () => void;
135
+ }
136
+ /** Load a `/api/admin/*` GET route into React state, re-fetching on `refresh()`
137
+ * or when `path` changes. */
138
+ declare function useAdminResource<T = unknown>(getToken: () => Promise<string | null>, path: string): AdminResource<T>;
139
+
140
+ export { type AdminResource, type AdminSection, type AdminSectionContext, type BillingSectionOptions, ChapterAdmin, type ChapterAdminProps, type CollectionSectionOptions, type DashboardSectionOptions, type EmailSectionOptions, type MeetingsSectionOptions, type PeopleSectionOptions, adminFetch, billingSection, collectionSection, dashboardSection, emailSection, meetingsSection, peopleSection, useAdminResource };
@@ -1,9 +1,23 @@
1
1
  import {
2
2
  ChapterAdmin,
3
- peopleSection
4
- } from "../../chunk-YO6DY5DL.js";
3
+ adminFetch,
4
+ billingSection,
5
+ collectionSection,
6
+ dashboardSection,
7
+ emailSection,
8
+ meetingsSection,
9
+ peopleSection,
10
+ useAdminResource
11
+ } from "../../chunk-HB2HUJCW.js";
5
12
  export {
6
13
  ChapterAdmin,
7
- peopleSection
14
+ adminFetch,
15
+ billingSection,
16
+ collectionSection,
17
+ dashboardSection,
18
+ emailSection,
19
+ meetingsSection,
20
+ peopleSection,
21
+ useAdminResource
8
22
  };
9
23
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
1
- export { AdminSection, AdminSectionContext, ChapterAdmin, ChapterAdminProps, PeopleSectionOptions, peopleSection } from './admin/index.js';
1
+ export { AdminResource, AdminSection, AdminSectionContext, BillingSectionOptions, ChapterAdmin, ChapterAdminProps, CollectionSectionOptions, DashboardSectionOptions, EmailSectionOptions, MeetingsSectionOptions, PeopleSectionOptions, adminFetch, billingSection, collectionSection, dashboardSection, emailSection, meetingsSection, peopleSection, useAdminResource } from './admin/index.js';
2
2
  export { ApiFn, BrandStyle, BrandStyleProps, JoinConfig, JoinIsland, JoinIslandProps, MembersArea, MembersAreaProps, PaymentStep, PaymentStepProps, RescheduleProps, Rescheduler, Slot, SlotPicker, SlotPickerClasses, SlotPickerProps, dayKey, dayLabel, fmtDate, fmtMoney, fullLabel, groupSlotsByDay, timeLabel, tzShort } from './member/index.js';
3
3
  import 'react';
4
4
  import '@odla-ai/crm';
package/dist/ui/index.js CHANGED
@@ -16,8 +16,15 @@ import {
16
16
  } from "../chunk-ZCZK6QLC.js";
17
17
  import {
18
18
  ChapterAdmin,
19
- peopleSection
20
- } from "../chunk-YO6DY5DL.js";
19
+ adminFetch,
20
+ billingSection,
21
+ collectionSection,
22
+ dashboardSection,
23
+ emailSection,
24
+ meetingsSection,
25
+ peopleSection,
26
+ useAdminResource
27
+ } from "../chunk-HB2HUJCW.js";
21
28
  export {
22
29
  BrandStyle,
23
30
  ChapterAdmin,
@@ -26,14 +33,21 @@ export {
26
33
  PaymentStep,
27
34
  Rescheduler,
28
35
  SlotPicker,
36
+ adminFetch,
37
+ billingSection,
38
+ collectionSection,
39
+ dashboardSection,
29
40
  dayKey,
30
41
  dayLabel,
42
+ emailSection,
31
43
  fmtDate,
32
44
  fmtMoney,
33
45
  fullLabel,
34
46
  groupSlotsByDay,
47
+ meetingsSection,
35
48
  peopleSection,
36
49
  timeLabel,
37
- tzShort
50
+ tzShort,
51
+ useAdminResource
38
52
  };
39
53
  //# sourceMappingURL=index.js.map