@medialane/ui 0.176.0 → 0.177.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/dist/utils/use-pop.cjs
CHANGED
|
@@ -29,12 +29,14 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
29
29
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
30
|
var use_pop_exports = {};
|
|
31
31
|
__export(use_pop_exports, {
|
|
32
|
+
popClaimedKey: () => popClaimedKey,
|
|
32
33
|
useMyPopEvents: () => useMyPopEvents,
|
|
33
34
|
usePopClaimStatus: () => usePopClaimStatus,
|
|
34
35
|
usePopCollections: () => usePopCollections
|
|
35
36
|
});
|
|
36
37
|
module.exports = __toCommonJS(use_pop_exports);
|
|
37
38
|
var import_swr = __toESM(require("swr"), 1);
|
|
39
|
+
var import_starknet = require("@medialane/sdk/starknet");
|
|
38
40
|
var import_use_medialane_client = require("./use-medialane-client.js");
|
|
39
41
|
function usePopCollections(getClient) {
|
|
40
42
|
const client = (0, import_use_medialane_client.useMedialaneClient)(getClient);
|
|
@@ -54,17 +56,20 @@ function useMyPopEvents(getClient, owner) {
|
|
|
54
56
|
);
|
|
55
57
|
return { events: data ?? [], isLoading, error, mutate };
|
|
56
58
|
}
|
|
57
|
-
function
|
|
58
|
-
|
|
59
|
+
function popClaimedKey(collection, wallet) {
|
|
60
|
+
return collection && wallet ? `pop-claimed-${collection}-${wallet}` : null;
|
|
61
|
+
}
|
|
62
|
+
function usePopClaimStatus(provider, collection, wallet) {
|
|
59
63
|
const { data, error, isLoading, mutate } = (0, import_swr.default)(
|
|
60
|
-
collection
|
|
61
|
-
() =>
|
|
64
|
+
popClaimedKey(collection, wallet),
|
|
65
|
+
() => (0, import_starknet.popHasClaimed)(provider, collection, wallet),
|
|
62
66
|
{ revalidateOnFocus: false, shouldRetryOnError: false }
|
|
63
67
|
);
|
|
64
|
-
return {
|
|
68
|
+
return { hasClaimed: data ?? null, isLoading, error, mutate };
|
|
65
69
|
}
|
|
66
70
|
// Annotate the CommonJS export names for ESM import in node:
|
|
67
71
|
0 && (module.exports = {
|
|
72
|
+
popClaimedKey,
|
|
68
73
|
useMyPopEvents,
|
|
69
74
|
usePopClaimStatus,
|
|
70
75
|
usePopCollections
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/use-pop.ts"],"sourcesContent":["\"use client\";\n\nimport useSWR from \"swr\";\nimport type { ApiCollection, ApiMeta
|
|
1
|
+
{"version":3,"sources":["../../src/utils/use-pop.ts"],"sourcesContent":["\"use client\";\n\nimport useSWR from \"swr\";\nimport type { ApiCollection, ApiMeta } from \"@medialane/sdk\";\nimport { popHasClaimed, type MedialaneClient } from \"@medialane/sdk/starknet\";\nimport type { ProviderInterface } from \"starknet\";\nimport { useMedialaneClient } from \"./use-medialane-client.js\";\n\nexport function usePopCollections(getClient: () => MedialaneClient) {\n const client = useMedialaneClient(getClient);\n const { data, error, isLoading, mutate } = useSWR<{ data: ApiCollection[]; meta?: ApiMeta }>(\n \"pop-collections\",\n () => client.api.listCollections({ service: \"pop-protocol\", hideEmpty: false, limit: 50 }),\n { revalidateOnFocus: false }\n );\n return { collections: data?.data ?? [], meta: data?.meta, isLoading, error, mutate };\n}\n\nexport function useMyPopEvents(getClient: () => MedialaneClient, owner: string | null) {\n const client = useMedialaneClient(getClient);\n const { data, error, isLoading, mutate } = useSWR<ApiCollection[]>(\n owner ? `my-pop-events-${owner}` : null,\n async () => (await client.api.listCollections({ service: \"pop-protocol\", owner: owner!, limit: 50 })).data ?? [],\n { revalidateOnFocus: false }\n );\n return { events: data ?? [], isLoading, error, mutate };\n}\n\nexport function popClaimedKey(collection: string | null, wallet: string | null): string | null {\n return collection && wallet ? `pop-claimed-${collection}-${wallet}` : null;\n}\n\n/** Whether `wallet` already holds this collection's credential, read from chain. */\nexport function usePopClaimStatus(\n provider: Pick<ProviderInterface, \"callContract\">,\n collection: string | null,\n wallet: string | null,\n) {\n const { data, error, isLoading, mutate } = useSWR<boolean>(\n popClaimedKey(collection, wallet),\n () => popHasClaimed(provider, collection!, wallet!),\n { revalidateOnFocus: false, shouldRetryOnError: false },\n );\n return { hasClaimed: data ?? null, isLoading, error, mutate };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,iBAAmB;AAEnB,sBAAoD;AAEpD,kCAAmC;AAE5B,SAAS,kBAAkB,WAAkC;AAClE,QAAM,aAAS,gDAAmB,SAAS;AAC3C,QAAM,EAAE,MAAM,OAAO,WAAW,OAAO,QAAI,WAAAA;AAAA,IACzC;AAAA,IACA,MAAM,OAAO,IAAI,gBAAgB,EAAE,SAAS,gBAAgB,WAAW,OAAO,OAAO,GAAG,CAAC;AAAA,IACzF,EAAE,mBAAmB,MAAM;AAAA,EAC7B;AACA,SAAO,EAAE,aAAa,MAAM,QAAQ,CAAC,GAAG,MAAM,MAAM,MAAM,WAAW,OAAO,OAAO;AACrF;AAEO,SAAS,eAAe,WAAkC,OAAsB;AACrF,QAAM,aAAS,gDAAmB,SAAS;AAC3C,QAAM,EAAE,MAAM,OAAO,WAAW,OAAO,QAAI,WAAAA;AAAA,IACzC,QAAQ,iBAAiB,KAAK,KAAK;AAAA,IACnC,aAAa,MAAM,OAAO,IAAI,gBAAgB,EAAE,SAAS,gBAAgB,OAAe,OAAO,GAAG,CAAC,GAAG,QAAQ,CAAC;AAAA,IAC/G,EAAE,mBAAmB,MAAM;AAAA,EAC7B;AACA,SAAO,EAAE,QAAQ,QAAQ,CAAC,GAAG,WAAW,OAAO,OAAO;AACxD;AAEO,SAAS,cAAc,YAA2B,QAAsC;AAC7F,SAAO,cAAc,SAAS,eAAe,UAAU,IAAI,MAAM,KAAK;AACxE;AAGO,SAAS,kBACd,UACA,YACA,QACA;AACA,QAAM,EAAE,MAAM,OAAO,WAAW,OAAO,QAAI,WAAAA;AAAA,IACzC,cAAc,YAAY,MAAM;AAAA,IAChC,UAAM,+BAAc,UAAU,YAAa,MAAO;AAAA,IAClD,EAAE,mBAAmB,OAAO,oBAAoB,MAAM;AAAA,EACxD;AACA,SAAO,EAAE,YAAY,QAAQ,MAAM,WAAW,OAAO,OAAO;AAC9D;","names":["useSWR"]}
|
package/dist/utils/use-pop.d.cts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as swr from 'swr';
|
|
2
|
-
import { ApiCollection,
|
|
2
|
+
import { ApiCollection, ApiMeta } from '@medialane/sdk';
|
|
3
3
|
import { MedialaneClient } from '@medialane/sdk/starknet';
|
|
4
|
+
import { ProviderInterface } from 'starknet';
|
|
4
5
|
|
|
5
6
|
declare function usePopCollections(getClient: () => MedialaneClient): {
|
|
6
7
|
collections: ApiCollection[];
|
|
@@ -18,11 +19,13 @@ declare function useMyPopEvents(getClient: () => MedialaneClient, owner: string
|
|
|
18
19
|
error: any;
|
|
19
20
|
mutate: swr.KeyedMutator<ApiCollection[]>;
|
|
20
21
|
};
|
|
21
|
-
declare function
|
|
22
|
-
|
|
22
|
+
declare function popClaimedKey(collection: string | null, wallet: string | null): string | null;
|
|
23
|
+
/** Whether `wallet` already holds this collection's credential, read from chain. */
|
|
24
|
+
declare function usePopClaimStatus(provider: Pick<ProviderInterface, "callContract">, collection: string | null, wallet: string | null): {
|
|
25
|
+
hasClaimed: boolean | null;
|
|
23
26
|
isLoading: boolean;
|
|
24
27
|
error: any;
|
|
25
|
-
mutate: swr.KeyedMutator<
|
|
28
|
+
mutate: swr.KeyedMutator<boolean>;
|
|
26
29
|
};
|
|
27
30
|
|
|
28
|
-
export { useMyPopEvents, usePopClaimStatus, usePopCollections };
|
|
31
|
+
export { popClaimedKey, useMyPopEvents, usePopClaimStatus, usePopCollections };
|
package/dist/utils/use-pop.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as swr from 'swr';
|
|
2
|
-
import { ApiCollection,
|
|
2
|
+
import { ApiCollection, ApiMeta } from '@medialane/sdk';
|
|
3
3
|
import { MedialaneClient } from '@medialane/sdk/starknet';
|
|
4
|
+
import { ProviderInterface } from 'starknet';
|
|
4
5
|
|
|
5
6
|
declare function usePopCollections(getClient: () => MedialaneClient): {
|
|
6
7
|
collections: ApiCollection[];
|
|
@@ -18,11 +19,13 @@ declare function useMyPopEvents(getClient: () => MedialaneClient, owner: string
|
|
|
18
19
|
error: any;
|
|
19
20
|
mutate: swr.KeyedMutator<ApiCollection[]>;
|
|
20
21
|
};
|
|
21
|
-
declare function
|
|
22
|
-
|
|
22
|
+
declare function popClaimedKey(collection: string | null, wallet: string | null): string | null;
|
|
23
|
+
/** Whether `wallet` already holds this collection's credential, read from chain. */
|
|
24
|
+
declare function usePopClaimStatus(provider: Pick<ProviderInterface, "callContract">, collection: string | null, wallet: string | null): {
|
|
25
|
+
hasClaimed: boolean | null;
|
|
23
26
|
isLoading: boolean;
|
|
24
27
|
error: any;
|
|
25
|
-
mutate: swr.KeyedMutator<
|
|
28
|
+
mutate: swr.KeyedMutator<boolean>;
|
|
26
29
|
};
|
|
27
30
|
|
|
28
|
-
export { useMyPopEvents, usePopClaimStatus, usePopCollections };
|
|
31
|
+
export { popClaimedKey, useMyPopEvents, usePopClaimStatus, usePopCollections };
|
package/dist/utils/use-pop.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import useSWR from "swr";
|
|
3
|
+
import { popHasClaimed } from "@medialane/sdk/starknet";
|
|
3
4
|
import { useMedialaneClient } from "./use-medialane-client.js";
|
|
4
5
|
function usePopCollections(getClient) {
|
|
5
6
|
const client = useMedialaneClient(getClient);
|
|
@@ -19,16 +20,19 @@ function useMyPopEvents(getClient, owner) {
|
|
|
19
20
|
);
|
|
20
21
|
return { events: data ?? [], isLoading, error, mutate };
|
|
21
22
|
}
|
|
22
|
-
function
|
|
23
|
-
|
|
23
|
+
function popClaimedKey(collection, wallet) {
|
|
24
|
+
return collection && wallet ? `pop-claimed-${collection}-${wallet}` : null;
|
|
25
|
+
}
|
|
26
|
+
function usePopClaimStatus(provider, collection, wallet) {
|
|
24
27
|
const { data, error, isLoading, mutate } = useSWR(
|
|
25
|
-
collection
|
|
26
|
-
() =>
|
|
28
|
+
popClaimedKey(collection, wallet),
|
|
29
|
+
() => popHasClaimed(provider, collection, wallet),
|
|
27
30
|
{ revalidateOnFocus: false, shouldRetryOnError: false }
|
|
28
31
|
);
|
|
29
|
-
return {
|
|
32
|
+
return { hasClaimed: data ?? null, isLoading, error, mutate };
|
|
30
33
|
}
|
|
31
34
|
export {
|
|
35
|
+
popClaimedKey,
|
|
32
36
|
useMyPopEvents,
|
|
33
37
|
usePopClaimStatus,
|
|
34
38
|
usePopCollections
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/use-pop.ts"],"sourcesContent":["\"use client\";\n\nimport useSWR from \"swr\";\nimport type { ApiCollection, ApiMeta
|
|
1
|
+
{"version":3,"sources":["../../src/utils/use-pop.ts"],"sourcesContent":["\"use client\";\n\nimport useSWR from \"swr\";\nimport type { ApiCollection, ApiMeta } from \"@medialane/sdk\";\nimport { popHasClaimed, type MedialaneClient } from \"@medialane/sdk/starknet\";\nimport type { ProviderInterface } from \"starknet\";\nimport { useMedialaneClient } from \"./use-medialane-client.js\";\n\nexport function usePopCollections(getClient: () => MedialaneClient) {\n const client = useMedialaneClient(getClient);\n const { data, error, isLoading, mutate } = useSWR<{ data: ApiCollection[]; meta?: ApiMeta }>(\n \"pop-collections\",\n () => client.api.listCollections({ service: \"pop-protocol\", hideEmpty: false, limit: 50 }),\n { revalidateOnFocus: false }\n );\n return { collections: data?.data ?? [], meta: data?.meta, isLoading, error, mutate };\n}\n\nexport function useMyPopEvents(getClient: () => MedialaneClient, owner: string | null) {\n const client = useMedialaneClient(getClient);\n const { data, error, isLoading, mutate } = useSWR<ApiCollection[]>(\n owner ? `my-pop-events-${owner}` : null,\n async () => (await client.api.listCollections({ service: \"pop-protocol\", owner: owner!, limit: 50 })).data ?? [],\n { revalidateOnFocus: false }\n );\n return { events: data ?? [], isLoading, error, mutate };\n}\n\nexport function popClaimedKey(collection: string | null, wallet: string | null): string | null {\n return collection && wallet ? `pop-claimed-${collection}-${wallet}` : null;\n}\n\n/** Whether `wallet` already holds this collection's credential, read from chain. */\nexport function usePopClaimStatus(\n provider: Pick<ProviderInterface, \"callContract\">,\n collection: string | null,\n wallet: string | null,\n) {\n const { data, error, isLoading, mutate } = useSWR<boolean>(\n popClaimedKey(collection, wallet),\n () => popHasClaimed(provider, collection!, wallet!),\n { revalidateOnFocus: false, shouldRetryOnError: false },\n );\n return { hasClaimed: data ?? null, isLoading, error, mutate };\n}\n"],"mappings":";AAEA,OAAO,YAAY;AAEnB,SAAS,qBAA2C;AAEpD,SAAS,0BAA0B;AAE5B,SAAS,kBAAkB,WAAkC;AAClE,QAAM,SAAS,mBAAmB,SAAS;AAC3C,QAAM,EAAE,MAAM,OAAO,WAAW,OAAO,IAAI;AAAA,IACzC;AAAA,IACA,MAAM,OAAO,IAAI,gBAAgB,EAAE,SAAS,gBAAgB,WAAW,OAAO,OAAO,GAAG,CAAC;AAAA,IACzF,EAAE,mBAAmB,MAAM;AAAA,EAC7B;AACA,SAAO,EAAE,aAAa,MAAM,QAAQ,CAAC,GAAG,MAAM,MAAM,MAAM,WAAW,OAAO,OAAO;AACrF;AAEO,SAAS,eAAe,WAAkC,OAAsB;AACrF,QAAM,SAAS,mBAAmB,SAAS;AAC3C,QAAM,EAAE,MAAM,OAAO,WAAW,OAAO,IAAI;AAAA,IACzC,QAAQ,iBAAiB,KAAK,KAAK;AAAA,IACnC,aAAa,MAAM,OAAO,IAAI,gBAAgB,EAAE,SAAS,gBAAgB,OAAe,OAAO,GAAG,CAAC,GAAG,QAAQ,CAAC;AAAA,IAC/G,EAAE,mBAAmB,MAAM;AAAA,EAC7B;AACA,SAAO,EAAE,QAAQ,QAAQ,CAAC,GAAG,WAAW,OAAO,OAAO;AACxD;AAEO,SAAS,cAAc,YAA2B,QAAsC;AAC7F,SAAO,cAAc,SAAS,eAAe,UAAU,IAAI,MAAM,KAAK;AACxE;AAGO,SAAS,kBACd,UACA,YACA,QACA;AACA,QAAM,EAAE,MAAM,OAAO,WAAW,OAAO,IAAI;AAAA,IACzC,cAAc,YAAY,MAAM;AAAA,IAChC,MAAM,cAAc,UAAU,YAAa,MAAO;AAAA,IAClD,EAAE,mBAAmB,OAAO,oBAAoB,MAAM;AAAA,EACxD;AACA,SAAO,EAAE,YAAY,QAAQ,MAAM,WAAW,OAAO,OAAO;AAC9D;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medialane/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.177.0",
|
|
4
4
|
"description": "Shared UI components for Medialane apps",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"preview": "vite --config preview/vite.config.ts"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
|
-
"@medialane/sdk": ">=0.
|
|
54
|
+
"@medialane/sdk": ">=0.159.0",
|
|
55
55
|
"@radix-ui/react-checkbox": ">=1.1.0",
|
|
56
56
|
"@radix-ui/react-collapsible": ">=1.1.0",
|
|
57
57
|
"@radix-ui/react-dialog": ">=1.1.0",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"zod": "^3.25.0"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
|
-
"@medialane/sdk": "0.
|
|
83
|
+
"@medialane/sdk": "0.159.0",
|
|
84
84
|
"@radix-ui/react-checkbox": "^1.3.8",
|
|
85
85
|
"@radix-ui/react-collapsible": "^1.1.17",
|
|
86
86
|
"@radix-ui/react-dialog": "^1.1.20",
|