@medialane/ui 0.286.0 → 0.288.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.
Files changed (53) hide show
  1. package/dist/components/badge.d.cts +1 -1
  2. package/dist/components/badge.d.ts +1 -1
  3. package/dist/components/button.d.cts +1 -1
  4. package/dist/components/button.d.ts +1 -1
  5. package/dist/components/collection-settings.cjs +350 -0
  6. package/dist/components/collection-settings.cjs.map +1 -0
  7. package/dist/components/collection-settings.d.cts +7 -0
  8. package/dist/components/collection-settings.d.ts +7 -0
  9. package/dist/components/collection-settings.js +335 -0
  10. package/dist/components/collection-settings.js.map +1 -0
  11. package/dist/components/collection-slug-claim.cjs +219 -0
  12. package/dist/components/collection-slug-claim.cjs.map +1 -0
  13. package/dist/components/collection-slug-claim.d.cts +10 -0
  14. package/dist/components/collection-slug-claim.d.ts +10 -0
  15. package/dist/components/collection-slug-claim.js +185 -0
  16. package/dist/components/collection-slug-claim.js.map +1 -0
  17. package/dist/components/launchpad/edition-mint-schema.d.cts +2 -2
  18. package/dist/components/launchpad/edition-mint-schema.d.ts +2 -2
  19. package/dist/components/medialane-app.cjs.map +1 -1
  20. package/dist/components/medialane-app.d.cts +1 -0
  21. package/dist/components/medialane-app.d.ts +1 -0
  22. package/dist/components/medialane-app.js.map +1 -1
  23. package/dist/components/mint-landing.cjs +232 -0
  24. package/dist/components/mint-landing.cjs.map +1 -0
  25. package/dist/components/mint-landing.d.cts +77 -0
  26. package/dist/components/mint-landing.d.ts +77 -0
  27. package/dist/components/mint-landing.js +212 -0
  28. package/dist/components/mint-landing.js.map +1 -0
  29. package/dist/components/settings-section.cjs +65 -0
  30. package/dist/components/settings-section.cjs.map +1 -0
  31. package/dist/components/settings-section.d.cts +24 -0
  32. package/dist/components/settings-section.d.ts +24 -0
  33. package/dist/components/settings-section.js +38 -0
  34. package/dist/components/settings-section.js.map +1 -0
  35. package/dist/index.cjs +6 -0
  36. package/dist/index.cjs.map +1 -1
  37. package/dist/index.d.cts +2 -0
  38. package/dist/index.d.ts +2 -0
  39. package/dist/index.js +4 -0
  40. package/dist/index.js.map +1 -1
  41. package/dist/utils/collection-settings-form.cjs +77 -0
  42. package/dist/utils/collection-settings-form.cjs.map +1 -0
  43. package/dist/utils/collection-settings-form.d.cts +21 -0
  44. package/dist/utils/collection-settings-form.d.ts +21 -0
  45. package/dist/utils/collection-settings-form.js +51 -0
  46. package/dist/utils/collection-settings-form.js.map +1 -0
  47. package/dist/utils/use-collection-settings.cjs +83 -0
  48. package/dist/utils/use-collection-settings.cjs.map +1 -0
  49. package/dist/utils/use-collection-settings.d.cts +58 -0
  50. package/dist/utils/use-collection-settings.d.ts +58 -0
  51. package/dist/utils/use-collection-settings.js +59 -0
  52. package/dist/utils/use-collection-settings.js.map +1 -0
  53. package/package.json +1 -1
@@ -0,0 +1,58 @@
1
+ import * as _medialane_sdk from '@medialane/sdk';
2
+ import * as zod from 'zod';
3
+ import { ChangeEvent } from 'react';
4
+ import { CollectionSettingsForm } from './collection-settings-form.js';
5
+
6
+ type SaveStatus = "idle" | "saved" | "error";
7
+ declare function useCollectionSettings(contract: string): {
8
+ collection: {
9
+ symbol: string | null;
10
+ chain: string;
11
+ owner: string | null;
12
+ collectionId: string | null;
13
+ name: string | null;
14
+ description: string | null;
15
+ image: string | null;
16
+ service: string | null;
17
+ contractAddress: string;
18
+ id: string;
19
+ createdAt: string;
20
+ updatedAt: string;
21
+ metadataStatus: "PENDING" | "FETCHING" | "FETCHED" | "FAILED";
22
+ standard: "ERC721" | "ERC1155";
23
+ attributes: zod.objectOutputType<{
24
+ trait_type: zod.ZodString;
25
+ value: zod.ZodUnion<[zod.ZodString, zod.ZodNumber, zod.ZodBoolean]>;
26
+ display_type: zod.ZodOptional<zod.ZodString>;
27
+ }, zod.ZodTypeAny, "passthrough">[] | null;
28
+ holderCount: number;
29
+ startBlock: string;
30
+ isFeatured: boolean;
31
+ isHidden: boolean;
32
+ claimedBy: string | null;
33
+ floorPrice: string | null;
34
+ totalVolume: string | null;
35
+ totalSupply: number;
36
+ profile: {
37
+ description: string | null;
38
+ image: string | null;
39
+ displayName: string | null;
40
+ gatedContentTitle: string | null;
41
+ hasGatedContent: boolean;
42
+ slug: string | null;
43
+ } | null;
44
+ } | null;
45
+ profile: _medialane_sdk.ApiCollectionProfile | null;
46
+ collectionLoading: boolean;
47
+ isLoading: boolean;
48
+ isOwner: boolean;
49
+ form: CollectionSettingsForm;
50
+ set: (key: keyof CollectionSettingsForm) => (e: ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
51
+ update: (patch: Partial<CollectionSettingsForm>) => void;
52
+ saving: boolean;
53
+ saveStatus: SaveStatus;
54
+ saveError: string | null;
55
+ save: () => Promise<void>;
56
+ };
57
+
58
+ export { useCollectionSettings };
@@ -0,0 +1,59 @@
1
+ "use client";
2
+ import { useCallback, useEffect, useState } from "react";
3
+ import { normalizeAddress } from "@medialane/sdk";
4
+ import { useMedialaneApp } from "../components/medialane-app.js";
5
+ import { describeError } from "./describe-error.js";
6
+ import { useCollection } from "./use-collections.js";
7
+ import { useCollectionProfile } from "./use-profiles.js";
8
+ import { EMPTY_SETTINGS_FORM, applyProfile, toProfileInput } from "./collection-settings-form.js";
9
+ function useCollectionSettings(contract) {
10
+ const { walletAddress, getClient, ensureSignedIn } = useMedialaneApp();
11
+ const { collection, isLoading: collectionLoading } = useCollection(contract);
12
+ const { profile, isLoading: profileLoading, mutate } = useCollectionProfile(contract);
13
+ const [form, setForm] = useState(EMPTY_SETTINGS_FORM);
14
+ const [saving, setSaving] = useState(false);
15
+ const [saveStatus, setSaveStatus] = useState("idle");
16
+ const [saveError, setSaveError] = useState(null);
17
+ useEffect(() => {
18
+ if (profile) setForm((f) => applyProfile(f, profile));
19
+ }, [profile]);
20
+ const update = useCallback((patch) => setForm((f) => ({ ...f, ...patch })), []);
21
+ const set = (key) => (e) => update({ [key]: e.target.value });
22
+ const isOwner = Boolean(
23
+ walletAddress && collection?.owner && normalizeAddress("STARKNET", walletAddress) === normalizeAddress("STARKNET", collection.owner)
24
+ );
25
+ const save = async () => {
26
+ setSaving(true);
27
+ setSaveError(null);
28
+ try {
29
+ await ensureSignedIn?.();
30
+ await getClient().api.collections.updateProfile(contract, toProfileInput(form));
31
+ await mutate();
32
+ setSaveStatus("saved");
33
+ setTimeout(() => setSaveStatus("idle"), 3e3);
34
+ } catch (e) {
35
+ setSaveStatus("error");
36
+ setSaveError(describeError(e).message);
37
+ } finally {
38
+ setSaving(false);
39
+ }
40
+ };
41
+ return {
42
+ collection,
43
+ profile,
44
+ collectionLoading,
45
+ isLoading: collectionLoading || profileLoading,
46
+ isOwner,
47
+ form,
48
+ set,
49
+ update,
50
+ saving,
51
+ saveStatus,
52
+ saveError,
53
+ save
54
+ };
55
+ }
56
+ export {
57
+ useCollectionSettings
58
+ };
59
+ //# sourceMappingURL=use-collection-settings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utils/use-collection-settings.ts"],"sourcesContent":["\"use client\";\n\nimport { useCallback, useEffect, useState, type ChangeEvent } from \"react\";\nimport { normalizeAddress } from \"@medialane/sdk\";\nimport { useMedialaneApp } from \"../components/medialane-app.js\";\nimport { describeError } from \"./describe-error.js\";\nimport { useCollection } from \"./use-collections.js\";\nimport { useCollectionProfile } from \"./use-profiles.js\";\nimport { EMPTY_SETTINGS_FORM, applyProfile, toProfileInput, type CollectionSettingsForm } from \"./collection-settings-form.js\";\n\ntype SaveStatus = \"idle\" | \"saved\" | \"error\";\n\nexport function useCollectionSettings(contract: string) {\n const { walletAddress, getClient, ensureSignedIn } = useMedialaneApp();\n const { collection, isLoading: collectionLoading } = useCollection(contract);\n const { profile, isLoading: profileLoading, mutate } = useCollectionProfile(contract);\n\n const [form, setForm] = useState<CollectionSettingsForm>(EMPTY_SETTINGS_FORM);\n const [saving, setSaving] = useState(false);\n const [saveStatus, setSaveStatus] = useState<SaveStatus>(\"idle\");\n const [saveError, setSaveError] = useState<string | null>(null);\n\n useEffect(() => {\n if (profile) setForm((f) => applyProfile(f, profile));\n }, [profile]);\n\n const update = useCallback((patch: Partial<CollectionSettingsForm>) => setForm((f) => ({ ...f, ...patch })), []);\n\n const set = (key: keyof CollectionSettingsForm) => (e: ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) =>\n update({ [key]: e.target.value });\n\n const isOwner = Boolean(\n walletAddress &&\n collection?.owner &&\n normalizeAddress(\"STARKNET\", walletAddress) === normalizeAddress(\"STARKNET\", collection.owner),\n );\n\n const save = async () => {\n setSaving(true);\n setSaveError(null);\n try {\n await ensureSignedIn?.();\n await getClient().api.collections.updateProfile(contract, toProfileInput(form));\n await mutate();\n setSaveStatus(\"saved\");\n setTimeout(() => setSaveStatus(\"idle\"), 3000);\n } catch (e) {\n setSaveStatus(\"error\");\n setSaveError(describeError(e).message);\n } finally {\n setSaving(false);\n }\n };\n\n return {\n collection,\n profile,\n collectionLoading,\n isLoading: collectionLoading || profileLoading,\n isOwner,\n form,\n set,\n update,\n saving,\n saveStatus,\n saveError,\n save,\n };\n}\n"],"mappings":";AAEA,SAAS,aAAa,WAAW,gBAAkC;AACnE,SAAS,wBAAwB;AACjC,SAAS,uBAAuB;AAChC,SAAS,qBAAqB;AAC9B,SAAS,qBAAqB;AAC9B,SAAS,4BAA4B;AACrC,SAAS,qBAAqB,cAAc,sBAAmD;AAIxF,SAAS,sBAAsB,UAAkB;AACtD,QAAM,EAAE,eAAe,WAAW,eAAe,IAAI,gBAAgB;AACrE,QAAM,EAAE,YAAY,WAAW,kBAAkB,IAAI,cAAc,QAAQ;AAC3E,QAAM,EAAE,SAAS,WAAW,gBAAgB,OAAO,IAAI,qBAAqB,QAAQ;AAEpF,QAAM,CAAC,MAAM,OAAO,IAAI,SAAiC,mBAAmB;AAC5E,QAAM,CAAC,QAAQ,SAAS,IAAI,SAAS,KAAK;AAC1C,QAAM,CAAC,YAAY,aAAa,IAAI,SAAqB,MAAM;AAC/D,QAAM,CAAC,WAAW,YAAY,IAAI,SAAwB,IAAI;AAE9D,YAAU,MAAM;AACd,QAAI,QAAS,SAAQ,CAAC,MAAM,aAAa,GAAG,OAAO,CAAC;AAAA,EACtD,GAAG,CAAC,OAAO,CAAC;AAEZ,QAAM,SAAS,YAAY,CAAC,UAA2C,QAAQ,CAAC,OAAO,EAAE,GAAG,GAAG,GAAG,MAAM,EAAE,GAAG,CAAC,CAAC;AAE/G,QAAM,MAAM,CAAC,QAAsC,CAAC,MAClD,OAAO,EAAE,CAAC,GAAG,GAAG,EAAE,OAAO,MAAM,CAAC;AAElC,QAAM,UAAU;AAAA,IACd,iBACE,YAAY,SACZ,iBAAiB,YAAY,aAAa,MAAM,iBAAiB,YAAY,WAAW,KAAK;AAAA,EACjG;AAEA,QAAM,OAAO,YAAY;AACvB,cAAU,IAAI;AACd,iBAAa,IAAI;AACjB,QAAI;AACF,YAAM,iBAAiB;AACvB,YAAM,UAAU,EAAE,IAAI,YAAY,cAAc,UAAU,eAAe,IAAI,CAAC;AAC9E,YAAM,OAAO;AACb,oBAAc,OAAO;AACrB,iBAAW,MAAM,cAAc,MAAM,GAAG,GAAI;AAAA,IAC9C,SAAS,GAAG;AACV,oBAAc,OAAO;AACrB,mBAAa,cAAc,CAAC,EAAE,OAAO;AAAA,IACvC,UAAE;AACA,gBAAU,KAAK;AAAA,IACjB;AAAA,EACF;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW,qBAAqB;AAAA,IAChC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medialane/ui",
3
- "version": "0.286.0",
3
+ "version": "0.288.0",
4
4
  "description": "Shared UI components for Medialane apps",
5
5
  "type": "module",
6
6
  "sideEffects": false,