@streamoid/photogenix-chat 0.2.7 → 0.2.8
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 +16 -11
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -54671,7 +54671,7 @@ function DirectEditorHost({
|
|
|
54671
54671
|
userId,
|
|
54672
54672
|
email,
|
|
54673
54673
|
modelType,
|
|
54674
|
-
|
|
54674
|
+
sourceImageUrls,
|
|
54675
54675
|
submitted,
|
|
54676
54676
|
submittedValues,
|
|
54677
54677
|
onSubmit,
|
|
@@ -54681,7 +54681,7 @@ function DirectEditorHost({
|
|
|
54681
54681
|
const containerRef = (0, import_react54.useRef)(null);
|
|
54682
54682
|
const [fabricFiles, setFabricFiles] = (0, import_react54.useState)([]);
|
|
54683
54683
|
const [fabricFileUrls, setFabricFileUrls] = (0, import_react54.useState)(/* @__PURE__ */ new Map());
|
|
54684
|
-
const [isLoadingFiles, setIsLoadingFiles] = (0, import_react54.useState)(!!
|
|
54684
|
+
const [isLoadingFiles, setIsLoadingFiles] = (0, import_react54.useState)(!!sourceImageUrls?.length);
|
|
54685
54685
|
const [error, setError] = (0, import_react54.useState)(null);
|
|
54686
54686
|
const [isSubmitted, setIsSubmitted] = (0, import_react54.useState)(submitted === true);
|
|
54687
54687
|
const [localSubmittedValues, setLocalSubmittedValues] = (0, import_react54.useState)(
|
|
@@ -54709,20 +54709,25 @@ function DirectEditorHost({
|
|
|
54709
54709
|
setLocalSubmittedValues(submittedValues ?? null);
|
|
54710
54710
|
}, [submitted, submittedValues]);
|
|
54711
54711
|
(0, import_react54.useEffect)(() => {
|
|
54712
|
-
if (!
|
|
54712
|
+
if (!sourceImageUrls?.length) {
|
|
54713
54713
|
setIsLoadingFiles(false);
|
|
54714
54714
|
return;
|
|
54715
54715
|
}
|
|
54716
54716
|
let cancelled = false;
|
|
54717
54717
|
(async () => {
|
|
54718
54718
|
try {
|
|
54719
|
-
const
|
|
54719
|
+
const entries = await Promise.all(
|
|
54720
|
+
sourceImageUrls.map(async (url) => {
|
|
54721
|
+
const file = await urlToFile(url);
|
|
54722
|
+
const objectUrl = URL.createObjectURL(file);
|
|
54723
|
+
return [file, objectUrl];
|
|
54724
|
+
})
|
|
54725
|
+
);
|
|
54720
54726
|
if (cancelled) return;
|
|
54721
|
-
|
|
54722
|
-
|
|
54723
|
-
setFabricFileUrls(/* @__PURE__ */ new Map([[file, objectUrl]]));
|
|
54727
|
+
setFabricFiles(entries.map(([f]) => f));
|
|
54728
|
+
setFabricFileUrls(new Map(entries.map(([f, u]) => [f, u])));
|
|
54724
54729
|
} catch (e) {
|
|
54725
|
-
if (!cancelled) setError(`Failed to load source
|
|
54730
|
+
if (!cancelled) setError(`Failed to load source images: ${e.message}`);
|
|
54726
54731
|
} finally {
|
|
54727
54732
|
if (!cancelled) setIsLoadingFiles(false);
|
|
54728
54733
|
}
|
|
@@ -54730,7 +54735,7 @@ function DirectEditorHost({
|
|
|
54730
54735
|
return () => {
|
|
54731
54736
|
cancelled = true;
|
|
54732
54737
|
};
|
|
54733
|
-
}, [
|
|
54738
|
+
}, [sourceImageUrls]);
|
|
54734
54739
|
(0, import_react54.useEffect)(() => {
|
|
54735
54740
|
if (!isLoadingFiles && !isCMSLoading) onReady?.();
|
|
54736
54741
|
}, [isLoadingFiles, isCMSLoading, onReady]);
|
|
@@ -55062,7 +55067,7 @@ var PhotogenixEditorElement = class extends HTMLElement {
|
|
|
55062
55067
|
if (!this._root) return;
|
|
55063
55068
|
const props = this.uiProps;
|
|
55064
55069
|
const photogenixBaseUrl = props.photogenixBaseUrl || props.photogenix_base_url || props.photogenixApiBase || "";
|
|
55065
|
-
const
|
|
55070
|
+
const sourceImageUrls = props.sourceImageUrls || (props.sourceImageUrl ? [props.sourceImageUrl] : props.imageUrl ? [props.imageUrl] : props.images?.map((img) => img.url).filter(Boolean) || []);
|
|
55066
55071
|
const modelType = props.modelType || props.model_type || props.toolType || props.tool_type || "";
|
|
55067
55072
|
this._root.render(
|
|
55068
55073
|
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(ChatCMSProvider, { workspaceId: this.workspaceId, userId: this.userId, email: this.email, photogenixBaseUrl: photogenixBaseUrl ? String(photogenixBaseUrl) : void 0, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
@@ -55072,7 +55077,7 @@ var PhotogenixEditorElement = class extends HTMLElement {
|
|
|
55072
55077
|
userId: this.userId,
|
|
55073
55078
|
email: this.email,
|
|
55074
55079
|
modelType: String(modelType),
|
|
55075
|
-
|
|
55080
|
+
sourceImageUrls,
|
|
55076
55081
|
submitted: this.submitted,
|
|
55077
55082
|
submittedValues: this.submittedValues,
|
|
55078
55083
|
onSubmit: (values, message) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamoid/photogenix-chat",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.8",
|
|
4
4
|
"description": "Photogenix editor components for the Streamoid chat host — packaged as a Web Component with React 19 bundled internally",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|