@parhelia/sharedien-dam 0.1.10745
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/LICENSE +8 -0
- package/README.md +27 -0
- package/dist/DamSelector.d.ts +10 -0
- package/dist/DamSelector.js +244 -0
- package/dist/DamSelector.js.map +1 -0
- package/dist/DamSelectorButton.d.ts +2 -0
- package/dist/DamSelectorButton.js +73 -0
- package/dist/DamSelectorButton.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +29 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +12 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +49 -0
- package/styles.css +2 -0
package/LICENSE
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# @parhelia/sharedien-dam
|
|
2
|
+
|
|
3
|
+
Sharedien DAM integration for Parhelia visual editor.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @parhelia/sharedien-dam
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { DamSelector } from '@parhelia/sharedien-dam';
|
|
15
|
+
import '@parhelia/sharedien-dam/styles.css';
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Features
|
|
19
|
+
|
|
20
|
+
- Sharedien DAM selector component
|
|
21
|
+
- Asset browsing and selection
|
|
22
|
+
- Integration with Parhelia editor
|
|
23
|
+
|
|
24
|
+
## License
|
|
25
|
+
|
|
26
|
+
See LICENSE file for details.
|
|
27
|
+
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DialogProps } from "@parhelia/core";
|
|
2
|
+
import { DamImageValue, DamSelectorProps } from "./types";
|
|
3
|
+
declare global {
|
|
4
|
+
interface Window {
|
|
5
|
+
sharedienAssetBrowser?: {
|
|
6
|
+
show: (url: string, config: any, callback: (content: any, isCancelled: boolean) => void, selector: string) => void;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export declare function DamSelector({ onClose, language, }: DialogProps<DamImageValue> & DamSelectorProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Button, Input, Select, TabView, TabPanel, Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter, useEditContext, } from "@parhelia/core";
|
|
3
|
+
import { useEffect, useState } from "react";
|
|
4
|
+
import React from "react";
|
|
5
|
+
import { ExternalLink, Search, Check, X } from "lucide-react";
|
|
6
|
+
// Utility function to format file sizes
|
|
7
|
+
function formatFileSize(bytes) {
|
|
8
|
+
if (bytes === 0)
|
|
9
|
+
return "0 Bytes";
|
|
10
|
+
const k = 1024;
|
|
11
|
+
const sizes = ["Bytes", "KB", "MB", "GB", "TB"];
|
|
12
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
13
|
+
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + " " + sizes[i];
|
|
14
|
+
}
|
|
15
|
+
export function DamSelector({ onClose, language = "en", }) {
|
|
16
|
+
const [assetId, setAssetId] = useState("");
|
|
17
|
+
const [selectedDerivative, setSelectedDerivative] = useState(null);
|
|
18
|
+
const [assetData, setAssetData] = useState(null);
|
|
19
|
+
const [loading, setLoading] = useState(false);
|
|
20
|
+
const [error, setError] = useState(null);
|
|
21
|
+
const [activeIndex, setActiveIndex] = useState(0);
|
|
22
|
+
const [isVisible, setIsVisible] = useState(false);
|
|
23
|
+
const [fromWidgetSelection, setFromWidgetSelection] = useState(false);
|
|
24
|
+
const editContext = useEditContext();
|
|
25
|
+
const sharedienDamConfig = editContext?.configuration?.extensions
|
|
26
|
+
?.sharedienDam;
|
|
27
|
+
const damUrl = sharedienDamConfig?.damUrl ?? "";
|
|
28
|
+
const damScriptUrl = sharedienDamConfig?.damScriptUrl ?? "";
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
const timer = setTimeout(() => {
|
|
31
|
+
setIsVisible(true);
|
|
32
|
+
}, 200);
|
|
33
|
+
return () => clearTimeout(timer);
|
|
34
|
+
}, []);
|
|
35
|
+
// Load the DAM widget script
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
// Load the external script for the DAM widget
|
|
38
|
+
const script = document.createElement("script");
|
|
39
|
+
script.src = damScriptUrl;
|
|
40
|
+
script.async = true;
|
|
41
|
+
document.body.appendChild(script);
|
|
42
|
+
return () => {
|
|
43
|
+
// Clean up script when component unmounts
|
|
44
|
+
if (document.body.contains(script)) {
|
|
45
|
+
document.body.removeChild(script);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
}, [damScriptUrl]);
|
|
49
|
+
// Initialize asset browser when switching to the second tab
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
if (activeIndex === 1) {
|
|
52
|
+
initiateAssetBrowser();
|
|
53
|
+
}
|
|
54
|
+
}, [activeIndex]);
|
|
55
|
+
// Automatically search when assetId changes from widget selection
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
if (assetId && assetId.trim() && fromWidgetSelection) {
|
|
58
|
+
searchAsset();
|
|
59
|
+
setFromWidgetSelection(false); // Reset the flag
|
|
60
|
+
}
|
|
61
|
+
}, [assetId, fromWidgetSelection]);
|
|
62
|
+
// Function to initialize the asset browser (converted from your C# code)
|
|
63
|
+
const initiateAssetBrowser = () => {
|
|
64
|
+
if (!window.sharedienAssetBrowser) {
|
|
65
|
+
console.error("DAM Asset Browser widget not loaded");
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const configuration = {
|
|
69
|
+
allowMultipleSelection: false,
|
|
70
|
+
canBeClosedByUser: false,
|
|
71
|
+
showMainNavigationBranding: false,
|
|
72
|
+
searchQuery: {
|
|
73
|
+
// Add your filters here if needed
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
const callback = (content, isCancelled) => {
|
|
77
|
+
if (isCancelled) {
|
|
78
|
+
console.log("Component has been cancelled");
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
console.log("Message received", content["selectedAssets"][0]);
|
|
82
|
+
// Set the asset ID and switch back to the first tab
|
|
83
|
+
if (content["selectedAssets"] && content["selectedAssets"][0]) {
|
|
84
|
+
setFromWidgetSelection(true); // Mark that this selection is from widget
|
|
85
|
+
setAssetId(content["selectedAssets"][0].identifier);
|
|
86
|
+
setActiveIndex(0); // Switch back to first tab
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
window.sharedienAssetBrowser.show(damUrl, configuration, callback, "#damBrowserContainer");
|
|
91
|
+
};
|
|
92
|
+
// Function to search for an asset
|
|
93
|
+
async function searchAsset() {
|
|
94
|
+
if (!assetId.trim()) {
|
|
95
|
+
setError("Please enter an Asset ID");
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
setLoading(true);
|
|
99
|
+
setError(null);
|
|
100
|
+
try {
|
|
101
|
+
// Call the API with assetId and language using POST
|
|
102
|
+
const response = await fetch("/parhelia/sharedien", {
|
|
103
|
+
method: "POST",
|
|
104
|
+
headers: {
|
|
105
|
+
"Content-Type": "application/json",
|
|
106
|
+
},
|
|
107
|
+
body: JSON.stringify({
|
|
108
|
+
assetId: assetId,
|
|
109
|
+
language: language,
|
|
110
|
+
}),
|
|
111
|
+
});
|
|
112
|
+
if (!response.ok) {
|
|
113
|
+
throw new Error(`Error fetching asset: ${response.statusText}`);
|
|
114
|
+
}
|
|
115
|
+
const data = await response.json();
|
|
116
|
+
if (data.Success === false) {
|
|
117
|
+
// Show the error message
|
|
118
|
+
setError(data.Message || "An error occurred during insert");
|
|
119
|
+
return; // Don't close the dialog
|
|
120
|
+
}
|
|
121
|
+
setAssetData(data);
|
|
122
|
+
// Set the preferred derivation as selected by default
|
|
123
|
+
const preferredItem = data.Derivations.find((item) => item.IsPreferred);
|
|
124
|
+
if (preferredItem) {
|
|
125
|
+
setSelectedDerivative(preferredItem.Derivation);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
catch (err) {
|
|
129
|
+
setError(err instanceof Error ? err.message : "An unknown error occurred");
|
|
130
|
+
console.error("Error fetching asset:", err);
|
|
131
|
+
}
|
|
132
|
+
finally {
|
|
133
|
+
setLoading(false);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
////
|
|
137
|
+
// Create select options from derivatives data
|
|
138
|
+
const getSelectOptions = () => {
|
|
139
|
+
if (!assetData?.Derivations)
|
|
140
|
+
return [];
|
|
141
|
+
return assetData.Derivations.map((item) => ({
|
|
142
|
+
value: item.Derivation.FileName,
|
|
143
|
+
label: `${item.Derivation.DerivationTypeIdentifier} (${item.Derivation.FileTypeIdentifier}) - ${formatFileSize(item.Derivation.FileSize)}${item.IsPreferred ? " [recommended version for import]" : ""}`,
|
|
144
|
+
disabled: false,
|
|
145
|
+
}));
|
|
146
|
+
};
|
|
147
|
+
// Handle select change
|
|
148
|
+
const handleSelectChange = (value) => {
|
|
149
|
+
const selectedItem = assetData?.Derivations.find((item) => item.Derivation.FileName === value);
|
|
150
|
+
if (selectedItem) {
|
|
151
|
+
setSelectedDerivative(selectedItem.Derivation);
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
const handleInsert = async () => {
|
|
155
|
+
// Only proceed if a derivative is selected
|
|
156
|
+
if (!selectedDerivative) {
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
try {
|
|
160
|
+
// Set loading state if needed
|
|
161
|
+
setLoading(true);
|
|
162
|
+
// Send POST request to insert endpoint
|
|
163
|
+
const response = await fetch("/parhelia/sharedien/insert", {
|
|
164
|
+
method: "POST",
|
|
165
|
+
headers: {
|
|
166
|
+
"Content-Type": "application/json",
|
|
167
|
+
},
|
|
168
|
+
body: JSON.stringify({
|
|
169
|
+
assetId: assetId,
|
|
170
|
+
language: language,
|
|
171
|
+
derivation: {
|
|
172
|
+
assetTypeIdentifier: selectedDerivative.AssetTypeIdentifier,
|
|
173
|
+
fileTypeIdentifier: selectedDerivative.FileTypeIdentifier,
|
|
174
|
+
fileMimeType: selectedDerivative.FileMimeType,
|
|
175
|
+
derivationTypeIdentifier: selectedDerivative.DerivationTypeIdentifier,
|
|
176
|
+
fileName: selectedDerivative.FileName,
|
|
177
|
+
fileEnding: selectedDerivative.FileEnding,
|
|
178
|
+
fileSize: selectedDerivative.FileSize,
|
|
179
|
+
uri: selectedDerivative.Uri,
|
|
180
|
+
downloadUri: selectedDerivative.DownloadUri,
|
|
181
|
+
status: selectedDerivative.Status,
|
|
182
|
+
},
|
|
183
|
+
}),
|
|
184
|
+
});
|
|
185
|
+
if (!response.ok) {
|
|
186
|
+
throw new Error(`Error inserting asset: ${response.statusText}`);
|
|
187
|
+
}
|
|
188
|
+
// Parse the response
|
|
189
|
+
const result = await response.json();
|
|
190
|
+
// Check if the response indicates failure
|
|
191
|
+
if (result.Success === false) {
|
|
192
|
+
// Show the error message
|
|
193
|
+
setError(result.Message || "An error occurred during insert");
|
|
194
|
+
return; // Don't close the dialog
|
|
195
|
+
}
|
|
196
|
+
// Check if this is a video asset by looking at Asset Type property
|
|
197
|
+
const assetTypeProperty = assetData?.AssetProperties?.find((prop) => prop.FieldName === "Asset Type");
|
|
198
|
+
const isVideo = assetTypeProperty?.Value === "Movie";
|
|
199
|
+
const mediaItemId = result?.length > 0 ? result[0] : undefined;
|
|
200
|
+
// Close the dialog and return the selected derivative info
|
|
201
|
+
onClose({
|
|
202
|
+
mediaId: isVideo ? undefined : mediaItemId,
|
|
203
|
+
videoId: isVideo ? mediaItemId : undefined,
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
catch (err) {
|
|
207
|
+
// Handle errors
|
|
208
|
+
setError(err instanceof Error
|
|
209
|
+
? err.message
|
|
210
|
+
: "An unknown error occurred during insert");
|
|
211
|
+
console.error("Error inserting asset:", err);
|
|
212
|
+
}
|
|
213
|
+
finally {
|
|
214
|
+
// Reset loading state
|
|
215
|
+
setLoading(false);
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
const footer = (_jsxs("div", { className: "flex gap-3 p-4", children: [_jsx("span", { title: !selectedDerivative
|
|
219
|
+
? "Please select a derivative first"
|
|
220
|
+
: loading
|
|
221
|
+
? "Processing..."
|
|
222
|
+
: assetData?.AssetInfo?.MeetsRestrictions === false
|
|
223
|
+
? "Cannot insert: " + assetData.AssetInfo.Message
|
|
224
|
+
: !assetData
|
|
225
|
+
? "Please search for an asset first"
|
|
226
|
+
: undefined, children: _jsxs(Button, { size: "sm", onClick: handleInsert, disabled: !selectedDerivative ||
|
|
227
|
+
loading ||
|
|
228
|
+
assetData?.AssetInfo?.MeetsRestrictions === false ||
|
|
229
|
+
!assetData, children: [loading ? (_jsx("i", { className: "pi pi-spin pi-spinner w-4 h-4" })) : (_jsx(Check, { className: "w-4 h-4" })), "Insert"] }) }), _jsxs(Button, { size: "sm", onClick: () => onClose(null), children: [_jsx(X, { className: "w-4 h-4" }), "Cancel"] })] }));
|
|
230
|
+
return (_jsx(Dialog, { open: true, onOpenChange: () => onClose(null), children: _jsxs(DialogContent, { className: "select-medidialog flex flex-col", style: {
|
|
231
|
+
width: "90vw",
|
|
232
|
+
height: "90vh",
|
|
233
|
+
maxWidth: "90vw",
|
|
234
|
+
maxHeight: "90vh",
|
|
235
|
+
}, children: [_jsx(DialogHeader, { className: "flex-shrink-0", children: _jsx(DialogTitle, { children: "Get Asset from DAM" }) }), _jsxs("div", { className: "flex-1 overflow-hidden flex flex-col", children: [_jsx("div", { className: "p-3 flex-shrink-0", children: _jsx("p", { className: "p3 mb-4", children: "Browse for your asset in the DAM and copy the Asset ID. Paste the Asset ID below and click the Insert button to apply the image. If available, you can also use the Asset Browser tab. In the widget, enter the Asset ID and click Confirm" }) }), isVisible && (_jsx("div", { className: "flex-1 overflow-hidden", children: _jsxs(TabView, { activeIndex: activeIndex, onTabChange: (e) => setActiveIndex(e.index), className: "dam-selector-tabs h-full", children: [_jsx(TabPanel, { header: "SELECT BY ASSET ID", children: _jsxs("div", { className: "h-full overflow-auto", children: [_jsxs("div", { className: "p-3 bg-blue-50 mb-4 flex align-items-center gap-2", children: [_jsx("i", { className: "p-2 pi pi-info-circle", style: { fontSize: "1.2rem" } }), _jsx("span", { className: "p-1 flex align-items-center", children: "For testing you can open DAM Browser in a new Tab" }), _jsxs(Button, { size: "sm", onClick: () => window.open(damUrl, "_blank"), children: [_jsx(ExternalLink, { className: "w-4 h-4" }), "Open DAM"] })] }), _jsxs("div", { className: "grid grid-cols-2", children: [_jsxs("div", { className: "col-6 pr-4", children: [_jsxs("div", { className: "p-field mb-3", children: [_jsx("label", { htmlFor: "assetId", className: "block mb-2", children: "Asset ID" }), _jsx(Input, { type: "text", id: "assetId", value: assetId, onChange: (e) => setAssetId(e.target.value), className: "w-full h-12 px-4", placeholder: "Enter Asset ID" })] }), _jsxs(Button, { size: "sm", onClick: searchAsset, disabled: loading, children: [_jsx(Search, { className: "w-4 h-4" }), "Search Asset"] }), error && (_jsxs("div", { className: "p-3 bg-red-50 text-red-700 mb-4 border-round", children: [_jsx("i", { className: "pi pi-exclamation-circle mr-2" }), error] })), assetData && (_jsxs("div", { className: "p-field p-card1 p-31", children: [_jsx("label", { htmlFor: "derivative", className: "block mb-2", children: "Select Derivatives" }), _jsx("div", { className: "mb-4", children: _jsx(Select, { id: "derivative", value: selectedDerivative?.FileName || "", onValueChange: handleSelectChange, options: getSelectOptions(), placeholder: "Choose a derivative...", className: "w-full h-12 px-4", disabled: false }) })] }))] }), _jsx("div", { className: "col-6 pl-4", children: _jsxs("div", { className: "p-card p-3 flex flex-column grid grid-cols-1 grid-rows-2", style: { minHeight: "300px" }, children: [_jsx("div", { className: "flex justify-content-center align-items-center row-1", style: { flex: "1" }, children: loading ? (_jsx("i", { className: "pi pi-spin pi-spinner text-6xl text-primary" })) : assetData?.PreviewDerivationSrc ? (_jsx("img", { src: assetData.PreviewDerivationSrc, alt: "Asset preview", className: "w-full h-auto max-h-64 object-contain border border-gray-200 rounded", style: { maxWidth: "100%" } })) : (_jsxs("div", { className: "flex flex-column align-items-center justify-content-center h-full", children: [_jsx("i", { className: "pi pi-image text-6xl text-gray-300 mb-3 p-1" }), _jsx("p", { className: "text-gray-500 text-center", children: "Asset preview will appear here" })] })) }), assetData?.AssetInfo?.MeetsRestrictions === false &&
|
|
236
|
+
assetData?.AssetInfo?.Message && (_jsxs("div", { className: "mt-3 p-3 bg-red-50 border-round", children: [_jsx("i", { className: "pi pi-exclamation-circle mr-2 text-red-500" }), _jsx("span", { children: assetData.AssetInfo.Message })] })), assetData?.AssetInfo?.MeetsRestrictions &&
|
|
237
|
+
assetData?.AssetInfo?.Message && (_jsxs("div", { className: "mt-3 p-3 bg-yellow-50 border-round", children: [_jsx("i", { className: "pi pi-exclamation-triangle mr-2 text-yellow-500" }), _jsx("span", { children: assetData.AssetInfo.Message })] })), assetData?.AssetProperties &&
|
|
238
|
+
assetData.AssetProperties.length > 0 && (_jsx("div", { className: "mt-3 p-3 bg-gray-50 border-round", children: _jsx("div", { className: "grid", children: assetData.AssetProperties.map((prop, index) => (_jsxs(React.Fragment, { children: [_jsxs("div", { className: "col-4 font-bold", children: [prop.FieldName, ":"] }), _jsx("div", { className: "col-8", children: prop.FieldName === "File Size"
|
|
239
|
+
? formatFileSize(parseInt(prop.Value))
|
|
240
|
+
: prop.FieldName === "Expiry Date"
|
|
241
|
+
? new Date(prop.Value).toLocaleDateString()
|
|
242
|
+
: prop.Value })] }, index))) }) }))] }) })] })] }) }), _jsx(TabPanel, { header: "BROWSE IN DAM", children: _jsx("div", { className: "h-full overflow-hidden", children: _jsxs("div", { className: "h-full flex flex-col", children: [_jsx("div", { id: "damBrowserContainer", className: "flex-1", style: { minHeight: 0 } }), !window.sharedienAssetBrowser && (_jsx("iframe", { src: damUrl, className: "w-full h-full border border-gray-300", title: "DAM Browser", sandbox: "allow-same-origin allow-scripts allow-popups allow-forms" })), _jsxs("div", { className: "mt-3 p-3 bg-yellow-50 border-round flex-shrink-0", children: [_jsx("i", { className: "pi pi-exclamation-triangle mr-2 text-yellow-500" }), _jsx("span", { children: "Note: If the DAM widget doesn't load, you'll need to manually copy the Asset ID from the DAM and paste it in the Asset ID field on the first tab." })] })] }) }) })] }) }))] }), _jsx(DialogFooter, { className: "flex-shrink-0 border-t bg-white relative z-10", children: footer })] }) }));
|
|
243
|
+
}
|
|
244
|
+
//# sourceMappingURL=DamSelector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DamSelector.js","sourceRoot":"","sources":["../src/DamSelector.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,MAAM,EAEN,KAAK,EACL,MAAM,EACN,OAAO,EACP,QAAQ,EACR,MAAM,EACN,aAAa,EACb,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,cAAc,GACf,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAM5C,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,cAAc,CAAC;AA0D9D,wCAAwC;AACxC,SAAS,cAAc,CAAC,KAAa;IACnC,IAAI,KAAK,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IAElC,MAAM,CAAC,GAAG,IAAI,CAAC;IACf,MAAM,KAAK,GAAG,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IAChD,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAEpD,OAAO,UAAU,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,C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N,cAAK,SAAS,EAAC,OAAO,YACnB,IAAI,CAAC,SAAS,KAAK,WAAW;4FAC7B,CAAC,CAAC,cAAc,CACZ,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CACrB;4FACH,CAAC,CAAC,IAAI,CAAC,SAAS,KAAK,aAAa;gGAChC,CAAC,CAAC,IAAI,IAAI,CACN,IAAI,CAAC,KAAK,CACX,CAAC,kBAAkB,EAAE;gGACxB,CAAC,CAAC,IAAI,CAAC,KAAK,GACZ,KAda,KAAK,CAeT,CAClB,CACF,GACG,GACF,CACP,IACC,GACF,IACF,IACF,GACG,EAEX,KAAC,QAAQ,IAAC,MAAM,EAAC,eAAe,YAC9B,cAAK,SAAS,EAAC,wBAAwB,YACrC,eAAK,SAAS,EAAC,sBAAsB,aAEnC,cACE,EAAE,EAAC,qBAAqB,EACxB,SAAS,EAAC,QAAQ,EAClB,KAAK,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,GAGnB,EAGL,CAAC,MAAM,CAAC,qBAAqB,IAAI,CAChC,iBACE,GAAG,EAAE,MAAM,EACX,SAAS,EAAC,sCAAsC,EAChD,KAAK,EAAC,aAAa,EACnB,OAAO,EAAC,0DAA0D,GAClE,CACH,EAED,eAAK,SAAS,EAAC,kDAAkD,aAC/D,YAAG,SAAS,EAAC,iDAAiD,GAAK,EACnE,+KAIO,IACH,IACF,GACF,GACG,IACH,GACN,CACP,IACG,EAEN,KAAC,YAAY,IAAC,SAAS,EAAC,+CAA+C,YACpE,MAAM,GACM,IACD,GACT,CACV,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { DamSelector } from "./DamSelector";
|
|
3
|
+
import { ExternalLink } from "lucide-react";
|
|
4
|
+
export const DamSelectorButton = {
|
|
5
|
+
label: "Select from DAM",
|
|
6
|
+
icon: (_jsx(ExternalLink, { strokeWidth: 1, size: 16 })),
|
|
7
|
+
isPimaryAction: false, // Primary action - appears outside menu
|
|
8
|
+
clientAction: async ({ editContext, field, variantName: contextVariantName, }) => {
|
|
9
|
+
const data = await editContext.openDialog(DamSelector, {
|
|
10
|
+
language: field.descriptor.item.language,
|
|
11
|
+
});
|
|
12
|
+
if (data?.mediaId || data?.videoId) {
|
|
13
|
+
const raw = (() => {
|
|
14
|
+
try {
|
|
15
|
+
return field?.rawValue && field?.rawValue[0] === "{"
|
|
16
|
+
? JSON.parse(field?.rawValue)
|
|
17
|
+
: { Variants: [] };
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
console.warn("Failed to parse picture field raw value:", error);
|
|
21
|
+
return { Variants: [] };
|
|
22
|
+
}
|
|
23
|
+
})();
|
|
24
|
+
// Get variant name from context (when called from PictureEditor variant button)
|
|
25
|
+
// or fallback to trying to determine it from field data
|
|
26
|
+
let variantName = contextVariantName;
|
|
27
|
+
if (!variantName && raw.Variants && raw.Variants.length > 0) {
|
|
28
|
+
// Use the first variant's name if available
|
|
29
|
+
variantName = raw.Variants[0]?.Name;
|
|
30
|
+
}
|
|
31
|
+
// If we still don't have a variant name, try to get it from the field's value
|
|
32
|
+
if (!variantName &&
|
|
33
|
+
field.value &&
|
|
34
|
+
typeof field.value === "object" &&
|
|
35
|
+
"variants" in field.value) {
|
|
36
|
+
const variants = field.value.variants;
|
|
37
|
+
if (Array.isArray(variants) &&
|
|
38
|
+
variants.length > 0 &&
|
|
39
|
+
variants[0]?.name) {
|
|
40
|
+
variantName = variants[0].name;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (!variantName) {
|
|
44
|
+
console.warn("Cannot determine variant name for DAM selection. No variants found in picture field.");
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
// Update or create the variant
|
|
48
|
+
if (!raw.Variants)
|
|
49
|
+
raw.Variants = [];
|
|
50
|
+
const selected = raw.Variants.find((x) => x.Name == variantName);
|
|
51
|
+
if (selected) {
|
|
52
|
+
selected.MediaId = data.mediaId;
|
|
53
|
+
selected.VideoId = data.videoId;
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
raw.Variants.push({
|
|
57
|
+
Name: variantName,
|
|
58
|
+
MediaId: data.mediaId,
|
|
59
|
+
VideoId: data.videoId,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
editContext.operations.editField({
|
|
63
|
+
field: field.descriptor,
|
|
64
|
+
rawValue: JSON.stringify(raw),
|
|
65
|
+
refresh: "immediate",
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
isGenerator: false,
|
|
70
|
+
id: "select-from-dam",
|
|
71
|
+
description: "Opens the sharedien DAM to select an image or video",
|
|
72
|
+
};
|
|
73
|
+
//# sourceMappingURL=DamSelectorButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DamSelectorButton.js","sourceRoot":"","sources":["../src/DamSelectorButton.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,MAAM,CAAC,MAAM,iBAAiB,GAAsB;IAClD,KAAK,EAAE,iBAAiB;IACxB,IAAI,EAAE,CAAC,KAAC,YAAY,IAAC,WAAW,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,GAAI,CAAoB;IACrE,cAAc,EAAE,KAAK,EAAE,wCAAwC;IAC/D,YAAY,EAAE,KAAK,EAAE,EACnB,WAAW,EACX,KAAK,EACL,WAAW,EAAE,kBAAkB,GACP,EAAE,EAAE;QAC5B,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC,UAAU,CACvC,WAAW,EACX;YACE,QAAQ,EAAE,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ;SACzC,CACF,CAAC;QAEF,IAAI,IAAI,EAAE,OAAO,IAAI,IAAI,EAAE,OAAO,EAAE,CAAC;YACnC,MAAM,GAAG,GAAG,CAAC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,CAAC,IAAI,CACV,sFAAsF,CACvF,CAAC;gBACF,OAAO;YACT,CAAC;YAED,+BAA+B;YAC/B,IAAI,CAAC,GAAG,CAAC,QAAQ;gBAAE,GAAG,CAAC,QAAQ,GAAG,EAAE,CAAC;YACrC,MAAM,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,WAAW,CAAC,CAAC;YAEtE,IAAI,QAAQ,EAAE,CAAC;gBACb,QAAQ,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;gBAChC,QAAQ,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;YAClC,CAAC;iBAAM,CAAC;gBACN,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC;oBAChB,IAAI,EAAE,WAAW;oBACjB,OAAO,EAAE,IAAI,CAAC,OAAO;oBACrB,OAAO,EAAE,IAAI,CAAC,OAAO;iBACtB,CAAC,CAAC;YACL,CAAC;YAED,WAAY,CAAC,UAAU,CAAC,SAAS,CAAC;gBAChC,KAAK,EAAE,KAAK,CAAC,UAAU;gBACvB,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC;gBAC7B,OAAO,EAAE,WAAW;aACrB,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IACD,WAAW,EAAE,KAAK;IAClB,EAAE,EAAE,iBAAiB;IACrB,WAAW,EAAE,qDAAqD;CACnE,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { EditorConfiguration } from "@parhelia/core";
|
|
2
|
+
import { SharedienDamExtension, DamImageValue, DamSelectorProps } from "./types";
|
|
3
|
+
import { DamSelectorButton } from "./DamSelectorButton";
|
|
4
|
+
import { DamSelector } from "./DamSelector";
|
|
5
|
+
export declare function configureSharedienDam(configuration: EditorConfiguration, sharedienDam: SharedienDamExtension): EditorConfiguration;
|
|
6
|
+
export { DamSelector, DamSelectorButton };
|
|
7
|
+
export type { DamImageValue, DamSelectorProps, SharedienDamExtension };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { DamSelectorButton } from "./DamSelectorButton";
|
|
2
|
+
import { DamSelector } from "./DamSelector";
|
|
3
|
+
export function configureSharedienDam(configuration, sharedienDam) {
|
|
4
|
+
configuration.extensions = {
|
|
5
|
+
...configuration.extensions,
|
|
6
|
+
sharedienDam: {
|
|
7
|
+
enableDamSelector: sharedienDam.enableDamSelector ?? false,
|
|
8
|
+
damUrl: sharedienDam.damUrl,
|
|
9
|
+
damScriptUrl: sharedienDam.damScriptUrl,
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
if (!configuration.fieldTypes.picture) {
|
|
13
|
+
configuration.fieldTypes.picture = {
|
|
14
|
+
editor: () => null,
|
|
15
|
+
variantButtons: []
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
if (!configuration.fieldTypes.picture.variantButtons) {
|
|
19
|
+
configuration.fieldTypes.picture.variantButtons = [];
|
|
20
|
+
}
|
|
21
|
+
// Add DAM selector button as a variant button (appears for each picture variant)
|
|
22
|
+
const buttonExists = configuration.fieldTypes.picture.variantButtons.some((btn) => btn.id === DamSelectorButton.id);
|
|
23
|
+
if (!buttonExists) {
|
|
24
|
+
configuration.fieldTypes.picture.variantButtons.push(DamSelectorButton);
|
|
25
|
+
}
|
|
26
|
+
return configuration;
|
|
27
|
+
}
|
|
28
|
+
export { DamSelector, DamSelectorButton };
|
|
29
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,MAAM,UAAU,qBAAqB,CACnC,aAAkC,EAClC,YAAmC;IAEnC,aAAa,CAAC,UAAU,GAAG;QACzB,GAAG,aAAa,CAAC,UAAU;QAC3B,YAAY,EAAE;YACZ,iBAAiB,EAAE,YAAY,CAAC,iBAAiB,IAAI,KAAK;YAC1D,MAAM,EAAE,YAAY,CAAC,MAAM;YAC3B,YAAY,EAAE,YAAY,CAAC,YAAY;SACxC;KACF,CAAC;IAEF,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;QACtC,aAAa,CAAC,UAAU,CAAC,OAAO,GAAG;YACjC,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI;YAClB,cAAc,EAAE,EAAE;SACnB,CAAA;IACH,CAAC;IAED,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC;QACrD,aAAa,CAAC,UAAU,CAAC,OAAO,CAAC,cAAc,GAAG,EAAE,CAAC;IACvD,CAAC;IAED,iFAAiF;IACjF,MAAM,YAAY,GAAG,aAAa,CAAC,UAAU,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,CACvE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,iBAAiB,CAAC,EAAE,CACzC,CAAC;IAEF,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,aAAa,CAAC,UAAU,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IAC1E,CAAC;IAED,OAAO,aAAa,CAAC;AACvB,CAAC;AAED,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type DamSelectorProps = {
|
|
2
|
+
language?: string;
|
|
3
|
+
};
|
|
4
|
+
export type DamImageValue = {
|
|
5
|
+
mediaId: string | undefined;
|
|
6
|
+
videoId: string | undefined;
|
|
7
|
+
};
|
|
8
|
+
export type SharedienDamExtension = {
|
|
9
|
+
enableDamSelector?: boolean;
|
|
10
|
+
damUrl?: string;
|
|
11
|
+
damScriptUrl?: string;
|
|
12
|
+
};
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@parhelia/sharedien-dam",
|
|
3
|
+
"version": "0.1.10745",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"main": "./dist/index.js",
|
|
9
|
+
"module": "./dist/index.js",
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"import": "./dist/index.js"
|
|
15
|
+
},
|
|
16
|
+
"./styles.css": "./styles.css"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist/",
|
|
20
|
+
"styles.css",
|
|
21
|
+
"README.md",
|
|
22
|
+
"LICENSE"
|
|
23
|
+
],
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build": "tsc -p tsconfig.build.json",
|
|
26
|
+
"lint": "eslint . --max-warnings 0",
|
|
27
|
+
"generate:component": "turbo gen react-component",
|
|
28
|
+
"check-types": "tsc --noEmit"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@repo/eslint-config": "*",
|
|
32
|
+
"@repo/typescript-config": "*",
|
|
33
|
+
"@turbo/gen": "^2.4.4",
|
|
34
|
+
"@types/node": "^22.13.9",
|
|
35
|
+
"@types/react": "19.0.10",
|
|
36
|
+
"@types/react-dom": "19.0.4",
|
|
37
|
+
"eslint": "^9.22.0",
|
|
38
|
+
"typescript": "5.8.2"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"@parhelia/core": "*",
|
|
42
|
+
"@tailwindcss/postcss": "^4.0.14",
|
|
43
|
+
"postcss": "^8.5.3",
|
|
44
|
+
"react": "^19.0.0",
|
|
45
|
+
"react-dom": "^19.0.0",
|
|
46
|
+
"tailwindcss": "^4.0.14",
|
|
47
|
+
"lucide-react": "^0.486.0"
|
|
48
|
+
}
|
|
49
|
+
}
|
package/styles.css
ADDED