@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,35 @@
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 claim_route_shell_exports = {};
21
+ __export(claim_route_shell_exports, {
22
+ ClaimRouteShell: () => ClaimRouteShell
23
+ });
24
+ module.exports = __toCommonJS(claim_route_shell_exports);
25
+ var import_jsx_runtime = require("react/jsx-runtime");
26
+ var import_back_button = require("./back-button.js");
27
+ var import_service_form_shell = require("./service-form-shell.js");
28
+ function ClaimRouteShell(props) {
29
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_service_form_shell.ServiceFormShell, { ...props, backSlot: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_back_button.BackButton, {}) });
30
+ }
31
+ // Annotate the CommonJS export names for ESM import in node:
32
+ 0 && (module.exports = {
33
+ ClaimRouteShell
34
+ });
35
+ //# sourceMappingURL=claim-route-shell.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/claim-route-shell.tsx"],"sourcesContent":["\"use client\";\n\nimport { BackButton } from \"./back-button.js\";\nimport { ServiceFormShell, type ServiceFormShellProps } from \"./service-form-shell.js\";\n\nexport function ClaimRouteShell(props: Omit<ServiceFormShellProps, \"backSlot\">) {\n return <ServiceFormShell {...props} backSlot={<BackButton />} />;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAMgD;AAJhD,yBAA2B;AAC3B,gCAA6D;AAEtD,SAAS,gBAAgB,OAAgD;AAC9E,SAAO,4CAAC,8CAAkB,GAAG,OAAO,UAAU,4CAAC,iCAAW,GAAI;AAChE;","names":[]}
@@ -0,0 +1,7 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ServiceFormShellProps } from './service-form-shell.cjs';
3
+ import 'react';
4
+
5
+ declare function ClaimRouteShell(props: Omit<ServiceFormShellProps, "backSlot">): react_jsx_runtime.JSX.Element;
6
+
7
+ export { ClaimRouteShell };
@@ -0,0 +1,7 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ServiceFormShellProps } from './service-form-shell.js';
3
+ import 'react';
4
+
5
+ declare function ClaimRouteShell(props: Omit<ServiceFormShellProps, "backSlot">): react_jsx_runtime.JSX.Element;
6
+
7
+ export { ClaimRouteShell };
@@ -0,0 +1,11 @@
1
+ "use client";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { BackButton } from "./back-button.js";
4
+ import { ServiceFormShell } from "./service-form-shell.js";
5
+ function ClaimRouteShell(props) {
6
+ return /* @__PURE__ */ jsx(ServiceFormShell, { ...props, backSlot: /* @__PURE__ */ jsx(BackButton, {}) });
7
+ }
8
+ export {
9
+ ClaimRouteShell
10
+ };
11
+ //# sourceMappingURL=claim-route-shell.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/claim-route-shell.tsx"],"sourcesContent":["\"use client\";\n\nimport { BackButton } from \"./back-button.js\";\nimport { ServiceFormShell, type ServiceFormShellProps } from \"./service-form-shell.js\";\n\nexport function ClaimRouteShell(props: Omit<ServiceFormShellProps, \"backSlot\">) {\n return <ServiceFormShell {...props} backSlot={<BackButton />} />;\n}\n"],"mappings":";AAMgD;AAJhD,SAAS,kBAAkB;AAC3B,SAAS,wBAAoD;AAEtD,SAAS,gBAAgB,OAAgD;AAC9E,SAAO,oBAAC,oBAAkB,GAAG,OAAO,UAAU,oBAAC,cAAW,GAAI;AAChE;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/medialane-app.tsx"],"sourcesContent":["\"use client\";\n\nimport { createContext, useContext, type ComponentType, type ElementType, type ReactNode } from \"react\";\nimport type { MedialaneClient } from \"@medialane/sdk/starknet\";\nimport type { FastMintSigner } from \"./fast-mint/types.js\";\nimport type { ApiToken } from \"@medialane/sdk\";\nimport type { ImageResolver } from \"../utils/ipfs.js\";\n\nexport type AssetRef = Pick<ApiToken, \"chain\" | \"contractAddress\" | \"tokenId\">;\n\nexport interface CompanionApp {\n title: string;\n description: string;\n icon: ElementType;\n origin: string;\n}\n\nexport type ReportTarget =\n | { type: \"TOKEN\"; contract: string; tokenId: string; name?: string }\n | { type: \"COLLECTION\"; contract: string; name?: string }\n | { type: \"CREATOR\"; address: string; name?: string };\n\nexport type ReportDialogSlot = ComponentType<{ open: boolean; onOpenChange: (open: boolean) => void; target: ReportTarget }>;\n\nexport interface MedialaneApp {\n getClient: () => MedialaneClient;\n getSigner: () => Promise<FastMintSigner> | FastMintSigner;\n walletAddress: string | null;\n walletLoading?: boolean;\n onRequireWallet: () => void;\n ensureSignedIn?: () => Promise<void>;\n connectLabel?: string;\n connectDescription?: string;\n companion?: CompanionApp;\n ReportDialog?: ReportDialogSlot;\n resolveImage?: ImageResolver;\n}\n\nexport const MedialaneAppContext = createContext<MedialaneApp | null>(null);\n\nexport function MedialaneAppProvider({ value, children }: { value: MedialaneApp; children: ReactNode }) {\n return <MedialaneAppContext.Provider value={value}>{children}</MedialaneAppContext.Provider>;\n}\n\nexport function useMedialaneApp(): MedialaneApp {\n const app = useContext(MedialaneAppContext);\n if (!app) throw new Error(\"MedialaneAppProvider missing\");\n return app;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAyCS;AAvCT,mBAAgG;AAoCzF,MAAM,0BAAsB,4BAAmC,IAAI;AAEnE,SAAS,qBAAqB,EAAE,OAAO,SAAS,GAAiD;AACtG,SAAO,4CAAC,oBAAoB,UAApB,EAA6B,OAAe,UAAS;AAC/D;AAEO,SAAS,kBAAgC;AAC9C,QAAM,UAAM,yBAAW,mBAAmB;AAC1C,MAAI,CAAC,IAAK,OAAM,IAAI,MAAM,8BAA8B;AACxD,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../src/components/medialane-app.tsx"],"sourcesContent":["\"use client\";\n\nimport { createContext, useContext, type ComponentType, type ElementType, type ReactNode } from \"react\";\nimport type { MedialaneClient } from \"@medialane/sdk/starknet\";\nimport type { FastMintSigner } from \"./fast-mint/types.js\";\nimport type { ApiToken } from \"@medialane/sdk\";\nimport type { ImageResolver } from \"../utils/ipfs.js\";\n\nexport type AssetRef = Pick<ApiToken, \"chain\" | \"contractAddress\" | \"tokenId\">;\n\nexport interface CompanionApp {\n title: string;\n description: string;\n icon: ElementType;\n origin: string;\n}\n\nexport type ReportTarget =\n | { type: \"TOKEN\"; contract: string; tokenId: string; name?: string }\n | { type: \"COLLECTION\"; contract: string; name?: string }\n | { type: \"CREATOR\"; address: string; name?: string };\n\nexport type ReportDialogSlot = ComponentType<{ open: boolean; onOpenChange: (open: boolean) => void; target: ReportTarget }>;\n\nexport interface MedialaneApp {\n getClient: () => MedialaneClient;\n getSigner: () => Promise<FastMintSigner> | FastMintSigner;\n walletAddress: string | null;\n walletLoading?: boolean;\n onRequireWallet: () => void;\n releaseSigner?: () => void;\n ensureSignedIn?: () => Promise<void>;\n connectLabel?: string;\n connectDescription?: string;\n companion?: CompanionApp;\n ReportDialog?: ReportDialogSlot;\n resolveImage?: ImageResolver;\n}\n\nexport const MedialaneAppContext = createContext<MedialaneApp | null>(null);\n\nexport function MedialaneAppProvider({ value, children }: { value: MedialaneApp; children: ReactNode }) {\n return <MedialaneAppContext.Provider value={value}>{children}</MedialaneAppContext.Provider>;\n}\n\nexport function useMedialaneApp(): MedialaneApp {\n const app = useContext(MedialaneAppContext);\n if (!app) throw new Error(\"MedialaneAppProvider missing\");\n return app;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA0CS;AAxCT,mBAAgG;AAqCzF,MAAM,0BAAsB,4BAAmC,IAAI;AAEnE,SAAS,qBAAqB,EAAE,OAAO,SAAS,GAAiD;AACtG,SAAO,4CAAC,oBAAoB,UAApB,EAA6B,OAAe,UAAS;AAC/D;AAEO,SAAS,kBAAgC;AAC9C,QAAM,UAAM,yBAAW,mBAAmB;AAC1C,MAAI,CAAC,IAAK,OAAM,IAAI,MAAM,8BAA8B;AACxD,SAAO;AACT;","names":[]}
@@ -39,6 +39,7 @@ interface MedialaneApp {
39
39
  walletAddress: string | null;
40
40
  walletLoading?: boolean;
41
41
  onRequireWallet: () => void;
42
+ releaseSigner?: () => void;
42
43
  ensureSignedIn?: () => Promise<void>;
43
44
  connectLabel?: string;
44
45
  connectDescription?: string;
@@ -39,6 +39,7 @@ interface MedialaneApp {
39
39
  walletAddress: string | null;
40
40
  walletLoading?: boolean;
41
41
  onRequireWallet: () => void;
42
+ releaseSigner?: () => void;
42
43
  ensureSignedIn?: () => Promise<void>;
43
44
  connectLabel?: string;
44
45
  connectDescription?: string;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/medialane-app.tsx"],"sourcesContent":["\"use client\";\n\nimport { createContext, useContext, type ComponentType, type ElementType, type ReactNode } from \"react\";\nimport type { MedialaneClient } from \"@medialane/sdk/starknet\";\nimport type { FastMintSigner } from \"./fast-mint/types.js\";\nimport type { ApiToken } from \"@medialane/sdk\";\nimport type { ImageResolver } from \"../utils/ipfs.js\";\n\nexport type AssetRef = Pick<ApiToken, \"chain\" | \"contractAddress\" | \"tokenId\">;\n\nexport interface CompanionApp {\n title: string;\n description: string;\n icon: ElementType;\n origin: string;\n}\n\nexport type ReportTarget =\n | { type: \"TOKEN\"; contract: string; tokenId: string; name?: string }\n | { type: \"COLLECTION\"; contract: string; name?: string }\n | { type: \"CREATOR\"; address: string; name?: string };\n\nexport type ReportDialogSlot = ComponentType<{ open: boolean; onOpenChange: (open: boolean) => void; target: ReportTarget }>;\n\nexport interface MedialaneApp {\n getClient: () => MedialaneClient;\n getSigner: () => Promise<FastMintSigner> | FastMintSigner;\n walletAddress: string | null;\n walletLoading?: boolean;\n onRequireWallet: () => void;\n ensureSignedIn?: () => Promise<void>;\n connectLabel?: string;\n connectDescription?: string;\n companion?: CompanionApp;\n ReportDialog?: ReportDialogSlot;\n resolveImage?: ImageResolver;\n}\n\nexport const MedialaneAppContext = createContext<MedialaneApp | null>(null);\n\nexport function MedialaneAppProvider({ value, children }: { value: MedialaneApp; children: ReactNode }) {\n return <MedialaneAppContext.Provider value={value}>{children}</MedialaneAppContext.Provider>;\n}\n\nexport function useMedialaneApp(): MedialaneApp {\n const app = useContext(MedialaneAppContext);\n if (!app) throw new Error(\"MedialaneAppProvider missing\");\n return app;\n}\n"],"mappings":";AAyCS;AAvCT,SAAS,eAAe,kBAAwE;AAoCzF,MAAM,sBAAsB,cAAmC,IAAI;AAEnE,SAAS,qBAAqB,EAAE,OAAO,SAAS,GAAiD;AACtG,SAAO,oBAAC,oBAAoB,UAApB,EAA6B,OAAe,UAAS;AAC/D;AAEO,SAAS,kBAAgC;AAC9C,QAAM,MAAM,WAAW,mBAAmB;AAC1C,MAAI,CAAC,IAAK,OAAM,IAAI,MAAM,8BAA8B;AACxD,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../src/components/medialane-app.tsx"],"sourcesContent":["\"use client\";\n\nimport { createContext, useContext, type ComponentType, type ElementType, type ReactNode } from \"react\";\nimport type { MedialaneClient } from \"@medialane/sdk/starknet\";\nimport type { FastMintSigner } from \"./fast-mint/types.js\";\nimport type { ApiToken } from \"@medialane/sdk\";\nimport type { ImageResolver } from \"../utils/ipfs.js\";\n\nexport type AssetRef = Pick<ApiToken, \"chain\" | \"contractAddress\" | \"tokenId\">;\n\nexport interface CompanionApp {\n title: string;\n description: string;\n icon: ElementType;\n origin: string;\n}\n\nexport type ReportTarget =\n | { type: \"TOKEN\"; contract: string; tokenId: string; name?: string }\n | { type: \"COLLECTION\"; contract: string; name?: string }\n | { type: \"CREATOR\"; address: string; name?: string };\n\nexport type ReportDialogSlot = ComponentType<{ open: boolean; onOpenChange: (open: boolean) => void; target: ReportTarget }>;\n\nexport interface MedialaneApp {\n getClient: () => MedialaneClient;\n getSigner: () => Promise<FastMintSigner> | FastMintSigner;\n walletAddress: string | null;\n walletLoading?: boolean;\n onRequireWallet: () => void;\n releaseSigner?: () => void;\n ensureSignedIn?: () => Promise<void>;\n connectLabel?: string;\n connectDescription?: string;\n companion?: CompanionApp;\n ReportDialog?: ReportDialogSlot;\n resolveImage?: ImageResolver;\n}\n\nexport const MedialaneAppContext = createContext<MedialaneApp | null>(null);\n\nexport function MedialaneAppProvider({ value, children }: { value: MedialaneApp; children: ReactNode }) {\n return <MedialaneAppContext.Provider value={value}>{children}</MedialaneAppContext.Provider>;\n}\n\nexport function useMedialaneApp(): MedialaneApp {\n const app = useContext(MedialaneAppContext);\n if (!app) throw new Error(\"MedialaneAppProvider missing\");\n return app;\n}\n"],"mappings":";AA0CS;AAxCT,SAAS,eAAe,kBAAwE;AAqCzF,MAAM,sBAAsB,cAAmC,IAAI;AAEnE,SAAS,qBAAqB,EAAE,OAAO,SAAS,GAAiD;AACtG,SAAO,oBAAC,oBAAoB,UAApB,EAA6B,OAAe,UAAS;AAC/D;AAEO,SAAS,kBAAgC;AAC9C,QAAM,MAAM,WAAW,mBAAmB;AAC1C,MAAI,CAAC,IAAK,OAAM,IAAI,MAAM,8BAA8B;AACxD,SAAO;AACT;","names":[]}
@@ -19,47 +19,51 @@ var __copyProps = (to, from, except, desc) => {
19
19
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
20
  var reward_earned_exports = {};
21
21
  __export(reward_earned_exports, {
22
- createRewardEarned: () => createRewardEarned
22
+ RewardEarned: () => RewardEarned
23
23
  });
24
24
  module.exports = __toCommonJS(reward_earned_exports);
25
25
  var import_jsx_runtime = require("react/jsx-runtime");
26
26
  var import_react = require("react");
27
27
  var import_xp_earned = require("./xp-earned.js");
28
- function createRewardEarned(getRewardsConfig) {
29
- let configPromise = null;
30
- const loadConfig = () => configPromise ?? (configPromise = getRewardsConfig());
31
- return function RewardEarned({ actionType, snapshot, className }) {
32
- const [config, setConfig] = (0, import_react.useState)(null);
33
- (0, import_react.useEffect)(() => {
34
- let alive = true;
35
- loadConfig().then((loaded) => {
36
- if (alive) setConfig(loaded);
37
- }).catch((err) => {
38
- console.error("rewards config could not be loaded", err);
39
- configPromise = null;
40
- });
41
- return () => {
42
- alive = false;
43
- };
44
- }, []);
45
- const action = config?.actions.find((a) => a.type === actionType);
46
- if (!config || !action) return null;
47
- const level = snapshot ? config.levels.find((l) => l.level === snapshot.currentLevel) : void 0;
48
- const nextLevel = snapshot ? config.levels.find((l) => l.level === snapshot.currentLevel + 1) : void 0;
49
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
50
- import_xp_earned.XpEarned,
51
- {
52
- xp: action.xp,
53
- label: action.label,
54
- totalXp: snapshot?.totalXp,
55
- levelXp: snapshot ? level?.xpRequired ?? 0 : void 0,
56
- nextLevelXp: snapshot ? nextLevel?.xpRequired ?? null : void 0
57
- }
58
- ) });
59
- };
28
+ var import_medialane_app = require("../medialane-app.js");
29
+ const configs = /* @__PURE__ */ new WeakMap();
30
+ function RewardEarned({ actionType, snapshot, className }) {
31
+ const api = (0, import_medialane_app.useMedialaneApp)().getClient().api;
32
+ const [config, setConfig] = (0, import_react.useState)(null);
33
+ (0, import_react.useEffect)(() => {
34
+ let alive = true;
35
+ let pending = configs.get(api);
36
+ if (!pending) {
37
+ pending = api.rewards.config();
38
+ configs.set(api, pending);
39
+ }
40
+ pending.then((loaded) => {
41
+ if (alive) setConfig(loaded);
42
+ }).catch((err) => {
43
+ console.error("rewards config could not be loaded", err);
44
+ configs.delete(api);
45
+ });
46
+ return () => {
47
+ alive = false;
48
+ };
49
+ }, [api]);
50
+ const action = config?.actions.find((a) => a.type === actionType);
51
+ if (!config || !action) return null;
52
+ const level = snapshot ? config.levels.find((l) => l.level === snapshot.currentLevel) : void 0;
53
+ const nextLevel = snapshot ? config.levels.find((l) => l.level === snapshot.currentLevel + 1) : void 0;
54
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
55
+ import_xp_earned.XpEarned,
56
+ {
57
+ xp: action.xp,
58
+ label: action.label,
59
+ totalXp: snapshot?.totalXp,
60
+ levelXp: snapshot ? level?.xpRequired ?? 0 : void 0,
61
+ nextLevelXp: snapshot ? nextLevel?.xpRequired ?? null : void 0
62
+ }
63
+ ) });
60
64
  }
61
65
  // Annotate the CommonJS export names for ESM import in node:
62
66
  0 && (module.exports = {
63
- createRewardEarned
67
+ RewardEarned
64
68
  });
65
69
  //# sourceMappingURL=reward-earned.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/rewards/reward-earned.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useState } from \"react\";\nimport { XpEarned } from \"./xp-earned.js\";\nimport type { ApiRewardsConfig } from \"@medialane/sdk\";\n\nexport interface RewardSnapshot {\n totalXp: number;\n currentLevel: number;\n}\n\nexport interface RewardEarnedProps {\n actionType: string;\n snapshot?: RewardSnapshot;\n className?: string;\n}\n\nexport function createRewardEarned(getRewardsConfig: () => Promise<ApiRewardsConfig>) {\n let configPromise: Promise<ApiRewardsConfig> | null = null;\n const loadConfig = () => (configPromise ??= getRewardsConfig());\n\n return function RewardEarned({ actionType, snapshot, className }: RewardEarnedProps) {\n const [config, setConfig] = useState<ApiRewardsConfig | null>(null);\n\n useEffect(() => {\n let alive = true;\n loadConfig()\n .then((loaded) => {\n if (alive) setConfig(loaded);\n })\n .catch((err) => {\n console.error(\"rewards config could not be loaded\", err);\n configPromise = null;\n });\n return () => {\n alive = false;\n };\n }, []);\n\n const action = config?.actions.find((a) => a.type === actionType);\n if (!config || !action) return null;\n\n const level = snapshot ? config.levels.find((l) => l.level === snapshot.currentLevel) : undefined;\n const nextLevel = snapshot ? config.levels.find((l) => l.level === snapshot.currentLevel + 1) : undefined;\n\n return (\n <div className={className}>\n <XpEarned\n xp={action.xp}\n label={action.label}\n totalXp={snapshot?.totalXp}\n levelXp={snapshot ? level?.xpRequired ?? 0 : undefined}\n nextLevelXp={snapshot ? nextLevel?.xpRequired ?? null : undefined}\n />\n </div>\n );\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA+CQ;AA7CR,mBAAoC;AACpC,uBAAyB;AAclB,SAAS,mBAAmB,kBAAmD;AACpF,MAAI,gBAAkD;AACtD,QAAM,aAAa,MAAO,kCAAkB,iBAAiB;AAE7D,SAAO,SAAS,aAAa,EAAE,YAAY,UAAU,UAAU,GAAsB;AACnF,UAAM,CAAC,QAAQ,SAAS,QAAI,uBAAkC,IAAI;AAElE,gCAAU,MAAM;AACd,UAAI,QAAQ;AACZ,iBAAW,EACR,KAAK,CAAC,WAAW;AAChB,YAAI,MAAO,WAAU,MAAM;AAAA,MAC7B,CAAC,EACA,MAAM,CAAC,QAAQ;AACd,gBAAQ,MAAM,sCAAsC,GAAG;AACvD,wBAAgB;AAAA,MAClB,CAAC;AACH,aAAO,MAAM;AACX,gBAAQ;AAAA,MACV;AAAA,IACF,GAAG,CAAC,CAAC;AAEL,UAAM,SAAS,QAAQ,QAAQ,KAAK,CAAC,MAAM,EAAE,SAAS,UAAU;AAChE,QAAI,CAAC,UAAU,CAAC,OAAQ,QAAO;AAE/B,UAAM,QAAQ,WAAW,OAAO,OAAO,KAAK,CAAC,MAAM,EAAE,UAAU,SAAS,YAAY,IAAI;AACxF,UAAM,YAAY,WAAW,OAAO,OAAO,KAAK,CAAC,MAAM,EAAE,UAAU,SAAS,eAAe,CAAC,IAAI;AAEhG,WACE,4CAAC,SAAI,WACH;AAAA,MAAC;AAAA;AAAA,QACC,IAAI,OAAO;AAAA,QACX,OAAO,OAAO;AAAA,QACd,SAAS,UAAU;AAAA,QACnB,SAAS,WAAW,OAAO,cAAc,IAAI;AAAA,QAC7C,aAAa,WAAW,WAAW,cAAc,OAAO;AAAA;AAAA,IAC1D,GACF;AAAA,EAEJ;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../src/components/rewards/reward-earned.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useState } from \"react\";\nimport { XpEarned } from \"./xp-earned.js\";\nimport type { ApiRewardsConfig } from \"@medialane/sdk\";\nimport { useMedialaneApp } from \"../medialane-app.js\";\n\nexport interface RewardSnapshot {\n totalXp: number;\n currentLevel: number;\n}\n\nexport interface RewardEarnedProps {\n actionType: string;\n snapshot?: RewardSnapshot;\n className?: string;\n}\n\nconst configs = new WeakMap<object, Promise<ApiRewardsConfig>>();\n\nexport function RewardEarned({ actionType, snapshot, className }: RewardEarnedProps) {\n const api = useMedialaneApp().getClient().api;\n const [config, setConfig] = useState<ApiRewardsConfig | null>(null);\n\n useEffect(() => {\n let alive = true;\n let pending = configs.get(api);\n if (!pending) {\n pending = api.rewards.config();\n configs.set(api, pending);\n }\n pending\n .then((loaded) => {\n if (alive) setConfig(loaded);\n })\n .catch((err) => {\n console.error(\"rewards config could not be loaded\", err);\n configs.delete(api);\n });\n return () => {\n alive = false;\n };\n }, [api]);\n\n const action = config?.actions.find((a) => a.type === actionType);\n if (!config || !action) return null;\n\n const level = snapshot ? config.levels.find((l) => l.level === snapshot.currentLevel) : undefined;\n const nextLevel = snapshot ? config.levels.find((l) => l.level === snapshot.currentLevel + 1) : undefined;\n\n return (\n <div className={className}>\n <XpEarned\n xp={action.xp}\n label={action.label}\n totalXp={snapshot?.totalXp}\n levelXp={snapshot ? level?.xpRequired ?? 0 : undefined}\n nextLevelXp={snapshot ? nextLevel?.xpRequired ?? null : undefined}\n />\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAoDM;AAlDN,mBAAoC;AACpC,uBAAyB;AAEzB,2BAAgC;AAahC,MAAM,UAAU,oBAAI,QAA2C;AAExD,SAAS,aAAa,EAAE,YAAY,UAAU,UAAU,GAAsB;AACnF,QAAM,UAAM,sCAAgB,EAAE,UAAU,EAAE;AAC1C,QAAM,CAAC,QAAQ,SAAS,QAAI,uBAAkC,IAAI;AAElE,8BAAU,MAAM;AACd,QAAI,QAAQ;AACZ,QAAI,UAAU,QAAQ,IAAI,GAAG;AAC7B,QAAI,CAAC,SAAS;AACZ,gBAAU,IAAI,QAAQ,OAAO;AAC7B,cAAQ,IAAI,KAAK,OAAO;AAAA,IAC1B;AACA,YACG,KAAK,CAAC,WAAW;AAChB,UAAI,MAAO,WAAU,MAAM;AAAA,IAC7B,CAAC,EACA,MAAM,CAAC,QAAQ;AACd,cAAQ,MAAM,sCAAsC,GAAG;AACvD,cAAQ,OAAO,GAAG;AAAA,IACpB,CAAC;AACH,WAAO,MAAM;AACX,cAAQ;AAAA,IACV;AAAA,EACF,GAAG,CAAC,GAAG,CAAC;AAER,QAAM,SAAS,QAAQ,QAAQ,KAAK,CAAC,MAAM,EAAE,SAAS,UAAU;AAChE,MAAI,CAAC,UAAU,CAAC,OAAQ,QAAO;AAE/B,QAAM,QAAQ,WAAW,OAAO,OAAO,KAAK,CAAC,MAAM,EAAE,UAAU,SAAS,YAAY,IAAI;AACxF,QAAM,YAAY,WAAW,OAAO,OAAO,KAAK,CAAC,MAAM,EAAE,UAAU,SAAS,eAAe,CAAC,IAAI;AAEhG,SACE,4CAAC,SAAI,WACH;AAAA,IAAC;AAAA;AAAA,MACC,IAAI,OAAO;AAAA,MACX,OAAO,OAAO;AAAA,MACd,SAAS,UAAU;AAAA,MACnB,SAAS,WAAW,OAAO,cAAc,IAAI;AAAA,MAC7C,aAAa,WAAW,WAAW,cAAc,OAAO;AAAA;AAAA,EAC1D,GACF;AAEJ;","names":[]}
@@ -1,5 +1,4 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { ApiRewardsConfig } from '@medialane/sdk';
3
2
 
4
3
  interface RewardSnapshot {
5
4
  totalXp: number;
@@ -10,6 +9,6 @@ interface RewardEarnedProps {
10
9
  snapshot?: RewardSnapshot;
11
10
  className?: string;
12
11
  }
13
- declare function createRewardEarned(getRewardsConfig: () => Promise<ApiRewardsConfig>): ({ actionType, snapshot, className }: RewardEarnedProps) => react_jsx_runtime.JSX.Element | null;
12
+ declare function RewardEarned({ actionType, snapshot, className }: RewardEarnedProps): react_jsx_runtime.JSX.Element | null;
14
13
 
15
- export { type RewardEarnedProps, type RewardSnapshot, createRewardEarned };
14
+ export { RewardEarned, type RewardEarnedProps, type RewardSnapshot };
@@ -1,5 +1,4 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { ApiRewardsConfig } from '@medialane/sdk';
3
2
 
4
3
  interface RewardSnapshot {
5
4
  totalXp: number;
@@ -10,6 +9,6 @@ interface RewardEarnedProps {
10
9
  snapshot?: RewardSnapshot;
11
10
  className?: string;
12
11
  }
13
- declare function createRewardEarned(getRewardsConfig: () => Promise<ApiRewardsConfig>): ({ actionType, snapshot, className }: RewardEarnedProps) => react_jsx_runtime.JSX.Element | null;
12
+ declare function RewardEarned({ actionType, snapshot, className }: RewardEarnedProps): react_jsx_runtime.JSX.Element | null;
14
13
 
15
- export { type RewardEarnedProps, type RewardSnapshot, createRewardEarned };
14
+ export { RewardEarned, type RewardEarnedProps, type RewardSnapshot };
@@ -2,40 +2,44 @@
2
2
  import { jsx } from "react/jsx-runtime";
3
3
  import { useEffect, useState } from "react";
4
4
  import { XpEarned } from "./xp-earned.js";
5
- function createRewardEarned(getRewardsConfig) {
6
- let configPromise = null;
7
- const loadConfig = () => configPromise ?? (configPromise = getRewardsConfig());
8
- return function RewardEarned({ actionType, snapshot, className }) {
9
- const [config, setConfig] = useState(null);
10
- useEffect(() => {
11
- let alive = true;
12
- loadConfig().then((loaded) => {
13
- if (alive) setConfig(loaded);
14
- }).catch((err) => {
15
- console.error("rewards config could not be loaded", err);
16
- configPromise = null;
17
- });
18
- return () => {
19
- alive = false;
20
- };
21
- }, []);
22
- const action = config?.actions.find((a) => a.type === actionType);
23
- if (!config || !action) return null;
24
- const level = snapshot ? config.levels.find((l) => l.level === snapshot.currentLevel) : void 0;
25
- const nextLevel = snapshot ? config.levels.find((l) => l.level === snapshot.currentLevel + 1) : void 0;
26
- return /* @__PURE__ */ jsx("div", { className, children: /* @__PURE__ */ jsx(
27
- XpEarned,
28
- {
29
- xp: action.xp,
30
- label: action.label,
31
- totalXp: snapshot?.totalXp,
32
- levelXp: snapshot ? level?.xpRequired ?? 0 : void 0,
33
- nextLevelXp: snapshot ? nextLevel?.xpRequired ?? null : void 0
34
- }
35
- ) });
36
- };
5
+ import { useMedialaneApp } from "../medialane-app.js";
6
+ const configs = /* @__PURE__ */ new WeakMap();
7
+ function RewardEarned({ actionType, snapshot, className }) {
8
+ const api = useMedialaneApp().getClient().api;
9
+ const [config, setConfig] = useState(null);
10
+ useEffect(() => {
11
+ let alive = true;
12
+ let pending = configs.get(api);
13
+ if (!pending) {
14
+ pending = api.rewards.config();
15
+ configs.set(api, pending);
16
+ }
17
+ pending.then((loaded) => {
18
+ if (alive) setConfig(loaded);
19
+ }).catch((err) => {
20
+ console.error("rewards config could not be loaded", err);
21
+ configs.delete(api);
22
+ });
23
+ return () => {
24
+ alive = false;
25
+ };
26
+ }, [api]);
27
+ const action = config?.actions.find((a) => a.type === actionType);
28
+ if (!config || !action) return null;
29
+ const level = snapshot ? config.levels.find((l) => l.level === snapshot.currentLevel) : void 0;
30
+ const nextLevel = snapshot ? config.levels.find((l) => l.level === snapshot.currentLevel + 1) : void 0;
31
+ return /* @__PURE__ */ jsx("div", { className, children: /* @__PURE__ */ jsx(
32
+ XpEarned,
33
+ {
34
+ xp: action.xp,
35
+ label: action.label,
36
+ totalXp: snapshot?.totalXp,
37
+ levelXp: snapshot ? level?.xpRequired ?? 0 : void 0,
38
+ nextLevelXp: snapshot ? nextLevel?.xpRequired ?? null : void 0
39
+ }
40
+ ) });
37
41
  }
38
42
  export {
39
- createRewardEarned
43
+ RewardEarned
40
44
  };
41
45
  //# sourceMappingURL=reward-earned.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/rewards/reward-earned.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useState } from \"react\";\nimport { XpEarned } from \"./xp-earned.js\";\nimport type { ApiRewardsConfig } from \"@medialane/sdk\";\n\nexport interface RewardSnapshot {\n totalXp: number;\n currentLevel: number;\n}\n\nexport interface RewardEarnedProps {\n actionType: string;\n snapshot?: RewardSnapshot;\n className?: string;\n}\n\nexport function createRewardEarned(getRewardsConfig: () => Promise<ApiRewardsConfig>) {\n let configPromise: Promise<ApiRewardsConfig> | null = null;\n const loadConfig = () => (configPromise ??= getRewardsConfig());\n\n return function RewardEarned({ actionType, snapshot, className }: RewardEarnedProps) {\n const [config, setConfig] = useState<ApiRewardsConfig | null>(null);\n\n useEffect(() => {\n let alive = true;\n loadConfig()\n .then((loaded) => {\n if (alive) setConfig(loaded);\n })\n .catch((err) => {\n console.error(\"rewards config could not be loaded\", err);\n configPromise = null;\n });\n return () => {\n alive = false;\n };\n }, []);\n\n const action = config?.actions.find((a) => a.type === actionType);\n if (!config || !action) return null;\n\n const level = snapshot ? config.levels.find((l) => l.level === snapshot.currentLevel) : undefined;\n const nextLevel = snapshot ? config.levels.find((l) => l.level === snapshot.currentLevel + 1) : undefined;\n\n return (\n <div className={className}>\n <XpEarned\n xp={action.xp}\n label={action.label}\n totalXp={snapshot?.totalXp}\n levelXp={snapshot ? level?.xpRequired ?? 0 : undefined}\n nextLevelXp={snapshot ? nextLevel?.xpRequired ?? null : undefined}\n />\n </div>\n );\n };\n}\n"],"mappings":";AA+CQ;AA7CR,SAAS,WAAW,gBAAgB;AACpC,SAAS,gBAAgB;AAclB,SAAS,mBAAmB,kBAAmD;AACpF,MAAI,gBAAkD;AACtD,QAAM,aAAa,MAAO,kCAAkB,iBAAiB;AAE7D,SAAO,SAAS,aAAa,EAAE,YAAY,UAAU,UAAU,GAAsB;AACnF,UAAM,CAAC,QAAQ,SAAS,IAAI,SAAkC,IAAI;AAElE,cAAU,MAAM;AACd,UAAI,QAAQ;AACZ,iBAAW,EACR,KAAK,CAAC,WAAW;AAChB,YAAI,MAAO,WAAU,MAAM;AAAA,MAC7B,CAAC,EACA,MAAM,CAAC,QAAQ;AACd,gBAAQ,MAAM,sCAAsC,GAAG;AACvD,wBAAgB;AAAA,MAClB,CAAC;AACH,aAAO,MAAM;AACX,gBAAQ;AAAA,MACV;AAAA,IACF,GAAG,CAAC,CAAC;AAEL,UAAM,SAAS,QAAQ,QAAQ,KAAK,CAAC,MAAM,EAAE,SAAS,UAAU;AAChE,QAAI,CAAC,UAAU,CAAC,OAAQ,QAAO;AAE/B,UAAM,QAAQ,WAAW,OAAO,OAAO,KAAK,CAAC,MAAM,EAAE,UAAU,SAAS,YAAY,IAAI;AACxF,UAAM,YAAY,WAAW,OAAO,OAAO,KAAK,CAAC,MAAM,EAAE,UAAU,SAAS,eAAe,CAAC,IAAI;AAEhG,WACE,oBAAC,SAAI,WACH;AAAA,MAAC;AAAA;AAAA,QACC,IAAI,OAAO;AAAA,QACX,OAAO,OAAO;AAAA,QACd,SAAS,UAAU;AAAA,QACnB,SAAS,WAAW,OAAO,cAAc,IAAI;AAAA,QAC7C,aAAa,WAAW,WAAW,cAAc,OAAO;AAAA;AAAA,IAC1D,GACF;AAAA,EAEJ;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../src/components/rewards/reward-earned.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useState } from \"react\";\nimport { XpEarned } from \"./xp-earned.js\";\nimport type { ApiRewardsConfig } from \"@medialane/sdk\";\nimport { useMedialaneApp } from \"../medialane-app.js\";\n\nexport interface RewardSnapshot {\n totalXp: number;\n currentLevel: number;\n}\n\nexport interface RewardEarnedProps {\n actionType: string;\n snapshot?: RewardSnapshot;\n className?: string;\n}\n\nconst configs = new WeakMap<object, Promise<ApiRewardsConfig>>();\n\nexport function RewardEarned({ actionType, snapshot, className }: RewardEarnedProps) {\n const api = useMedialaneApp().getClient().api;\n const [config, setConfig] = useState<ApiRewardsConfig | null>(null);\n\n useEffect(() => {\n let alive = true;\n let pending = configs.get(api);\n if (!pending) {\n pending = api.rewards.config();\n configs.set(api, pending);\n }\n pending\n .then((loaded) => {\n if (alive) setConfig(loaded);\n })\n .catch((err) => {\n console.error(\"rewards config could not be loaded\", err);\n configs.delete(api);\n });\n return () => {\n alive = false;\n };\n }, [api]);\n\n const action = config?.actions.find((a) => a.type === actionType);\n if (!config || !action) return null;\n\n const level = snapshot ? config.levels.find((l) => l.level === snapshot.currentLevel) : undefined;\n const nextLevel = snapshot ? config.levels.find((l) => l.level === snapshot.currentLevel + 1) : undefined;\n\n return (\n <div className={className}>\n <XpEarned\n xp={action.xp}\n label={action.label}\n totalXp={snapshot?.totalXp}\n levelXp={snapshot ? level?.xpRequired ?? 0 : undefined}\n nextLevelXp={snapshot ? nextLevel?.xpRequired ?? null : undefined}\n />\n </div>\n );\n}\n"],"mappings":";AAoDM;AAlDN,SAAS,WAAW,gBAAgB;AACpC,SAAS,gBAAgB;AAEzB,SAAS,uBAAuB;AAahC,MAAM,UAAU,oBAAI,QAA2C;AAExD,SAAS,aAAa,EAAE,YAAY,UAAU,UAAU,GAAsB;AACnF,QAAM,MAAM,gBAAgB,EAAE,UAAU,EAAE;AAC1C,QAAM,CAAC,QAAQ,SAAS,IAAI,SAAkC,IAAI;AAElE,YAAU,MAAM;AACd,QAAI,QAAQ;AACZ,QAAI,UAAU,QAAQ,IAAI,GAAG;AAC7B,QAAI,CAAC,SAAS;AACZ,gBAAU,IAAI,QAAQ,OAAO;AAC7B,cAAQ,IAAI,KAAK,OAAO;AAAA,IAC1B;AACA,YACG,KAAK,CAAC,WAAW;AAChB,UAAI,MAAO,WAAU,MAAM;AAAA,IAC7B,CAAC,EACA,MAAM,CAAC,QAAQ;AACd,cAAQ,MAAM,sCAAsC,GAAG;AACvD,cAAQ,OAAO,GAAG;AAAA,IACpB,CAAC;AACH,WAAO,MAAM;AACX,cAAQ;AAAA,IACV;AAAA,EACF,GAAG,CAAC,GAAG,CAAC;AAER,QAAM,SAAS,QAAQ,QAAQ,KAAK,CAAC,MAAM,EAAE,SAAS,UAAU;AAChE,MAAI,CAAC,UAAU,CAAC,OAAQ,QAAO;AAE/B,QAAM,QAAQ,WAAW,OAAO,OAAO,KAAK,CAAC,MAAM,EAAE,UAAU,SAAS,YAAY,IAAI;AACxF,QAAM,YAAY,WAAW,OAAO,OAAO,KAAK,CAAC,MAAM,EAAE,UAAU,SAAS,eAAe,CAAC,IAAI;AAEhG,SACE,oBAAC,SAAI,WACH;AAAA,IAAC;AAAA;AAAA,MACC,IAAI,OAAO;AAAA,MACX,OAAO,OAAO;AAAA,MACd,SAAS,UAAU;AAAA,MACnB,SAAS,WAAW,OAAO,cAAc,IAAI;AAAA,MAC7C,aAAa,WAAW,WAAW,cAAc,OAAO;AAAA;AAAA,EAC1D,GACF;AAEJ;","names":[]}
@@ -0,0 +1,90 @@
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 transaction_dialog_exports = {};
21
+ __export(transaction_dialog_exports, {
22
+ TransactionDialog: () => TransactionDialog
23
+ });
24
+ module.exports = __toCommonJS(transaction_dialog_exports);
25
+ var import_jsx_runtime = require("react/jsx-runtime");
26
+ var import_react = require("react");
27
+ var import_lucide_react = require("lucide-react");
28
+ var import_dialog = require("./dialog.js");
29
+ var import_button = require("./button.js");
30
+ var import_confetti = require("../utils/media-wallet/confetti.js");
31
+ const ACTIVE_STEP = { preparing: 0, submitting: 1, confirming: 2 };
32
+ function TransactionDialog({ tx, title, workingLabel, firstStepLabel = "Prepare", children }) {
33
+ const { phase, error, reset } = tx;
34
+ const working = phase === "preparing" || phase === "submitting" || phase === "confirming";
35
+ const success = phase === "success";
36
+ const failed = phase === "error";
37
+ const steps = [firstStepLabel, "Submit transaction", "Confirm transaction"];
38
+ const confettiFired = (0, import_react.useRef)(false);
39
+ (0, import_react.useEffect)(() => {
40
+ if (success && !confettiFired.current) {
41
+ confettiFired.current = true;
42
+ (0, import_confetti.fireConfetti)();
43
+ }
44
+ if (!success) confettiFired.current = false;
45
+ }, [success]);
46
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.Dialog, { open: phase !== "idle", modal: true, onOpenChange: (open) => {
47
+ if (!open && !working) reset();
48
+ }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
49
+ import_dialog.DialogContent,
50
+ {
51
+ className: "sm:max-w-md",
52
+ onInteractOutside: working ? (e) => e.preventDefault() : void 0,
53
+ onEscapeKeyDown: working ? (e) => e.preventDefault() : void 0,
54
+ ...working ? { hideClose: true } : {},
55
+ children: [
56
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.DialogTitle, { className: "sr-only", children: working ? workingLabel : title }),
57
+ working && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-col items-center gap-6 py-4", children: [
58
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex h-16 w-16 items-center justify-center rounded-full bg-primary/10", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Loader2, { className: "h-8 w-8 animate-spin text-primary" }) }),
59
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-1 text-center", children: [
60
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-lg font-semibold", children: workingLabel }),
61
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm text-muted-foreground", children: phase === "confirming" ? "Waiting for block confirmation" : "Submitting transaction" })
62
+ ] }),
63
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ol", { className: "w-full space-y-2 rounded-xl border border-border/60 bg-muted/30 p-4", children: steps.map((label, i) => {
64
+ const active = i === ACTIVE_STEP[phase];
65
+ const done = i < ACTIVE_STEP[phase];
66
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("li", { "data-step": true, "aria-current": active ? "step" : void 0, className: "flex items-center gap-3", children: [
67
+ done ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.CheckCircle2, { className: "h-4 w-4 shrink-0 text-emerald-500" }) : active ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Loader2, { className: "h-4 w-4 shrink-0 animate-spin text-primary" }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "h-4 w-4 shrink-0 rounded-full border-2 border-muted-foreground/30" }),
68
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: done ? "text-sm text-foreground" : active ? "text-sm font-medium text-primary" : "text-sm text-muted-foreground", children: label })
69
+ ] }, label);
70
+ }) }),
71
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-center text-xs text-muted-foreground", children: "This usually takes 10\u201330 seconds. Do not close this window." })
72
+ ] }),
73
+ success && children,
74
+ failed && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-col items-center gap-5 py-2", children: [
75
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex h-16 w-16 items-center justify-center rounded-full bg-destructive/10", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.XCircle, { className: "h-9 w-9 text-destructive" }) }),
76
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-1 text-center", children: [
77
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-xl font-bold", children: "Something went wrong" }),
78
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "mx-auto max-w-xs text-sm text-muted-foreground", children: error ?? "We couldn't complete that. Please try again." })
79
+ ] }),
80
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_button.Button, { variant: "outline", className: "w-full", onClick: reset, children: "Try again" })
81
+ ] })
82
+ ]
83
+ }
84
+ ) });
85
+ }
86
+ // Annotate the CommonJS export names for ESM import in node:
87
+ 0 && (module.exports = {
88
+ TransactionDialog
89
+ });
90
+ //# sourceMappingURL=transaction-dialog.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/transaction-dialog.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useRef, type ReactNode } from \"react\";\nimport { CheckCircle2, Loader2, XCircle } from \"lucide-react\";\nimport { Dialog, DialogContent, DialogTitle } from \"./dialog.js\";\nimport { Button } from \"./button.js\";\nimport { fireConfetti } from \"../utils/media-wallet/confetti.js\";\nimport type { useTransaction } from \"../utils/use-transaction.js\";\n\nexport interface TransactionDialogProps {\n tx: Pick<ReturnType<typeof useTransaction>, \"phase\" | \"error\" | \"reset\">;\n title: string;\n workingLabel: string;\n firstStepLabel?: string;\n children?: ReactNode;\n}\n\nconst ACTIVE_STEP = { preparing: 0, submitting: 1, confirming: 2 } as const;\n\nexport function TransactionDialog({ tx, title, workingLabel, firstStepLabel = \"Prepare\", children }: TransactionDialogProps) {\n const { phase, error, reset } = tx;\n const working = phase === \"preparing\" || phase === \"submitting\" || phase === \"confirming\";\n const success = phase === \"success\";\n const failed = phase === \"error\";\n const steps = [firstStepLabel, \"Submit transaction\", \"Confirm transaction\"];\n\n const confettiFired = useRef(false);\n useEffect(() => {\n if (success && !confettiFired.current) {\n confettiFired.current = true;\n fireConfetti();\n }\n if (!success) confettiFired.current = false;\n }, [success]);\n\n return (\n <Dialog open={phase !== \"idle\"} modal onOpenChange={(open) => { if (!open && !working) reset(); }}>\n <DialogContent\n className=\"sm:max-w-md\"\n onInteractOutside={working ? (e) => e.preventDefault() : undefined}\n onEscapeKeyDown={working ? (e) => e.preventDefault() : undefined}\n {...(working ? { hideClose: true } : {})}\n >\n <DialogTitle className=\"sr-only\">{working ? workingLabel : title}</DialogTitle>\n\n {working && (\n <div className=\"flex flex-col items-center gap-6 py-4\">\n <div className=\"flex h-16 w-16 items-center justify-center rounded-full bg-primary/10\">\n <Loader2 className=\"h-8 w-8 animate-spin text-primary\" />\n </div>\n <div className=\"space-y-1 text-center\">\n <p className=\"text-lg font-semibold\">{workingLabel}</p>\n <p className=\"text-sm text-muted-foreground\">\n {phase === \"confirming\" ? \"Waiting for block confirmation\" : \"Submitting transaction\"}\n </p>\n </div>\n <ol className=\"w-full space-y-2 rounded-xl border border-border/60 bg-muted/30 p-4\">\n {steps.map((label, i) => {\n const active = i === ACTIVE_STEP[phase];\n const done = i < ACTIVE_STEP[phase];\n return (\n <li key={label} data-step aria-current={active ? \"step\" : undefined} className=\"flex items-center gap-3\">\n {done ? (\n <CheckCircle2 className=\"h-4 w-4 shrink-0 text-emerald-500\" />\n ) : active ? (\n <Loader2 className=\"h-4 w-4 shrink-0 animate-spin text-primary\" />\n ) : (\n <div className=\"h-4 w-4 shrink-0 rounded-full border-2 border-muted-foreground/30\" />\n )}\n <span className={done ? \"text-sm text-foreground\" : active ? \"text-sm font-medium text-primary\" : \"text-sm text-muted-foreground\"}>\n {label}\n </span>\n </li>\n );\n })}\n </ol>\n <p className=\"text-center text-xs text-muted-foreground\">This usually takes 10–30 seconds. Do not close this window.</p>\n </div>\n )}\n\n {success && children}\n\n {failed && (\n <div className=\"flex flex-col items-center gap-5 py-2\">\n <div className=\"flex h-16 w-16 items-center justify-center rounded-full bg-destructive/10\">\n <XCircle className=\"h-9 w-9 text-destructive\" />\n </div>\n <div className=\"space-y-1 text-center\">\n <p className=\"text-xl font-bold\">Something went wrong</p>\n <p className=\"mx-auto max-w-xs text-sm text-muted-foreground\">{error ?? \"We couldn't complete that. Please try again.\"}</p>\n </div>\n <Button variant=\"outline\" className=\"w-full\" onClick={reset}>\n Try again\n </Button>\n </div>\n )}\n </DialogContent>\n </Dialog>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA2CQ;AAzCR,mBAAkD;AAClD,0BAA+C;AAC/C,oBAAmD;AACnD,oBAAuB;AACvB,sBAA6B;AAW7B,MAAM,cAAc,EAAE,WAAW,GAAG,YAAY,GAAG,YAAY,EAAE;AAE1D,SAAS,kBAAkB,EAAE,IAAI,OAAO,cAAc,iBAAiB,WAAW,SAAS,GAA2B;AAC3H,QAAM,EAAE,OAAO,OAAO,MAAM,IAAI;AAChC,QAAM,UAAU,UAAU,eAAe,UAAU,gBAAgB,UAAU;AAC7E,QAAM,UAAU,UAAU;AAC1B,QAAM,SAAS,UAAU;AACzB,QAAM,QAAQ,CAAC,gBAAgB,sBAAsB,qBAAqB;AAE1E,QAAM,oBAAgB,qBAAO,KAAK;AAClC,8BAAU,MAAM;AACd,QAAI,WAAW,CAAC,cAAc,SAAS;AACrC,oBAAc,UAAU;AACxB,wCAAa;AAAA,IACf;AACA,QAAI,CAAC,QAAS,eAAc,UAAU;AAAA,EACxC,GAAG,CAAC,OAAO,CAAC;AAEZ,SACE,4CAAC,wBAAO,MAAM,UAAU,QAAQ,OAAK,MAAC,cAAc,CAAC,SAAS;AAAE,QAAI,CAAC,QAAQ,CAAC,QAAS,OAAM;AAAA,EAAG,GAC9F;AAAA,IAAC;AAAA;AAAA,MACC,WAAU;AAAA,MACV,mBAAmB,UAAU,CAAC,MAAM,EAAE,eAAe,IAAI;AAAA,MACzD,iBAAiB,UAAU,CAAC,MAAM,EAAE,eAAe,IAAI;AAAA,MACtD,GAAI,UAAU,EAAE,WAAW,KAAK,IAAI,CAAC;AAAA,MAEtC;AAAA,oDAAC,6BAAY,WAAU,WAAW,oBAAU,eAAe,OAAM;AAAA,QAEhE,WACC,6CAAC,SAAI,WAAU,yCACb;AAAA,sDAAC,SAAI,WAAU,yEACb,sDAAC,+BAAQ,WAAU,qCAAoC,GACzD;AAAA,UACA,6CAAC,SAAI,WAAU,yBACb;AAAA,wDAAC,OAAE,WAAU,yBAAyB,wBAAa;AAAA,YACnD,4CAAC,OAAE,WAAU,iCACV,oBAAU,eAAe,mCAAmC,0BAC/D;AAAA,aACF;AAAA,UACA,4CAAC,QAAG,WAAU,uEACX,gBAAM,IAAI,CAAC,OAAO,MAAM;AACvB,kBAAM,SAAS,MAAM,YAAY,KAAK;AACtC,kBAAM,OAAO,IAAI,YAAY,KAAK;AAClC,mBACE,6CAAC,QAAe,aAAS,MAAC,gBAAc,SAAS,SAAS,QAAW,WAAU,2BAC5E;AAAA,qBACC,4CAAC,oCAAa,WAAU,qCAAoC,IAC1D,SACF,4CAAC,+BAAQ,WAAU,8CAA6C,IAEhE,4CAAC,SAAI,WAAU,qEAAoE;AAAA,cAErF,4CAAC,UAAK,WAAW,OAAO,4BAA4B,SAAS,qCAAqC,iCAC/F,iBACH;AAAA,iBAVO,KAWT;AAAA,UAEJ,CAAC,GACH;AAAA,UACA,4CAAC,OAAE,WAAU,6CAA4C,8EAA2D;AAAA,WACtH;AAAA,QAGD,WAAW;AAAA,QAEX,UACC,6CAAC,SAAI,WAAU,yCACb;AAAA,sDAAC,SAAI,WAAU,6EACb,sDAAC,+BAAQ,WAAU,4BAA2B,GAChD;AAAA,UACA,6CAAC,SAAI,WAAU,yBACb;AAAA,wDAAC,OAAE,WAAU,qBAAoB,kCAAoB;AAAA,YACrD,4CAAC,OAAE,WAAU,kDAAkD,mBAAS,gDAA+C;AAAA,aACzH;AAAA,UACA,4CAAC,wBAAO,SAAQ,WAAU,WAAU,UAAS,SAAS,OAAO,uBAE7D;AAAA,WACF;AAAA;AAAA;AAAA,EAEJ,GACF;AAEJ;","names":[]}
@@ -0,0 +1,18 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ReactNode } from 'react';
3
+ import { useTransaction } from '../utils/use-transaction.cjs';
4
+ import '@medialane/sdk/starknet';
5
+ import './fast-mint/types.cjs';
6
+ import 'starknet';
7
+ import '@medialane/sdk';
8
+
9
+ interface TransactionDialogProps {
10
+ tx: Pick<ReturnType<typeof useTransaction>, "phase" | "error" | "reset">;
11
+ title: string;
12
+ workingLabel: string;
13
+ firstStepLabel?: string;
14
+ children?: ReactNode;
15
+ }
16
+ declare function TransactionDialog({ tx, title, workingLabel, firstStepLabel, children }: TransactionDialogProps): react_jsx_runtime.JSX.Element;
17
+
18
+ export { TransactionDialog, type TransactionDialogProps };
@@ -0,0 +1,18 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ReactNode } from 'react';
3
+ import { useTransaction } from '../utils/use-transaction.js';
4
+ import '@medialane/sdk/starknet';
5
+ import './fast-mint/types.js';
6
+ import 'starknet';
7
+ import '@medialane/sdk';
8
+
9
+ interface TransactionDialogProps {
10
+ tx: Pick<ReturnType<typeof useTransaction>, "phase" | "error" | "reset">;
11
+ title: string;
12
+ workingLabel: string;
13
+ firstStepLabel?: string;
14
+ children?: ReactNode;
15
+ }
16
+ declare function TransactionDialog({ tx, title, workingLabel, firstStepLabel, children }: TransactionDialogProps): react_jsx_runtime.JSX.Element;
17
+
18
+ export { TransactionDialog, type TransactionDialogProps };
@@ -0,0 +1,66 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useEffect, useRef } from "react";
4
+ import { CheckCircle2, Loader2, XCircle } from "lucide-react";
5
+ import { Dialog, DialogContent, DialogTitle } from "./dialog.js";
6
+ import { Button } from "./button.js";
7
+ import { fireConfetti } from "../utils/media-wallet/confetti.js";
8
+ const ACTIVE_STEP = { preparing: 0, submitting: 1, confirming: 2 };
9
+ function TransactionDialog({ tx, title, workingLabel, firstStepLabel = "Prepare", children }) {
10
+ const { phase, error, reset } = tx;
11
+ const working = phase === "preparing" || phase === "submitting" || phase === "confirming";
12
+ const success = phase === "success";
13
+ const failed = phase === "error";
14
+ const steps = [firstStepLabel, "Submit transaction", "Confirm transaction"];
15
+ const confettiFired = useRef(false);
16
+ useEffect(() => {
17
+ if (success && !confettiFired.current) {
18
+ confettiFired.current = true;
19
+ fireConfetti();
20
+ }
21
+ if (!success) confettiFired.current = false;
22
+ }, [success]);
23
+ return /* @__PURE__ */ jsx(Dialog, { open: phase !== "idle", modal: true, onOpenChange: (open) => {
24
+ if (!open && !working) reset();
25
+ }, children: /* @__PURE__ */ jsxs(
26
+ DialogContent,
27
+ {
28
+ className: "sm:max-w-md",
29
+ onInteractOutside: working ? (e) => e.preventDefault() : void 0,
30
+ onEscapeKeyDown: working ? (e) => e.preventDefault() : void 0,
31
+ ...working ? { hideClose: true } : {},
32
+ children: [
33
+ /* @__PURE__ */ jsx(DialogTitle, { className: "sr-only", children: working ? workingLabel : title }),
34
+ working && /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-6 py-4", children: [
35
+ /* @__PURE__ */ jsx("div", { className: "flex h-16 w-16 items-center justify-center rounded-full bg-primary/10", children: /* @__PURE__ */ jsx(Loader2, { className: "h-8 w-8 animate-spin text-primary" }) }),
36
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1 text-center", children: [
37
+ /* @__PURE__ */ jsx("p", { className: "text-lg font-semibold", children: workingLabel }),
38
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: phase === "confirming" ? "Waiting for block confirmation" : "Submitting transaction" })
39
+ ] }),
40
+ /* @__PURE__ */ jsx("ol", { className: "w-full space-y-2 rounded-xl border border-border/60 bg-muted/30 p-4", children: steps.map((label, i) => {
41
+ const active = i === ACTIVE_STEP[phase];
42
+ const done = i < ACTIVE_STEP[phase];
43
+ return /* @__PURE__ */ jsxs("li", { "data-step": true, "aria-current": active ? "step" : void 0, className: "flex items-center gap-3", children: [
44
+ done ? /* @__PURE__ */ jsx(CheckCircle2, { className: "h-4 w-4 shrink-0 text-emerald-500" }) : active ? /* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 shrink-0 animate-spin text-primary" }) : /* @__PURE__ */ jsx("div", { className: "h-4 w-4 shrink-0 rounded-full border-2 border-muted-foreground/30" }),
45
+ /* @__PURE__ */ jsx("span", { className: done ? "text-sm text-foreground" : active ? "text-sm font-medium text-primary" : "text-sm text-muted-foreground", children: label })
46
+ ] }, label);
47
+ }) }),
48
+ /* @__PURE__ */ jsx("p", { className: "text-center text-xs text-muted-foreground", children: "This usually takes 10\u201330 seconds. Do not close this window." })
49
+ ] }),
50
+ success && children,
51
+ failed && /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-5 py-2", children: [
52
+ /* @__PURE__ */ jsx("div", { className: "flex h-16 w-16 items-center justify-center rounded-full bg-destructive/10", children: /* @__PURE__ */ jsx(XCircle, { className: "h-9 w-9 text-destructive" }) }),
53
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1 text-center", children: [
54
+ /* @__PURE__ */ jsx("p", { className: "text-xl font-bold", children: "Something went wrong" }),
55
+ /* @__PURE__ */ jsx("p", { className: "mx-auto max-w-xs text-sm text-muted-foreground", children: error ?? "We couldn't complete that. Please try again." })
56
+ ] }),
57
+ /* @__PURE__ */ jsx(Button, { variant: "outline", className: "w-full", onClick: reset, children: "Try again" })
58
+ ] })
59
+ ]
60
+ }
61
+ ) });
62
+ }
63
+ export {
64
+ TransactionDialog
65
+ };
66
+ //# sourceMappingURL=transaction-dialog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/transaction-dialog.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useRef, type ReactNode } from \"react\";\nimport { CheckCircle2, Loader2, XCircle } from \"lucide-react\";\nimport { Dialog, DialogContent, DialogTitle } from \"./dialog.js\";\nimport { Button } from \"./button.js\";\nimport { fireConfetti } from \"../utils/media-wallet/confetti.js\";\nimport type { useTransaction } from \"../utils/use-transaction.js\";\n\nexport interface TransactionDialogProps {\n tx: Pick<ReturnType<typeof useTransaction>, \"phase\" | \"error\" | \"reset\">;\n title: string;\n workingLabel: string;\n firstStepLabel?: string;\n children?: ReactNode;\n}\n\nconst ACTIVE_STEP = { preparing: 0, submitting: 1, confirming: 2 } as const;\n\nexport function TransactionDialog({ tx, title, workingLabel, firstStepLabel = \"Prepare\", children }: TransactionDialogProps) {\n const { phase, error, reset } = tx;\n const working = phase === \"preparing\" || phase === \"submitting\" || phase === \"confirming\";\n const success = phase === \"success\";\n const failed = phase === \"error\";\n const steps = [firstStepLabel, \"Submit transaction\", \"Confirm transaction\"];\n\n const confettiFired = useRef(false);\n useEffect(() => {\n if (success && !confettiFired.current) {\n confettiFired.current = true;\n fireConfetti();\n }\n if (!success) confettiFired.current = false;\n }, [success]);\n\n return (\n <Dialog open={phase !== \"idle\"} modal onOpenChange={(open) => { if (!open && !working) reset(); }}>\n <DialogContent\n className=\"sm:max-w-md\"\n onInteractOutside={working ? (e) => e.preventDefault() : undefined}\n onEscapeKeyDown={working ? (e) => e.preventDefault() : undefined}\n {...(working ? { hideClose: true } : {})}\n >\n <DialogTitle className=\"sr-only\">{working ? workingLabel : title}</DialogTitle>\n\n {working && (\n <div className=\"flex flex-col items-center gap-6 py-4\">\n <div className=\"flex h-16 w-16 items-center justify-center rounded-full bg-primary/10\">\n <Loader2 className=\"h-8 w-8 animate-spin text-primary\" />\n </div>\n <div className=\"space-y-1 text-center\">\n <p className=\"text-lg font-semibold\">{workingLabel}</p>\n <p className=\"text-sm text-muted-foreground\">\n {phase === \"confirming\" ? \"Waiting for block confirmation\" : \"Submitting transaction\"}\n </p>\n </div>\n <ol className=\"w-full space-y-2 rounded-xl border border-border/60 bg-muted/30 p-4\">\n {steps.map((label, i) => {\n const active = i === ACTIVE_STEP[phase];\n const done = i < ACTIVE_STEP[phase];\n return (\n <li key={label} data-step aria-current={active ? \"step\" : undefined} className=\"flex items-center gap-3\">\n {done ? (\n <CheckCircle2 className=\"h-4 w-4 shrink-0 text-emerald-500\" />\n ) : active ? (\n <Loader2 className=\"h-4 w-4 shrink-0 animate-spin text-primary\" />\n ) : (\n <div className=\"h-4 w-4 shrink-0 rounded-full border-2 border-muted-foreground/30\" />\n )}\n <span className={done ? \"text-sm text-foreground\" : active ? \"text-sm font-medium text-primary\" : \"text-sm text-muted-foreground\"}>\n {label}\n </span>\n </li>\n );\n })}\n </ol>\n <p className=\"text-center text-xs text-muted-foreground\">This usually takes 10–30 seconds. Do not close this window.</p>\n </div>\n )}\n\n {success && children}\n\n {failed && (\n <div className=\"flex flex-col items-center gap-5 py-2\">\n <div className=\"flex h-16 w-16 items-center justify-center rounded-full bg-destructive/10\">\n <XCircle className=\"h-9 w-9 text-destructive\" />\n </div>\n <div className=\"space-y-1 text-center\">\n <p className=\"text-xl font-bold\">Something went wrong</p>\n <p className=\"mx-auto max-w-xs text-sm text-muted-foreground\">{error ?? \"We couldn't complete that. Please try again.\"}</p>\n </div>\n <Button variant=\"outline\" className=\"w-full\" onClick={reset}>\n Try again\n </Button>\n </div>\n )}\n </DialogContent>\n </Dialog>\n );\n}\n"],"mappings":";AA2CQ,cAOI,YAPJ;AAzCR,SAAS,WAAW,cAA8B;AAClD,SAAS,cAAc,SAAS,eAAe;AAC/C,SAAS,QAAQ,eAAe,mBAAmB;AACnD,SAAS,cAAc;AACvB,SAAS,oBAAoB;AAW7B,MAAM,cAAc,EAAE,WAAW,GAAG,YAAY,GAAG,YAAY,EAAE;AAE1D,SAAS,kBAAkB,EAAE,IAAI,OAAO,cAAc,iBAAiB,WAAW,SAAS,GAA2B;AAC3H,QAAM,EAAE,OAAO,OAAO,MAAM,IAAI;AAChC,QAAM,UAAU,UAAU,eAAe,UAAU,gBAAgB,UAAU;AAC7E,QAAM,UAAU,UAAU;AAC1B,QAAM,SAAS,UAAU;AACzB,QAAM,QAAQ,CAAC,gBAAgB,sBAAsB,qBAAqB;AAE1E,QAAM,gBAAgB,OAAO,KAAK;AAClC,YAAU,MAAM;AACd,QAAI,WAAW,CAAC,cAAc,SAAS;AACrC,oBAAc,UAAU;AACxB,mBAAa;AAAA,IACf;AACA,QAAI,CAAC,QAAS,eAAc,UAAU;AAAA,EACxC,GAAG,CAAC,OAAO,CAAC;AAEZ,SACE,oBAAC,UAAO,MAAM,UAAU,QAAQ,OAAK,MAAC,cAAc,CAAC,SAAS;AAAE,QAAI,CAAC,QAAQ,CAAC,QAAS,OAAM;AAAA,EAAG,GAC9F;AAAA,IAAC;AAAA;AAAA,MACC,WAAU;AAAA,MACV,mBAAmB,UAAU,CAAC,MAAM,EAAE,eAAe,IAAI;AAAA,MACzD,iBAAiB,UAAU,CAAC,MAAM,EAAE,eAAe,IAAI;AAAA,MACtD,GAAI,UAAU,EAAE,WAAW,KAAK,IAAI,CAAC;AAAA,MAEtC;AAAA,4BAAC,eAAY,WAAU,WAAW,oBAAU,eAAe,OAAM;AAAA,QAEhE,WACC,qBAAC,SAAI,WAAU,yCACb;AAAA,8BAAC,SAAI,WAAU,yEACb,8BAAC,WAAQ,WAAU,qCAAoC,GACzD;AAAA,UACA,qBAAC,SAAI,WAAU,yBACb;AAAA,gCAAC,OAAE,WAAU,yBAAyB,wBAAa;AAAA,YACnD,oBAAC,OAAE,WAAU,iCACV,oBAAU,eAAe,mCAAmC,0BAC/D;AAAA,aACF;AAAA,UACA,oBAAC,QAAG,WAAU,uEACX,gBAAM,IAAI,CAAC,OAAO,MAAM;AACvB,kBAAM,SAAS,MAAM,YAAY,KAAK;AACtC,kBAAM,OAAO,IAAI,YAAY,KAAK;AAClC,mBACE,qBAAC,QAAe,aAAS,MAAC,gBAAc,SAAS,SAAS,QAAW,WAAU,2BAC5E;AAAA,qBACC,oBAAC,gBAAa,WAAU,qCAAoC,IAC1D,SACF,oBAAC,WAAQ,WAAU,8CAA6C,IAEhE,oBAAC,SAAI,WAAU,qEAAoE;AAAA,cAErF,oBAAC,UAAK,WAAW,OAAO,4BAA4B,SAAS,qCAAqC,iCAC/F,iBACH;AAAA,iBAVO,KAWT;AAAA,UAEJ,CAAC,GACH;AAAA,UACA,oBAAC,OAAE,WAAU,6CAA4C,8EAA2D;AAAA,WACtH;AAAA,QAGD,WAAW;AAAA,QAEX,UACC,qBAAC,SAAI,WAAU,yCACb;AAAA,8BAAC,SAAI,WAAU,6EACb,8BAAC,WAAQ,WAAU,4BAA2B,GAChD;AAAA,UACA,qBAAC,SAAI,WAAU,yBACb;AAAA,gCAAC,OAAE,WAAU,qBAAoB,kCAAoB;AAAA,YACrD,oBAAC,OAAE,WAAU,kDAAkD,mBAAS,gDAA+C;AAAA,aACzH;AAAA,UACA,oBAAC,UAAO,SAAQ,WAAU,WAAU,UAAS,SAAS,OAAO,uBAE7D;AAAA,WACF;AAAA;AAAA;AAAA,EAEJ,GACF;AAEJ;","names":[]}