@bettercms-ai/sdk 1.10.0 → 1.11.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.cjs CHANGED
@@ -778,6 +778,21 @@ async function createComponent(client, input) {
778
778
  });
779
779
  return res.data;
780
780
  }
781
+ async function listExtractionCandidates(client, projectId) {
782
+ const qs3 = projectId ? `?projectId=${encodeURIComponent(projectId)}` : "";
783
+ const res = await client.fetchJSON(
784
+ client.url(`/management/components/extraction-candidates${qs3}`),
785
+ { method: "GET" }
786
+ );
787
+ return res.data;
788
+ }
789
+ async function extractComponent(client, input) {
790
+ const res = await client.fetchJSON(
791
+ client.url("/management/components/extract"),
792
+ { method: "POST", body: JSON.stringify(input) }
793
+ );
794
+ return { component: res.data, replaced: res.replaced };
795
+ }
781
796
  async function updateComponent(client, id, input) {
782
797
  const res = await client.fetchJSON(
783
798
  client.url(`/management/components/${id}`),
@@ -966,6 +981,14 @@ var BetterCMSManagementClient = class extends BetterCMSDeliveryClient {
966
981
  updateComponent(id, input) {
967
982
  return updateComponent(this, id, input);
968
983
  }
984
+ /** Sections repeating across the project's pages, proposed as components. */
985
+ listExtractionCandidates(projectId) {
986
+ return listExtractionCandidates(this, projectId);
987
+ }
988
+ /** Fold one candidate into a component and repoint every occurrence at it. */
989
+ extractComponent(input) {
990
+ return extractComponent(this, input);
991
+ }
969
992
  // ── AI (Option B): write/rewrite/translate copy + generate SEO meta (BYOK-metered) ──
970
993
  /** Write, rewrite, or translate a piece of copy. Returns the suggested text. */
971
994
  writeContent(input) {