@charisol/plexo-sdk 1.1.6 → 1.1.7
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.js +29 -25
- package/dist/utilities/aiHelper.d.ts +3 -0
- package/dist/utilities/useAIAction.d.ts +3 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -624,6 +624,7 @@ async function Ve(e) {
|
|
|
624
624
|
prompt: e.prompt,
|
|
625
625
|
templateKind: e.templateKind,
|
|
626
626
|
context: e.context,
|
|
627
|
+
isBlogLayout: e.isBlogLayout,
|
|
627
628
|
tier: e.tier,
|
|
628
629
|
externalUserId: e.externalUserId
|
|
629
630
|
})
|
|
@@ -636,47 +637,49 @@ async function Ve(e) {
|
|
|
636
637
|
}
|
|
637
638
|
//#endregion
|
|
638
639
|
//#region src/utilities/useAIAction.ts
|
|
639
|
-
function He({ apiKey: e, templateKind: t,
|
|
640
|
-
let [
|
|
641
|
-
|
|
642
|
-
mode:
|
|
643
|
-
prompt:
|
|
644
|
-
context:
|
|
645
|
-
},
|
|
640
|
+
function He({ apiKey: e, templateKind: t, isBlogLayout: n, tier: r, externalUserId: i, onApply: a }) {
|
|
641
|
+
let [o, s] = A("idle"), [c, l] = A(""), [u, d] = A(""), f = k(null), p = fe(async (o, c, u) => {
|
|
642
|
+
f.current = {
|
|
643
|
+
mode: o,
|
|
644
|
+
prompt: c,
|
|
645
|
+
context: u
|
|
646
|
+
}, s("loading"), d("");
|
|
646
647
|
try {
|
|
647
|
-
let { summary:
|
|
648
|
+
let { summary: d, result: f } = await Ve({
|
|
648
649
|
apiKey: e,
|
|
649
|
-
mode:
|
|
650
|
-
prompt:
|
|
650
|
+
mode: o,
|
|
651
|
+
prompt: c,
|
|
651
652
|
templateKind: t,
|
|
652
|
-
context:
|
|
653
|
-
|
|
654
|
-
|
|
653
|
+
context: u,
|
|
654
|
+
isBlogLayout: n,
|
|
655
|
+
tier: r,
|
|
656
|
+
externalUserId: i
|
|
655
657
|
});
|
|
656
|
-
|
|
658
|
+
a(f), l(d), s("success");
|
|
657
659
|
} catch (e) {
|
|
658
|
-
|
|
660
|
+
d(e instanceof Error ? e.message : "AI request failed."), s("error");
|
|
659
661
|
}
|
|
660
662
|
}, [
|
|
661
663
|
e,
|
|
662
664
|
t,
|
|
663
665
|
n,
|
|
664
666
|
r,
|
|
665
|
-
i
|
|
667
|
+
i,
|
|
668
|
+
a
|
|
666
669
|
]);
|
|
667
670
|
return {
|
|
668
|
-
status:
|
|
669
|
-
summary:
|
|
670
|
-
error:
|
|
671
|
-
run:
|
|
671
|
+
status: o,
|
|
672
|
+
summary: c,
|
|
673
|
+
error: u,
|
|
674
|
+
run: p,
|
|
672
675
|
retry: fe(() => {
|
|
673
|
-
if (
|
|
674
|
-
let { mode: e, prompt: t, context: n } =
|
|
675
|
-
|
|
676
|
+
if (f.current) {
|
|
677
|
+
let { mode: e, prompt: t, context: n } = f.current;
|
|
678
|
+
p(e, t, n);
|
|
676
679
|
}
|
|
677
|
-
}, [
|
|
680
|
+
}, [p]),
|
|
678
681
|
reset: fe(() => {
|
|
679
|
-
|
|
682
|
+
s("idle"), l(""), d("");
|
|
680
683
|
}, [])
|
|
681
684
|
};
|
|
682
685
|
}
|
|
@@ -56233,6 +56236,7 @@ var zW = (e) => ({ body: {
|
|
|
56233
56236
|
let gn = He({
|
|
56234
56237
|
apiKey: ot(),
|
|
56235
56238
|
templateKind: ft,
|
|
56239
|
+
isBlogLayout: fe,
|
|
56236
56240
|
tier: lt.tier,
|
|
56237
56241
|
externalUserId: y,
|
|
56238
56242
|
onApply: (e) => {
|
|
@@ -7,6 +7,9 @@ export interface AIActionRequest {
|
|
|
7
7
|
prompt: string;
|
|
8
8
|
templateKind: 'EMAIL' | 'LANDING_PAGE';
|
|
9
9
|
context: ElementJSON | TemplateJSON;
|
|
10
|
+
/** True only when editing an actual blog post template — lets the server offer the
|
|
11
|
+
* blog_* placeholder block types (blog_title, blog_content, etc.) to the model. */
|
|
12
|
+
isBlogLayout?: boolean;
|
|
10
13
|
/** Optional tier override (AUTO | BASIC | MEDIUM | HIGH); omit to use the account default. */
|
|
11
14
|
tier?: string;
|
|
12
15
|
/**
|
|
@@ -4,6 +4,8 @@ export type AIActionStatus = 'idle' | 'loading' | 'success' | 'error';
|
|
|
4
4
|
interface UseAIActionOptions {
|
|
5
5
|
apiKey: string;
|
|
6
6
|
templateKind: 'EMAIL' | 'LANDING_PAGE';
|
|
7
|
+
/** True only when editing an actual blog post template — see AIActionRequest.isBlogLayout. */
|
|
8
|
+
isBlogLayout?: boolean;
|
|
7
9
|
tier?: string;
|
|
8
10
|
/** Host's own end-user id — see PlexoBuilderProps.externalUserId. */
|
|
9
11
|
externalUserId?: string;
|
|
@@ -22,5 +24,5 @@ interface UseAIActionResult {
|
|
|
22
24
|
* "Edit with AI" popup and the whole-layout prompt bar: idle -> loading -> success/error,
|
|
23
25
|
* with the last request remembered so the caller's bubble can offer a Retry button.
|
|
24
26
|
*/
|
|
25
|
-
export declare function useAIAction({ apiKey, templateKind, tier, externalUserId, onApply }: UseAIActionOptions): UseAIActionResult;
|
|
27
|
+
export declare function useAIAction({ apiKey, templateKind, isBlogLayout, tier, externalUserId, onApply }: UseAIActionOptions): UseAIActionResult;
|
|
26
28
|
export {};
|
package/package.json
CHANGED