@odla-ai/chapter 0.22.1 → 0.23.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.
@@ -1,7 +1,8 @@
1
1
  import * as preact from 'preact';
2
2
  import { ComponentChildren, JSX } from 'preact';
3
3
  import { CrmClient, Crm, CrmRecord } from '@odla-ai/crm';
4
- import { C as Chapter } from '../../types-CgWUQ2MH.js';
4
+ import { a as Chapter, b as ChapterCopy } from '../../copy-context-pDogTR4x.js';
5
+ export { C as ChapterCopyProvider, u as useChapterCopy } from '../../copy-context-pDogTR4x.js';
5
6
  import { CrmLifecycleAdapter, CrmWorkspaceMasterContext, CrmWorkspaceRecordContext, RecordPanelTab } from '@odla-ai/crm/ui';
6
7
 
7
8
  /** Normalized public auth configuration consumed by the Clerk gate. */
@@ -80,6 +81,8 @@ interface AdminWorkspace {
80
81
  label: string;
81
82
  /** Canonical nested view used when a workspace is opened without one. */
82
83
  defaultViewId?: string;
84
+ /** Optional named @odla-ai/ui accent scoped to this workspace's content. */
85
+ accent?: string;
83
86
  render: (ctx: AdminSectionContext) => ComponentChildren;
84
87
  }
85
88
  /** Legacy name for a top-level workspace. @deprecated Use AdminWorkspace. */
@@ -147,7 +150,7 @@ declare function defaultAdminWorkspaces(chapter: Chapter): AdminWorkspace[];
147
150
  declare function defaultAdminSections(chapter: Chapter): AdminSection[];
148
151
 
149
152
  /** Application-authoritative stage transitions used by Chapter collections. */
150
- declare function applicationLifecycleAdapter(ctx: Pick<AdminSectionContext, "getToken">): CrmLifecycleAdapter;
153
+ declare function applicationLifecycleAdapter(ctx: Pick<AdminSectionContext, "getToken">, copy?: ChapterCopy["admin"]["records"]): CrmLifecycleAdapter;
151
154
 
152
155
  /** Configuration for the person-collection compatibility preset. */
153
156
  interface PeopleSectionOptions {
@@ -24,12 +24,16 @@ import {
24
24
  meetingsSection,
25
25
  peopleSection,
26
26
  useAdminResource
27
- } from "../../chunk-C4XQSRW7.js";
28
- import "../../chunk-3QKGKUTX.js";
27
+ } from "../../chunk-VCC4S6JU.js";
28
+ import {
29
+ ChapterCopyProvider,
30
+ useChapterCopy
31
+ } from "../../chunk-NTZSXAFT.js";
29
32
  export {
30
33
  AdminNote,
31
34
  AdminPage,
32
35
  ChapterAdmin,
36
+ ChapterCopyProvider,
33
37
  NetworkShareActions,
34
38
  Panel,
35
39
  RecordActions,
@@ -51,6 +55,7 @@ export {
51
55
  loadChapterAdminUser,
52
56
  meetingsSection,
53
57
  peopleSection,
54
- useAdminResource
58
+ useAdminResource,
59
+ useChapterCopy
55
60
  };
56
61
  //# sourceMappingURL=index.js.map
@@ -1,6 +1,6 @@
1
1
  export { AdminAccountMenuProps, AdminChrome, AdminNote, AdminPage, AdminResource, AdminRouteState, AdminRouteTarget, AdminRouting, AdminSection, AdminSectionContext, AdminWorkspace, AdminWorkspaceNavProps, AvailabilitySectionOptions, BillingSectionOptions, ChapterAdmin, ChapterAdminAuthAdapter, ChapterAdminAuthConfig, ChapterAdminAuthLoadContext, ChapterAdminProps, ChapterAdminUser, CollectionSectionOptions, DashboardSectionOptions, EmailSectionOptions, MeetingsSectionOptions, NetworkShareActions, NetworkShareActionsProps, Panel, PeopleSectionOptions, RecordActions, RecordActionsProps, ThemeWarning, adminFetch, adminRouteFromUrl, adminRouteHref, adminSectionFromUrl, adminSectionHref, applicationLifecycleAdapter, availabilitySection, billingSection, collectionSection, dashboardSection, defaultAdminSections, defaultAdminWorkspaces, emailSection, loadChapterAdminConfig, loadChapterAdminUser, meetingsSection, peopleSection, useAdminResource } from './admin/index.js';
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';
2
+ export { C as ChapterCopyProvider, u as useChapterCopy } from '../copy-context-pDogTR4x.js';
3
+ export { ApiFn, BrandStyle, BrandStyleProps, JoinConfig, JoinFlowState, JoinIsland, JoinIslandProps, JoinStepRenderContext, JoinSubmitRenderContext, MemberProvisionalRenderContext, MembersArea, MembersAreaProps, PaymentPriceLines, PaymentStep, PaymentStepProps, RescheduleProps, Rescheduler, Slot, SlotPicker, SlotPickerClasses, SlotPickerProps, dayKey, dayLabel, fmtDate, fmtMoney, fullLabel, groupSlotsByDay, loadJoinResume, timeLabel, tzShort } from './member/index.js';
3
4
  import 'preact';
4
5
  import '@odla-ai/crm';
5
- import '../types-CgWUQ2MH.js';
6
6
  import '@odla-ai/crm/ui';
package/dist/ui/index.js CHANGED
@@ -10,9 +10,10 @@ import {
10
10
  fmtMoney,
11
11
  fullLabel,
12
12
  groupSlotsByDay,
13
+ loadJoinResume,
13
14
  timeLabel,
14
15
  tzShort
15
- } from "../chunk-4COPR4SY.js";
16
+ } from "../chunk-OYXNI6VR.js";
16
17
  import {
17
18
  AdminNote,
18
19
  AdminPage,
@@ -39,15 +40,18 @@ import {
39
40
  meetingsSection,
40
41
  peopleSection,
41
42
  useAdminResource
42
- } from "../chunk-C4XQSRW7.js";
43
+ } from "../chunk-VCC4S6JU.js";
43
44
  import {
44
- BrandStyle
45
- } from "../chunk-3QKGKUTX.js";
45
+ BrandStyle,
46
+ ChapterCopyProvider,
47
+ useChapterCopy
48
+ } from "../chunk-NTZSXAFT.js";
46
49
  export {
47
50
  AdminNote,
48
51
  AdminPage,
49
52
  BrandStyle,
50
53
  ChapterAdmin,
54
+ ChapterCopyProvider,
51
55
  JoinIsland,
52
56
  MembersArea,
53
57
  NetworkShareActions,
@@ -78,10 +82,12 @@ export {
78
82
  groupSlotsByDay,
79
83
  loadChapterAdminConfig,
80
84
  loadChapterAdminUser,
85
+ loadJoinResume,
81
86
  meetingsSection,
82
87
  peopleSection,
83
88
  timeLabel,
84
89
  tzShort,
85
- useAdminResource
90
+ useAdminResource,
91
+ useChapterCopy
86
92
  };
87
93
  //# sourceMappingURL=index.js.map
@@ -1,6 +1,7 @@
1
1
  import * as preact from 'preact';
2
2
  import { ComponentChildren, JSX } from 'preact';
3
- import { a as ChapterBrand } from '../../types-CgWUQ2MH.js';
3
+ import { b as ChapterCopy, c as ChapterBrand } from '../../copy-context-pDogTR4x.js';
4
+ export { C as ChapterCopyProvider, u as useChapterCopy } from '../../copy-context-pDogTR4x.js';
4
5
  import '@odla-ai/crm';
5
6
 
6
7
  /** A bookable slot: a start instant in epoch milliseconds. */
@@ -60,6 +61,28 @@ declare function SlotPicker<T extends Slot = Slot>(props: SlotPickerProps<T>): p
60
61
  * non-2xx status (the islands catch and surface a friendly message). */
61
62
  type ApiFn = <T = unknown>(path: string, opts?: RequestInit) => Promise<T>;
62
63
 
64
+ /** The stable, non-meeting fields of an application (safe to expose to its own
65
+ * owner). */
66
+ interface ApplicationSummary {
67
+ id: string;
68
+ firstName: string | null;
69
+ lastName: string | null;
70
+ email: string | null;
71
+ status: string;
72
+ createdAt: number | null;
73
+ meetingLink: string | null;
74
+ paid: boolean;
75
+ renewalAt: number | null;
76
+ canceled: boolean;
77
+ }
78
+ /** A summary plus the reconciled meeting fields — the `application` the member
79
+ * area renders. */
80
+ interface MemberApplication extends ApplicationSummary {
81
+ meetingAt: number | null;
82
+ meetUrl: string | null;
83
+ timezone: string;
84
+ }
85
+
63
86
  /** Props for {@link MembersArea}. */
64
87
  interface MembersAreaProps {
65
88
  api: ApiFn;
@@ -71,6 +94,18 @@ interface MembersAreaProps {
71
94
  applyHref?: string;
72
95
  /** What a full (non-provisional) member sees below the account header. */
73
96
  memberContent?: ComponentChildren;
97
+ /** Resolved member-area copy. */
98
+ copy?: ChapterCopy["members"];
99
+ /** Replace the provisional application card without replacing auth/data load. */
100
+ renderProvisional?: (context: MemberProvisionalRenderContext) => ComponentChildren;
101
+ }
102
+ /** Data and actions supplied to a site's provisional-member render slot. */
103
+ interface MemberProvisionalRenderContext {
104
+ api: ApiFn;
105
+ application: MemberApplication | null;
106
+ applyHref: string;
107
+ reload: () => Promise<void>;
108
+ defaultContent: ComponentChildren;
74
109
  }
75
110
  /** The signed-in member area. Loads /api/me on mount and renders the account
76
111
  * header plus the provisional application card or the full-member content. */
@@ -85,6 +120,8 @@ interface RescheduleProps {
85
120
  onRescheduled: () => void | Promise<void>;
86
121
  /** Link text to open the picker (e.g. "Choose a time" for a first booking). */
87
122
  label?: string;
123
+ /** Resolved rescheduling copy. */
124
+ copy?: ChapterCopy["members"]["reschedule"];
88
125
  }
89
126
  /** A collapsed "change your time" link that expands into a {@link SlotPicker} and
90
127
  * rebooks on pick. Degrades to a message when scheduling is unavailable. */
@@ -96,7 +133,41 @@ interface JoinConfig {
96
133
  name: string;
97
134
  paymentsReady: boolean;
98
135
  refundPolicyText?: string;
136
+ /** Resolved copy for the packaged join flow. */
137
+ copy?: ChapterCopy["join"];
99
138
  }
139
+ /** Server-validated state used to resume a join journey after a redirect. */
140
+ type JoinFlowState = {
141
+ step: "form";
142
+ } | {
143
+ step: "payment";
144
+ applicationId: string;
145
+ } | {
146
+ step: "paymentPending";
147
+ applicationId: string;
148
+ } | {
149
+ step: "booking";
150
+ applicationId: string;
151
+ } | {
152
+ step: "done";
153
+ applicationId: string;
154
+ booked: {
155
+ startAt: number;
156
+ timezone: string;
157
+ };
158
+ };
159
+ /** Canonical flow state supplied to a site's per-step heading render slot. */
160
+ interface JoinStepRenderContext {
161
+ state: JoinFlowState;
162
+ applicationId?: string;
163
+ }
164
+ /** Submission state supplied to a site's submit-control render slot. */
165
+ interface JoinSubmitRenderContext {
166
+ submitting: boolean;
167
+ disabled: boolean;
168
+ }
169
+ /** Load canonical server state for a capability-bearing application id. */
170
+ declare function loadJoinResume(applicationId: string, fetcher?: typeof fetch): Promise<JoinFlowState>;
100
171
  /** Props for {@link JoinIsland}. */
101
172
  interface JoinIslandProps {
102
173
  config: JoinConfig;
@@ -105,6 +176,35 @@ interface JoinIslandProps {
105
176
  children: ComponentChildren;
106
177
  /** Where the confirmation links after booking. Default "/members/". */
107
178
  membersHref?: string;
179
+ /** Resolved join copy. Defaults to `config.copy`, then the nearest provider. */
180
+ copy?: ChapterCopy["join"];
181
+ /** Trusted initial state produced by the server, never raw URL parameters. */
182
+ initialState?: JoinFlowState;
183
+ /** Resolve redirect/query state against the server before resuming the flow. */
184
+ loadResume?: () => Promise<JoinFlowState | null>;
185
+ /** Render a heading or other site-owned framing above each packaged step. */
186
+ renderStepHeader?: (context: JoinStepRenderContext) => ComponentChildren;
187
+ /** Replace the packaged completion card while retaining flow orchestration. */
188
+ renderDone?: (context: Extract<JoinFlowState, {
189
+ step: "done";
190
+ }> & {
191
+ membersHref: string;
192
+ }) => ComponentChildren;
193
+ /** Replace the submit control without replacing the application form. */
194
+ renderSubmit?: (context: JoinSubmitRenderContext) => ComponentChildren;
195
+ /** Additional host validation gate for the submit action. */
196
+ submitDisabled?: boolean;
197
+ /** Stripe Elements presentation and site-owned payment content. */
198
+ payment?: {
199
+ appearance?: Record<string, unknown>;
200
+ fonts?: readonly Record<string, unknown>[];
201
+ renderPriceLines?: (lines: {
202
+ standardCents: number;
203
+ discountCents: number;
204
+ dueTodayCents: number;
205
+ }) => ComponentChildren;
206
+ children?: ComponentChildren;
207
+ };
108
208
  }
109
209
  /** The signup island. Renders the site's form, then drives payment (when the
110
210
  * chapter charges) and booking (when a calendar is connected) to confirmation. */
@@ -118,6 +218,22 @@ interface PaymentStepProps {
118
218
  refundPolicyText: string;
119
219
  /** Called once the payment succeeds (or is processing) — advance to booking. */
120
220
  onPaid: () => void;
221
+ /** Stripe Elements appearance passed through without Chapter reinterpretation. */
222
+ appearance?: Record<string, unknown>;
223
+ /** Stripe Elements custom-font descriptors. */
224
+ fonts?: readonly Record<string, unknown>[];
225
+ /** Resolved payment-step copy. */
226
+ copy?: ChapterCopy["join"]["payment"];
227
+ /** Render the server-returned membership price breakdown. */
228
+ renderPriceLines?: (lines: PaymentPriceLines) => ComponentChildren;
229
+ /** Site-owned trust, security, or explanatory content. */
230
+ children?: ComponentChildren;
231
+ }
232
+ /** Server-authoritative membership amounts supplied to the payment price slot. */
233
+ interface PaymentPriceLines {
234
+ standardCents: number;
235
+ discountCents: number;
236
+ dueTodayCents: number;
121
237
  }
122
238
  /** The card-entry step: acknowledge the refund policy → create the subscription
123
239
  * → mount Stripe Elements → confirm. */
@@ -133,4 +249,4 @@ interface BrandStyleProps {
133
249
  * there is no brand to theme). */
134
250
  declare function BrandStyle(props: BrandStyleProps): preact.JSX.Element | null;
135
251
 
136
- export { type ApiFn, BrandStyle, type BrandStyleProps, type JoinConfig, JoinIsland, type JoinIslandProps, MembersArea, type MembersAreaProps, PaymentStep, type PaymentStepProps, type RescheduleProps, Rescheduler, type Slot, SlotPicker, type SlotPickerClasses, type SlotPickerProps, dayKey, dayLabel, fmtDate, fmtMoney, fullLabel, groupSlotsByDay, timeLabel, tzShort };
252
+ export { type ApiFn, BrandStyle, type BrandStyleProps, type JoinConfig, type JoinFlowState, JoinIsland, type JoinIslandProps, type JoinStepRenderContext, type JoinSubmitRenderContext, type MemberProvisionalRenderContext, MembersArea, type MembersAreaProps, type PaymentPriceLines, PaymentStep, type PaymentStepProps, type RescheduleProps, Rescheduler, type Slot, SlotPicker, type SlotPickerClasses, type SlotPickerProps, dayKey, dayLabel, fmtDate, fmtMoney, fullLabel, groupSlotsByDay, loadJoinResume, timeLabel, tzShort };
@@ -10,14 +10,18 @@ import {
10
10
  fmtMoney,
11
11
  fullLabel,
12
12
  groupSlotsByDay,
13
+ loadJoinResume,
13
14
  timeLabel,
14
15
  tzShort
15
- } from "../../chunk-4COPR4SY.js";
16
+ } from "../../chunk-OYXNI6VR.js";
16
17
  import {
17
- BrandStyle
18
- } from "../../chunk-3QKGKUTX.js";
18
+ BrandStyle,
19
+ ChapterCopyProvider,
20
+ useChapterCopy
21
+ } from "../../chunk-NTZSXAFT.js";
19
22
  export {
20
23
  BrandStyle,
24
+ ChapterCopyProvider,
21
25
  JoinIsland,
22
26
  MembersArea,
23
27
  PaymentStep,
@@ -29,7 +33,9 @@ export {
29
33
  fmtMoney,
30
34
  fullLabel,
31
35
  groupSlotsByDay,
36
+ loadJoinResume,
32
37
  timeLabel,
33
- tzShort
38
+ tzShort,
39
+ useChapterCopy
34
40
  };
35
41
  //# sourceMappingURL=index.js.map