@medialane/ui 0.411.1 → 0.413.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 (129) hide show
  1. package/dist/components/add-to-medialane.cjs +82 -0
  2. package/dist/components/add-to-medialane.cjs.map +1 -0
  3. package/dist/components/add-to-medialane.d.cts +9 -0
  4. package/dist/components/add-to-medialane.d.ts +9 -0
  5. package/dist/components/add-to-medialane.js +58 -0
  6. package/dist/components/add-to-medialane.js.map +1 -0
  7. package/dist/components/asset-page.cjs +6 -4
  8. package/dist/components/asset-page.cjs.map +1 -1
  9. package/dist/components/asset-page.js +6 -4
  10. package/dist/components/asset-page.js.map +1 -1
  11. package/dist/components/asset-top-sections.cjs +1 -1
  12. package/dist/components/asset-top-sections.cjs.map +1 -1
  13. package/dist/components/asset-top-sections.js +1 -1
  14. package/dist/components/asset-top-sections.js.map +1 -1
  15. package/dist/components/asset-unavailable.cjs +2 -5
  16. package/dist/components/asset-unavailable.cjs.map +1 -1
  17. package/dist/components/asset-unavailable.d.cts +1 -3
  18. package/dist/components/asset-unavailable.d.ts +1 -3
  19. package/dist/components/asset-unavailable.js +3 -6
  20. package/dist/components/asset-unavailable.js.map +1 -1
  21. package/dist/components/claim-coin-panel.cjs +109 -0
  22. package/dist/components/claim-coin-panel.cjs.map +1 -0
  23. package/dist/components/claim-coin-panel.d.cts +5 -0
  24. package/dist/components/claim-coin-panel.d.ts +5 -0
  25. package/dist/components/claim-coin-panel.js +75 -0
  26. package/dist/components/claim-coin-panel.js.map +1 -0
  27. package/dist/components/collection-page.cjs +5 -2
  28. package/dist/components/collection-page.cjs.map +1 -1
  29. package/dist/components/collection-page.js +5 -2
  30. package/dist/components/collection-page.js.map +1 -1
  31. package/dist/components/fast-mint/fast-mint.cjs +1 -1
  32. package/dist/components/fast-mint/fast-mint.cjs.map +1 -1
  33. package/dist/components/fast-mint/fast-mint.js +1 -1
  34. package/dist/components/fast-mint/fast-mint.js.map +1 -1
  35. package/dist/components/fast-mint/ip-type-section.cjs +21 -32
  36. package/dist/components/fast-mint/ip-type-section.cjs.map +1 -1
  37. package/dist/components/fast-mint/ip-type-section.js +22 -33
  38. package/dist/components/fast-mint/ip-type-section.js.map +1 -1
  39. package/dist/components/fast-mint/licensing-section.cjs +43 -54
  40. package/dist/components/fast-mint/licensing-section.cjs.map +1 -1
  41. package/dist/components/fast-mint/licensing-section.js +44 -55
  42. package/dist/components/fast-mint/licensing-section.js.map +1 -1
  43. package/dist/components/launchpad/edition-mint-fields.cjs +0 -2
  44. package/dist/components/launchpad/edition-mint-fields.cjs.map +1 -1
  45. package/dist/components/launchpad/edition-mint-fields.js +0 -2
  46. package/dist/components/launchpad/edition-mint-fields.js.map +1 -1
  47. package/dist/components/launchpad/remix-mint.cjs +1 -1
  48. package/dist/components/launchpad/remix-mint.cjs.map +1 -1
  49. package/dist/components/launchpad/remix-mint.js +1 -1
  50. package/dist/components/launchpad/remix-mint.js.map +1 -1
  51. package/dist/components/launchpad/single-edition-mint.cjs +0 -2
  52. package/dist/components/launchpad/single-edition-mint.cjs.map +1 -1
  53. package/dist/components/launchpad/single-edition-mint.js +0 -2
  54. package/dist/components/launchpad/single-edition-mint.js.map +1 -1
  55. package/dist/components/launchpad/tier-mint-form.cjs +46 -55
  56. package/dist/components/launchpad/tier-mint-form.cjs.map +1 -1
  57. package/dist/components/launchpad/tier-mint-form.js +46 -55
  58. package/dist/components/launchpad/tier-mint-form.js.map +1 -1
  59. package/dist/components/launchpad-filter-bar.cjs +1 -1
  60. package/dist/components/launchpad-filter-bar.cjs.map +1 -1
  61. package/dist/components/launchpad-filter-bar.js +1 -1
  62. package/dist/components/launchpad-filter-bar.js.map +1 -1
  63. package/dist/components/launchpad-services.cjs +2 -2
  64. package/dist/components/launchpad-services.cjs.map +1 -1
  65. package/dist/components/launchpad-services.js +2 -2
  66. package/dist/components/launchpad-services.js.map +1 -1
  67. package/dist/components/mint-landing.cjs +1 -1
  68. package/dist/components/mint-landing.cjs.map +1 -1
  69. package/dist/components/mint-landing.js +1 -1
  70. package/dist/components/mint-landing.js.map +1 -1
  71. package/dist/components/page-aside.cjs +0 -8
  72. package/dist/components/page-aside.cjs.map +1 -1
  73. package/dist/components/page-aside.d.cts +0 -8
  74. package/dist/components/page-aside.d.ts +0 -8
  75. package/dist/components/page-aside.js +0 -8
  76. package/dist/components/page-aside.js.map +1 -1
  77. package/dist/components/portfolio-collections.cjs +3 -9
  78. package/dist/components/portfolio-collections.cjs.map +1 -1
  79. package/dist/components/portfolio-collections.d.cts +1 -4
  80. package/dist/components/portfolio-collections.d.ts +1 -4
  81. package/dist/components/portfolio-collections.js +4 -10
  82. package/dist/components/portfolio-collections.js.map +1 -1
  83. package/dist/components/service-form-shell.cjs +1 -1
  84. package/dist/components/service-form-shell.cjs.map +1 -1
  85. package/dist/components/service-form-shell.js +1 -1
  86. package/dist/components/service-form-shell.js.map +1 -1
  87. package/dist/components/underline-tabs.cjs +1 -1
  88. package/dist/components/underline-tabs.cjs.map +1 -1
  89. package/dist/components/underline-tabs.js +1 -1
  90. package/dist/components/underline-tabs.js.map +1 -1
  91. package/dist/data/launchpad-services.cjs +5 -5
  92. package/dist/data/launchpad-services.cjs.map +1 -1
  93. package/dist/data/launchpad-services.js +5 -5
  94. package/dist/data/launchpad-services.js.map +1 -1
  95. package/dist/i18n/catalog/pt.cjs +43 -66
  96. package/dist/i18n/catalog/pt.cjs.map +1 -1
  97. package/dist/i18n/catalog/pt.js +43 -66
  98. package/dist/i18n/catalog/pt.js.map +1 -1
  99. package/dist/index.cjs +6 -3
  100. package/dist/index.cjs.map +1 -1
  101. package/dist/index.d.cts +2 -1
  102. package/dist/index.d.ts +2 -1
  103. package/dist/index.js +4 -2
  104. package/dist/index.js.map +1 -1
  105. package/dist/utils/not-found.cjs +31 -0
  106. package/dist/utils/not-found.cjs.map +1 -0
  107. package/dist/utils/not-found.d.cts +3 -0
  108. package/dist/utils/not-found.d.ts +3 -0
  109. package/dist/utils/not-found.js +7 -0
  110. package/dist/utils/not-found.js.map +1 -0
  111. package/dist/utils/use-collections.cjs +10 -2
  112. package/dist/utils/use-collections.cjs.map +1 -1
  113. package/dist/utils/use-collections.d.cts +1 -0
  114. package/dist/utils/use-collections.d.ts +1 -0
  115. package/dist/utils/use-collections.js +10 -2
  116. package/dist/utils/use-collections.js.map +1 -1
  117. package/dist/utils/use-tokens.cjs +6 -18
  118. package/dist/utils/use-tokens.cjs.map +1 -1
  119. package/dist/utils/use-tokens.d.cts +1 -1
  120. package/dist/utils/use-tokens.d.ts +1 -1
  121. package/dist/utils/use-tokens.js +6 -18
  122. package/dist/utils/use-tokens.js.map +1 -1
  123. package/package.json +3 -3
  124. package/dist/components/claim/claim-collection-panel.cjs +0 -210
  125. package/dist/components/claim/claim-collection-panel.cjs.map +0 -1
  126. package/dist/components/claim/claim-collection-panel.d.cts +0 -8
  127. package/dist/components/claim/claim-collection-panel.d.ts +0 -8
  128. package/dist/components/claim/claim-collection-panel.js +0 -176
  129. package/dist/components/claim/claim-collection-panel.js.map +0 -1
@@ -1,36 +1,24 @@
1
1
  "use client";
2
- import { useState } from "react";
3
2
  import useSWR from "swr";
4
3
  import useSWRInfinite from "swr/infinite";
5
4
  import { useMedialaneClient } from "./use-medialane-client.js";
6
5
  import { QUERY_PREFIX, queryKeys } from "./query-keys.js";
6
+ import { isNotFound } from "./not-found.js";
7
7
  const EMPTY_TOKENS = [];
8
- const INDEXING_POLL_MS = 1e4;
9
- const INDEXING_WINDOW_MS = 6e4;
10
- function isNotIndexedYet(error) {
11
- return Boolean(
12
- error && typeof error === "object" && error.status === 404
13
- );
14
- }
15
8
  function useToken(contract, tokenId, initial) {
16
9
  const client = useMedialaneClient();
17
- const [startedAt] = useState(() => Date.now());
18
10
  const { data, error, isLoading, mutate } = useSWR(
19
11
  contract && tokenId ? queryKeys.token(contract, tokenId) : null,
20
12
  () => client.api.tokens.get(contract, tokenId),
21
- {
22
- shouldRetryOnError: false,
23
- fallbackData: initial ?? void 0,
24
- refreshInterval: (latest) => latest || initial || Date.now() - startedAt > INDEXING_WINDOW_MS ? 0 : INDEXING_POLL_MS
25
- }
13
+ { fallbackData: initial ?? void 0, shouldRetryOnError: (err) => !isNotFound(err) }
26
14
  );
27
15
  const token = data ?? null;
28
- const withinWindow = Date.now() - startedAt <= INDEXING_WINDOW_MS;
16
+ const notFound = !token && isNotFound(error);
29
17
  return {
30
18
  token,
31
- isLoading: isLoading && !token,
32
- isIndexing: !token && isNotIndexedYet(error) && withinWindow,
33
- error: isNotIndexedYet(error) ? void 0 : error,
19
+ isLoading: !token && !notFound && (isLoading || !!error),
20
+ notFound,
21
+ error: notFound ? void 0 : error,
34
22
  mutate
35
23
  };
36
24
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/use-tokens.ts"],"sourcesContent":["\"use client\";\n\nimport { useState } from \"react\";\nimport useSWR from \"swr\";\nimport useSWRInfinite from \"swr/infinite\";\nimport type { ApiToken } from \"@medialane/sdk\";\nimport { useMedialaneClient } from \"./use-medialane-client.js\";\nimport { QUERY_PREFIX, queryKeys } from \"./query-keys.js\";\n\nconst EMPTY_TOKENS: ApiToken[] = [];\n\nconst INDEXING_POLL_MS = 10_000;\nconst INDEXING_WINDOW_MS = 60_000;\n\nfunction isNotIndexedYet(error: unknown): boolean {\n return Boolean(\n error && typeof error === \"object\" && (error as { status?: unknown }).status === 404,\n );\n}\n\nexport function useToken( contract: string | null, tokenId: string | null, initial?: ApiToken | null) {\n const client = useMedialaneClient();\n const [startedAt] = useState(() => Date.now());\n\n const { data, error, isLoading, mutate } = useSWR(\n contract && tokenId ? queryKeys.token(contract, tokenId) : null,\n () => client.api.tokens.get(contract!, tokenId!),\n {\n shouldRetryOnError: false,\n fallbackData: initial ?? undefined,\n refreshInterval: (latest) =>\n latest || initial || Date.now() - startedAt > INDEXING_WINDOW_MS ? 0 : INDEXING_POLL_MS,\n }\n );\n\n const token = data ?? null;\n const withinWindow = Date.now() - startedAt <= INDEXING_WINDOW_MS;\n\n return {\n token,\n isLoading: isLoading && !token,\n isIndexing: !token && isNotIndexedYet(error) && withinWindow,\n error: isNotIndexedYet(error) ? undefined : error,\n mutate,\n };\n}\n\nexport function useTokenBalance(\n contract: string | null,\n tokenId: string | null,\n owner: string | null | undefined,\n) {\n const client = useMedialaneClient();\n\n const { data, mutate } = useSWR(\n contract && tokenId && owner ? queryKeys.tokenBalance(contract, tokenId, owner) : null,\n () => client.api.tokens.balance(contract!, tokenId!, owner!)\n );\n\n return { amount: data?.amount ?? null, mutate };\n}\n\nexport function useTokensByOwner(\n address: string | null,\n page = 1,\n limit = 20,\n) {\n const client = useMedialaneClient();\n\n const { data, error, isLoading, mutate } = useSWR(\n address ? queryKeys.tokensOwned(address, page, limit) : null,\n () => client.api.tokens.ownedBy(address!, { page: page, limit: limit }),\n { revalidateOnMount: true }\n );\n\n return {\n tokens: data?.data ?? EMPTY_TOKENS,\n meta: data?.meta,\n isLoading,\n error,\n mutate,\n };\n}\n\nexport function useOwnedTokens(address: string | null, limit = 20) {\n const client = useMedialaneClient();\n\n const { data, error, isLoading, isValidating, setSize, mutate } = useSWRInfinite(\n (index) => (address ? ([QUERY_PREFIX.tokensOwnedPages, address, limit, index + 1] as const) : null),\n ([, owner, pageSize, page]) => client.api.tokens.ownedBy(owner, { page, limit: pageSize }),\n { revalidateFirstPage: false },\n );\n\n const tokens = data ? data.flatMap((page) => page.data) : EMPTY_TOKENS;\n const total = data?.[0]?.meta?.total ?? null;\n\n return {\n tokens,\n total,\n isLoading,\n isLoadingMore: isValidating,\n hasMore: total !== null && tokens.length < total,\n loadMore: () => void setSize((size) => size + 1),\n error,\n mutate,\n };\n}\n\nexport function useTokenHistory( contract: string | null, tokenId: string | null) {\n const client = useMedialaneClient();\n\n const { data, error, isLoading } = useSWR(\n contract && tokenId ? queryKeys.tokenHistory(contract, tokenId) : null,\n () => client.api.tokens.history(contract!, tokenId!)\n );\n\n return { history: data?.data ?? [], isLoading, error };\n}\n\n"],"mappings":";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,IAAI;AAAA,IACjC,YAAY,UAAU,UAAU,aAAa,UAAU,OAAO,IAAI;AAAA,IAClE,MAAM,OAAO,IAAI,OAAO,QAAQ,UAAW,OAAQ;AAAA,EACrD;AAEA,SAAO,EAAE,SAAS,MAAM,QAAQ,CAAC,GAAG,WAAW,MAAM;AACvD;","names":[]}
1
+ {"version":3,"sources":["../../src/utils/use-tokens.ts"],"sourcesContent":["\"use client\";\n\nimport useSWR from \"swr\";\nimport useSWRInfinite from \"swr/infinite\";\nimport type { ApiToken } from \"@medialane/sdk\";\nimport { useMedialaneClient } from \"./use-medialane-client.js\";\nimport { QUERY_PREFIX, queryKeys } from \"./query-keys.js\";\nimport { isNotFound } from \"./not-found.js\";\n\nconst EMPTY_TOKENS: ApiToken[] = [];\n\nexport function useToken( contract: string | null, tokenId: string | null, initial?: ApiToken | null) {\n const client = useMedialaneClient();\n\n const { data, error, isLoading, mutate } = useSWR(\n contract && tokenId ? queryKeys.token(contract, tokenId) : null,\n () => client.api.tokens.get(contract!, tokenId!),\n { fallbackData: initial ?? undefined, shouldRetryOnError: (err) => !isNotFound(err) }\n );\n\n const token = data ?? null;\n const notFound = !token && isNotFound(error);\n\n return {\n token,\n isLoading: !token && !notFound && (isLoading || !!error),\n notFound,\n error: notFound ? undefined : error,\n mutate,\n };\n}\n\nexport function useTokenBalance(\n contract: string | null,\n tokenId: string | null,\n owner: string | null | undefined,\n) {\n const client = useMedialaneClient();\n\n const { data, mutate } = useSWR(\n contract && tokenId && owner ? queryKeys.tokenBalance(contract, tokenId, owner) : null,\n () => client.api.tokens.balance(contract!, tokenId!, owner!)\n );\n\n return { amount: data?.amount ?? null, mutate };\n}\n\nexport function useTokensByOwner(\n address: string | null,\n page = 1,\n limit = 20,\n) {\n const client = useMedialaneClient();\n\n const { data, error, isLoading, mutate } = useSWR(\n address ? queryKeys.tokensOwned(address, page, limit) : null,\n () => client.api.tokens.ownedBy(address!, { page: page, limit: limit }),\n { revalidateOnMount: true }\n );\n\n return {\n tokens: data?.data ?? EMPTY_TOKENS,\n meta: data?.meta,\n isLoading,\n error,\n mutate,\n };\n}\n\nexport function useOwnedTokens(address: string | null, limit = 20) {\n const client = useMedialaneClient();\n\n const { data, error, isLoading, isValidating, setSize, mutate } = useSWRInfinite(\n (index) => (address ? ([QUERY_PREFIX.tokensOwnedPages, address, limit, index + 1] as const) : null),\n ([, owner, pageSize, page]) => client.api.tokens.ownedBy(owner, { page, limit: pageSize }),\n { revalidateFirstPage: false },\n );\n\n const tokens = data ? data.flatMap((page) => page.data) : EMPTY_TOKENS;\n const total = data?.[0]?.meta?.total ?? null;\n\n return {\n tokens,\n total,\n isLoading,\n isLoadingMore: isValidating,\n hasMore: total !== null && tokens.length < total,\n loadMore: () => void setSize((size) => size + 1),\n error,\n mutate,\n };\n}\n\nexport function useTokenHistory( contract: string | null, tokenId: string | null) {\n const client = useMedialaneClient();\n\n const { data, error, isLoading } = useSWR(\n contract && tokenId ? queryKeys.tokenHistory(contract, tokenId) : null,\n () => client.api.tokens.history(contract!, tokenId!)\n );\n\n return { history: data?.data ?? [], isLoading, error };\n}\n\n"],"mappings":";AAEA,OAAO,YAAY;AACnB,OAAO,oBAAoB;AAE3B,SAAS,0BAA0B;AACnC,SAAS,cAAc,iBAAiB;AACxC,SAAS,kBAAkB;AAE3B,MAAM,eAA2B,CAAC;AAE3B,SAAS,SAAU,UAAyB,SAAwB,SAA2B;AACpG,QAAM,SAAS,mBAAmB;AAElC,QAAM,EAAE,MAAM,OAAO,WAAW,OAAO,IAAI;AAAA,IACzC,YAAY,UAAU,UAAU,MAAM,UAAU,OAAO,IAAI;AAAA,IAC3D,MAAM,OAAO,IAAI,OAAO,IAAI,UAAW,OAAQ;AAAA,IAC/C,EAAE,cAAc,WAAW,QAAW,oBAAoB,CAAC,QAAQ,CAAC,WAAW,GAAG,EAAE;AAAA,EACtF;AAEA,QAAM,QAAQ,QAAQ;AACtB,QAAM,WAAW,CAAC,SAAS,WAAW,KAAK;AAE3C,SAAO;A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KAAK,QAAQ,CAAC,SAAS,KAAK,IAAI,IAAI;AAC1D,QAAM,QAAQ,OAAO,CAAC,GAAG,MAAM,SAAS;AAExC,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA,eAAe;AAAA,IACf,SAAS,UAAU,QAAQ,OAAO,SAAS;AAAA,IAC3C,UAAU,MAAM,KAAK,QAAQ,CAAC,SAAS,OAAO,CAAC;AAAA,IAC/C;AAAA,IACA;AAAA,EACF;AACF;AAEO,SAAS,gBAAiB,UAAyB,SAAwB;AAChF,QAAM,SAAS,mBAAmB;AAElC,QAAM,EAAE,MAAM,OAAO,UAAU,IAAI;AAAA,IACjC,YAAY,UAAU,UAAU,aAAa,UAAU,OAAO,IAAI;AAAA,IAClE,MAAM,OAAO,IAAI,OAAO,QAAQ,UAAW,OAAQ;AAAA,EACrD;AAEA,SAAO,EAAE,SAAS,MAAM,QAAQ,CAAC,GAAG,WAAW,MAAM;AACvD;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medialane/ui",
3
- "version": "0.411.1",
3
+ "version": "0.413.0",
4
4
  "description": "Shared UI components for Medialane apps",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -62,7 +62,7 @@
62
62
  "preview": "vite --config preview/vite.config.ts"
63
63
  },
64
64
  "peerDependencies": {
65
- "@medialane/sdk": ">=0.237.0 <1.0.0",
65
+ "@medialane/sdk": ">=0.246.0 <1.0.0",
66
66
  "@radix-ui/react-checkbox": ">=1.1.0",
67
67
  "@radix-ui/react-collapsible": ">=1.1.0",
68
68
  "@radix-ui/react-dialog": ">=1.1.0",
@@ -98,7 +98,7 @@
98
98
  "devDependencies": {
99
99
  "@happy-dom/global-registrator": "^20.14.5",
100
100
  "@hookform/resolvers": "^5.9.2",
101
- "@medialane/sdk": "0.245.0",
101
+ "@medialane/sdk": "0.247.0",
102
102
  "@radix-ui/react-checkbox": "^1.3.8",
103
103
  "@radix-ui/react-collapsible": "^1.1.17",
104
104
  "@radix-ui/react-dialog": "^1.1.20",
@@ -1,210 +0,0 @@
1
- "use strict";
2
- "use client";
3
- var __create = Object.create;
4
- var __defProp = Object.defineProperty;
5
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getProtoOf = Object.getPrototypeOf;
8
- var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __export = (target, all) => {
10
- for (var name in all)
11
- __defProp(target, name, { get: all[name], enumerable: true });
12
- };
13
- var __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from === "object" || typeof from === "function") {
15
- for (let key of __getOwnPropNames(from))
16
- if (!__hasOwnProp.call(to, key) && key !== except)
17
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
- }
19
- return to;
20
- };
21
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
- // If the importer is in node compatibility mode or this is not an ESM
23
- // file that has been converted to a CommonJS file using a Babel-
24
- // compatible transform (i.e. "__esModule" has not been set), then set
25
- // "default" to the CommonJS "module.exports" for node compatibility.
26
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
- mod
28
- ));
29
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
- var claim_collection_panel_exports = {};
31
- __export(claim_collection_panel_exports, {
32
- ClaimCollectionPanel: () => ClaimCollectionPanel
33
- });
34
- module.exports = __toCommonJS(claim_collection_panel_exports);
35
- var import_jsx_runtime = require("react/jsx-runtime");
36
- var import_react = require("react");
37
- var import_link = __toESM(require("../link.js"), 1);
38
- var import_medialane_app = require("../medialane-app.js");
39
- var import_describe_error = require("../../utils/describe-error.js");
40
- var import_button = require("../button.js");
41
- var import_input = require("../input.js");
42
- var import_label = require("../label.js");
43
- var import_textarea = require("../textarea.js");
44
- var import_lucide_react = require("lucide-react");
45
- var import_i18n = require("../../i18n/index.js");
46
- const isValidAddress = (a) => /^0x[0-9a-fA-F]{40,64}$/.test(a.trim());
47
- const DEFAULT_HELPER_TEXT = (0, import_i18n.msg)("Paste a collection or coin contract address.");
48
- function ClaimCollectionPanel({
49
- helperText,
50
- kind = "collection"
51
- } = {}) {
52
- const t = (0, import_i18n.useT)();
53
- const { walletAddress, getClient, ensureSignedIn, onRequireWallet, connectLabel } = (0, import_medialane_app.useMedialaneApp)();
54
- const [contractAddress, setContractAddress] = (0, import_react.useState)("");
55
- const [email, setEmail] = (0, import_react.useState)("");
56
- const [notes, setNotes] = (0, import_react.useState)("");
57
- const [step, setStep] = (0, import_react.useState)("input");
58
- const [panelError, setPanelError] = (0, import_react.useState)(null);
59
- const [verifyError, setVerifyError] = (0, import_react.useState)("");
60
- const [claimedCollection, setClaimedCollection] = (0, import_react.useState)(null);
61
- async function handleAutoClaim() {
62
- if (!contractAddress.trim() || !walletAddress) {
63
- setPanelError(t("Secure the account first."));
64
- return;
65
- }
66
- setPanelError(null);
67
- setStep("verifying");
68
- try {
69
- await ensureSignedIn?.();
70
- const api = getClient().api;
71
- const result = kind === "coin" ? await api.coins.claim(contractAddress.trim()) : await api.collections.claim(contractAddress.trim(), walletAddress);
72
- if (result.verified) {
73
- const claimed = kind === "coin" ? result.coin : result.collection;
74
- setClaimedCollection(claimed ?? { contractAddress: contractAddress.trim() });
75
- setStep("success");
76
- } else {
77
- setVerifyError("reason" in result && result.reason || "Could not verify onchain ownership");
78
- setStep("manual");
79
- }
80
- } catch (err) {
81
- setVerifyError((0, import_describe_error.describeError)(err).message);
82
- setStep("manual");
83
- }
84
- }
85
- async function handleManualRequest() {
86
- if (!email.trim()) {
87
- setPanelError(t("Add an email for the reply."));
88
- return;
89
- }
90
- setPanelError(null);
91
- try {
92
- await getClient().api.collections.requestClaim({
93
- contractAddress: contractAddress.trim(),
94
- walletAddress: walletAddress ?? void 0,
95
- email: email.trim(),
96
- notes: notes.trim() || void 0
97
- });
98
- setStep("pending");
99
- } catch (err) {
100
- console.error("collection claim request failed", err);
101
- setPanelError(t("Try sending again."));
102
- }
103
- }
104
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-6 max-w-lg", children: [
105
- step === "success" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "rounded-xl border border-green-500/40 bg-green-500/5 p-5 space-y-4", children: [
106
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
107
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "font-semibold text-foreground", children: t("Collection claimed successfully") }),
108
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm text-muted-foreground mt-0.5", children: t("Your collection is verified and added to your portfolio.") })
109
- ] }),
110
- claimedCollection && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "rounded-lg bg-muted/50 px-3 py-2", children: [
111
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm font-medium", children: claimedCollection.name ?? t("Collection") }),
112
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-xs text-muted-foreground tabular-nums mt-0.5 truncate", children: claimedCollection.contractAddress })
113
- ] }),
114
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex gap-3", children: [
115
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_button.Button, { asChild: true, size: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_link.default, { href: "/portfolio/collections", children: t("View in portfolio") }) }),
116
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
117
- import_button.Button,
118
- {
119
- size: "sm",
120
- variant: "soft",
121
- onClick: () => {
122
- setContractAddress("");
123
- setClaimedCollection(null);
124
- setStep("input");
125
- },
126
- children: t("Claim another")
127
- }
128
- )
129
- ] })
130
- ] }),
131
- step === "pending" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "rounded-xl border border-border bg-muted/30 p-5 space-y-2", children: [
132
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "font-semibold text-foreground", children: t("Claim under review") }),
133
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm text-muted-foreground", children: t("Updates go to {email}.", { email }) })
134
- ] }),
135
- (step === "input" || step === "verifying") && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-4", children: [
136
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-1.5", children: [
137
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_label.Label, { htmlFor: "contract", children: t("Contract address") }),
138
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
139
- import_input.Input,
140
- {
141
- id: "contract",
142
- placeholder: "0x\u2026",
143
- value: contractAddress,
144
- onChange: (e) => setContractAddress(e.target.value),
145
- disabled: step === "verifying",
146
- "aria-invalid": contractAddress.trim() !== "" && !isValidAddress(contractAddress)
147
- }
148
- ),
149
- contractAddress.trim() !== "" && !isValidAddress(contractAddress) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-xs text-destructive", children: t("Starknet addresses start with 0x.") }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-xs text-muted-foreground", children: helperText ?? t(DEFAULT_HELPER_TEXT) })
150
- ] }),
151
- panelError && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { role: "alert", className: "text-sm text-destructive", children: panelError }),
152
- !walletAddress ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_button.Button, { onClick: onRequireWallet, className: "w-full", children: connectLabel ?? t("Connect") }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
153
- import_button.Button,
154
- {
155
- onClick: handleAutoClaim,
156
- disabled: step === "verifying" || !isValidAddress(contractAddress),
157
- className: "w-full",
158
- children: step === "verifying" ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
159
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Loader2, { className: "mr-2 h-4 w-4 animate-spin" }),
160
- t("Verifying\u2026")
161
- ] }) : t("Verify & claim")
162
- }
163
- )
164
- ] }),
165
- step === "manual" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-5", children: [
166
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "rounded-xl border border-border bg-muted/30 p-4 space-y-1", children: [
167
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm font-medium text-foreground", children: t("Manual verification required") }),
168
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-xs text-muted-foreground", children: verifyError })
169
- ] }),
170
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-4", children: [
171
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-1.5", children: [
172
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_label.Label, { htmlFor: "email", children: t("Your email *") }),
173
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
174
- import_input.Input,
175
- {
176
- id: "email",
177
- type: "email",
178
- value: email,
179
- onChange: (e) => setEmail(e.target.value),
180
- placeholder: t("you@example.com")
181
- }
182
- )
183
- ] }),
184
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-1.5", children: [
185
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_label.Label, { htmlFor: "notes", children: t("Tell us about your connection to this collection") }),
186
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
187
- import_textarea.Textarea,
188
- {
189
- id: "notes",
190
- value: notes,
191
- onChange: (e) => setNotes(e.target.value),
192
- rows: 3,
193
- placeholder: t("Details for the review")
194
- }
195
- )
196
- ] }),
197
- panelError && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { role: "alert", className: "text-sm text-destructive", children: panelError }),
198
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex gap-3", children: [
199
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_button.Button, { onClick: handleManualRequest, className: "flex-1", children: t("Submit request") }),
200
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_button.Button, { variant: "soft", onClick: () => setStep("input"), children: t("Back") })
201
- ] })
202
- ] })
203
- ] })
204
- ] });
205
- }
206
- // Annotate the CommonJS export names for ESM import in node:
207
- 0 && (module.exports = {
208
- ClaimCollectionPanel
209
- });
210
- //# sourceMappingURL=claim-collection-panel.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/components/claim/claim-collection-panel.tsx"],"sourcesContent":["\"use client\";\n\nimport { useState } from \"react\";\nimport Link from \"../link.js\";\nimport { useMedialaneApp } from \"../medialane-app.js\";\nimport { describeError } from \"../../utils/describe-error.js\";\nimport { Button } from \"../button.js\";\nimport { Input } from \"../input.js\";\nimport { Label } from \"../label.js\";\nimport { Textarea } from \"../textarea.js\";\nimport { Loader2 } from \"lucide-react\";\nimport { msg, useT } from \"../../i18n/index.js\";\n\ntype Step = \"input\" | \"verifying\" | \"success\" | \"manual\" | \"pending\";\n\nconst isValidAddress = (a: string) => /^0x[0-9a-fA-F]{40,64}$/.test(a.trim());\n\nconst DEFAULT_HELPER_TEXT = msg(\"Paste a collection or coin contract address.\");\n\nexport function ClaimCollectionPanel({\n helperText,\n kind = \"collection\",\n}: { helperText?: React.ReactNode; kind?: \"collection\" | \"coin\" } = {}) {\n const t = useT();\n const { walletAddress, getClient, ensureSignedIn, onRequireWallet, connectLabel } = useMedialaneApp();\n const [contractAddress, setContractAddress] = useState(\"\");\n const [email, setEmail] = useState(\"\");\n const [notes, setNotes] = useState(\"\");\n const [step, setStep] = useState<Step>(\"input\");\n const [panelError, setPanelError] = useState<string | null>(null);\n const [verifyError, setVerifyError] = useState(\"\");\n const [claimedCollection, setClaimedCollection] = useState<{\n contractAddress: string;\n name?: string | null;\n } | null>(null);\n\n async function handleAutoClaim() {\n if (!contractAddress.trim() || !walletAddress) {\n setPanelError(t(\"Secure the account first.\"));\n return;\n }\n setPanelError(null);\n setStep(\"verifying\");\n try {\n await ensureSignedIn?.();\n const api = getClient().api;\n const result =\n kind === \"coin\"\n ? await api.coins.claim(contractAddress.trim())\n : await api.collections.claim(contractAddress.trim(), walletAddress);\n\n if (result.verified) {\n const claimed = kind === \"coin\" ? (result as { coin?: { contractAddress: string; name?: string | null } }).coin : (result as { collection?: { contractAddress: string; name?: string | null } }).collection;\n setClaimedCollection(claimed ?? { contractAddress: contractAddress.trim() });\n setStep(\"success\");\n } else {\n setVerifyError((\"reason\" in result && result.reason) || \"Could not verify onchain ownership\");\n setStep(\"manual\");\n }\n } catch (err) {\n setVerifyError(describeError(err).message);\n setStep(\"manual\");\n }\n }\n\n async function handleManualRequest() {\n if (!email.trim()) { setPanelError(t(\"Add an email for the reply.\")); return; }\n setPanelError(null);\n try {\n await getClient().api.collections.requestClaim({\n contractAddress: contractAddress.trim(),\n walletAddress: walletAddress ?? undefined,\n email: email.trim(),\n notes: notes.trim() || undefined,\n });\n setStep(\"pending\");\n } catch (err) {\n console.error(\"collection claim request failed\", err);\n setPanelError(t(\"Try sending again.\"));\n }\n }\n\n return (\n <div className=\"space-y-6 max-w-lg\">\n {step === \"success\" && (\n <div className=\"rounded-xl border border-green-500/40 bg-green-500/5 p-5 space-y-4\">\n <div>\n <p className=\"font-semibold text-foreground\">{t(\"Collection claimed successfully\")}</p>\n <p className=\"text-sm text-muted-foreground mt-0.5\">\n {t(\"Your collection is verified and added to your portfolio.\")}\n </p>\n </div>\n {claimedCollection && (\n <div className=\"rounded-lg bg-muted/50 px-3 py-2\">\n <p className=\"text-sm font-medium\">{claimedCollection.name ?? t(\"Collection\")}</p>\n <p className=\"text-xs text-muted-foreground tabular-nums mt-0.5 truncate\">\n {claimedCollection.contractAddress}\n </p>\n </div>\n )}\n <div className=\"flex gap-3\">\n <Button asChild size=\"sm\">\n <Link href=\"/portfolio/collections\">{t(\"View in portfolio\")}</Link>\n </Button>\n <Button\n size=\"sm\"\n variant=\"soft\"\n onClick={() => { setContractAddress(\"\"); setClaimedCollection(null); setStep(\"input\"); }}\n >\n {t(\"Claim another\")}\n </Button>\n </div>\n </div>\n )}\n\n {step === \"pending\" && (\n <div className=\"rounded-xl border border-border bg-muted/30 p-5 space-y-2\">\n <p className=\"font-semibold text-foreground\">{t(\"Claim under review\")}</p>\n <p className=\"text-sm text-muted-foreground\">{t(\"Updates go to {email}.\", { email })}</p>\n </div>\n )}\n\n {(step === \"input\" || step === \"verifying\") && (\n <div className=\"space-y-4\">\n <div className=\"space-y-1.5\">\n <Label htmlFor=\"contract\">{t(\"Contract address\")}</Label>\n <Input\n id=\"contract\"\n placeholder=\"0x…\"\n value={contractAddress}\n onChange={(e) => setContractAddress(e.target.value)}\n disabled={step === \"verifying\"}\n aria-invalid={contractAddress.trim() !== \"\" && !isValidAddress(contractAddress)}\n />\n {contractAddress.trim() !== \"\" && !isValidAddress(contractAddress) ? (\n <p className=\"text-xs text-destructive\">\n {t(\"Starknet addresses start with 0x.\")}\n </p>\n ) : (\n <p className=\"text-xs text-muted-foreground\">{helperText ?? t(DEFAULT_HELPER_TEXT)}</p>\n )}\n </div>\n {panelError && <p role=\"alert\" className=\"text-sm text-destructive\">{panelError}</p>}\n {!walletAddress ? (\n <Button onClick={onRequireWallet} className=\"w-full\">\n {connectLabel ?? t(\"Connect\")}\n </Button>\n ) : (\n <Button\n onClick={handleAutoClaim}\n disabled={step === \"verifying\" || !isValidAddress(contractAddress)}\n className=\"w-full\"\n >\n {step === \"verifying\"\n ? <><Loader2 className=\"mr-2 h-4 w-4 animate-spin\" />{t(\"Verifying…\")}</>\n : t(\"Verify & claim\")\n }\n </Button>\n )}\n </div>\n )}\n\n {step === \"manual\" && (\n <div className=\"space-y-5\">\n <div className=\"rounded-xl border border-border bg-muted/30 p-4 space-y-1\">\n <p className=\"text-sm font-medium text-foreground\">{t(\"Manual verification required\")}</p>\n <p className=\"text-xs text-muted-foreground\">\n {verifyError}</p>\n </div>\n <div className=\"space-y-4\">\n <div className=\"space-y-1.5\">\n <Label htmlFor=\"email\">{t(\"Your email *\")}</Label>\n <Input\n id=\"email\"\n type=\"email\"\n value={email}\n onChange={(e) => setEmail(e.target.value)}\n placeholder={t(\"you@example.com\")}\n />\n </div>\n <div className=\"space-y-1.5\">\n <Label htmlFor=\"notes\">{t(\"Tell us about your connection to this collection\")}</Label>\n <Textarea\n id=\"notes\"\n value={notes}\n onChange={(e) => setNotes(e.target.value)}\n rows={3}\n placeholder={t(\"Details for the review\")}\n />\n </div>\n {panelError && <p role=\"alert\" className=\"text-sm text-destructive\">{panelError}</p>}\n <div className=\"flex gap-3\">\n <Button onClick={handleManualRequest} className=\"flex-1\">{t(\"Submit request\")}</Button>\n <Button variant=\"soft\" onClick={() => setStep(\"input\")}>{t(\"Back\")}</Button>\n </div>\n </div>\n </div>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAsFU;AApFV,mBAAyB;AACzB,kBAAiB;AACjB,2BAAgC;AAChC,4BAA8B;AAC9B,oBAAuB;AACvB,mBAAsB;AACtB,mBAAsB;AACtB,sBAAyB;AACzB,0BAAwB;AACxB,kBAA0B;AAI1B,MAAM,iBAAiB,CAAC,MAAc,yBAAyB,KAAK,EAAE,KAAK,CAAC;AAE5E,MAAM,0BAAsB,iBAAI,8CAA8C;AAEvE,SAAS,qBAAqB;AAAA,EACnC;AAAA,EACA,OAAO;AACT,IAAoE,CAAC,GAAG;AACtE,QAAM,QAAI,kBAAK;AACf,QAAM,EAAE,eAAe,WAAW,gBAAgB,iBAAiB,aAAa,QAAI,sCAAgB;AACpG,QAAM,CAAC,iBAAiB,kBAAkB,QAAI,uBAAS,EAAE;AACzD,QAAM,CAAC,OAAO,QAAQ,QAAI,uBAAS,EAAE;AACrC,QAAM,CAAC,OAAO,QAAQ,QAAI,u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A,cACC,IAAG;AAAA,cACH,MAAK;AAAA,cACL,OAAO;AAAA,cACP,UAAU,CAAC,MAAM,SAAS,EAAE,OAAO,KAAK;AAAA,cACxC,aAAa,EAAE,iBAAiB;AAAA;AAAA,UAClC;AAAA,WACF;AAAA,QACA,6CAAC,SAAI,WAAU,eACb;AAAA,sDAAC,sBAAM,SAAQ,SAAS,YAAE,kDAAkD,GAAE;AAAA,UAC9E;AAAA,YAAC;AAAA;AAAA,cACC,IAAG;AAAA,cACH,OAAO;AAAA,cACP,UAAU,CAAC,MAAM,SAAS,EAAE,OAAO,KAAK;AAAA,cACxC,MAAM;AAAA,cACN,aAAa,EAAE,wBAAwB;AAAA;AAAA,UACzC;AAAA,WACF;AAAA,QACC,cAAc,4CAAC,OAAE,MAAK,SAAQ,WAAU,4BAA4B,sBAAW;AAAA,QAChF,6CAAC,SAAI,WAAU,cACb;AAAA,sDAAC,wBAAO,SAAS,qBAAqB,WAAU,UAAU,YAAE,gBAAgB,GAAE;AAAA,UAC9E,4CAAC,wBAAO,SAAQ,QAAO,SAAS,MAAM,QAAQ,OAAO,GAAI,YAAE,MAAM,GAAE;AAAA,WACrE;AAAA,SACF;AAAA,OACF;AAAA,KAEJ;AAEJ;","names":["Link"]}
@@ -1,8 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
-
3
- declare function ClaimCollectionPanel({ helperText, kind, }?: {
4
- helperText?: React.ReactNode;
5
- kind?: "collection" | "coin";
6
- }): react_jsx_runtime.JSX.Element;
7
-
8
- export { ClaimCollectionPanel };
@@ -1,8 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
-
3
- declare function ClaimCollectionPanel({ helperText, kind, }?: {
4
- helperText?: React.ReactNode;
5
- kind?: "collection" | "coin";
6
- }): react_jsx_runtime.JSX.Element;
7
-
8
- export { ClaimCollectionPanel };
@@ -1,176 +0,0 @@
1
- "use client";
2
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
- import { useState } from "react";
4
- import Link from "../link.js";
5
- import { useMedialaneApp } from "../medialane-app.js";
6
- import { describeError } from "../../utils/describe-error.js";
7
- import { Button } from "../button.js";
8
- import { Input } from "../input.js";
9
- import { Label } from "../label.js";
10
- import { Textarea } from "../textarea.js";
11
- import { Loader2 } from "lucide-react";
12
- import { msg, useT } from "../../i18n/index.js";
13
- const isValidAddress = (a) => /^0x[0-9a-fA-F]{40,64}$/.test(a.trim());
14
- const DEFAULT_HELPER_TEXT = msg("Paste a collection or coin contract address.");
15
- function ClaimCollectionPanel({
16
- helperText,
17
- kind = "collection"
18
- } = {}) {
19
- const t = useT();
20
- const { walletAddress, getClient, ensureSignedIn, onRequireWallet, connectLabel } = useMedialaneApp();
21
- const [contractAddress, setContractAddress] = useState("");
22
- const [email, setEmail] = useState("");
23
- const [notes, setNotes] = useState("");
24
- const [step, setStep] = useState("input");
25
- const [panelError, setPanelError] = useState(null);
26
- const [verifyError, setVerifyError] = useState("");
27
- const [claimedCollection, setClaimedCollection] = useState(null);
28
- async function handleAutoClaim() {
29
- if (!contractAddress.trim() || !walletAddress) {
30
- setPanelError(t("Secure the account first."));
31
- return;
32
- }
33
- setPanelError(null);
34
- setStep("verifying");
35
- try {
36
- await ensureSignedIn?.();
37
- const api = getClient().api;
38
- const result = kind === "coin" ? await api.coins.claim(contractAddress.trim()) : await api.collections.claim(contractAddress.trim(), walletAddress);
39
- if (result.verified) {
40
- const claimed = kind === "coin" ? result.coin : result.collection;
41
- setClaimedCollection(claimed ?? { contractAddress: contractAddress.trim() });
42
- setStep("success");
43
- } else {
44
- setVerifyError("reason" in result && result.reason || "Could not verify onchain ownership");
45
- setStep("manual");
46
- }
47
- } catch (err) {
48
- setVerifyError(describeError(err).message);
49
- setStep("manual");
50
- }
51
- }
52
- async function handleManualRequest() {
53
- if (!email.trim()) {
54
- setPanelError(t("Add an email for the reply."));
55
- return;
56
- }
57
- setPanelError(null);
58
- try {
59
- await getClient().api.collections.requestClaim({
60
- contractAddress: contractAddress.trim(),
61
- walletAddress: walletAddress ?? void 0,
62
- email: email.trim(),
63
- notes: notes.trim() || void 0
64
- });
65
- setStep("pending");
66
- } catch (err) {
67
- console.error("collection claim request failed", err);
68
- setPanelError(t("Try sending again."));
69
- }
70
- }
71
- return /* @__PURE__ */ jsxs("div", { className: "space-y-6 max-w-lg", children: [
72
- step === "success" && /* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-green-500/40 bg-green-500/5 p-5 space-y-4", children: [
73
- /* @__PURE__ */ jsxs("div", { children: [
74
- /* @__PURE__ */ jsx("p", { className: "font-semibold text-foreground", children: t("Collection claimed successfully") }),
75
- /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground mt-0.5", children: t("Your collection is verified and added to your portfolio.") })
76
- ] }),
77
- claimedCollection && /* @__PURE__ */ jsxs("div", { className: "rounded-lg bg-muted/50 px-3 py-2", children: [
78
- /* @__PURE__ */ jsx("p", { className: "text-sm font-medium", children: claimedCollection.name ?? t("Collection") }),
79
- /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground tabular-nums mt-0.5 truncate", children: claimedCollection.contractAddress })
80
- ] }),
81
- /* @__PURE__ */ jsxs("div", { className: "flex gap-3", children: [
82
- /* @__PURE__ */ jsx(Button, { asChild: true, size: "sm", children: /* @__PURE__ */ jsx(Link, { href: "/portfolio/collections", children: t("View in portfolio") }) }),
83
- /* @__PURE__ */ jsx(
84
- Button,
85
- {
86
- size: "sm",
87
- variant: "soft",
88
- onClick: () => {
89
- setContractAddress("");
90
- setClaimedCollection(null);
91
- setStep("input");
92
- },
93
- children: t("Claim another")
94
- }
95
- )
96
- ] })
97
- ] }),
98
- step === "pending" && /* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-border bg-muted/30 p-5 space-y-2", children: [
99
- /* @__PURE__ */ jsx("p", { className: "font-semibold text-foreground", children: t("Claim under review") }),
100
- /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: t("Updates go to {email}.", { email }) })
101
- ] }),
102
- (step === "input" || step === "verifying") && /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
103
- /* @__PURE__ */ jsxs("div", { className: "space-y-1.5", children: [
104
- /* @__PURE__ */ jsx(Label, { htmlFor: "contract", children: t("Contract address") }),
105
- /* @__PURE__ */ jsx(
106
- Input,
107
- {
108
- id: "contract",
109
- placeholder: "0x\u2026",
110
- value: contractAddress,
111
- onChange: (e) => setContractAddress(e.target.value),
112
- disabled: step === "verifying",
113
- "aria-invalid": contractAddress.trim() !== "" && !isValidAddress(contractAddress)
114
- }
115
- ),
116
- contractAddress.trim() !== "" && !isValidAddress(contractAddress) ? /* @__PURE__ */ jsx("p", { className: "text-xs text-destructive", children: t("Starknet addresses start with 0x.") }) : /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: helperText ?? t(DEFAULT_HELPER_TEXT) })
117
- ] }),
118
- panelError && /* @__PURE__ */ jsx("p", { role: "alert", className: "text-sm text-destructive", children: panelError }),
119
- !walletAddress ? /* @__PURE__ */ jsx(Button, { onClick: onRequireWallet, className: "w-full", children: connectLabel ?? t("Connect") }) : /* @__PURE__ */ jsx(
120
- Button,
121
- {
122
- onClick: handleAutoClaim,
123
- disabled: step === "verifying" || !isValidAddress(contractAddress),
124
- className: "w-full",
125
- children: step === "verifying" ? /* @__PURE__ */ jsxs(Fragment, { children: [
126
- /* @__PURE__ */ jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }),
127
- t("Verifying\u2026")
128
- ] }) : t("Verify & claim")
129
- }
130
- )
131
- ] }),
132
- step === "manual" && /* @__PURE__ */ jsxs("div", { className: "space-y-5", children: [
133
- /* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-border bg-muted/30 p-4 space-y-1", children: [
134
- /* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-foreground", children: t("Manual verification required") }),
135
- /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: verifyError })
136
- ] }),
137
- /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
138
- /* @__PURE__ */ jsxs("div", { className: "space-y-1.5", children: [
139
- /* @__PURE__ */ jsx(Label, { htmlFor: "email", children: t("Your email *") }),
140
- /* @__PURE__ */ jsx(
141
- Input,
142
- {
143
- id: "email",
144
- type: "email",
145
- value: email,
146
- onChange: (e) => setEmail(e.target.value),
147
- placeholder: t("you@example.com")
148
- }
149
- )
150
- ] }),
151
- /* @__PURE__ */ jsxs("div", { className: "space-y-1.5", children: [
152
- /* @__PURE__ */ jsx(Label, { htmlFor: "notes", children: t("Tell us about your connection to this collection") }),
153
- /* @__PURE__ */ jsx(
154
- Textarea,
155
- {
156
- id: "notes",
157
- value: notes,
158
- onChange: (e) => setNotes(e.target.value),
159
- rows: 3,
160
- placeholder: t("Details for the review")
161
- }
162
- )
163
- ] }),
164
- panelError && /* @__PURE__ */ jsx("p", { role: "alert", className: "text-sm text-destructive", children: panelError }),
165
- /* @__PURE__ */ jsxs("div", { className: "flex gap-3", children: [
166
- /* @__PURE__ */ jsx(Button, { onClick: handleManualRequest, className: "flex-1", children: t("Submit request") }),
167
- /* @__PURE__ */ jsx(Button, { variant: "soft", onClick: () => setStep("input"), children: t("Back") })
168
- ] })
169
- ] })
170
- ] })
171
- ] });
172
- }
173
- export {
174
- ClaimCollectionPanel
175
- };
176
- //# sourceMappingURL=claim-collection-panel.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/components/claim/claim-collection-panel.tsx"],"sourcesContent":["\"use client\";\n\nimport { useState } from \"react\";\nimport Link from \"../link.js\";\nimport { useMedialaneApp } from \"../medialane-app.js\";\nimport { describeError } from \"../../utils/describe-error.js\";\nimport { Button } from \"../button.js\";\nimport { Input } from \"../input.js\";\nimport { Label } from \"../label.js\";\nimport { Textarea } from \"../textarea.js\";\nimport { Loader2 } from \"lucide-react\";\nimport { msg, useT } from \"../../i18n/index.js\";\n\ntype Step = \"input\" | \"verifying\" | \"success\" | \"manual\" | \"pending\";\n\nconst isValidAddress = (a: string) => /^0x[0-9a-fA-F]{40,64}$/.test(a.trim());\n\nconst DEFAULT_HELPER_TEXT = msg(\"Paste a collection or coin contract address.\");\n\nexport function ClaimCollectionPanel({\n helperText,\n kind = \"collection\",\n}: { helperText?: React.ReactNode; kind?: \"collection\" | \"coin\" } = {}) {\n const t = useT();\n const { walletAddress, getClient, ensureSignedIn, onRequireWallet, connectLabel } = useMedialaneApp();\n const [contractAddress, setContractAddress] = useState(\"\");\n const [email, setEmail] = useState(\"\");\n const [notes, setNotes] = useState(\"\");\n const [step, setStep] = useState<Step>(\"input\");\n const [panelError, setPanelError] = useState<string | null>(null);\n const [verifyError, setVerifyError] = useState(\"\");\n const [claimedCollection, setClaimedCollection] = useState<{\n contractAddress: string;\n name?: string | null;\n } | null>(null);\n\n async function handleAutoClaim() {\n if (!contractAddress.trim() || !walletAddress) {\n setPanelError(t(\"Secure the account first.\"));\n return;\n }\n setPanelError(null);\n setStep(\"verifying\");\n try {\n await ensureSignedIn?.();\n const api = getClient().api;\n const result =\n kind === \"coin\"\n ? await api.coins.claim(contractAddress.trim())\n : await api.collections.claim(contractAddress.trim(), walletAddress);\n\n if (result.verified) {\n const claimed = kind === \"coin\" ? (result as { coin?: { contractAddress: string; name?: string | null } }).coin : (result as { collection?: { contractAddress: string; name?: string | null } }).collection;\n setClaimedCollection(claimed ?? { contractAddress: contractAddress.trim() });\n setStep(\"success\");\n } else {\n setVerifyError((\"reason\" in result && result.reason) || \"Could not verify onchain ownership\");\n setStep(\"manual\");\n }\n } catch (err) {\n setVerifyError(describeError(err).message);\n setStep(\"manual\");\n }\n }\n\n async function handleManualRequest() {\n if (!email.trim()) { setPanelError(t(\"Add an email for the reply.\")); return; }\n setPanelError(null);\n try {\n await getClient().api.collections.requestClaim({\n contractAddress: contractAddress.trim(),\n walletAddress: walletAddress ?? undefined,\n email: email.trim(),\n notes: notes.trim() || undefined,\n });\n setStep(\"pending\");\n } catch (err) {\n console.error(\"collection claim request failed\", err);\n setPanelError(t(\"Try sending again.\"));\n }\n }\n\n return (\n <div className=\"space-y-6 max-w-lg\">\n {step === \"success\" && (\n <div className=\"rounded-xl border border-green-500/40 bg-green-500/5 p-5 space-y-4\">\n <div>\n <p className=\"font-semibold text-foreground\">{t(\"Collection claimed successfully\")}</p>\n <p className=\"text-sm text-muted-foreground mt-0.5\">\n {t(\"Your collection is verified and added to your portfolio.\")}\n </p>\n </div>\n {claimedCollection && (\n <div className=\"rounded-lg bg-muted/50 px-3 py-2\">\n <p className=\"text-sm font-medium\">{claimedCollection.name ?? t(\"Collection\")}</p>\n <p className=\"text-xs text-muted-foreground tabular-nums mt-0.5 truncate\">\n {claimedCollection.contractAddress}\n </p>\n </div>\n )}\n <div className=\"flex gap-3\">\n <Button asChild size=\"sm\">\n <Link href=\"/portfolio/collections\">{t(\"View in portfolio\")}</Link>\n </Button>\n <Button\n size=\"sm\"\n variant=\"soft\"\n onClick={() => { setContractAddress(\"\"); setClaimedCollection(null); setStep(\"input\"); }}\n >\n {t(\"Claim another\")}\n </Button>\n </div>\n </div>\n )}\n\n {step === \"pending\" && (\n <div className=\"rounded-xl border border-border bg-muted/30 p-5 space-y-2\">\n <p className=\"font-semibold text-foreground\">{t(\"Claim under review\")}</p>\n <p className=\"text-sm text-muted-foreground\">{t(\"Updates go to {email}.\", { email })}</p>\n </div>\n )}\n\n {(step === \"input\" || step === \"verifying\") && (\n <div className=\"space-y-4\">\n <div className=\"space-y-1.5\">\n <Label htmlFor=\"contract\">{t(\"Contract address\")}</Label>\n <Input\n id=\"contract\"\n placeholder=\"0x…\"\n value={contractAddress}\n onChange={(e) => setContractAddress(e.target.value)}\n disabled={step === \"verifying\"}\n aria-invalid={contractAddress.trim() !== \"\" && !isValidAddress(contractAddress)}\n />\n {contractAddress.trim() !== \"\" && !isValidAddress(contractAddress) ? (\n <p className=\"text-xs text-destructive\">\n {t(\"Starknet addresses start with 0x.\")}\n </p>\n ) : (\n <p className=\"text-xs text-muted-foreground\">{helperText ?? t(DEFAULT_HELPER_TEXT)}</p>\n )}\n </div>\n {panelError && <p role=\"alert\" className=\"text-sm text-destructive\">{panelError}</p>}\n {!walletAddress ? (\n <Button onClick={onRequireWallet} className=\"w-full\">\n {connectLabel ?? t(\"Connect\")}\n </Button>\n ) : (\n <Button\n onClick={handleAutoClaim}\n disabled={step === \"verifying\" || !isValidAddress(contractAddress)}\n className=\"w-full\"\n >\n {step === \"verifying\"\n ? <><Loader2 className=\"mr-2 h-4 w-4 animate-spin\" />{t(\"Verifying…\")}</>\n : t(\"Verify & claim\")\n }\n </Button>\n )}\n </div>\n )}\n\n {step === \"manual\" && (\n <div className=\"space-y-5\">\n <div className=\"rounded-xl border border-border bg-muted/30 p-4 space-y-1\">\n <p className=\"text-sm font-medium text-foreground\">{t(\"Manual verification required\")}</p>\n <p className=\"text-xs text-muted-foreground\">\n {verifyError}</p>\n </div>\n <div className=\"space-y-4\">\n <div className=\"space-y-1.5\">\n <Label htmlFor=\"email\">{t(\"Your email *\")}</Label>\n <Input\n id=\"email\"\n type=\"email\"\n value={email}\n onChange={(e) => setEmail(e.target.value)}\n placeholder={t(\"you@example.com\")}\n />\n </div>\n <div className=\"space-y-1.5\">\n <Label htmlFor=\"notes\">{t(\"Tell us about your connection to this collection\")}</Label>\n <Textarea\n id=\"notes\"\n value={notes}\n onChange={(e) => setNotes(e.target.value)}\n rows={3}\n placeholder={t(\"Details for the review\")}\n />\n </div>\n {panelError && <p role=\"alert\" className=\"text-sm text-destructive\">{panelError}</p>}\n <div className=\"flex gap-3\">\n <Button onClick={handleManualRequest} className=\"flex-1\">{t(\"Submit request\")}</Button>\n <Button variant=\"soft\" onClick={() => setStep(\"input\")}>{t(\"Back\")}</Button>\n </div>\n </div>\n </div>\n )}\n </div>\n );\n}\n"],"mappings":";AAsFU,SAoEQ,UAnEN,KADF;AApFV,SAAS,gBAAgB;AACzB,OAAO,UAAU;AACjB,SAAS,uBAAuB;AAChC,SAAS,qBAAqB;AAC9B,SAAS,cAAc;AACvB,SAAS,aAAa;AACtB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