@odla-ai/chapter 0.42.2 → 0.42.3

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,8 +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 { a as Chapter, b as ChapterCopy, M as MemberContentDocument, E as EffectiveMemberContent, c as MemberContentTierAuthority } from '../../copy-context-BBPsYe24.js';
5
- export { C as ChapterCopyProvider, u as useChapterCopy } from '../../copy-context-BBPsYe24.js';
4
+ import { a as Chapter, b as ChapterCopy, M as MemberContentDocument, E as EffectiveMemberContent, c as MemberContentTierAuthority } from '../../copy-context-Bh1EZvCg.js';
5
+ export { C as ChapterCopyProvider, u as useChapterCopy } from '../../copy-context-Bh1EZvCg.js';
6
6
  import { CrmLifecycleAdapter, CrmWorkspaceMasterContext, CrmWorkspaceRecordContext, RecordPanelTab } from '@odla-ai/crm/ui';
7
7
 
8
8
  /** Normalized public auth configuration consumed by the Clerk gate. */
@@ -34,11 +34,11 @@ import {
34
34
  networkRecordsWorkspace,
35
35
  peopleSection,
36
36
  useAdminResource
37
- } from "../../chunk-HWUTCXBV.js";
37
+ } from "../../chunk-7MEVZEL2.js";
38
38
  import {
39
39
  ChapterCopyProvider,
40
40
  useChapterCopy
41
- } from "../../chunk-JXFYOUDL.js";
41
+ } from "../../chunk-4HS2JPE2.js";
42
42
  export {
43
43
  AdminNote,
44
44
  AdminPage,
@@ -1,5 +1,5 @@
1
1
  export { AdminAccountMenuProps, AdminBuilderLibraryData, AdminChrome, AdminMemberContentData, AdminNote, AdminPage, AdminResource, AdminRouteState, AdminRouteTarget, AdminRouting, AdminSection, AdminSectionContext, AdminWorkspace, AdminWorkspaceNavProps, AdmissionGrantsWorkspace, AvailabilitySectionOptions, BillingSectionOptions, BuilderLibraryAdmin, ChapterAdmin, ChapterAdminAuthAdapter, ChapterAdminAuthConfig, ChapterAdminAuthLoadContext, ChapterAdminProps, ChapterAdminUser, CollectionSectionOptions, DashboardSectionOptions, EmailSectionOptions, LeaderAdmissionAction, LeaderAdmissionActionProps, LeaderNetworkOverview, MeetingsSectionOptions, MemberContentAdmin, NetworkRecordsWorkspace, NetworkShareActions, NetworkShareActionsProps, Panel, PeopleSectionOptions, RecordActions, RecordActionsProps, ThemeWarning, adminFetch, adminRouteFromUrl, adminRouteHref, adminSectionFromUrl, adminSectionHref, admissionGrantsWorkspace, applicationLifecycleAdapter, availabilitySection, billingSection, builderLibrarySection, collectionSection, dashboardSection, defaultAdminSections, defaultAdminWorkspaces, emailSection, loadChapterAdminConfig, loadChapterAdminUser, meetingsSection, memberContentSection, networkRecordsWorkspace, peopleSection, useAdminResource } from './admin/index.js';
2
- export { C as ChapterCopyProvider, u as useChapterCopy } from '../copy-context-BBPsYe24.js';
2
+ export { C as ChapterCopyProvider, u as useChapterCopy } from '../copy-context-Bh1EZvCg.js';
3
3
  export { ApiFn, BrandStyle, BrandStyleProps, GiftCodeRedeemResult, GiftCodeRedeemer, GiftCodeRedeemerCopy, GiftCodeRedeemerProps, GiftOfferCards, GiftOfferCardsMode, GiftOfferCardsProps, GiftPurchases, GiftPurchasesProps, JoinBookingSimulation, JoinConfig, JoinFlowState, JoinIsland, JoinIslandProps, JoinSimulation, JoinStepRenderContext, JoinSubmitRenderContext, JoinTier, JoinTierRenderContext, MEMBERSHIP_CARD_TOKEN_DEFAULTS, MemberContentArea, MemberContentAreaProps, MemberGifts, MemberProvisionalRenderContext, MembersArea, MembersAreaProps, MembershipCardTokenName, MembershipCards, MembershipCardsMode, MembershipCardsProps, PaymentPriceLines, PaymentStep, PaymentStepProps, PaymentStepSimulation, RescheduleProps, Rescheduler, Slot, SlotPicker, SlotPickerClasses, SlotPickerProps, SubResponse, TierPlaceholder, dayKey, dayLabel, fmtDate, fmtMoney, fullLabel, groupSlotsByDay, loadJoinResume, membershipApplicationHref, tierNeedsPayment, timeLabel, tzShort, useTierSelection } from './member/index.js';
4
4
  import 'preact';
5
5
  import '@odla-ai/crm';
package/dist/ui/index.js CHANGED
@@ -24,7 +24,7 @@ import {
24
24
  timeLabel,
25
25
  tzShort,
26
26
  useTierSelection
27
- } from "../chunk-S7CND3R5.js";
27
+ } from "../chunk-VWDEHUNI.js";
28
28
  import {
29
29
  AdminNote,
30
30
  AdminPage,
@@ -61,12 +61,12 @@ import {
61
61
  networkRecordsWorkspace,
62
62
  peopleSection,
63
63
  useAdminResource
64
- } from "../chunk-HWUTCXBV.js";
64
+ } from "../chunk-7MEVZEL2.js";
65
65
  import {
66
66
  BrandStyle,
67
67
  ChapterCopyProvider,
68
68
  useChapterCopy
69
- } from "../chunk-JXFYOUDL.js";
69
+ } from "../chunk-4HS2JPE2.js";
70
70
  import "../chunk-IVXVECKR.js";
71
71
  export {
72
72
  AdminNote,
@@ -1,7 +1,7 @@
1
1
  import * as preact from 'preact';
2
2
  import { ComponentChildren, JSX } from 'preact';
3
- import { d as MemberContentProjection, e as MemberContentPageProjection, b as ChapterCopy, f as ChapterBrand } from '../../copy-context-BBPsYe24.js';
4
- export { C as ChapterCopyProvider, u as useChapterCopy } from '../../copy-context-BBPsYe24.js';
3
+ import { d as MemberContentProjection, e as MemberContentPageProjection, b as ChapterCopy, f as ChapterBrand } from '../../copy-context-Bh1EZvCg.js';
4
+ export { C as ChapterCopyProvider, u as useChapterCopy } from '../../copy-context-Bh1EZvCg.js';
5
5
  import { FieldType, FieldConditions } from '@odla-ai/crm';
6
6
 
7
7
  /** A bookable slot: a start instant in epoch milliseconds. */
@@ -24,12 +24,12 @@ import {
24
24
  timeLabel,
25
25
  tzShort,
26
26
  useTierSelection
27
- } from "../../chunk-S7CND3R5.js";
27
+ } from "../../chunk-VWDEHUNI.js";
28
28
  import {
29
29
  BrandStyle,
30
30
  ChapterCopyProvider,
31
31
  useChapterCopy
32
- } from "../../chunk-JXFYOUDL.js";
32
+ } from "../../chunk-4HS2JPE2.js";
33
33
  import "../../chunk-IVXVECKR.js";
34
34
  export {
35
35
  BrandStyle,
@@ -3338,17 +3338,36 @@ async function deliverAdmissionGrants(options) {
3338
3338
  }
3339
3339
 
3340
3340
  // src/worker-network-fetch.ts
3341
- function targetFetcher(env, target) {
3342
- if (!target.binding) return null;
3341
+ var NetworkTargetTransportError = class extends Error {
3342
+ code = "binding_unavailable";
3343
+ binding;
3344
+ constructor(binding) {
3345
+ super(`service binding "${binding}" is unavailable`);
3346
+ this.name = "NetworkTargetTransportError";
3347
+ this.binding = binding;
3348
+ }
3349
+ };
3350
+ function resolveNetworkTargetTransport(env, target) {
3351
+ if (!target.binding) {
3352
+ return {
3353
+ kind: "url",
3354
+ fetch: (destination, init) => globalThis.fetch(destination, init)
3355
+ };
3356
+ }
3343
3357
  const candidate = env[target.binding];
3344
3358
  if (typeof candidate !== "object" || candidate === null || !("fetch" in candidate) || typeof candidate.fetch !== "function") {
3345
- throw new Error(`service binding "${target.binding}" is unavailable`);
3359
+ throw new NetworkTargetTransportError(target.binding);
3346
3360
  }
3347
- return candidate;
3361
+ const binding = candidate;
3362
+ return {
3363
+ kind: "binding",
3364
+ binding: target.binding,
3365
+ // Keep the receiver attached: Cloudflare service bindings require it.
3366
+ fetch: (destination, init) => binding.fetch(new Request(destination, init))
3367
+ };
3348
3368
  }
3349
3369
  function fetchNetworkTarget(env, target, destination, init) {
3350
- const binding = targetFetcher(env, target);
3351
- return binding ? binding.fetch(new Request(destination, init)) : globalThis.fetch(destination, init);
3370
+ return resolveNetworkTargetTransport(env, target).fetch(destination, init);
3352
3371
  }
3353
3372
 
3354
3373
  // src/worker-network-admission-state.ts
@@ -5762,26 +5781,50 @@ var handleNetworkSnapshot = async (req, url, env, ctx) => {
5762
5781
  const types = await Promise.all(
5763
5782
  Object.keys(ctx.chapter.crm.config.types).map((type) => (0, import_crm8.typeSummary)({ crm: ctx.chapter.crm, db }, type))
5764
5783
  );
5784
+ const activeConfiguration = ctx.chapter.signupControl ? await loadActiveSignupControl(db, ctx.chapter.id, env.ODLA_ENV) : null;
5765
5785
  const snapshot = {
5766
5786
  version: 1,
5767
5787
  site: { id: ctx.chapter.id, name: ctx.chapter.name, mode: ctx.chapter.mode },
5768
5788
  generatedAt: Date.now(),
5789
+ configuration: {
5790
+ activeRevision: activeConfiguration?.revision ?? null,
5791
+ ...activeConfiguration ? { digest: activeConfiguration.digest } : {}
5792
+ },
5769
5793
  types
5770
5794
  };
5771
5795
  return json(snapshot);
5772
5796
  };
5773
5797
  async function snapshotOne(db, env, ctx, target) {
5798
+ const transportKind = target.binding ? "binding" : "url";
5799
+ const base = {
5800
+ id: target.id,
5801
+ name: target.name,
5802
+ url: target.url,
5803
+ configuration: { activeRevision: null },
5804
+ publicSite: { available: null }
5805
+ };
5774
5806
  const secret = await getVaultSecret(db, target.secretName);
5775
- if (!secret) return { id: target.id, name: target.name, url: target.url, available: false, error: "edge secret is missing" };
5807
+ if (!secret) return {
5808
+ ...base,
5809
+ available: false,
5810
+ transport: {
5811
+ kind: transportKind,
5812
+ ...target.binding ? { binding: target.binding } : {},
5813
+ reachable: null,
5814
+ error: { code: "edge_secret_missing", message: "edge secret is missing" }
5815
+ },
5816
+ error: "edge secret is missing"
5817
+ };
5776
5818
  const destination = new URL("/api/network/snapshot", target.url);
5777
5819
  try {
5820
+ const transport = resolveNetworkTargetTransport(env, target);
5778
5821
  const headers = await (0, import_db8.signFederatedRequest)({
5779
5822
  secret,
5780
5823
  sender: ctx.chapter.id,
5781
5824
  method: "GET",
5782
5825
  url: destination
5783
5826
  });
5784
- const response = await fetchNetworkTarget(env, target, destination, {
5827
+ const response = await transport.fetch(destination, {
5785
5828
  headers,
5786
5829
  signal: AbortSignal.timeout(1e4)
5787
5830
  });
@@ -5789,28 +5832,47 @@ async function snapshotOne(db, env, ctx, target) {
5789
5832
  if (!response.ok || !body || !("version" in body) || body.version !== 1 || !("site" in body) || body.site.id !== target.id || !Array.isArray(body.types)) {
5790
5833
  const upstream = body && "error" in body && typeof body.error === "string" ? body.error : void 0;
5791
5834
  return {
5792
- id: target.id,
5793
- name: target.name,
5794
- url: target.url,
5835
+ ...base,
5795
5836
  available: false,
5837
+ transport: {
5838
+ kind: transport.kind,
5839
+ ...transport.binding ? { binding: transport.binding } : {},
5840
+ reachable: true
5841
+ },
5842
+ publicSite: { available: transport.kind === "url" ? true : null },
5796
5843
  error: upstream ?? (response.ok ? "invalid follower snapshot" : `follower returned ${response.status}`)
5797
5844
  };
5798
5845
  }
5799
5846
  return {
5800
- id: target.id,
5801
- name: target.name,
5802
- url: target.url,
5847
+ ...base,
5803
5848
  available: true,
5849
+ transport: {
5850
+ kind: transport.kind,
5851
+ ...transport.binding ? { binding: transport.binding } : {},
5852
+ reachable: true
5853
+ },
5854
+ configuration: body.configuration ?? { activeRevision: null },
5855
+ publicSite: { available: transport.kind === "url" ? true : null },
5804
5856
  generatedAt: body.generatedAt,
5805
5857
  types: body.types
5806
5858
  };
5807
5859
  } catch (error) {
5860
+ const bindingError = error instanceof NetworkTargetTransportError;
5861
+ const message = error instanceof Error ? error.message : "snapshot failed";
5808
5862
  return {
5809
- id: target.id,
5810
- name: target.name,
5811
- url: target.url,
5863
+ ...base,
5812
5864
  available: false,
5813
- error: error instanceof Error ? error.message : "snapshot failed"
5865
+ transport: {
5866
+ kind: transportKind,
5867
+ ...target.binding ? { binding: target.binding } : {},
5868
+ reachable: false,
5869
+ error: {
5870
+ code: bindingError ? "binding_unavailable" : target.binding ? "binding_request_failed" : "url_request_failed",
5871
+ message
5872
+ }
5873
+ },
5874
+ publicSite: { available: target.binding ? null : false },
5875
+ error: message
5814
5876
  };
5815
5877
  }
5816
5878
  }