@medialane/ui 0.231.0 → 0.233.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/claim-route-shell.cjs +35 -0
  2. package/dist/components/claim-route-shell.cjs.map +1 -0
  3. package/dist/components/claim-route-shell.d.cts +7 -0
  4. package/dist/components/claim-route-shell.d.ts +7 -0
  5. package/dist/components/claim-route-shell.js +11 -0
  6. package/dist/components/claim-route-shell.js.map +1 -0
  7. package/dist/components/medialane-app.cjs.map +1 -1
  8. package/dist/components/medialane-app.d.cts +1 -0
  9. package/dist/components/medialane-app.d.ts +1 -0
  10. package/dist/components/medialane-app.js.map +1 -1
  11. package/dist/components/rewards/reward-earned.cjs +38 -34
  12. package/dist/components/rewards/reward-earned.cjs.map +1 -1
  13. package/dist/components/rewards/reward-earned.d.cts +2 -3
  14. package/dist/components/rewards/reward-earned.d.ts +2 -3
  15. package/dist/components/rewards/reward-earned.js +37 -33
  16. package/dist/components/rewards/reward-earned.js.map +1 -1
  17. package/dist/components/transaction-dialog.cjs +90 -0
  18. package/dist/components/transaction-dialog.cjs.map +1 -0
  19. package/dist/components/transaction-dialog.d.cts +18 -0
  20. package/dist/components/transaction-dialog.d.ts +18 -0
  21. package/dist/components/transaction-dialog.js +66 -0
  22. package/dist/components/transaction-dialog.js.map +1 -0
  23. package/dist/components/wallet-required.cjs +62 -0
  24. package/dist/components/wallet-required.cjs.map +1 -0
  25. package/dist/components/wallet-required.d.cts +13 -0
  26. package/dist/components/wallet-required.d.ts +13 -0
  27. package/dist/components/wallet-required.js +38 -0
  28. package/dist/components/wallet-required.js.map +1 -0
  29. package/dist/index.cjs +20 -2
  30. package/dist/index.cjs.map +1 -1
  31. package/dist/index.d.cts +7 -1
  32. package/dist/index.d.ts +7 -1
  33. package/dist/index.js +14 -2
  34. package/dist/index.js.map +1 -1
  35. package/dist/utils/portfolio-cache.cjs +34 -0
  36. package/dist/utils/portfolio-cache.cjs.map +1 -0
  37. package/dist/utils/portfolio-cache.d.cts +3 -0
  38. package/dist/utils/portfolio-cache.d.ts +3 -0
  39. package/dist/utils/portfolio-cache.js +10 -0
  40. package/dist/utils/portfolio-cache.js.map +1 -0
  41. package/dist/utils/use-launchpad-image-upload.cjs +103 -0
  42. package/dist/utils/use-launchpad-image-upload.cjs.map +1 -0
  43. package/dist/utils/use-launchpad-image-upload.d.cts +21 -0
  44. package/dist/utils/use-launchpad-image-upload.d.ts +21 -0
  45. package/dist/utils/use-launchpad-image-upload.js +79 -0
  46. package/dist/utils/use-launchpad-image-upload.js.map +1 -0
  47. package/dist/utils/use-transaction.cjs +84 -0
  48. package/dist/utils/use-transaction.cjs.map +1 -0
  49. package/dist/utils/use-transaction.d.cts +17 -0
  50. package/dist/utils/use-transaction.d.ts +17 -0
  51. package/dist/utils/use-transaction.js +60 -0
  52. package/dist/utils/use-transaction.js.map +1 -0
  53. package/package.json +3 -3
@@ -0,0 +1,84 @@
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_transaction_exports = {};
21
+ __export(use_transaction_exports, {
22
+ useTransaction: () => useTransaction
23
+ });
24
+ module.exports = __toCommonJS(use_transaction_exports);
25
+ var import_react = require("react");
26
+ var import_starknet = require("@medialane/sdk/starknet");
27
+ var import_medialane_app = require("../components/medialane-app.js");
28
+ var import_describe_error = require("./describe-error.js");
29
+ function useTransaction() {
30
+ const app = (0, import_medialane_app.useMedialaneApp)();
31
+ const [phase, setPhase] = (0, import_react.useState)("idle");
32
+ const [txHash, setTxHash] = (0, import_react.useState)(null);
33
+ const [receipt, setReceipt] = (0, import_react.useState)(null);
34
+ const [error, setError] = (0, import_react.useState)(null);
35
+ const run = (0, import_react.useCallback)(
36
+ async (work) => {
37
+ setPhase("preparing");
38
+ setTxHash(null);
39
+ setReceipt(null);
40
+ setError(null);
41
+ try {
42
+ const signer = await app.getSigner();
43
+ let hash = null;
44
+ const tracked = {
45
+ address: signer.address,
46
+ signTypedData: (data) => signer.signTypedData(data),
47
+ execute: async (calls, opts) => {
48
+ setPhase("submitting");
49
+ const result = await signer.execute(calls, opts);
50
+ hash = result.txHash;
51
+ setTxHash(result.txHash);
52
+ setPhase("confirming");
53
+ return result;
54
+ }
55
+ };
56
+ await work(tracked);
57
+ if (hash) {
58
+ const client = app.getClient();
59
+ setReceipt(await (0, import_starknet.assertTransactionSucceeded)(client.provider, hash));
60
+ await (0, import_starknet.syncTransactionBestEffort)(client, hash);
61
+ }
62
+ setPhase("success");
63
+ } catch (err) {
64
+ setError((0, import_describe_error.describeError)(err, "We couldn't complete that. Please try again.").message);
65
+ setPhase("error");
66
+ } finally {
67
+ app.releaseSigner?.();
68
+ }
69
+ },
70
+ [app]
71
+ );
72
+ const reset = (0, import_react.useCallback)(() => {
73
+ setPhase("idle");
74
+ setTxHash(null);
75
+ setReceipt(null);
76
+ setError(null);
77
+ }, []);
78
+ return { phase, txHash, receipt, error, run, reset };
79
+ }
80
+ // Annotate the CommonJS export names for ESM import in node:
81
+ 0 && (module.exports = {
82
+ useTransaction
83
+ });
84
+ //# sourceMappingURL=use-transaction.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utils/use-transaction.ts"],"sourcesContent":["\"use client\";\n\nimport { useCallback, useState } from \"react\";\nimport { assertTransactionSucceeded, syncTransactionBestEffort, type ReceiptLike } from \"@medialane/sdk/starknet\";\nimport { useMedialaneApp } from \"../components/medialane-app.js\";\nimport type { FastMintSigner } from \"../components/fast-mint/types.js\";\nimport { describeError } from \"./describe-error.js\";\n\nexport type TransactionPhase = \"idle\" | \"preparing\" | \"submitting\" | \"confirming\" | \"success\" | \"error\";\n\nexport function useTransaction() {\n const app = useMedialaneApp();\n const [phase, setPhase] = useState<TransactionPhase>(\"idle\");\n const [txHash, setTxHash] = useState<string | null>(null);\n const [receipt, setReceipt] = useState<ReceiptLike | null>(null);\n const [error, setError] = useState<string | null>(null);\n\n const run = useCallback(\n async (work: (signer: FastMintSigner) => Promise<void>) => {\n setPhase(\"preparing\");\n setTxHash(null);\n setReceipt(null);\n setError(null);\n try {\n const signer = await app.getSigner();\n let hash: string | null = null;\n const tracked: FastMintSigner = {\n address: signer.address,\n signTypedData: (data) => signer.signTypedData(data),\n execute: async (calls, opts) => {\n setPhase(\"submitting\");\n const result = await signer.execute(calls, opts);\n hash = result.txHash;\n setTxHash(result.txHash);\n setPhase(\"confirming\");\n return result;\n },\n };\n await work(tracked);\n if (hash) {\n const client = app.getClient();\n setReceipt(await assertTransactionSucceeded(client.provider, hash));\n await syncTransactionBestEffort(client, hash);\n }\n setPhase(\"success\");\n } catch (err) {\n setError(describeError(err, \"We couldn't complete that. Please try again.\").message);\n setPhase(\"error\");\n } finally {\n app.releaseSigner?.();\n }\n },\n [app],\n );\n\n const reset = useCallback(() => {\n setPhase(\"idle\");\n setTxHash(null);\n setReceipt(null);\n setError(null);\n }, []);\n\n return { phase, txHash, receipt, error, run, reset };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAAsC;AACtC,sBAAwF;AACxF,2BAAgC;AAEhC,4BAA8B;AAIvB,SAAS,iBAAiB;AAC/B,QAAM,UAAM,sCAAgB;A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AAO,KAAK,MAAM;AACrD;","names":[]}
@@ -0,0 +1,17 @@
1
+ import { ReceiptLike } from '@medialane/sdk/starknet';
2
+ import { FastMintSigner } from '../components/fast-mint/types.cjs';
3
+ import 'react';
4
+ import 'starknet';
5
+ import '@medialane/sdk';
6
+
7
+ type TransactionPhase = "idle" | "preparing" | "submitting" | "confirming" | "success" | "error";
8
+ declare function useTransaction(): {
9
+ phase: TransactionPhase;
10
+ txHash: string | null;
11
+ receipt: ReceiptLike | null;
12
+ error: string | null;
13
+ run: (work: (signer: FastMintSigner) => Promise<void>) => Promise<void>;
14
+ reset: () => void;
15
+ };
16
+
17
+ export { type TransactionPhase, useTransaction };
@@ -0,0 +1,17 @@
1
+ import { ReceiptLike } from '@medialane/sdk/starknet';
2
+ import { FastMintSigner } from '../components/fast-mint/types.js';
3
+ import 'react';
4
+ import 'starknet';
5
+ import '@medialane/sdk';
6
+
7
+ type TransactionPhase = "idle" | "preparing" | "submitting" | "confirming" | "success" | "error";
8
+ declare function useTransaction(): {
9
+ phase: TransactionPhase;
10
+ txHash: string | null;
11
+ receipt: ReceiptLike | null;
12
+ error: string | null;
13
+ run: (work: (signer: FastMintSigner) => Promise<void>) => Promise<void>;
14
+ reset: () => void;
15
+ };
16
+
17
+ export { type TransactionPhase, useTransaction };
@@ -0,0 +1,60 @@
1
+ "use client";
2
+ import { useCallback, useState } from "react";
3
+ import { assertTransactionSucceeded, syncTransactionBestEffort } from "@medialane/sdk/starknet";
4
+ import { useMedialaneApp } from "../components/medialane-app.js";
5
+ import { describeError } from "./describe-error.js";
6
+ function useTransaction() {
7
+ const app = useMedialaneApp();
8
+ const [phase, setPhase] = useState("idle");
9
+ const [txHash, setTxHash] = useState(null);
10
+ const [receipt, setReceipt] = useState(null);
11
+ const [error, setError] = useState(null);
12
+ const run = useCallback(
13
+ async (work) => {
14
+ setPhase("preparing");
15
+ setTxHash(null);
16
+ setReceipt(null);
17
+ setError(null);
18
+ try {
19
+ const signer = await app.getSigner();
20
+ let hash = null;
21
+ const tracked = {
22
+ address: signer.address,
23
+ signTypedData: (data) => signer.signTypedData(data),
24
+ execute: async (calls, opts) => {
25
+ setPhase("submitting");
26
+ const result = await signer.execute(calls, opts);
27
+ hash = result.txHash;
28
+ setTxHash(result.txHash);
29
+ setPhase("confirming");
30
+ return result;
31
+ }
32
+ };
33
+ await work(tracked);
34
+ if (hash) {
35
+ const client = app.getClient();
36
+ setReceipt(await assertTransactionSucceeded(client.provider, hash));
37
+ await syncTransactionBestEffort(client, hash);
38
+ }
39
+ setPhase("success");
40
+ } catch (err) {
41
+ setError(describeError(err, "We couldn't complete that. Please try again.").message);
42
+ setPhase("error");
43
+ } finally {
44
+ app.releaseSigner?.();
45
+ }
46
+ },
47
+ [app]
48
+ );
49
+ const reset = useCallback(() => {
50
+ setPhase("idle");
51
+ setTxHash(null);
52
+ setReceipt(null);
53
+ setError(null);
54
+ }, []);
55
+ return { phase, txHash, receipt, error, run, reset };
56
+ }
57
+ export {
58
+ useTransaction
59
+ };
60
+ //# sourceMappingURL=use-transaction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utils/use-transaction.ts"],"sourcesContent":["\"use client\";\n\nimport { useCallback, useState } from \"react\";\nimport { assertTransactionSucceeded, syncTransactionBestEffort, type ReceiptLike } from \"@medialane/sdk/starknet\";\nimport { useMedialaneApp } from \"../components/medialane-app.js\";\nimport type { FastMintSigner } from \"../components/fast-mint/types.js\";\nimport { describeError } from \"./describe-error.js\";\n\nexport type TransactionPhase = \"idle\" | \"preparing\" | \"submitting\" | \"confirming\" | \"success\" | \"error\";\n\nexport function useTransaction() {\n const app = useMedialaneApp();\n const [phase, setPhase] = useState<TransactionPhase>(\"idle\");\n const [txHash, setTxHash] = useState<string | null>(null);\n const [receipt, setReceipt] = useState<ReceiptLike | null>(null);\n const [error, setError] = useState<string | null>(null);\n\n const run = useCallback(\n async (work: (signer: FastMintSigner) => Promise<void>) => {\n setPhase(\"preparing\");\n setTxHash(null);\n setReceipt(null);\n setError(null);\n try {\n const signer = await app.getSigner();\n let hash: string | null = null;\n const tracked: FastMintSigner = {\n address: signer.address,\n signTypedData: (data) => signer.signTypedData(data),\n execute: async (calls, opts) => {\n setPhase(\"submitting\");\n const result = await signer.execute(calls, opts);\n hash = result.txHash;\n setTxHash(result.txHash);\n setPhase(\"confirming\");\n return result;\n },\n };\n await work(tracked);\n if (hash) {\n const client = app.getClient();\n setReceipt(await assertTransactionSucceeded(client.provider, hash));\n await syncTransactionBestEffort(client, hash);\n }\n setPhase(\"success\");\n } catch (err) {\n setError(describeError(err, \"We couldn't complete that. Please try again.\").message);\n setPhase(\"error\");\n } finally {\n app.releaseSigner?.();\n }\n },\n [app],\n );\n\n const reset = useCallback(() => {\n setPhase(\"idle\");\n setTxHash(null);\n setReceipt(null);\n setError(null);\n }, []);\n\n return { phase, txHash, receipt, error, run, reset };\n}\n"],"mappings":";AAEA,SAAS,aAAa,gBAAgB;AACtC,SAAS,4BAA4B,iCAAmD;AACxF,SAAS,uBAAuB;AAEhC,SAAS,qBAAqB;AAIvB,SAAS,iBAAiB;AAC/B,QAAM,MAAM,gBAAgB;AAC5B,QAAM,CAAC,OAAO,QAAQ,IAAI,SAA2B,MAAM;AAC3D,QAAM,CAAC,QAAQ,SAAS,IAAI,SAAwB,IAAI;AACxD,QAAM,CAAC,SAAS,UAAU,IAAI,SAA6B,IAAI;AAC/D,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAwB,IAAI;AAEtD,QAAM,MAAM;AAAA,IACV,OAAO,SAAoD;AACzD,eAAS,WAAW;AACpB,gBAAU,IAAI;AACd,iBAAW,IAAI;AACf,eAAS,IAAI;AACb,UAAI;AACF,cAAM,SAAS,MAAM,IAAI,UAAU;AACnC,YAAI,OAAsB;AAC1B,cAAM,UAA0B;AAAA,UAC9B,SAAS,OAAO;AAAA,UAChB,eAAe,CAAC,SAAS,OAAO,cAAc,IAAI;AAAA,UAClD,SAAS,OAAO,OAAO,SAAS;AAC9B,qBAAS,YAAY;AACrB,kBAAM,SAAS,MAAM,OAAO,QAAQ,OAAO,IAAI;AAC/C,mBAAO,OAAO;AACd,sBAAU,OAAO,MAAM;AACvB,qBAAS,YAAY;AACrB,mBAAO;AAAA,UACT;AAAA,QACF;AACA,cAAM,KAAK,OAAO;AAClB,YAAI,MAAM;AACR,gBAAM,SAAS,IAAI,UAAU;AAC7B,qBAAW,MAAM,2BAA2B,OAAO,UAAU,IAAI,CAAC;AAClE,gBAAM,0BAA0B,QAAQ,IAAI;AAAA,QAC9C;AACA,iBAAS,SAAS;AAAA,MACpB,SAAS,KAAK;AACZ,iBAAS,cAAc,KAAK,8CAA8C,EAAE,OAAO;AACnF,iBAAS,OAAO;AAAA,MAClB,UAAE;AACA,YAAI,gBAAgB;AAAA,MACtB;AAAA,IACF;AAAA,IACA,CAAC,GAAG;AAAA,EACN;AAEA,QAAM,QAAQ,YAAY,MAAM;AAC9B,aAAS,MAAM;AACf,cAAU,IAAI;AACd,eAAW,IAAI;AACf,aAAS,IAAI;AAAA,EACf,GAAG,CAAC,CAAC;AAEL,SAAO,EAAE,OAAO,QAAQ,SAAS,OAAO,KAAK,MAAM;AACrD;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medialane/ui",
3
- "version": "0.231.0",
3
+ "version": "0.233.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.201.0 <0.202.0",
54
+ "@medialane/sdk": ">=0.202.0 <0.203.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",
@@ -83,7 +83,7 @@
83
83
  },
84
84
  "devDependencies": {
85
85
  "@happy-dom/global-registrator": "^20.14.5",
86
- "@medialane/sdk": "0.201.0",
86
+ "@medialane/sdk": "0.202.0",
87
87
  "@radix-ui/react-checkbox": "^1.3.8",
88
88
  "@radix-ui/react-collapsible": "^1.1.17",
89
89
  "@radix-ui/react-dialog": "^1.1.20",