@stamprally/admin-ui 0.11.0 → 0.13.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/README.md ADDED
@@ -0,0 +1,37 @@
1
+ # @stamprally/admin-ui
2
+
3
+ Accessible authoring forms and a headless editor for rally management screens.
4
+
5
+ ## Structured editor
6
+
7
+ ```tsx
8
+ import { AdminRallyEditor } from "@stamprally/admin-ui";
9
+ import "@stamprally/admin-ui/styles.css";
10
+
11
+ <AdminRallyEditor config={config} locale="en" onChange={setConfig} />
12
+ ```
13
+
14
+ The editor provides structured fields for localized rally and reward content,
15
+ reward limits and expiry, all condition types, theme properties, and separate
16
+ public/server metadata sections. `JsonConfigIO` remains available for import/export
17
+ and validation workflows, but normal editing does not require JSON.
18
+
19
+ ## Headless API
20
+
21
+ `useAdminRallyEditor(initialConfig)` returns immutable editing actions:
22
+
23
+ ```tsx
24
+ const editor = useAdminRallyEditor(config, { onChange: saveDraft });
25
+ editor.addSpot({ name: { en: "Museum" }, conditions: [{ type: "qr", secretToken: "" }] });
26
+ editor.duplicateReward("reward-1");
27
+ editor.reorderSpots(2, 0);
28
+ editor.reorderRewards(1, 0);
29
+ editor.undo();
30
+ ```
31
+
32
+ Use `canUndo`/`canRedo` to control history buttons. `resetConfig(newConfig)` replaces
33
+ the current draft when an external CMS update arrives. `updateLocalizedField` accepts
34
+ paths such as `title`, `description`, `spots.0.name`, or `spots.spot-1.name`.
35
+ Updates use functional React state transitions, so consecutive updates are not
36
+ lost. External configuration changes replace a clean draft automatically; call
37
+ `resetConfig(newConfig)` to explicitly accept a conflicting external draft.