@bettercms-ai/sdk 1.28.0 → 1.29.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/dist/index.d.cts CHANGED
@@ -1244,6 +1244,8 @@ interface StegaPayload {
1244
1244
  slug: string;
1245
1245
  /** Field key (or block id) the value belongs to. */
1246
1246
  field: string;
1247
+ /** The binding kind (`text`), where the encoder knows it. */
1248
+ kind?: string;
1247
1249
  }
1248
1250
  /** Append an invisible provenance payload to a string. */
1249
1251
  declare function encodeStega(clean: string, payload: StegaPayload): string;
@@ -1254,6 +1256,72 @@ declare function decodeStega(value: string): {
1254
1256
  } | null;
1255
1257
  /** Remove any stega payload, returning the clean string. */
1256
1258
  declare function stripStega(value: string): string;
1259
+ /**
1260
+ * Where a value BEGINS in a rendered page: an empty frame. The canvas brackets every bound
1261
+ * string with it and the payload frame, so a text node can be told inside a value from text
1262
+ * that merely precedes one. @see resolveStega
1263
+ */
1264
+ declare const STEGA_OPEN = "\u2060\u2061";
1265
+ /** Remove EVERY stega frame, markers included. What a value passes through before it is saved or published. */
1266
+ declare function stegaClean(value: string): string;
1267
+ /** The least of a DOM node this needs: a real `Node` satisfies it, and so does a test's plain object. */
1268
+ interface StegaNode {
1269
+ textContent: string | null;
1270
+ parentNode: StegaNode | null;
1271
+ childNodes?: ArrayLike<StegaNode>;
1272
+ }
1273
+ /**
1274
+ * Which value does this node render? Its payload and the nearest ancestor that holds the whole
1275
+ * value, or null when the node's text belongs to none.
1276
+ *
1277
+ * By CONTENT, not by attribute: a splitting library cuts a heading into one element per
1278
+ * character, a marquee clones its track, a component redraws its children, and the element a
1279
+ * build stamped is gone or copied. The string survives all of that, in order, across however
1280
+ * many text nodes: climbing from the clicked node, the first ancestor whose text holds a value
1281
+ * (its open marker to its payload frame) that overlaps the node is the value's extent.
1282
+ * Every copy of a value resolves to the same payload.
1283
+ */
1284
+ declare function resolveStega(node: StegaNode): {
1285
+ payload: StegaPayload;
1286
+ element: StegaNode;
1287
+ } | null;
1288
+
1289
+ /**
1290
+ * `bcms:content-applied` — what the visual editor tells a page after it has applied an edit to
1291
+ * the page's DOM.
1292
+ *
1293
+ * An edit changes how tall a heading is. Everything on the page that measured the layout once
1294
+ * (ScrollTrigger's start and end positions, Lenis's scroll limit, a carousel's slide widths, a
1295
+ * text splitter's lines) is now wrong, and only the page's own code can measure again. So the
1296
+ * editor posts one message to the frame's window after each applied edit, and the site listens:
1297
+ *
1298
+ * onContentApplied(() => ScrollTrigger.refresh());
1299
+ *
1300
+ * A published page receives no such message: nothing there posts it, and the listener is inert.
1301
+ */
1302
+ /** The `type` of the message. */
1303
+ declare const CONTENT_APPLIED = "bcms:content-applied";
1304
+ interface ContentAppliedMessage {
1305
+ type: typeof CONTENT_APPLIED;
1306
+ /** The field addresses whose rendering changed; empty when the editor does not say. */
1307
+ fields: string[];
1308
+ }
1309
+ /** The message the editor posts: `frame.contentWindow.postMessage(contentApplied(fields), origin)`. */
1310
+ declare const contentApplied: (fields?: readonly string[]) => ContentAppliedMessage;
1311
+ /** The least of `window` this needs. */
1312
+ interface MessageTarget {
1313
+ addEventListener(type: "message", listener: (event: {
1314
+ data: unknown;
1315
+ }) => void): void;
1316
+ removeEventListener(type: "message", listener: (event: {
1317
+ data: unknown;
1318
+ }) => void): void;
1319
+ }
1320
+ /**
1321
+ * Run `handler` after every edit the editor applies to this page. Returns the function that
1322
+ * stops listening. Safe to call where there is no window (a server render): it does nothing.
1323
+ */
1324
+ declare function onContentApplied(handler: (message: ContentAppliedMessage) => void, target?: MessageTarget | undefined): () => void;
1257
1325
 
1258
1326
  /**
1259
1327
  * Reading a rich-text field, for any site.
@@ -1827,4 +1895,4 @@ interface WebhookListResponse {
1827
1895
  };
1828
1896
  }
1829
1897
 
1830
- export { type AddPageFieldsInput, type ApiKeyUsage, type ApiKeyWithRaw, type AuthResult, BetterCMSError as BCMSClientError, ErrorCodes as BCMSErrorCodes, BetterCMS, BetterCMSAdminClient, type BetterCMSAdminOptions, BetterCMSDeliveryClient, BetterCMSError, BetterCMSManagementClient, type BetterCMSManagementOptions, type BetterCMSReadClient, type BetterCMSSiteOptions, type CommandManagedLayoutInput, type CreateApiKeyInput, type CreateClientOptions, type CreateEntryInput, type CreateFormInput, type CreateManagedPageInput, type CreateModelInput, type CreatePageInput, type CreateWebhookInput, type CreateWorkspaceInput, type DeliveryForm, type DeliveryFormField, type DeliveryFormFieldType, ErrorCodes, type ExtractionCandidate, type FormFieldInput, type FormListOptions, type FormSubmitError, type FormValue, type FormValues, type GetEntryOptions, type GetManagedLayoutOptions, type ListContentAllOptions, type ListContentOptions, type ListEntriesFilter, type ListEntriesOptions, type ListPagesOptions, type ManagedComponent, type ManagedComponentInput, type ManagedComponentSummary, type ManagedContentEntry, type ManagedContentModel, type ManagedForm, type ManagedFormInput, type ManagedLayoutClient, type ManagedLayoutDocument, type ManagedMediaAsset, type ManagedPage, type ManagementClient, type MediaListOptions, type MediaMetadata, type Member, type MemberRole, type ModelFieldset, PORTABLE_TEXT_FORMAT, type PageCreateReport, type PageListOptions, type PendingInvite, type PublishManagedLayoutInput, type PublishedContent, type ResolvedSeo, type RichTextValue, type SearchHit, type SearchOptions, type SeoInput, type SeoLocation, type SeoMeta, type SeoMetaInput, type SetPageContentInput, type StegaPayload, type SubmissionListOptions, type SubmitFormOptions, type SubmitFormResult, type TextOrRich, type UpdateApiKeyInput, type UpdateAssetInput, type UpdateEntryInput, type UpdateFormInput, type UpdateModelInput, type UpdatePageInput, type UpdateWebhookInput, type UpdateWorkspaceInput, type UploadAssetInput, type UploadedAsset, type Webhook, type WebhookAdvancedConfig, type WebhookEvent, type WebhookListResponse, type WebhookWithSecret, type WriteContentInput, addModelFields, addPageFields, asStringArray, commandManagedLayout, createApiKey, createClient, createEntry, createForm, createManagedPage, createModel, createPage, createWorkspace, decodeStega, deleteForm, deleteMedia, deletePage, deleteSubmission, deleteWorkspace, encodeStega, entrySeoInput, formInitialValues, getApiKeyUsage, getEntry, getForm, getManagedLayout, getManagedPage, getMedia, getMember, getModel, getPage, getSubmission, getWorkspace, inviteMember, isMultiValueField, isRichText, listApiKeys, listEntries, listForms, listManagedPages, listMedia, listMembers, listModels, listPages, listSubmissions, listWorkspaces, plain, portableText, publishManagedLayout, publishPage, publishedContentFile, publishedEntry, readPublishedContent, regenerateApiKey, removeMember, resetPublishedContentCache, resolveSeo, revokeApiKey, rich, search, setPageContent, shouldShowField, signIn, signInWithGithub, signInWithGoogle, signUp, stripStega, submitForm, toggleOption, updateApiKey, updateEntry, updateForm, updateMemberRole, updateModel, updatePage, updatePageModel, updateWorkspace, uploadMedia };
1898
+ export { type AddPageFieldsInput, type ApiKeyUsage, type ApiKeyWithRaw, type AuthResult, BetterCMSError as BCMSClientError, ErrorCodes as BCMSErrorCodes, BetterCMS, BetterCMSAdminClient, type BetterCMSAdminOptions, BetterCMSDeliveryClient, BetterCMSError, BetterCMSManagementClient, type BetterCMSManagementOptions, type BetterCMSReadClient, type BetterCMSSiteOptions, CONTENT_APPLIED, type CommandManagedLayoutInput, type ContentAppliedMessage, type CreateApiKeyInput, type CreateClientOptions, type CreateEntryInput, type CreateFormInput, type CreateManagedPageInput, type CreateModelInput, type CreatePageInput, type CreateWebhookInput, type CreateWorkspaceInput, type DeliveryForm, type DeliveryFormField, type DeliveryFormFieldType, ErrorCodes, type ExtractionCandidate, type FormFieldInput, type FormListOptions, type FormSubmitError, type FormValue, type FormValues, type GetEntryOptions, type GetManagedLayoutOptions, type ListContentAllOptions, type ListContentOptions, type ListEntriesFilter, type ListEntriesOptions, type ListPagesOptions, type ManagedComponent, type ManagedComponentInput, type ManagedComponentSummary, type ManagedContentEntry, type ManagedContentModel, type ManagedForm, type ManagedFormInput, type ManagedLayoutClient, type ManagedLayoutDocument, type ManagedMediaAsset, type ManagedPage, type ManagementClient, type MediaListOptions, type MediaMetadata, type Member, type MemberRole, type ModelFieldset, PORTABLE_TEXT_FORMAT, type PageCreateReport, type PageListOptions, type PendingInvite, type PublishManagedLayoutInput, type PublishedContent, type ResolvedSeo, type RichTextValue, STEGA_OPEN, type SearchHit, type SearchOptions, type SeoInput, type SeoLocation, type SeoMeta, type SeoMetaInput, type SetPageContentInput, type StegaNode, type StegaPayload, type SubmissionListOptions, type SubmitFormOptions, type SubmitFormResult, type TextOrRich, type UpdateApiKeyInput, type UpdateAssetInput, type UpdateEntryInput, type UpdateFormInput, type UpdateModelInput, type UpdatePageInput, type UpdateWebhookInput, type UpdateWorkspaceInput, type UploadAssetInput, type UploadedAsset, type Webhook, type WebhookAdvancedConfig, type WebhookEvent, type WebhookListResponse, type WebhookWithSecret, type WriteContentInput, addModelFields, addPageFields, asStringArray, commandManagedLayout, contentApplied, createApiKey, createClient, createEntry, createForm, createManagedPage, createModel, createPage, createWorkspace, decodeStega, deleteForm, deleteMedia, deletePage, deleteSubmission, deleteWorkspace, encodeStega, entrySeoInput, formInitialValues, getApiKeyUsage, getEntry, getForm, getManagedLayout, getManagedPage, getMedia, getMember, getModel, getPage, getSubmission, getWorkspace, inviteMember, isMultiValueField, isRichText, listApiKeys, listEntries, listForms, listManagedPages, listMedia, listMembers, listModels, listPages, listSubmissions, listWorkspaces, onContentApplied, plain, portableText, publishManagedLayout, publishPage, publishedContentFile, publishedEntry, readPublishedContent, regenerateApiKey, removeMember, resetPublishedContentCache, resolveSeo, resolveStega, revokeApiKey, rich, search, setPageContent, shouldShowField, signIn, signInWithGithub, signInWithGoogle, signUp, stegaClean, stripStega, submitForm, toggleOption, updateApiKey, updateEntry, updateForm, updateMemberRole, updateModel, updatePage, updatePageModel, updateWorkspace, uploadMedia };
package/dist/index.d.ts CHANGED
@@ -1244,6 +1244,8 @@ interface StegaPayload {
1244
1244
  slug: string;
1245
1245
  /** Field key (or block id) the value belongs to. */
1246
1246
  field: string;
1247
+ /** The binding kind (`text`), where the encoder knows it. */
1248
+ kind?: string;
1247
1249
  }
1248
1250
  /** Append an invisible provenance payload to a string. */
1249
1251
  declare function encodeStega(clean: string, payload: StegaPayload): string;
@@ -1254,6 +1256,72 @@ declare function decodeStega(value: string): {
1254
1256
  } | null;
1255
1257
  /** Remove any stega payload, returning the clean string. */
1256
1258
  declare function stripStega(value: string): string;
1259
+ /**
1260
+ * Where a value BEGINS in a rendered page: an empty frame. The canvas brackets every bound
1261
+ * string with it and the payload frame, so a text node can be told inside a value from text
1262
+ * that merely precedes one. @see resolveStega
1263
+ */
1264
+ declare const STEGA_OPEN = "\u2060\u2061";
1265
+ /** Remove EVERY stega frame, markers included. What a value passes through before it is saved or published. */
1266
+ declare function stegaClean(value: string): string;
1267
+ /** The least of a DOM node this needs: a real `Node` satisfies it, and so does a test's plain object. */
1268
+ interface StegaNode {
1269
+ textContent: string | null;
1270
+ parentNode: StegaNode | null;
1271
+ childNodes?: ArrayLike<StegaNode>;
1272
+ }
1273
+ /**
1274
+ * Which value does this node render? Its payload and the nearest ancestor that holds the whole
1275
+ * value, or null when the node's text belongs to none.
1276
+ *
1277
+ * By CONTENT, not by attribute: a splitting library cuts a heading into one element per
1278
+ * character, a marquee clones its track, a component redraws its children, and the element a
1279
+ * build stamped is gone or copied. The string survives all of that, in order, across however
1280
+ * many text nodes: climbing from the clicked node, the first ancestor whose text holds a value
1281
+ * (its open marker to its payload frame) that overlaps the node is the value's extent.
1282
+ * Every copy of a value resolves to the same payload.
1283
+ */
1284
+ declare function resolveStega(node: StegaNode): {
1285
+ payload: StegaPayload;
1286
+ element: StegaNode;
1287
+ } | null;
1288
+
1289
+ /**
1290
+ * `bcms:content-applied` — what the visual editor tells a page after it has applied an edit to
1291
+ * the page's DOM.
1292
+ *
1293
+ * An edit changes how tall a heading is. Everything on the page that measured the layout once
1294
+ * (ScrollTrigger's start and end positions, Lenis's scroll limit, a carousel's slide widths, a
1295
+ * text splitter's lines) is now wrong, and only the page's own code can measure again. So the
1296
+ * editor posts one message to the frame's window after each applied edit, and the site listens:
1297
+ *
1298
+ * onContentApplied(() => ScrollTrigger.refresh());
1299
+ *
1300
+ * A published page receives no such message: nothing there posts it, and the listener is inert.
1301
+ */
1302
+ /** The `type` of the message. */
1303
+ declare const CONTENT_APPLIED = "bcms:content-applied";
1304
+ interface ContentAppliedMessage {
1305
+ type: typeof CONTENT_APPLIED;
1306
+ /** The field addresses whose rendering changed; empty when the editor does not say. */
1307
+ fields: string[];
1308
+ }
1309
+ /** The message the editor posts: `frame.contentWindow.postMessage(contentApplied(fields), origin)`. */
1310
+ declare const contentApplied: (fields?: readonly string[]) => ContentAppliedMessage;
1311
+ /** The least of `window` this needs. */
1312
+ interface MessageTarget {
1313
+ addEventListener(type: "message", listener: (event: {
1314
+ data: unknown;
1315
+ }) => void): void;
1316
+ removeEventListener(type: "message", listener: (event: {
1317
+ data: unknown;
1318
+ }) => void): void;
1319
+ }
1320
+ /**
1321
+ * Run `handler` after every edit the editor applies to this page. Returns the function that
1322
+ * stops listening. Safe to call where there is no window (a server render): it does nothing.
1323
+ */
1324
+ declare function onContentApplied(handler: (message: ContentAppliedMessage) => void, target?: MessageTarget | undefined): () => void;
1257
1325
 
1258
1326
  /**
1259
1327
  * Reading a rich-text field, for any site.
@@ -1827,4 +1895,4 @@ interface WebhookListResponse {
1827
1895
  };
1828
1896
  }
1829
1897
 
1830
- export { type AddPageFieldsInput, type ApiKeyUsage, type ApiKeyWithRaw, type AuthResult, BetterCMSError as BCMSClientError, ErrorCodes as BCMSErrorCodes, BetterCMS, BetterCMSAdminClient, type BetterCMSAdminOptions, BetterCMSDeliveryClient, BetterCMSError, BetterCMSManagementClient, type BetterCMSManagementOptions, type BetterCMSReadClient, type BetterCMSSiteOptions, type CommandManagedLayoutInput, type CreateApiKeyInput, type CreateClientOptions, type CreateEntryInput, type CreateFormInput, type CreateManagedPageInput, type CreateModelInput, type CreatePageInput, type CreateWebhookInput, type CreateWorkspaceInput, type DeliveryForm, type DeliveryFormField, type DeliveryFormFieldType, ErrorCodes, type ExtractionCandidate, type FormFieldInput, type FormListOptions, type FormSubmitError, type FormValue, type FormValues, type GetEntryOptions, type GetManagedLayoutOptions, type ListContentAllOptions, type ListContentOptions, type ListEntriesFilter, type ListEntriesOptions, type ListPagesOptions, type ManagedComponent, type ManagedComponentInput, type ManagedComponentSummary, type ManagedContentEntry, type ManagedContentModel, type ManagedForm, type ManagedFormInput, type ManagedLayoutClient, type ManagedLayoutDocument, type ManagedMediaAsset, type ManagedPage, type ManagementClient, type MediaListOptions, type MediaMetadata, type Member, type MemberRole, type ModelFieldset, PORTABLE_TEXT_FORMAT, type PageCreateReport, type PageListOptions, type PendingInvite, type PublishManagedLayoutInput, type PublishedContent, type ResolvedSeo, type RichTextValue, type SearchHit, type SearchOptions, type SeoInput, type SeoLocation, type SeoMeta, type SeoMetaInput, type SetPageContentInput, type StegaPayload, type SubmissionListOptions, type SubmitFormOptions, type SubmitFormResult, type TextOrRich, type UpdateApiKeyInput, type UpdateAssetInput, type UpdateEntryInput, type UpdateFormInput, type UpdateModelInput, type UpdatePageInput, type UpdateWebhookInput, type UpdateWorkspaceInput, type UploadAssetInput, type UploadedAsset, type Webhook, type WebhookAdvancedConfig, type WebhookEvent, type WebhookListResponse, type WebhookWithSecret, type WriteContentInput, addModelFields, addPageFields, asStringArray, commandManagedLayout, createApiKey, createClient, createEntry, createForm, createManagedPage, createModel, createPage, createWorkspace, decodeStega, deleteForm, deleteMedia, deletePage, deleteSubmission, deleteWorkspace, encodeStega, entrySeoInput, formInitialValues, getApiKeyUsage, getEntry, getForm, getManagedLayout, getManagedPage, getMedia, getMember, getModel, getPage, getSubmission, getWorkspace, inviteMember, isMultiValueField, isRichText, listApiKeys, listEntries, listForms, listManagedPages, listMedia, listMembers, listModels, listPages, listSubmissions, listWorkspaces, plain, portableText, publishManagedLayout, publishPage, publishedContentFile, publishedEntry, readPublishedContent, regenerateApiKey, removeMember, resetPublishedContentCache, resolveSeo, revokeApiKey, rich, search, setPageContent, shouldShowField, signIn, signInWithGithub, signInWithGoogle, signUp, stripStega, submitForm, toggleOption, updateApiKey, updateEntry, updateForm, updateMemberRole, updateModel, updatePage, updatePageModel, updateWorkspace, uploadMedia };
1898
+ export { type AddPageFieldsInput, type ApiKeyUsage, type ApiKeyWithRaw, type AuthResult, BetterCMSError as BCMSClientError, ErrorCodes as BCMSErrorCodes, BetterCMS, BetterCMSAdminClient, type BetterCMSAdminOptions, BetterCMSDeliveryClient, BetterCMSError, BetterCMSManagementClient, type BetterCMSManagementOptions, type BetterCMSReadClient, type BetterCMSSiteOptions, CONTENT_APPLIED, type CommandManagedLayoutInput, type ContentAppliedMessage, type CreateApiKeyInput, type CreateClientOptions, type CreateEntryInput, type CreateFormInput, type CreateManagedPageInput, type CreateModelInput, type CreatePageInput, type CreateWebhookInput, type CreateWorkspaceInput, type DeliveryForm, type DeliveryFormField, type DeliveryFormFieldType, ErrorCodes, type ExtractionCandidate, type FormFieldInput, type FormListOptions, type FormSubmitError, type FormValue, type FormValues, type GetEntryOptions, type GetManagedLayoutOptions, type ListContentAllOptions, type ListContentOptions, type ListEntriesFilter, type ListEntriesOptions, type ListPagesOptions, type ManagedComponent, type ManagedComponentInput, type ManagedComponentSummary, type ManagedContentEntry, type ManagedContentModel, type ManagedForm, type ManagedFormInput, type ManagedLayoutClient, type ManagedLayoutDocument, type ManagedMediaAsset, type ManagedPage, type ManagementClient, type MediaListOptions, type MediaMetadata, type Member, type MemberRole, type ModelFieldset, PORTABLE_TEXT_FORMAT, type PageCreateReport, type PageListOptions, type PendingInvite, type PublishManagedLayoutInput, type PublishedContent, type ResolvedSeo, type RichTextValue, STEGA_OPEN, type SearchHit, type SearchOptions, type SeoInput, type SeoLocation, type SeoMeta, type SeoMetaInput, type SetPageContentInput, type StegaNode, type StegaPayload, type SubmissionListOptions, type SubmitFormOptions, type SubmitFormResult, type TextOrRich, type UpdateApiKeyInput, type UpdateAssetInput, type UpdateEntryInput, type UpdateFormInput, type UpdateModelInput, type UpdatePageInput, type UpdateWebhookInput, type UpdateWorkspaceInput, type UploadAssetInput, type UploadedAsset, type Webhook, type WebhookAdvancedConfig, type WebhookEvent, type WebhookListResponse, type WebhookWithSecret, type WriteContentInput, addModelFields, addPageFields, asStringArray, commandManagedLayout, contentApplied, createApiKey, createClient, createEntry, createForm, createManagedPage, createModel, createPage, createWorkspace, decodeStega, deleteForm, deleteMedia, deletePage, deleteSubmission, deleteWorkspace, encodeStega, entrySeoInput, formInitialValues, getApiKeyUsage, getEntry, getForm, getManagedLayout, getManagedPage, getMedia, getMember, getModel, getPage, getSubmission, getWorkspace, inviteMember, isMultiValueField, isRichText, listApiKeys, listEntries, listForms, listManagedPages, listMedia, listMembers, listModels, listPages, listSubmissions, listWorkspaces, onContentApplied, plain, portableText, publishManagedLayout, publishPage, publishedContentFile, publishedEntry, readPublishedContent, regenerateApiKey, removeMember, resetPublishedContentCache, resolveSeo, resolveStega, revokeApiKey, rich, search, setPageContent, shouldShowField, signIn, signInWithGithub, signInWithGoogle, signUp, stegaClean, stripStega, submitForm, toggleOption, updateApiKey, updateEntry, updateForm, updateMemberRole, updateModel, updatePage, updatePageModel, updateWorkspace, uploadMedia };
package/dist/index.js CHANGED
@@ -1395,6 +1395,52 @@ function decodeStega(value) {
1395
1395
  function stripStega(value) {
1396
1396
  return value.replace(FRAME, "");
1397
1397
  }
1398
+ var STEGA_OPEN = `${START}${END}`;
1399
+ var FRAMES = new RegExp(`${START}([${ZERO}${ONE}]*)${END}`, "g");
1400
+ function stegaClean(value) {
1401
+ return value.replace(FRAMES, "");
1402
+ }
1403
+ function resolveStega(node) {
1404
+ let offset = 0;
1405
+ const length = node.textContent?.length ?? 0;
1406
+ for (let cur = node, up = node.parentNode; up; cur = up, up = up.parentNode) {
1407
+ for (const sibling of Array.from(up.childNodes ?? [])) {
1408
+ if (sibling === cur) break;
1409
+ offset += sibling.textContent?.length ?? 0;
1410
+ }
1411
+ const text = up.textContent ?? "";
1412
+ const opens = [];
1413
+ for (const frame of text.matchAll(FRAMES)) {
1414
+ if (!frame[1]) {
1415
+ opens.push(frame.index);
1416
+ continue;
1417
+ }
1418
+ const open = opens.pop();
1419
+ if (frame.index + frame[0].length <= offset || open === void 0 || open >= offset + length) continue;
1420
+ try {
1421
+ return { payload: JSON.parse(fromBits(frame[1])), element: up };
1422
+ } catch {
1423
+ break;
1424
+ }
1425
+ }
1426
+ }
1427
+ return null;
1428
+ }
1429
+
1430
+ // src/content-applied.ts
1431
+ var CONTENT_APPLIED = "bcms:content-applied";
1432
+ var contentApplied = (fields = []) => ({ type: CONTENT_APPLIED, fields: [...fields] });
1433
+ function onContentApplied(handler, target = globalThis.window) {
1434
+ if (!target) return () => {
1435
+ };
1436
+ const listener = (event) => {
1437
+ const data = event.data;
1438
+ if (!data || typeof data !== "object" || data.type !== CONTENT_APPLIED) return;
1439
+ handler({ type: CONTENT_APPLIED, fields: Array.isArray(data.fields) ? data.fields.filter((f) => typeof f === "string") : [] });
1440
+ };
1441
+ target.addEventListener("message", listener);
1442
+ return () => target.removeEventListener("message", listener);
1443
+ }
1398
1444
 
1399
1445
  // src/richtext.ts
1400
1446
  var PORTABLE_TEXT_FORMAT = "portable-text-1";
@@ -1913,12 +1959,15 @@ export {
1913
1959
  BetterCMSDeliveryClient,
1914
1960
  BetterCMSError,
1915
1961
  BetterCMSManagementClient,
1962
+ CONTENT_APPLIED,
1916
1963
  ErrorCodes,
1917
1964
  PORTABLE_TEXT_FORMAT,
1965
+ STEGA_OPEN,
1918
1966
  addModelFields,
1919
1967
  addPageFields,
1920
1968
  asStringArray,
1921
1969
  commandManagedLayout,
1970
+ contentApplied,
1922
1971
  createApiKey,
1923
1972
  createClient,
1924
1973
  createEntry,
@@ -1966,6 +2015,7 @@ export {
1966
2015
  listPages,
1967
2016
  listSubmissions,
1968
2017
  listWorkspaces,
2018
+ onContentApplied,
1969
2019
  plain,
1970
2020
  portableText,
1971
2021
  publishManagedLayout,
@@ -1977,6 +2027,7 @@ export {
1977
2027
  removeMember,
1978
2028
  resetPublishedContentCache,
1979
2029
  resolveSeo,
2030
+ resolveStega,
1980
2031
  revokeApiKey,
1981
2032
  rich,
1982
2033
  search,
@@ -1986,6 +2037,7 @@ export {
1986
2037
  signInWithGithub,
1987
2038
  signInWithGoogle,
1988
2039
  signUp,
2040
+ stegaClean,
1989
2041
  stripStega,
1990
2042
  submitForm,
1991
2043
  toggleOption,