@medialane/ui 0.178.0 → 0.180.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/fast-mint/fast-mint.d.cts +2 -2
- package/dist/components/fast-mint/fast-mint.d.ts +2 -2
- package/dist/components/sheet.d.cts +1 -1
- package/dist/components/sheet.d.ts +1 -1
- package/dist/utils/describe-error.cjs +4 -0
- package/dist/utils/describe-error.cjs.map +1 -1
- package/dist/utils/describe-error.js +4 -0
- package/dist/utils/describe-error.js.map +1 -1
- package/dist/utils/wallet-failure.cjs +2 -2
- package/dist/utils/wallet-failure.cjs.map +1 -1
- package/dist/utils/wallet-failure.js +2 -2
- package/dist/utils/wallet-failure.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
3
|
import { FastMintProps } from './types.cjs';
|
|
4
4
|
import 'starknet';
|
|
5
5
|
import '@medialane/sdk';
|
|
6
6
|
import '@medialane/sdk/starknet';
|
|
7
7
|
|
|
8
|
-
declare function FastMint(props: FastMintProps): string | number | bigint | boolean |
|
|
8
|
+
declare function FastMint(props: FastMintProps): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
|
|
9
9
|
|
|
10
10
|
export { FastMint };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
3
|
import { FastMintProps } from './types.js';
|
|
4
4
|
import 'starknet';
|
|
5
5
|
import '@medialane/sdk';
|
|
6
6
|
import '@medialane/sdk/starknet';
|
|
7
7
|
|
|
8
|
-
declare function FastMint(props: FastMintProps): string | number | bigint | boolean |
|
|
8
|
+
declare function FastMint(props: FastMintProps): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
|
|
9
9
|
|
|
10
10
|
export { FastMint };
|
|
@@ -10,7 +10,7 @@ declare const SheetClose: React.ForwardRefExoticComponent<SheetPrimitive.DialogC
|
|
|
10
10
|
declare const SheetPortal: React.FC<SheetPrimitive.DialogPortalProps>;
|
|
11
11
|
declare const SheetOverlay: React.ForwardRefExoticComponent<Omit<SheetPrimitive.DialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
12
12
|
declare const sheetVariants: (props?: ({
|
|
13
|
-
side?: "
|
|
13
|
+
side?: "left" | "right" | "bottom" | "top" | null | undefined;
|
|
14
14
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
15
15
|
interface SheetContentProps extends React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content>, VariantProps<typeof sheetVariants> {
|
|
16
16
|
overlayClassName?: string;
|
|
@@ -10,7 +10,7 @@ declare const SheetClose: React.ForwardRefExoticComponent<SheetPrimitive.DialogC
|
|
|
10
10
|
declare const SheetPortal: React.FC<SheetPrimitive.DialogPortalProps>;
|
|
11
11
|
declare const SheetOverlay: React.ForwardRefExoticComponent<Omit<SheetPrimitive.DialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
12
12
|
declare const sheetVariants: (props?: ({
|
|
13
|
-
side?: "
|
|
13
|
+
side?: "left" | "right" | "bottom" | "top" | null | undefined;
|
|
14
14
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
15
15
|
interface SheetContentProps extends React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content>, VariantProps<typeof sheetVariants> {
|
|
16
16
|
overlayClassName?: string;
|
|
@@ -27,6 +27,7 @@ __export(describe_error_exports, {
|
|
|
27
27
|
module.exports = __toCommonJS(describe_error_exports);
|
|
28
28
|
var import_sdk = require("@medialane/sdk");
|
|
29
29
|
var import_wallet_error = require("./wallet-error.js");
|
|
30
|
+
var import_wallet_failure = require("./wallet-failure.js");
|
|
30
31
|
const NOT_SUBMITTED = "Request not completed. Nothing was submitted.";
|
|
31
32
|
const GENERIC = "Something went wrong. Please try again.";
|
|
32
33
|
const NETWORK_BUSY = "The network is busy right now. Nothing was submitted. Please try again in a moment.";
|
|
@@ -62,6 +63,9 @@ function describeError(error, fallback) {
|
|
|
62
63
|
isUserRejection: true
|
|
63
64
|
};
|
|
64
65
|
}
|
|
66
|
+
if ((0, import_wallet_failure.passkeyUnsupportedReason)(error)) {
|
|
67
|
+
return notice("Passkey not supported", (0, import_wallet_failure.describeWalletFailure)(error).message);
|
|
68
|
+
}
|
|
65
69
|
if (error instanceof import_wallet_error.WrongNetworkError) {
|
|
66
70
|
return notice(
|
|
67
71
|
"Wrong network",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/describe-error.ts"],"sourcesContent":["import { MedialaneApiError, PasskeyCancelledError, UserFacingError } from \"@medialane/sdk\";\nimport { WrongNetworkError, isBareExecuteFailure, isUserRejectedRequest, collectErrorText } from \"./wallet-error.js\";\n\nexport const NOT_SUBMITTED = \"Request not completed. Nothing was submitted.\";\nexport const GENERIC = \"Something went wrong. Please try again.\";\nexport const NETWORK_BUSY =\n \"The network is busy right now. Nothing was submitted. Please try again in a moment.\";\n\nexport interface ErrorNotice {\n title: string;\n message: string;\n description?: string;\n isUserRejection: boolean;\n}\n\nconst notice = (title: string, message: string, description?: string): ErrorNotice => ({\n title,\n message,\n description,\n isUserRejection: false,\n});\n\nfunction isTransient(error: unknown): boolean {\n if (error instanceof MedialaneApiError) {\n return error.status === 408 || error.status === 429 || error.status >= 500;\n }\n return /-32001|unable to complete request|service unavailable|temporarily unavailable|rate.?limit|too many requests|gateway time-?out|bad gateway|failed to fetch|fetch failed|network ?error|load failed/i.test(\n collectErrorText(error),\n );\n}\n\nfunction apiReason(error: MedialaneApiError): string | undefined {\n const body = error.details;\n if (body && typeof body === \"object\" && \"error\" in body) {\n const reason = (body as { error?: unknown }).error;\n if (typeof reason === \"string\" && reason.trim() !== \"\") return reason;\n }\n return undefined;\n}\n\nexport function describeError(error: unknown, fallback?: string): ErrorNotice {\n if (error instanceof PasskeyCancelledError || isUserRejectedRequest(error)) {\n const unclear = isBareExecuteFailure(error) || error instanceof PasskeyCancelledError;\n return {\n title: \"Request not completed\",\n message: NOT_SUBMITTED,\n description: unclear\n ? \"Your wallet didn't complete this request. You may have closed or declined it, it may need extra verification such as 2FA before it can sign, or it may have hit a temporary network hiccup. Try again in a moment.\"\n : \"Your wallet didn't complete this request. You may have closed or declined it, or it may need extra verification before it can sign.\",\n isUserRejection: true,\n };\n }\n\n if (error instanceof WrongNetworkError) {\n return notice(\n \"Wrong network\",\n \"Your wallet is connected to the wrong network. Nothing was submitted.\",\n \"Switch your wallet to Starknet Mainnet, then try again.\",\n );\n }\n\n if (isTransient(error)) {\n return notice(\"Network busy\", NETWORK_BUSY);\n }\n\n if (error instanceof UserFacingError) {\n return notice(\"Something went wrong\", error.message);\n }\n\n if (error instanceof MedialaneApiError) {\n return notice(\"Something went wrong\", apiReason(error) ?? fallback ?? GENERIC);\n }\n\n const text = collectErrorText(error).toLowerCase();\n if (text.includes(\"insufficient\") && /balance|allowance|funds/.test(text)) {\n return notice(\n \"Insufficient balance\",\n \"You don't have enough balance to complete this transaction.\",\n \"Add funds to your wallet, then try again.\",\n );\n }\n\n return notice(\"Something went wrong\", fallback ?? GENERIC);\n}\n\nexport { UserFacingError };\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAA0E;AAC1E,0BAAiG;
|
|
1
|
+
{"version":3,"sources":["../../src/utils/describe-error.ts"],"sourcesContent":["import { MedialaneApiError, PasskeyCancelledError, UserFacingError } from \"@medialane/sdk\";\nimport { WrongNetworkError, isBareExecuteFailure, isUserRejectedRequest, collectErrorText } from \"./wallet-error.js\";\nimport { describeWalletFailure, passkeyUnsupportedReason } from \"./wallet-failure.js\";\n\nexport const NOT_SUBMITTED = \"Request not completed. Nothing was submitted.\";\nexport const GENERIC = \"Something went wrong. Please try again.\";\nexport const NETWORK_BUSY =\n \"The network is busy right now. Nothing was submitted. Please try again in a moment.\";\n\nexport interface ErrorNotice {\n title: string;\n message: string;\n description?: string;\n isUserRejection: boolean;\n}\n\nconst notice = (title: string, message: string, description?: string): ErrorNotice => ({\n title,\n message,\n description,\n isUserRejection: false,\n});\n\nfunction isTransient(error: unknown): boolean {\n if (error instanceof MedialaneApiError) {\n return error.status === 408 || error.status === 429 || error.status >= 500;\n }\n return /-32001|unable to complete request|service unavailable|temporarily unavailable|rate.?limit|too many requests|gateway time-?out|bad gateway|failed to fetch|fetch failed|network ?error|load failed/i.test(\n collectErrorText(error),\n );\n}\n\nfunction apiReason(error: MedialaneApiError): string | undefined {\n const body = error.details;\n if (body && typeof body === \"object\" && \"error\" in body) {\n const reason = (body as { error?: unknown }).error;\n if (typeof reason === \"string\" && reason.trim() !== \"\") return reason;\n }\n return undefined;\n}\n\nexport function describeError(error: unknown, fallback?: string): ErrorNotice {\n if (error instanceof PasskeyCancelledError || isUserRejectedRequest(error)) {\n const unclear = isBareExecuteFailure(error) || error instanceof PasskeyCancelledError;\n return {\n title: \"Request not completed\",\n message: NOT_SUBMITTED,\n description: unclear\n ? \"Your wallet didn't complete this request. You may have closed or declined it, it may need extra verification such as 2FA before it can sign, or it may have hit a temporary network hiccup. Try again in a moment.\"\n : \"Your wallet didn't complete this request. You may have closed or declined it, or it may need extra verification before it can sign.\",\n isUserRejection: true,\n };\n }\n\n if (passkeyUnsupportedReason(error)) {\n return notice(\"Passkey not supported\", describeWalletFailure(error).message);\n }\n\n if (error instanceof WrongNetworkError) {\n return notice(\n \"Wrong network\",\n \"Your wallet is connected to the wrong network. Nothing was submitted.\",\n \"Switch your wallet to Starknet Mainnet, then try again.\",\n );\n }\n\n if (isTransient(error)) {\n return notice(\"Network busy\", NETWORK_BUSY);\n }\n\n if (error instanceof UserFacingError) {\n return notice(\"Something went wrong\", error.message);\n }\n\n if (error instanceof MedialaneApiError) {\n return notice(\"Something went wrong\", apiReason(error) ?? fallback ?? GENERIC);\n }\n\n const text = collectErrorText(error).toLowerCase();\n if (text.includes(\"insufficient\") && /balance|allowance|funds/.test(text)) {\n return notice(\n \"Insufficient balance\",\n \"You don't have enough balance to complete this transaction.\",\n \"Add funds to your wallet, then try again.\",\n );\n }\n\n return notice(\"Something went wrong\", fallback ?? GENERIC);\n}\n\nexport { UserFacingError };\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAA0E;AAC1E,0BAAiG;AACjG,4BAAgE;AAEzD,MAAM,gBAAgB;AACtB,MAAM,UAAU;AAChB,MAAM,eACX;AASF,MAAM,SAAS,CAAC,OAAe,SAAiB,iBAAuC;AAAA,EACrF;AAAA,EACA;AAAA,EACA;AAAA,EACA,iBAAiB;AACnB;AAEA,SAAS,YAAY,OAAyB;AAC5C,MAAI,iBAAiB,8BAAmB;AACtC,WAAO,MAAM,WAAW,OAAO,MAAM,WAAW,OAAO,MAAM,UAAU;AAAA,EACzE;AACA,SAAO,qMAAqM;AAAA,QAC1M,sCAAiB,KAAK;AAAA,EACxB;AACF;AAEA,SAAS,UAAU,OAA8C;AAC/D,QAAM,OAAO,MAAM;AACnB,MAAI,QAAQ,OAAO,SAAS,YAAY,WAAW,MAAM;AACvD,UAAM,SAAU,KAA6B;AAC7C,QAAI,OAAO,WAAW,YAAY,OAAO,KAAK,MAAM,GAAI,QAAO;AAAA,EACjE;AACA,SAAO;AACT;AAEO,SAAS,cAAc,OAAgB,UAAgC;AAC5E,MAAI,iBAAiB,wCAAyB,2CAAsB,KAAK,GAAG;AAC1E,UAAM,cAAU,0CAAqB,KAAK,KAAK,iBAAiB;AAChE,WAAO;AAAA,MACL,OAAO;AAAA,MACP,SAAS;AAAA,MACT,aAAa,UACT,uNACA;AAAA,MACJ,iBAAiB;AAAA,IACnB;AAAA,EACF;AAEA,UAAI,gDAAyB,KAAK,GAAG;AACnC,WAAO,OAAO,6BAAyB,6CAAsB,KAAK,EAAE,OAAO;AAAA,EAC7E;AAEA,MAAI,iBAAiB,uCAAmB;AACtC,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,MAAI,YAAY,KAAK,GAAG;AACtB,WAAO,OAAO,gBAAgB,YAAY;AAAA,EAC5C;AAEA,MAAI,iBAAiB,4BAAiB;AACpC,WAAO,OAAO,wBAAwB,MAAM,OAAO;AAAA,EACrD;AAEA,MAAI,iBAAiB,8BAAmB;AACtC,WAAO,OAAO,wBAAwB,UAAU,KAAK,KAAK,YAAY,OAAO;AAAA,EAC/E;AAEA,QAAM,WAAO,sCAAiB,KAAK,EAAE,YAAY;AACjD,MAAI,KAAK,SAAS,cAAc,KAAK,0BAA0B,KAAK,IAAI,GAAG;AACzE,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,SAAO,OAAO,wBAAwB,YAAY,OAAO;AAC3D;","names":[]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { MedialaneApiError, PasskeyCancelledError, UserFacingError } from "@medialane/sdk";
|
|
2
2
|
import { WrongNetworkError, isBareExecuteFailure, isUserRejectedRequest, collectErrorText } from "./wallet-error.js";
|
|
3
|
+
import { describeWalletFailure, passkeyUnsupportedReason } from "./wallet-failure.js";
|
|
3
4
|
const NOT_SUBMITTED = "Request not completed. Nothing was submitted.";
|
|
4
5
|
const GENERIC = "Something went wrong. Please try again.";
|
|
5
6
|
const NETWORK_BUSY = "The network is busy right now. Nothing was submitted. Please try again in a moment.";
|
|
@@ -35,6 +36,9 @@ function describeError(error, fallback) {
|
|
|
35
36
|
isUserRejection: true
|
|
36
37
|
};
|
|
37
38
|
}
|
|
39
|
+
if (passkeyUnsupportedReason(error)) {
|
|
40
|
+
return notice("Passkey not supported", describeWalletFailure(error).message);
|
|
41
|
+
}
|
|
38
42
|
if (error instanceof WrongNetworkError) {
|
|
39
43
|
return notice(
|
|
40
44
|
"Wrong network",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/describe-error.ts"],"sourcesContent":["import { MedialaneApiError, PasskeyCancelledError, UserFacingError } from \"@medialane/sdk\";\nimport { WrongNetworkError, isBareExecuteFailure, isUserRejectedRequest, collectErrorText } from \"./wallet-error.js\";\n\nexport const NOT_SUBMITTED = \"Request not completed. Nothing was submitted.\";\nexport const GENERIC = \"Something went wrong. Please try again.\";\nexport const NETWORK_BUSY =\n \"The network is busy right now. Nothing was submitted. Please try again in a moment.\";\n\nexport interface ErrorNotice {\n title: string;\n message: string;\n description?: string;\n isUserRejection: boolean;\n}\n\nconst notice = (title: string, message: string, description?: string): ErrorNotice => ({\n title,\n message,\n description,\n isUserRejection: false,\n});\n\nfunction isTransient(error: unknown): boolean {\n if (error instanceof MedialaneApiError) {\n return error.status === 408 || error.status === 429 || error.status >= 500;\n }\n return /-32001|unable to complete request|service unavailable|temporarily unavailable|rate.?limit|too many requests|gateway time-?out|bad gateway|failed to fetch|fetch failed|network ?error|load failed/i.test(\n collectErrorText(error),\n );\n}\n\nfunction apiReason(error: MedialaneApiError): string | undefined {\n const body = error.details;\n if (body && typeof body === \"object\" && \"error\" in body) {\n const reason = (body as { error?: unknown }).error;\n if (typeof reason === \"string\" && reason.trim() !== \"\") return reason;\n }\n return undefined;\n}\n\nexport function describeError(error: unknown, fallback?: string): ErrorNotice {\n if (error instanceof PasskeyCancelledError || isUserRejectedRequest(error)) {\n const unclear = isBareExecuteFailure(error) || error instanceof PasskeyCancelledError;\n return {\n title: \"Request not completed\",\n message: NOT_SUBMITTED,\n description: unclear\n ? \"Your wallet didn't complete this request. You may have closed or declined it, it may need extra verification such as 2FA before it can sign, or it may have hit a temporary network hiccup. Try again in a moment.\"\n : \"Your wallet didn't complete this request. You may have closed or declined it, or it may need extra verification before it can sign.\",\n isUserRejection: true,\n };\n }\n\n if (error instanceof WrongNetworkError) {\n return notice(\n \"Wrong network\",\n \"Your wallet is connected to the wrong network. Nothing was submitted.\",\n \"Switch your wallet to Starknet Mainnet, then try again.\",\n );\n }\n\n if (isTransient(error)) {\n return notice(\"Network busy\", NETWORK_BUSY);\n }\n\n if (error instanceof UserFacingError) {\n return notice(\"Something went wrong\", error.message);\n }\n\n if (error instanceof MedialaneApiError) {\n return notice(\"Something went wrong\", apiReason(error) ?? fallback ?? GENERIC);\n }\n\n const text = collectErrorText(error).toLowerCase();\n if (text.includes(\"insufficient\") && /balance|allowance|funds/.test(text)) {\n return notice(\n \"Insufficient balance\",\n \"You don't have enough balance to complete this transaction.\",\n \"Add funds to your wallet, then try again.\",\n );\n }\n\n return notice(\"Something went wrong\", fallback ?? GENERIC);\n}\n\nexport { UserFacingError };\n"],"mappings":"AAAA,SAAS,mBAAmB,uBAAuB,uBAAuB;AAC1E,SAAS,mBAAmB,sBAAsB,uBAAuB,wBAAwB;
|
|
1
|
+
{"version":3,"sources":["../../src/utils/describe-error.ts"],"sourcesContent":["import { MedialaneApiError, PasskeyCancelledError, UserFacingError } from \"@medialane/sdk\";\nimport { WrongNetworkError, isBareExecuteFailure, isUserRejectedRequest, collectErrorText } from \"./wallet-error.js\";\nimport { describeWalletFailure, passkeyUnsupportedReason } from \"./wallet-failure.js\";\n\nexport const NOT_SUBMITTED = \"Request not completed. Nothing was submitted.\";\nexport const GENERIC = \"Something went wrong. Please try again.\";\nexport const NETWORK_BUSY =\n \"The network is busy right now. Nothing was submitted. Please try again in a moment.\";\n\nexport interface ErrorNotice {\n title: string;\n message: string;\n description?: string;\n isUserRejection: boolean;\n}\n\nconst notice = (title: string, message: string, description?: string): ErrorNotice => ({\n title,\n message,\n description,\n isUserRejection: false,\n});\n\nfunction isTransient(error: unknown): boolean {\n if (error instanceof MedialaneApiError) {\n return error.status === 408 || error.status === 429 || error.status >= 500;\n }\n return /-32001|unable to complete request|service unavailable|temporarily unavailable|rate.?limit|too many requests|gateway time-?out|bad gateway|failed to fetch|fetch failed|network ?error|load failed/i.test(\n collectErrorText(error),\n );\n}\n\nfunction apiReason(error: MedialaneApiError): string | undefined {\n const body = error.details;\n if (body && typeof body === \"object\" && \"error\" in body) {\n const reason = (body as { error?: unknown }).error;\n if (typeof reason === \"string\" && reason.trim() !== \"\") return reason;\n }\n return undefined;\n}\n\nexport function describeError(error: unknown, fallback?: string): ErrorNotice {\n if (error instanceof PasskeyCancelledError || isUserRejectedRequest(error)) {\n const unclear = isBareExecuteFailure(error) || error instanceof PasskeyCancelledError;\n return {\n title: \"Request not completed\",\n message: NOT_SUBMITTED,\n description: unclear\n ? \"Your wallet didn't complete this request. You may have closed or declined it, it may need extra verification such as 2FA before it can sign, or it may have hit a temporary network hiccup. Try again in a moment.\"\n : \"Your wallet didn't complete this request. You may have closed or declined it, or it may need extra verification before it can sign.\",\n isUserRejection: true,\n };\n }\n\n if (passkeyUnsupportedReason(error)) {\n return notice(\"Passkey not supported\", describeWalletFailure(error).message);\n }\n\n if (error instanceof WrongNetworkError) {\n return notice(\n \"Wrong network\",\n \"Your wallet is connected to the wrong network. Nothing was submitted.\",\n \"Switch your wallet to Starknet Mainnet, then try again.\",\n );\n }\n\n if (isTransient(error)) {\n return notice(\"Network busy\", NETWORK_BUSY);\n }\n\n if (error instanceof UserFacingError) {\n return notice(\"Something went wrong\", error.message);\n }\n\n if (error instanceof MedialaneApiError) {\n return notice(\"Something went wrong\", apiReason(error) ?? fallback ?? GENERIC);\n }\n\n const text = collectErrorText(error).toLowerCase();\n if (text.includes(\"insufficient\") && /balance|allowance|funds/.test(text)) {\n return notice(\n \"Insufficient balance\",\n \"You don't have enough balance to complete this transaction.\",\n \"Add funds to your wallet, then try again.\",\n );\n }\n\n return notice(\"Something went wrong\", fallback ?? GENERIC);\n}\n\nexport { UserFacingError };\n"],"mappings":"AAAA,SAAS,mBAAmB,uBAAuB,uBAAuB;AAC1E,SAAS,mBAAmB,sBAAsB,uBAAuB,wBAAwB;AACjG,SAAS,uBAAuB,gCAAgC;AAEzD,MAAM,gBAAgB;AACtB,MAAM,UAAU;AAChB,MAAM,eACX;AASF,MAAM,SAAS,CAAC,OAAe,SAAiB,iBAAuC;AAAA,EACrF;AAAA,EACA;AAAA,EACA;AAAA,EACA,iBAAiB;AACnB;AAEA,SAAS,YAAY,OAAyB;AAC5C,MAAI,iBAAiB,mBAAmB;AACtC,WAAO,MAAM,WAAW,OAAO,MAAM,WAAW,OAAO,MAAM,UAAU;AAAA,EACzE;AACA,SAAO,qMAAqM;AAAA,IAC1M,iBAAiB,KAAK;AAAA,EACxB;AACF;AAEA,SAAS,UAAU,OAA8C;AAC/D,QAAM,OAAO,MAAM;AACnB,MAAI,QAAQ,OAAO,SAAS,YAAY,WAAW,MAAM;AACvD,UAAM,SAAU,KAA6B;AAC7C,QAAI,OAAO,WAAW,YAAY,OAAO,KAAK,MAAM,GAAI,QAAO;AAAA,EACjE;AACA,SAAO;AACT;AAEO,SAAS,cAAc,OAAgB,UAAgC;AAC5E,MAAI,iBAAiB,yBAAyB,sBAAsB,KAAK,GAAG;AAC1E,UAAM,UAAU,qBAAqB,KAAK,KAAK,iBAAiB;AAChE,WAAO;AAAA,MACL,OAAO;AAAA,MACP,SAAS;AAAA,MACT,aAAa,UACT,uNACA;AAAA,MACJ,iBAAiB;AAAA,IACnB;AAAA,EACF;AAEA,MAAI,yBAAyB,KAAK,GAAG;AACnC,WAAO,OAAO,yBAAyB,sBAAsB,KAAK,EAAE,OAAO;AAAA,EAC7E;AAEA,MAAI,iBAAiB,mBAAmB;AACtC,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,MAAI,YAAY,KAAK,GAAG;AACtB,WAAO,OAAO,gBAAgB,YAAY;AAAA,EAC5C;AAEA,MAAI,iBAAiB,iBAAiB;AACpC,WAAO,OAAO,wBAAwB,MAAM,OAAO;AAAA,EACrD;AAEA,MAAI,iBAAiB,mBAAmB;AACtC,WAAO,OAAO,wBAAwB,UAAU,KAAK,KAAK,YAAY,OAAO;AAAA,EAC/E;AAEA,QAAM,OAAO,iBAAiB,KAAK,EAAE,YAAY;AACjD,MAAI,KAAK,SAAS,cAAc,KAAK,0BAA0B,KAAK,IAAI,GAAG;AACzE,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,SAAO,OAAO,wBAAwB,YAAY,OAAO;AAC3D;","names":[]}
|
|
@@ -48,14 +48,14 @@ function describeWalletFailure(err, support = "unknown") {
|
|
|
48
48
|
if (unsupported === "no-prf") {
|
|
49
49
|
return {
|
|
50
50
|
kind: "unsupported-passkey",
|
|
51
|
-
message: "
|
|
51
|
+
message: "Let's save your passkey in another place. Try again and choose your phone or password manager.",
|
|
52
52
|
canRetry: true
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
55
|
if (unsupported === "no-webauthn") {
|
|
56
56
|
return {
|
|
57
57
|
kind: "no-passkeys",
|
|
58
|
-
message: "
|
|
58
|
+
message: "Open Medialane in a regular browser window or on another device to continue.",
|
|
59
59
|
canRetry: false
|
|
60
60
|
};
|
|
61
61
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/wallet-failure.ts"],"sourcesContent":["import type { PasskeySupport } from \"./passkey-support.js\";\n\nexport type WalletFailureKind =\n | \"cancelled\"\n | \"no-passkeys\"\n | \"unsupported-passkey\"\n | \"network\"\n | \"still-deploying\"\n | \"deployment\"\n | \"unknown\";\n\nexport interface WalletFailureNotice {\n kind: WalletFailureKind;\n message: string;\n canRetry: boolean;\n}\n\nexport const isPasskeyCancelled = (err: unknown): boolean =>\n typeof err === \"object\" && err !== null && (err as { name?: unknown }).name === \"PasskeyCancelledError\";\n\nexport type PasskeyUnsupportedReason = \"no-webauthn\" | \"no-prf\";\n\nexport function passkeyUnsupportedReason(err: unknown): PasskeyUnsupportedReason | null {\n if (typeof err !== \"object\" || err === null) return null;\n const { name, reason } = err as { name?: unknown; reason?: unknown };\n if (name !== \"PasskeyUnsupportedError\") return null;\n return reason === \"no-webauthn\" || reason === \"no-prf\" ? reason : null;\n}\n\nconst message = (err: unknown): string => (err instanceof Error ? err.message : \"\");\n\nexport function describeWalletFailure(err: unknown, support: PasskeySupport = \"unknown\"): WalletFailureNotice {\n const raw = message(err);\n\n if (isPasskeyCancelled(err)) {\n return support === \"unavailable\"\n ? {\n kind: \"no-passkeys\",\n message: \"Passkeys aren't available in this window. Open Medialane in a regular browser window (not Guest or Incognito) and try again.\",\n canRetry: true,\n }\n : {\n kind: \"cancelled\",\n message:\n \"The passkey prompt was closed. Try again to finish setting up your account. If your browser says your device can't be used, open Medialane in a regular browser window (not Guest or Incognito).\",\n canRetry: true,\n };\n }\n\n const unsupported = passkeyUnsupportedReason(err);\n if (unsupported === \"no-prf\") {\n return {\n kind: \"unsupported-passkey\",\n message: \"
|
|
1
|
+
{"version":3,"sources":["../../src/utils/wallet-failure.ts"],"sourcesContent":["import type { PasskeySupport } from \"./passkey-support.js\";\n\nexport type WalletFailureKind =\n | \"cancelled\"\n | \"no-passkeys\"\n | \"unsupported-passkey\"\n | \"network\"\n | \"still-deploying\"\n | \"deployment\"\n | \"unknown\";\n\nexport interface WalletFailureNotice {\n kind: WalletFailureKind;\n message: string;\n canRetry: boolean;\n}\n\nexport const isPasskeyCancelled = (err: unknown): boolean =>\n typeof err === \"object\" && err !== null && (err as { name?: unknown }).name === \"PasskeyCancelledError\";\n\nexport type PasskeyUnsupportedReason = \"no-webauthn\" | \"no-prf\";\n\nexport function passkeyUnsupportedReason(err: unknown): PasskeyUnsupportedReason | null {\n if (typeof err !== \"object\" || err === null) return null;\n const { name, reason } = err as { name?: unknown; reason?: unknown };\n if (name !== \"PasskeyUnsupportedError\") return null;\n return reason === \"no-webauthn\" || reason === \"no-prf\" ? reason : null;\n}\n\nconst message = (err: unknown): string => (err instanceof Error ? err.message : \"\");\n\nexport function describeWalletFailure(err: unknown, support: PasskeySupport = \"unknown\"): WalletFailureNotice {\n const raw = message(err);\n\n if (isPasskeyCancelled(err)) {\n return support === \"unavailable\"\n ? {\n kind: \"no-passkeys\",\n message: \"Passkeys aren't available in this window. Open Medialane in a regular browser window (not Guest or Incognito) and try again.\",\n canRetry: true,\n }\n : {\n kind: \"cancelled\",\n message:\n \"The passkey prompt was closed. Try again to finish setting up your account. If your browser says your device can't be used, open Medialane in a regular browser window (not Guest or Incognito).\",\n canRetry: true,\n };\n }\n\n const unsupported = passkeyUnsupportedReason(err);\n if (unsupported === \"no-prf\") {\n return {\n kind: \"unsupported-passkey\",\n message: \"Let's save your passkey in another place. Try again and choose your phone or password manager.\",\n canRetry: true,\n };\n }\n if (unsupported === \"no-webauthn\") {\n return {\n kind: \"no-passkeys\",\n message: \"Open Medialane in a regular browser window or on another device to continue.\",\n canRetry: false,\n };\n }\n\n if (/has not appeared|submitted but/i.test(raw)) {\n return {\n kind: \"still-deploying\",\n message: \"Your wallet is still being set up. Give it a minute, then try again. Nothing is lost.\",\n canRetry: true,\n };\n }\n\n if (/deploy/i.test(raw)) {\n return { kind: \"deployment\", message: \"We couldn't finish setting up your wallet. Please try again in a moment.\", canRetry: true };\n }\n\n if (/failed to fetch|networkerror|load failed|network request failed/i.test(raw)) {\n return { kind: \"network\", message: \"We couldn't reach Medialane. Check your connection and try again.\", canRetry: true };\n }\n\n return { kind: \"unknown\", message: \"We couldn't finish setting up your account. Please try again.\", canRetry: true };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBO,MAAM,qBAAqB,CAAC,QACjC,OAAO,QAAQ,YAAY,QAAQ,QAAS,IAA2B,SAAS;AAI3E,SAAS,yBAAyB,KAA+C;AACtF,MAAI,OAAO,QAAQ,YAAY,QAAQ,KAAM,QAAO;AACpD,QAAM,EAAE,MAAM,OAAO,IAAI;AACzB,MAAI,SAAS,0BAA2B,QAAO;AAC/C,SAAO,WAAW,iBAAiB,WAAW,WAAW,SAAS;AACpE;AAEA,MAAM,UAAU,CAAC,QAA0B,eAAe,QAAQ,IAAI,UAAU;AAEzE,SAAS,sBAAsB,KAAc,UAA0B,WAAgC;AAC5G,QAAM,MAAM,QAAQ,GAAG;AAEvB,MAAI,mBAAmB,GAAG,GAAG;AAC3B,WAAO,YAAY,gBACf;AAAA,MACE,MAAM;AAAA,MACN,SAAS;AAAA,MACT,UAAU;AAAA,IACZ,IACA;AAAA,MACE,MAAM;AAAA,MACN,SACE;AAAA,MACF,UAAU;AAAA,IACZ;AAAA,EACN;AAEA,QAAM,cAAc,yBAAyB,GAAG;AAChD,MAAI,gBAAgB,UAAU;AAC5B,WAAO;AAAA,MACL,MAAM;AAAA,MACN,SAAS;AAAA,MACT,UAAU;AAAA,IACZ;AAAA,EACF;AACA,MAAI,gBAAgB,eAAe;AACjC,WAAO;AAAA,MACL,MAAM;AAAA,MACN,SAAS;AAAA,MACT,UAAU;AAAA,IACZ;AAAA,EACF;AAEA,MAAI,kCAAkC,KAAK,GAAG,GAAG;AAC/C,WAAO;AAAA,MACL,MAAM;AAAA,MACN,SAAS;AAAA,MACT,UAAU;AAAA,IACZ;AAAA,EACF;AAEA,MAAI,UAAU,KAAK,GAAG,GAAG;AACvB,WAAO,EAAE,MAAM,cAAc,SAAS,4EAA4E,UAAU,KAAK;AAAA,EACnI;AAEA,MAAI,mEAAmE,KAAK,GAAG,GAAG;AAChF,WAAO,EAAE,MAAM,WAAW,SAAS,qEAAqE,UAAU,KAAK;AAAA,EACzH;AAEA,SAAO,EAAE,MAAM,WAAW,SAAS,iEAAiE,UAAU,KAAK;AACrH;","names":[]}
|
|
@@ -23,14 +23,14 @@ function describeWalletFailure(err, support = "unknown") {
|
|
|
23
23
|
if (unsupported === "no-prf") {
|
|
24
24
|
return {
|
|
25
25
|
kind: "unsupported-passkey",
|
|
26
|
-
message: "
|
|
26
|
+
message: "Let's save your passkey in another place. Try again and choose your phone or password manager.",
|
|
27
27
|
canRetry: true
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
30
|
if (unsupported === "no-webauthn") {
|
|
31
31
|
return {
|
|
32
32
|
kind: "no-passkeys",
|
|
33
|
-
message: "
|
|
33
|
+
message: "Open Medialane in a regular browser window or on another device to continue.",
|
|
34
34
|
canRetry: false
|
|
35
35
|
};
|
|
36
36
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/wallet-failure.ts"],"sourcesContent":["import type { PasskeySupport } from \"./passkey-support.js\";\n\nexport type WalletFailureKind =\n | \"cancelled\"\n | \"no-passkeys\"\n | \"unsupported-passkey\"\n | \"network\"\n | \"still-deploying\"\n | \"deployment\"\n | \"unknown\";\n\nexport interface WalletFailureNotice {\n kind: WalletFailureKind;\n message: string;\n canRetry: boolean;\n}\n\nexport const isPasskeyCancelled = (err: unknown): boolean =>\n typeof err === \"object\" && err !== null && (err as { name?: unknown }).name === \"PasskeyCancelledError\";\n\nexport type PasskeyUnsupportedReason = \"no-webauthn\" | \"no-prf\";\n\nexport function passkeyUnsupportedReason(err: unknown): PasskeyUnsupportedReason | null {\n if (typeof err !== \"object\" || err === null) return null;\n const { name, reason } = err as { name?: unknown; reason?: unknown };\n if (name !== \"PasskeyUnsupportedError\") return null;\n return reason === \"no-webauthn\" || reason === \"no-prf\" ? reason : null;\n}\n\nconst message = (err: unknown): string => (err instanceof Error ? err.message : \"\");\n\nexport function describeWalletFailure(err: unknown, support: PasskeySupport = \"unknown\"): WalletFailureNotice {\n const raw = message(err);\n\n if (isPasskeyCancelled(err)) {\n return support === \"unavailable\"\n ? {\n kind: \"no-passkeys\",\n message: \"Passkeys aren't available in this window. Open Medialane in a regular browser window (not Guest or Incognito) and try again.\",\n canRetry: true,\n }\n : {\n kind: \"cancelled\",\n message:\n \"The passkey prompt was closed. Try again to finish setting up your account. If your browser says your device can't be used, open Medialane in a regular browser window (not Guest or Incognito).\",\n canRetry: true,\n };\n }\n\n const unsupported = passkeyUnsupportedReason(err);\n if (unsupported === \"no-prf\") {\n return {\n kind: \"unsupported-passkey\",\n message: \"
|
|
1
|
+
{"version":3,"sources":["../../src/utils/wallet-failure.ts"],"sourcesContent":["import type { PasskeySupport } from \"./passkey-support.js\";\n\nexport type WalletFailureKind =\n | \"cancelled\"\n | \"no-passkeys\"\n | \"unsupported-passkey\"\n | \"network\"\n | \"still-deploying\"\n | \"deployment\"\n | \"unknown\";\n\nexport interface WalletFailureNotice {\n kind: WalletFailureKind;\n message: string;\n canRetry: boolean;\n}\n\nexport const isPasskeyCancelled = (err: unknown): boolean =>\n typeof err === \"object\" && err !== null && (err as { name?: unknown }).name === \"PasskeyCancelledError\";\n\nexport type PasskeyUnsupportedReason = \"no-webauthn\" | \"no-prf\";\n\nexport function passkeyUnsupportedReason(err: unknown): PasskeyUnsupportedReason | null {\n if (typeof err !== \"object\" || err === null) return null;\n const { name, reason } = err as { name?: unknown; reason?: unknown };\n if (name !== \"PasskeyUnsupportedError\") return null;\n return reason === \"no-webauthn\" || reason === \"no-prf\" ? reason : null;\n}\n\nconst message = (err: unknown): string => (err instanceof Error ? err.message : \"\");\n\nexport function describeWalletFailure(err: unknown, support: PasskeySupport = \"unknown\"): WalletFailureNotice {\n const raw = message(err);\n\n if (isPasskeyCancelled(err)) {\n return support === \"unavailable\"\n ? {\n kind: \"no-passkeys\",\n message: \"Passkeys aren't available in this window. Open Medialane in a regular browser window (not Guest or Incognito) and try again.\",\n canRetry: true,\n }\n : {\n kind: \"cancelled\",\n message:\n \"The passkey prompt was closed. Try again to finish setting up your account. If your browser says your device can't be used, open Medialane in a regular browser window (not Guest or Incognito).\",\n canRetry: true,\n };\n }\n\n const unsupported = passkeyUnsupportedReason(err);\n if (unsupported === \"no-prf\") {\n return {\n kind: \"unsupported-passkey\",\n message: \"Let's save your passkey in another place. Try again and choose your phone or password manager.\",\n canRetry: true,\n };\n }\n if (unsupported === \"no-webauthn\") {\n return {\n kind: \"no-passkeys\",\n message: \"Open Medialane in a regular browser window or on another device to continue.\",\n canRetry: false,\n };\n }\n\n if (/has not appeared|submitted but/i.test(raw)) {\n return {\n kind: \"still-deploying\",\n message: \"Your wallet is still being set up. Give it a minute, then try again. Nothing is lost.\",\n canRetry: true,\n };\n }\n\n if (/deploy/i.test(raw)) {\n return { kind: \"deployment\", message: \"We couldn't finish setting up your wallet. Please try again in a moment.\", canRetry: true };\n }\n\n if (/failed to fetch|networkerror|load failed|network request failed/i.test(raw)) {\n return { kind: \"network\", message: \"We couldn't reach Medialane. Check your connection and try again.\", canRetry: true };\n }\n\n return { kind: \"unknown\", message: \"We couldn't finish setting up your account. Please try again.\", canRetry: true };\n}\n"],"mappings":"AAiBO,MAAM,qBAAqB,CAAC,QACjC,OAAO,QAAQ,YAAY,QAAQ,QAAS,IAA2B,SAAS;AAI3E,SAAS,yBAAyB,KAA+C;AACtF,MAAI,OAAO,QAAQ,YAAY,QAAQ,KAAM,QAAO;AACpD,QAAM,EAAE,MAAM,OAAO,IAAI;AACzB,MAAI,SAAS,0BAA2B,QAAO;AAC/C,SAAO,WAAW,iBAAiB,WAAW,WAAW,SAAS;AACpE;AAEA,MAAM,UAAU,CAAC,QAA0B,eAAe,QAAQ,IAAI,UAAU;AAEzE,SAAS,sBAAsB,KAAc,UAA0B,WAAgC;AAC5G,QAAM,MAAM,QAAQ,GAAG;AAEvB,MAAI,mBAAmB,GAAG,GAAG;AAC3B,WAAO,YAAY,gBACf;AAAA,MACE,MAAM;AAAA,MACN,SAAS;AAAA,MACT,UAAU;AAAA,IACZ,IACA;AAAA,MACE,MAAM;AAAA,MACN,SACE;AAAA,MACF,UAAU;AAAA,IACZ;AAAA,EACN;AAEA,QAAM,cAAc,yBAAyB,GAAG;AAChD,MAAI,gBAAgB,UAAU;AAC5B,WAAO;AAAA,MACL,MAAM;AAAA,MACN,SAAS;AAAA,MACT,UAAU;AAAA,IACZ;AAAA,EACF;AACA,MAAI,gBAAgB,eAAe;AACjC,WAAO;AAAA,MACL,MAAM;AAAA,MACN,SAAS;AAAA,MACT,UAAU;AAAA,IACZ;AAAA,EACF;AAEA,MAAI,kCAAkC,KAAK,GAAG,GAAG;AAC/C,WAAO;AAAA,MACL,MAAM;AAAA,MACN,SAAS;AAAA,MACT,UAAU;AAAA,IACZ;AAAA,EACF;AAEA,MAAI,UAAU,KAAK,GAAG,GAAG;AACvB,WAAO,EAAE,MAAM,cAAc,SAAS,4EAA4E,UAAU,KAAK;AAAA,EACnI;AAEA,MAAI,mEAAmE,KAAK,GAAG,GAAG;AAChF,WAAO,EAAE,MAAM,WAAW,SAAS,qEAAqE,UAAU,KAAK;AAAA,EACzH;AAEA,SAAO,EAAE,MAAM,WAAW,SAAS,iEAAiE,UAAU,KAAK;AACrH;","names":[]}
|