@medialane/ui 0.285.0 → 0.287.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 (65) hide show
  1. package/dist/components/account/input-otp.d.cts +2 -2
  2. package/dist/components/account/input-otp.d.ts +2 -2
  3. package/dist/components/button.d.cts +2 -2
  4. package/dist/components/button.d.ts +2 -2
  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/marketplace-filters.cjs +253 -0
  20. package/dist/components/marketplace-filters.cjs.map +1 -0
  21. package/dist/components/marketplace-filters.d.cts +34 -0
  22. package/dist/components/marketplace-filters.d.ts +34 -0
  23. package/dist/components/marketplace-filters.js +216 -0
  24. package/dist/components/marketplace-filters.js.map +1 -0
  25. package/dist/components/marketplace-search.cjs +175 -0
  26. package/dist/components/marketplace-search.cjs.map +1 -0
  27. package/dist/components/marketplace-search.d.cts +11 -0
  28. package/dist/components/marketplace-search.d.ts +11 -0
  29. package/dist/components/marketplace-search.js +140 -0
  30. package/dist/components/marketplace-search.js.map +1 -0
  31. package/dist/components/medialane-app.cjs.map +1 -1
  32. package/dist/components/medialane-app.d.cts +1 -0
  33. package/dist/components/medialane-app.d.ts +1 -0
  34. package/dist/components/medialane-app.js.map +1 -1
  35. package/dist/components/settings-section.cjs +65 -0
  36. package/dist/components/settings-section.cjs.map +1 -0
  37. package/dist/components/settings-section.d.cts +24 -0
  38. package/dist/components/settings-section.d.ts +24 -0
  39. package/dist/components/settings-section.js +38 -0
  40. package/dist/components/settings-section.js.map +1 -0
  41. package/dist/index.cjs +20 -0
  42. package/dist/index.cjs.map +1 -1
  43. package/dist/index.d.cts +4 -0
  44. package/dist/index.d.ts +4 -0
  45. package/dist/index.js +12 -0
  46. package/dist/index.js.map +1 -1
  47. package/dist/utils/collection-settings-form.cjs +77 -0
  48. package/dist/utils/collection-settings-form.cjs.map +1 -0
  49. package/dist/utils/collection-settings-form.d.cts +21 -0
  50. package/dist/utils/collection-settings-form.d.ts +21 -0
  51. package/dist/utils/collection-settings-form.js +51 -0
  52. package/dist/utils/collection-settings-form.js.map +1 -0
  53. package/dist/utils/use-collection-settings.cjs +83 -0
  54. package/dist/utils/use-collection-settings.cjs.map +1 -0
  55. package/dist/utils/use-collection-settings.d.cts +58 -0
  56. package/dist/utils/use-collection-settings.d.ts +58 -0
  57. package/dist/utils/use-collection-settings.js +59 -0
  58. package/dist/utils/use-collection-settings.js.map +1 -0
  59. package/dist/utils/use-debounced-value.cjs +38 -0
  60. package/dist/utils/use-debounced-value.cjs.map +1 -0
  61. package/dist/utils/use-debounced-value.d.cts +3 -0
  62. package/dist/utils/use-debounced-value.d.ts +3 -0
  63. package/dist/utils/use-debounced-value.js +14 -0
  64. package/dist/utils/use-debounced-value.js.map +1 -0
  65. 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,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ACjB;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":[]}
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ "use client";
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+ var use_debounced_value_exports = {};
21
+ __export(use_debounced_value_exports, {
22
+ useDebouncedValue: () => useDebouncedValue
23
+ });
24
+ module.exports = __toCommonJS(use_debounced_value_exports);
25
+ var import_react = require("react");
26
+ function useDebouncedValue(value, delayMs) {
27
+ const [debounced, setDebounced] = (0, import_react.useState)(value);
28
+ (0, import_react.useEffect)(() => {
29
+ const timer = setTimeout(() => setDebounced(value), delayMs);
30
+ return () => clearTimeout(timer);
31
+ }, [value, delayMs]);
32
+ return debounced;
33
+ }
34
+ // Annotate the CommonJS export names for ESM import in node:
35
+ 0 && (module.exports = {
36
+ useDebouncedValue
37
+ });
38
+ //# sourceMappingURL=use-debounced-value.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utils/use-debounced-value.ts"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useState } from \"react\";\n\nexport function useDebouncedValue<T>(value: T, delayMs: number): T {\n const [debounced, setDebounced] = useState(value);\n useEffect(() => {\n const timer = setTimeout(() => setDebounced(value), delayMs);\n return () => clearTimeout(timer);\n }, [value, delayMs]);\n return debounced;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAAoC;AAE7B,SAAS,kBAAqB,OAAU,SAAoB;AACjE,QAAM,CAAC,WAAW,YAAY,QAAI,uBAAS,KAAK;AAChD,8BAAU,MAAM;AACd,UAAM,QAAQ,WAAW,MAAM,aAAa,KAAK,GAAG,OAAO;AAC3D,WAAO,MAAM,aAAa,KAAK;AAAA,EACjC,GAAG,CAAC,OAAO,OAAO,CAAC;AACnB,SAAO;AACT;","names":[]}
@@ -0,0 +1,3 @@
1
+ declare function useDebouncedValue<T>(value: T, delayMs: number): T;
2
+
3
+ export { useDebouncedValue };
@@ -0,0 +1,3 @@
1
+ declare function useDebouncedValue<T>(value: T, delayMs: number): T;
2
+
3
+ export { useDebouncedValue };
@@ -0,0 +1,14 @@
1
+ "use client";
2
+ import { useEffect, useState } from "react";
3
+ function useDebouncedValue(value, delayMs) {
4
+ const [debounced, setDebounced] = useState(value);
5
+ useEffect(() => {
6
+ const timer = setTimeout(() => setDebounced(value), delayMs);
7
+ return () => clearTimeout(timer);
8
+ }, [value, delayMs]);
9
+ return debounced;
10
+ }
11
+ export {
12
+ useDebouncedValue
13
+ };
14
+ //# sourceMappingURL=use-debounced-value.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utils/use-debounced-value.ts"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useState } from \"react\";\n\nexport function useDebouncedValue<T>(value: T, delayMs: number): T {\n const [debounced, setDebounced] = useState(value);\n useEffect(() => {\n const timer = setTimeout(() => setDebounced(value), delayMs);\n return () => clearTimeout(timer);\n }, [value, delayMs]);\n return debounced;\n}\n"],"mappings":";AAEA,SAAS,WAAW,gBAAgB;AAE7B,SAAS,kBAAqB,OAAU,SAAoB;AACjE,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,KAAK;AAChD,YAAU,MAAM;AACd,UAAM,QAAQ,WAAW,MAAM,aAAa,KAAK,GAAG,OAAO;AAC3D,WAAO,MAAM,aAAa,KAAK;AAAA,EACjC,GAAG,CAAC,OAAO,OAAO,CAAC;AACnB,SAAO;AACT;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medialane/ui",
3
- "version": "0.285.0",
3
+ "version": "0.287.0",
4
4
  "description": "Shared UI components for Medialane apps",
5
5
  "type": "module",
6
6
  "sideEffects": false,