@bettercms-ai/sdk 1.6.0 → 1.7.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 +25 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +35 -1
- package/dist/index.d.ts +35 -1
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -757,6 +757,22 @@ async function updateComponent(client, id, input) {
|
|
|
757
757
|
return res.data;
|
|
758
758
|
}
|
|
759
759
|
|
|
760
|
+
// src/methods/management/ai.ts
|
|
761
|
+
async function writeContent(client, input) {
|
|
762
|
+
const res = await client.fetchJSON(client.url("/management/ai/content"), {
|
|
763
|
+
method: "POST",
|
|
764
|
+
body: JSON.stringify(input)
|
|
765
|
+
});
|
|
766
|
+
return res.data.suggestion;
|
|
767
|
+
}
|
|
768
|
+
async function generateSeoMeta(client, input) {
|
|
769
|
+
const res = await client.fetchJSON(client.url("/management/ai/seo-meta"), {
|
|
770
|
+
method: "POST",
|
|
771
|
+
body: JSON.stringify(input)
|
|
772
|
+
});
|
|
773
|
+
return res.data;
|
|
774
|
+
}
|
|
775
|
+
|
|
760
776
|
// src/management-client.ts
|
|
761
777
|
var DEFAULT_BASE_URL2 = "https://api.bettercms.ai/v1";
|
|
762
778
|
var DEFAULT_TIMEOUT2 = 1e4;
|
|
@@ -918,6 +934,15 @@ var BetterCMSManagementClient = class extends BetterCMSDeliveryClient {
|
|
|
918
934
|
updateComponent(id, input) {
|
|
919
935
|
return updateComponent(this, id, input);
|
|
920
936
|
}
|
|
937
|
+
// ── AI (Option B): write/rewrite/translate copy + generate SEO meta (BYOK-metered) ──
|
|
938
|
+
/** Write, rewrite, or translate a piece of copy. Returns the suggested text. */
|
|
939
|
+
writeContent(input) {
|
|
940
|
+
return writeContent(this, input);
|
|
941
|
+
}
|
|
942
|
+
/** Generate SEO metadata for a piece of content (title, description, keywords, JSON-LD). */
|
|
943
|
+
generateSeoMeta(input) {
|
|
944
|
+
return generateSeoMeta(this, input);
|
|
945
|
+
}
|
|
921
946
|
};
|
|
922
947
|
function sleep2(ms) {
|
|
923
948
|
return new Promise((resolve) => setTimeout(resolve, ms));
|