@fraczled/sdk 1.0.3 → 1.0.5
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/README.md +58 -0
- package/dist/fraczled-sdk.es.js +1 -1
- package/dist/fraczled-sdk.umd.js +122 -117
- package/dist/{index-B7nKcvyh.js → index-CEY4Vg36.js} +7841 -7775
- package/dist/{index.es-DWObXjGN.js → index.es-BHRAhVWf.js} +1 -1
- package/index.d.ts +17 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -63,6 +63,7 @@ interface EditorConfig {
|
|
|
63
63
|
injectBaseStyles?: boolean;
|
|
64
64
|
showLoader?: boolean;
|
|
65
65
|
};
|
|
66
|
+
customPanels?: CustomSidebarPanel[];
|
|
66
67
|
}
|
|
67
68
|
```
|
|
68
69
|
|
|
@@ -74,6 +75,10 @@ to avoid relying on external CDNs.
|
|
|
74
75
|
|
|
75
76
|
License validation is always handled by https://fraczled.com and requires outbound HTTPS access.
|
|
76
77
|
|
|
78
|
+
## Server-side enforcement (recommended)
|
|
79
|
+
|
|
80
|
+
To fully prevent unauthorized usage, gate the editor bundle on your server. See `docs/license-enforcement.md` for the full flow and sample code.
|
|
81
|
+
|
|
77
82
|
## License Keys
|
|
78
83
|
|
|
79
84
|
### Development Keys (dev\_\*)
|
|
@@ -130,6 +135,59 @@ Creates a new editor instance.
|
|
|
130
135
|
- `select` - Fired when selection changes
|
|
131
136
|
- `export` - Fired when user exports
|
|
132
137
|
|
|
138
|
+
## Custom Sidebar Panels
|
|
139
|
+
|
|
140
|
+
You can add your own sidebar tools and panels inside the editor UI. Custom panels render inside the same side panel shell used by built-in tools, and receive access to the `store` and current `state`.
|
|
141
|
+
|
|
142
|
+
```tsx
|
|
143
|
+
import { createFraczledEditor } from "@fraczled/sdk";
|
|
144
|
+
import { BadgeCheck } from "lucide-react";
|
|
145
|
+
|
|
146
|
+
const editor = createFraczledEditor({
|
|
147
|
+
apiKey: "YOUR_LICENSE_KEY",
|
|
148
|
+
projectId: "YOUR_PROJECT_ID",
|
|
149
|
+
container: document.getElementById("editor"),
|
|
150
|
+
customPanels: [
|
|
151
|
+
{
|
|
152
|
+
id: "my-product:approvals",
|
|
153
|
+
label: "Approvals",
|
|
154
|
+
icon: BadgeCheck,
|
|
155
|
+
feature: "approvals", // optional entitlement key
|
|
156
|
+
render: ({ store, state, closePanel, setActivePanel }) => (
|
|
157
|
+
<div className="space-y-4">
|
|
158
|
+
<div className="rounded-lg border border-slate-200 bg-slate-50 p-3 text-xs text-slate-600">
|
|
159
|
+
Selected elements: {state.selection.length}
|
|
160
|
+
</div>
|
|
161
|
+
<button
|
|
162
|
+
className="w-full rounded-lg bg-slate-900 px-3 py-2 text-sm font-semibold text-white"
|
|
163
|
+
onClick={() =>
|
|
164
|
+
store.addElement({
|
|
165
|
+
type: "text",
|
|
166
|
+
name: "Approved Copy",
|
|
167
|
+
content: "Approved Copy"
|
|
168
|
+
})
|
|
169
|
+
}
|
|
170
|
+
>
|
|
171
|
+
Insert Approved Copy
|
|
172
|
+
</button>
|
|
173
|
+
<button
|
|
174
|
+
className="w-full rounded-lg border border-slate-200 px-3 py-2 text-sm font-medium"
|
|
175
|
+
onClick={closePanel}
|
|
176
|
+
>
|
|
177
|
+
Close
|
|
178
|
+
</button>
|
|
179
|
+
</div>
|
|
180
|
+
)
|
|
181
|
+
}
|
|
182
|
+
]
|
|
183
|
+
});
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
Notes:
|
|
187
|
+
- `id` must be unique and should not match built-in tool labels (for example, `Design` or `Elements`).
|
|
188
|
+
- `feature` maps to `entitlements.features[feature]` and controls visibility/access based on licensing.
|
|
189
|
+
- `render` is called when the panel is active, so you can wire buttons directly to `store` methods or read from `state`.
|
|
190
|
+
|
|
133
191
|
## Support
|
|
134
192
|
|
|
135
193
|
- Documentation: [fraczled.com/docs](https://fraczled.com/docs)
|
package/dist/fraczled-sdk.es.js
CHANGED