@medialane/ui 0.396.0 → 0.397.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/account/input-otp.d.cts +2 -2
- package/dist/components/account/input-otp.d.ts +2 -2
- package/dist/components/alert.d.cts +1 -1
- package/dist/components/alert.d.ts +1 -1
- package/dist/components/badge.d.cts +1 -1
- package/dist/components/badge.d.ts +1 -1
- package/dist/components/button.d.cts +2 -2
- package/dist/components/button.d.ts +2 -2
- package/dist/components/drop/create/asset-editor.cjs +14 -4
- package/dist/components/drop/create/asset-editor.cjs.map +1 -1
- package/dist/components/drop/create/asset-editor.js +14 -4
- package/dist/components/drop/create/asset-editor.js.map +1 -1
- package/dist/components/fast-mint/asset-form-parts.cjs +8 -43
- package/dist/components/fast-mint/asset-form-parts.cjs.map +1 -1
- package/dist/components/fast-mint/asset-form-parts.d.cts +5 -10
- package/dist/components/fast-mint/asset-form-parts.d.ts +5 -10
- package/dist/components/fast-mint/asset-form-parts.js +8 -42
- package/dist/components/fast-mint/asset-form-parts.js.map +1 -1
- package/dist/components/fast-mint/dropzone.cjs +1 -0
- package/dist/components/fast-mint/dropzone.cjs.map +1 -1
- package/dist/components/fast-mint/dropzone.js +1 -0
- package/dist/components/fast-mint/dropzone.js.map +1 -1
- package/dist/components/fast-mint/fast-mint.cjs +47 -45
- package/dist/components/fast-mint/fast-mint.cjs.map +1 -1
- package/dist/components/fast-mint/fast-mint.js +48 -46
- package/dist/components/fast-mint/fast-mint.js.map +1 -1
- package/dist/components/image-upload-field.cjs +140 -0
- package/dist/components/image-upload-field.cjs.map +1 -0
- package/dist/components/image-upload-field.d.cts +19 -0
- package/dist/components/image-upload-field.d.ts +19 -0
- package/dist/components/image-upload-field.js +106 -0
- package/dist/components/image-upload-field.js.map +1 -0
- package/dist/components/launchpad/coin-create.cjs +11 -54
- package/dist/components/launchpad/coin-create.cjs.map +1 -1
- package/dist/components/launchpad/coin-create.js +12 -55
- package/dist/components/launchpad/coin-create.js.map +1 -1
- package/dist/components/launchpad/collection-create-form.cjs +18 -76
- package/dist/components/launchpad/collection-create-form.cjs.map +1 -1
- package/dist/components/launchpad/collection-create-form.js +18 -76
- package/dist/components/launchpad/collection-create-form.js.map +1 -1
- package/dist/components/launchpad/edition-mint-fields.cjs +12 -87
- package/dist/components/launchpad/edition-mint-fields.cjs.map +1 -1
- package/dist/components/launchpad/edition-mint-fields.d.cts +4 -8
- package/dist/components/launchpad/edition-mint-fields.d.ts +4 -8
- package/dist/components/launchpad/edition-mint-fields.js +14 -79
- package/dist/components/launchpad/edition-mint-fields.js.map +1 -1
- package/dist/components/launchpad/edition-mint-schema.d.cts +6 -6
- package/dist/components/launchpad/edition-mint-schema.d.ts +6 -6
- package/dist/components/launchpad/edition-mint.cjs +21 -39
- package/dist/components/launchpad/edition-mint.cjs.map +1 -1
- package/dist/components/launchpad/edition-mint.js +21 -39
- package/dist/components/launchpad/edition-mint.js.map +1 -1
- package/dist/components/launchpad/pop-create-fields.cjs +14 -91
- package/dist/components/launchpad/pop-create-fields.cjs.map +1 -1
- package/dist/components/launchpad/pop-create-fields.d.cts +4 -8
- package/dist/components/launchpad/pop-create-fields.d.ts +4 -8
- package/dist/components/launchpad/pop-create-fields.js +14 -83
- package/dist/components/launchpad/pop-create-fields.js.map +1 -1
- package/dist/components/launchpad/pop-create.cjs +20 -32
- package/dist/components/launchpad/pop-create.cjs.map +1 -1
- package/dist/components/launchpad/pop-create.js +20 -32
- package/dist/components/launchpad/pop-create.js.map +1 -1
- package/dist/components/launchpad/remix-mint.cjs +15 -52
- package/dist/components/launchpad/remix-mint.cjs.map +1 -1
- package/dist/components/launchpad/remix-mint.js +16 -53
- package/dist/components/launchpad/remix-mint.js.map +1 -1
- package/dist/components/launchpad/single-edition-mint.cjs +11 -72
- package/dist/components/launchpad/single-edition-mint.cjs.map +1 -1
- package/dist/components/launchpad/single-edition-mint.js +12 -73
- package/dist/components/launchpad/single-edition-mint.js.map +1 -1
- package/dist/components/launchpad/tier-mint-form.cjs +14 -60
- package/dist/components/launchpad/tier-mint-form.cjs.map +1 -1
- package/dist/components/launchpad/tier-mint-form.js +15 -61
- package/dist/components/launchpad/tier-mint-form.js.map +1 -1
- package/dist/components/launchpad/tier-mint-presets.cjs +0 -4
- package/dist/components/launchpad/tier-mint-presets.cjs.map +1 -1
- package/dist/components/launchpad/tier-mint-presets.d.cts +0 -2
- package/dist/components/launchpad/tier-mint-presets.d.ts +0 -2
- package/dist/components/launchpad/tier-mint-presets.js +0 -4
- package/dist/components/launchpad/tier-mint-presets.js.map +1 -1
- package/dist/i18n/catalog/pt.cjs +3 -7
- package/dist/i18n/catalog/pt.cjs.map +1 -1
- package/dist/i18n/catalog/pt.js +3 -7
- package/dist/i18n/catalog/pt.js.map +1 -1
- package/dist/index.cjs +9 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/utils/ipfs-upload.cjs +3 -7
- package/dist/utils/ipfs-upload.cjs.map +1 -1
- package/dist/utils/ipfs-upload.d.cts +1 -3
- package/dist/utils/ipfs-upload.d.ts +1 -3
- package/dist/utils/ipfs-upload.js +3 -7
- package/dist/utils/ipfs-upload.js.map +1 -1
- package/dist/utils/use-file-upload.cjs +105 -0
- package/dist/utils/use-file-upload.cjs.map +1 -0
- package/dist/utils/use-file-upload.d.cts +26 -0
- package/dist/utils/use-file-upload.d.ts +26 -0
- package/dist/utils/use-file-upload.js +81 -0
- package/dist/utils/use-file-upload.js.map +1 -0
- package/dist/utils/use-image-upload.cjs +56 -0
- package/dist/utils/use-image-upload.cjs.map +1 -0
- package/dist/utils/use-image-upload.d.cts +19 -0
- package/dist/utils/use-image-upload.d.ts +19 -0
- package/dist/utils/use-image-upload.js +32 -0
- package/dist/utils/use-image-upload.js.map +1 -0
- package/package.json +1 -1
- package/dist/components/fast-mint/use-ipfs-upload.cjs +0 -64
- package/dist/components/fast-mint/use-ipfs-upload.cjs.map +0 -1
- package/dist/components/fast-mint/use-ipfs-upload.d.cts +0 -9
- package/dist/components/fast-mint/use-ipfs-upload.d.ts +0 -9
- package/dist/components/fast-mint/use-ipfs-upload.js +0 -40
- package/dist/components/fast-mint/use-ipfs-upload.js.map +0 -1
- package/dist/utils/use-launchpad-image-upload.cjs +0 -103
- package/dist/utils/use-launchpad-image-upload.cjs.map +0 -1
- package/dist/utils/use-launchpad-image-upload.d.cts +0 -21
- package/dist/utils/use-launchpad-image-upload.d.ts +0 -21
- package/dist/utils/use-launchpad-image-upload.js +0 -79
- package/dist/utils/use-launchpad-image-upload.js.map +0 -1
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect, useRef, useState } from "react";
|
|
3
|
+
import { uploadFailureToast } from "./ipfs-upload.js";
|
|
4
|
+
import { useT } from "../i18n/provider.js";
|
|
5
|
+
const EMPTY = { status: "empty", file: null, preview: null, uri: null, error: null, canRetry: false };
|
|
6
|
+
function useFileUpload(options) {
|
|
7
|
+
const t = useT();
|
|
8
|
+
const [state, setState] = useState(EMPTY);
|
|
9
|
+
const fieldRef = useRef(null);
|
|
10
|
+
const previewRef = useRef(null);
|
|
11
|
+
const attemptRef = useRef(0);
|
|
12
|
+
const release = () => {
|
|
13
|
+
if (previewRef.current) URL.revokeObjectURL(previewRef.current);
|
|
14
|
+
previewRef.current = null;
|
|
15
|
+
};
|
|
16
|
+
useEffect(() => () => {
|
|
17
|
+
attemptRef.current += 1;
|
|
18
|
+
release();
|
|
19
|
+
}, []);
|
|
20
|
+
const failureText = (err) => {
|
|
21
|
+
const failure = uploadFailureToast(err);
|
|
22
|
+
const declined = failure.title !== "Upload failed";
|
|
23
|
+
const title = t(declined ? failure.title : options.failureMessage ?? failure.title);
|
|
24
|
+
return failure.description ? `${title}: ${t(failure.description)}` : title;
|
|
25
|
+
};
|
|
26
|
+
const run = async (file, preview) => {
|
|
27
|
+
const attempt = ++attemptRef.current;
|
|
28
|
+
setState({ status: "uploading", file, preview, uri: null, error: null, canRetry: false });
|
|
29
|
+
try {
|
|
30
|
+
const uri = await options.upload(file);
|
|
31
|
+
if (attempt !== attemptRef.current) return;
|
|
32
|
+
setState({ status: "uploaded", file, preview, uri, error: null, canRetry: false });
|
|
33
|
+
options.onChange?.(uri);
|
|
34
|
+
} catch (err) {
|
|
35
|
+
if (attempt !== attemptRef.current) return;
|
|
36
|
+
setState({ status: "failed", file, preview, uri: null, error: failureText(err), canRetry: true });
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
const select = async (file) => {
|
|
40
|
+
release();
|
|
41
|
+
const problem = options.validate?.(file);
|
|
42
|
+
if (problem) {
|
|
43
|
+
attemptRef.current += 1;
|
|
44
|
+
setState({ status: "failed", file, preview: null, uri: null, error: t(problem), canRetry: false });
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
previewRef.current = URL.createObjectURL(file);
|
|
48
|
+
await run(file, previewRef.current);
|
|
49
|
+
};
|
|
50
|
+
const retry = async () => {
|
|
51
|
+
if (state.canRetry && state.file) await run(state.file, state.preview);
|
|
52
|
+
};
|
|
53
|
+
const clear = () => {
|
|
54
|
+
attemptRef.current += 1;
|
|
55
|
+
release();
|
|
56
|
+
const discardingFailure = state.status === "failed";
|
|
57
|
+
setState(EMPTY);
|
|
58
|
+
if (!discardingFailure) options.onChange?.(null);
|
|
59
|
+
};
|
|
60
|
+
const reveal = () => {
|
|
61
|
+
fieldRef.current?.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
62
|
+
fieldRef.current?.focus({ preventScroll: true });
|
|
63
|
+
};
|
|
64
|
+
const confirm = (requiredMessage) => {
|
|
65
|
+
if (state.status === "uploading" || state.status === "failed") {
|
|
66
|
+
reveal();
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
if (requiredMessage && !state.uri) {
|
|
70
|
+
setState((current) => ({ ...current, error: t(requiredMessage) }));
|
|
71
|
+
reveal();
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
return true;
|
|
75
|
+
};
|
|
76
|
+
return { ...state, uploading: state.status === "uploading", fieldRef, select, retry, clear, confirm };
|
|
77
|
+
}
|
|
78
|
+
export {
|
|
79
|
+
useFileUpload
|
|
80
|
+
};
|
|
81
|
+
//# sourceMappingURL=use-file-upload.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/use-file-upload.ts"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useRef, useState } from \"react\";\nimport { uploadFailureToast } from \"./ipfs-upload.js\";\nimport { useT } from \"../i18n/provider.js\";\n\nexport interface FileUploadOptions {\n upload: (file: File) => Promise<string>;\n validate?: (file: File) => string | null;\n failureMessage?: string;\n onChange?: (uri: string | null) => void;\n}\n\nexport type FileUploadStatus = \"empty\" | \"uploading\" | \"uploaded\" | \"failed\";\n\ninterface UploadState {\n status: FileUploadStatus;\n file: File | null;\n preview: string | null;\n uri: string | null;\n error: string | null;\n canRetry: boolean;\n}\n\nconst EMPTY: UploadState = { status: \"empty\", file: null, preview: null, uri: null, error: null, canRetry: false };\n\nexport function useFileUpload(options: FileUploadOptions) {\n const t = useT();\n const [state, setState] = useState<UploadState>(EMPTY);\n const fieldRef = useRef<HTMLDivElement | null>(null);\n const previewRef = useRef<string | null>(null);\n const attemptRef = useRef(0);\n\n const release = () => {\n if (previewRef.current) URL.revokeObjectURL(previewRef.current);\n previewRef.current = null;\n };\n\n useEffect(() => () => {\n attemptRef.current += 1;\n release();\n }, []);\n\n const failureText = (err: unknown) => {\n const failure = uploadFailureToast(err);\n const declined = failure.title !== \"Upload failed\";\n const title = t(declined ? failure.title : options.failureMessage ?? failure.title);\n return failure.description ? `${title}: ${t(failure.description)}` : title;\n };\n\n const run = async (file: File, preview: string | null) => {\n const attempt = ++attemptRef.current;\n setState({ status: \"uploading\", file, preview, uri: null, error: null, canRetry: false });\n try {\n const uri = await options.upload(file);\n if (attempt !== attemptRef.current) return;\n setState({ status: \"uploaded\", file, preview, uri, error: null, canRetry: false });\n options.onChange?.(uri);\n } catch (err) {\n if (attempt !== attemptRef.current) return;\n setState({ status: \"failed\", file, preview, uri: null, error: failureText(err), canRetry: true });\n }\n };\n\n const select = async (file: File) => {\n release();\n const problem = options.validate?.(file);\n if (problem) {\n attemptRef.current += 1;\n setState({ status: \"failed\", file, preview: null, uri: null, error: t(problem), canRetry: false });\n return;\n }\n previewRef.current = URL.createObjectURL(file);\n await run(file, previewRef.current);\n };\n\n const retry = async () => {\n if (state.canRetry && state.file) await run(state.file, state.preview);\n };\n\n const clear = () => {\n attemptRef.current += 1;\n release();\n const discardingFailure = state.status === \"failed\";\n setState(EMPTY);\n if (!discardingFailure) options.onChange?.(null);\n };\n\n const reveal = () => {\n fieldRef.current?.scrollIntoView({ behavior: \"smooth\", block: \"center\" });\n fieldRef.current?.focus({ preventScroll: true });\n };\n\n const confirm = (requiredMessage?: string): boolean => {\n if (state.status === \"uploading\" || state.status === \"failed\") {\n reveal();\n return false;\n }\n if (requiredMessage && !state.uri) {\n setState((current) => ({ ...current, error: t(requiredMessage) }));\n reveal();\n return false;\n }\n return true;\n };\n\n return { ...state, uploading: state.status === \"uploading\", fieldRef, select, retry, clear, confirm };\n}\n\nexport type FileUpload = ReturnType<typeof useFileUpload>;\n"],"mappings":";AAEA,SAAS,WAAW,QAAQ,gBAAgB;AAC5C,SAAS,0BAA0B;AACnC,SAAS,YAAY;AAoBrB,MAAM,QAAqB,EAAE,QAAQ,SAAS,MAAM,MAAM,SAAS,MAAM,KAAK,MAAM,OAAO,MAAM,UAAU,MAAM;AAE1G,SAAS,cAAc,SAA4B;AACxD,QAAM,IAAI,KAAK;AACf,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAsB,KAAK;AACrD,QAAM,WAAW,OAA8B,IAAI;AACnD,QAAM,aAAa,OAAsB,IAAI;AAC7C,QAAM,aAAa,OAAO,CAAC;AAE3B,QAAM,UAAU,MAAM;AACpB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,WAAW,OAAO;AAAA,EACpC;AAEA,QAAM,QAAQ,YAAY;AACxB,QAAI,MAAM,YAAY,MAAM,KAAM,OAAM,IAAI,MAAM,MAAM,MAAM,OAAO;AAAA,EACvE;AAEA,QAAM,QAAQ,MAAM;AAClB,eAAW,WAAW;AACtB,YAAQ;AACR,UAAM,oBAAoB,MAAM,WAAW;AAC3C,aAAS,KAAK;AACd,QAAI,CAAC,kBAAmB,SAAQ,WAAW,IAAI;AAAA,EACjD;AAEA,QAAM,SAAS,MAAM;AACnB,aAAS,SAAS,eAAe,EAAE,UAAU,UAAU,OAAO,SAAS,CAAC;AACxE,aAAS,SAAS,MAAM,EAAE,eAAe,KAAK,CAAC;AAAA,EACjD;AAEA,QAAM,UAAU,CAAC,oBAAsC;AACrD,QAAI,MAAM,WAAW,eAAe,MAAM,WAAW,UAAU;AAC7D,aAAO;AACP,aAAO;AAAA,IACT;AACA,QAAI,mBAAmB,CAAC,MAAM,KAAK;AACjC,eAAS,CAAC,aAAa,EAAE,GAAG,SAAS,OAAO,EAAE,eAAe,EAAE,EAAE;AACjE,aAAO;AACP,aAAO;AAAA,IACT;AACA,WAAO;AAAA,EACT;AAEA,SAAO,EAAE,GAAG,OAAO,WAAW,MAAM,WAAW,aAAa,UAAU,QAAQ,OAAO,OAAO,QAAQ;AACtG;","names":[]}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var use_image_upload_exports = {};
|
|
21
|
+
__export(use_image_upload_exports, {
|
|
22
|
+
useImageUpload: () => useImageUpload
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(use_image_upload_exports);
|
|
25
|
+
var import_medialane_app = require("../components/medialane-app.js");
|
|
26
|
+
var import_ipfs_upload = require("./ipfs-upload.js");
|
|
27
|
+
var import_upload_limits = require("./upload-limits.js");
|
|
28
|
+
var import_use_file_upload = require("./use-file-upload.js");
|
|
29
|
+
var import_translate = require("../i18n/translate.js");
|
|
30
|
+
const SLOW_AFTER_MS = 6e4;
|
|
31
|
+
function useImageUpload({ onChange } = {}) {
|
|
32
|
+
const app = (0, import_medialane_app.useMedialaneApp)();
|
|
33
|
+
const upload = async (file) => {
|
|
34
|
+
await app.ensureSignedIn?.();
|
|
35
|
+
let timer;
|
|
36
|
+
const slow = new Promise((_, reject) => {
|
|
37
|
+
timer = setTimeout(() => reject(new Error("the image service is slow right now \u2014 please try again")), SLOW_AFTER_MS);
|
|
38
|
+
});
|
|
39
|
+
try {
|
|
40
|
+
return (await Promise.race([(0, import_ipfs_upload.uploadFileToIpfs)(app.getClient().api, file, "image"), slow])).uri;
|
|
41
|
+
} finally {
|
|
42
|
+
clearTimeout(timer);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
return (0, import_use_file_upload.useFileUpload)({
|
|
46
|
+
upload,
|
|
47
|
+
validate: (file) => (0, import_upload_limits.uploadError)(file, "image"),
|
|
48
|
+
failureMessage: (0, import_translate.msg)("Image upload failed"),
|
|
49
|
+
onChange
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
53
|
+
0 && (module.exports = {
|
|
54
|
+
useImageUpload
|
|
55
|
+
});
|
|
56
|
+
//# sourceMappingURL=use-image-upload.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/use-image-upload.ts"],"sourcesContent":["\"use client\";\n\nimport { useMedialaneApp } from \"../components/medialane-app.js\";\nimport { uploadFileToIpfs } from \"./ipfs-upload.js\";\nimport { uploadError } from \"./upload-limits.js\";\nimport { useFileUpload, type FileUploadOptions } from \"./use-file-upload.js\";\nimport { msg } from \"../i18n/translate.js\";\n\nconst SLOW_AFTER_MS = 60_000;\n\nexport function useImageUpload({ onChange }: Pick<FileUploadOptions, \"onChange\"> = {}) {\n const app = useMedialaneApp();\n\n const upload = async (file: File) => {\n await app.ensureSignedIn?.();\n let timer: ReturnType<typeof setTimeout> | undefined;\n const slow = new Promise<never>((_, reject) => {\n timer = setTimeout(() => reject(new Error(\"the image service is slow right now — please try again\")), SLOW_AFTER_MS);\n });\n try {\n return (await Promise.race([uploadFileToIpfs(app.getClient().api, file, \"image\"), slow])).uri;\n } finally {\n clearTimeout(timer);\n }\n };\n\n return useFileUpload({\n upload,\n validate: (file) => uploadError(file, \"image\"),\n failureMessage: msg(\"Image upload failed\"),\n onChange,\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,2BAAgC;AAChC,yBAAiC;AACjC,2BAA4B;AAC5B,6BAAsD;AACtD,uBAAoB;AAEpB,MAAM,gBAAgB;AAEf,SAAS,eAAe,EAAE,SAAS,IAAyC,CAAC,GAAG;AACrF,QAAM,UAAM,sCAAgB;AAE5B,QAAM,SAAS,OAAO,SAAe;AACnC,UAAM,IAAI,iBAAiB;AAC3B,QAAI;AACJ,UAAM,OAAO,IAAI,QAAe,CAAC,GAAG,WAAW;AAC7C,cAAQ,WAAW,MAAM,OAAO,IAAI,MAAM,6DAAwD,CAAC,GAAG,aAAa;AAAA,IACrH,CAAC;AACD,QAAI;AACF,cAAQ,MAAM,QAAQ,KAAK,KAAC,qCAAiB,IAAI,UAAU,EAAE,KAAK,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG;AAAA,IAC5F,UAAE;AACA,mBAAa,KAAK;AAAA,IACpB;AAAA,EACF;AAEA,aAAO,sCAAc;AAAA,IACnB;AAAA,IACA,UAAU,CAAC,aAAS,kCAAY,MAAM,OAAO;AAAA,IAC7C,oBAAgB,sBAAI,qBAAqB;AAAA,IACzC;AAAA,EACF,CAAC;AACH;","names":[]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { FileUploadOptions, FileUploadStatus } from './use-file-upload.cjs';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
declare function useImageUpload({ onChange }?: Pick<FileUploadOptions, "onChange">): {
|
|
5
|
+
uploading: boolean;
|
|
6
|
+
fieldRef: React.RefObject<HTMLDivElement | null>;
|
|
7
|
+
select: (file: File) => Promise<void>;
|
|
8
|
+
retry: () => Promise<void>;
|
|
9
|
+
clear: () => void;
|
|
10
|
+
confirm: (requiredMessage?: string) => boolean;
|
|
11
|
+
status: FileUploadStatus;
|
|
12
|
+
file: File | null;
|
|
13
|
+
preview: string | null;
|
|
14
|
+
uri: string | null;
|
|
15
|
+
error: string | null;
|
|
16
|
+
canRetry: boolean;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export { useImageUpload };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { FileUploadOptions, FileUploadStatus } from './use-file-upload.js';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
declare function useImageUpload({ onChange }?: Pick<FileUploadOptions, "onChange">): {
|
|
5
|
+
uploading: boolean;
|
|
6
|
+
fieldRef: React.RefObject<HTMLDivElement | null>;
|
|
7
|
+
select: (file: File) => Promise<void>;
|
|
8
|
+
retry: () => Promise<void>;
|
|
9
|
+
clear: () => void;
|
|
10
|
+
confirm: (requiredMessage?: string) => boolean;
|
|
11
|
+
status: FileUploadStatus;
|
|
12
|
+
file: File | null;
|
|
13
|
+
preview: string | null;
|
|
14
|
+
uri: string | null;
|
|
15
|
+
error: string | null;
|
|
16
|
+
canRetry: boolean;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export { useImageUpload };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useMedialaneApp } from "../components/medialane-app.js";
|
|
3
|
+
import { uploadFileToIpfs } from "./ipfs-upload.js";
|
|
4
|
+
import { uploadError } from "./upload-limits.js";
|
|
5
|
+
import { useFileUpload } from "./use-file-upload.js";
|
|
6
|
+
import { msg } from "../i18n/translate.js";
|
|
7
|
+
const SLOW_AFTER_MS = 6e4;
|
|
8
|
+
function useImageUpload({ onChange } = {}) {
|
|
9
|
+
const app = useMedialaneApp();
|
|
10
|
+
const upload = async (file) => {
|
|
11
|
+
await app.ensureSignedIn?.();
|
|
12
|
+
let timer;
|
|
13
|
+
const slow = new Promise((_, reject) => {
|
|
14
|
+
timer = setTimeout(() => reject(new Error("the image service is slow right now \u2014 please try again")), SLOW_AFTER_MS);
|
|
15
|
+
});
|
|
16
|
+
try {
|
|
17
|
+
return (await Promise.race([uploadFileToIpfs(app.getClient().api, file, "image"), slow])).uri;
|
|
18
|
+
} finally {
|
|
19
|
+
clearTimeout(timer);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
return useFileUpload({
|
|
23
|
+
upload,
|
|
24
|
+
validate: (file) => uploadError(file, "image"),
|
|
25
|
+
failureMessage: msg("Image upload failed"),
|
|
26
|
+
onChange
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
export {
|
|
30
|
+
useImageUpload
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=use-image-upload.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/use-image-upload.ts"],"sourcesContent":["\"use client\";\n\nimport { useMedialaneApp } from \"../components/medialane-app.js\";\nimport { uploadFileToIpfs } from \"./ipfs-upload.js\";\nimport { uploadError } from \"./upload-limits.js\";\nimport { useFileUpload, type FileUploadOptions } from \"./use-file-upload.js\";\nimport { msg } from \"../i18n/translate.js\";\n\nconst SLOW_AFTER_MS = 60_000;\n\nexport function useImageUpload({ onChange }: Pick<FileUploadOptions, \"onChange\"> = {}) {\n const app = useMedialaneApp();\n\n const upload = async (file: File) => {\n await app.ensureSignedIn?.();\n let timer: ReturnType<typeof setTimeout> | undefined;\n const slow = new Promise<never>((_, reject) => {\n timer = setTimeout(() => reject(new Error(\"the image service is slow right now — please try again\")), SLOW_AFTER_MS);\n });\n try {\n return (await Promise.race([uploadFileToIpfs(app.getClient().api, file, \"image\"), slow])).uri;\n } finally {\n clearTimeout(timer);\n }\n };\n\n return useFileUpload({\n upload,\n validate: (file) => uploadError(file, \"image\"),\n failureMessage: msg(\"Image upload failed\"),\n onChange,\n });\n}\n"],"mappings":";AAEA,SAAS,uBAAuB;AAChC,SAAS,wBAAwB;AACjC,SAAS,mBAAmB;AAC5B,SAAS,qBAA6C;AACtD,SAAS,WAAW;AAEpB,MAAM,gBAAgB;AAEf,SAAS,eAAe,EAAE,SAAS,IAAyC,CAAC,GAAG;AACrF,QAAM,MAAM,gBAAgB;AAE5B,QAAM,SAAS,OAAO,SAAe;AACnC,UAAM,IAAI,iBAAiB;AAC3B,QAAI;AACJ,UAAM,OAAO,IAAI,QAAe,CAAC,GAAG,WAAW;AAC7C,cAAQ,WAAW,MAAM,OAAO,IAAI,MAAM,6DAAwD,CAAC,GAAG,aAAa;AAAA,IACrH,CAAC;AACD,QAAI;AACF,cAAQ,MAAM,QAAQ,KAAK,CAAC,iBAAiB,IAAI,UAAU,EAAE,KAAK,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG;AAAA,IAC5F,UAAE;AACA,mBAAa,KAAK;AAAA,IACpB;AAAA,EACF;AAEA,SAAO,cAAc;AAAA,IACnB;AAAA,IACA,UAAU,CAAC,SAAS,YAAY,MAAM,OAAO;AAAA,IAC7C,gBAAgB,IAAI,qBAAqB;AAAA,IACzC;AAAA,EACF,CAAC;AACH;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
"use client";
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
-
var use_ipfs_upload_exports = {};
|
|
21
|
-
__export(use_ipfs_upload_exports, {
|
|
22
|
-
useIpfsUpload: () => useIpfsUpload
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(use_ipfs_upload_exports);
|
|
25
|
-
var import_react = require("react");
|
|
26
|
-
var import_ipfs_upload = require("../../utils/ipfs-upload.js");
|
|
27
|
-
function useIpfsUpload() {
|
|
28
|
-
const [preview, setPreview] = (0, import_react.useState)(null);
|
|
29
|
-
const [uri, setUri] = (0, import_react.useState)(null);
|
|
30
|
-
const [uploading, setUploading] = (0, import_react.useState)(false);
|
|
31
|
-
const previewRef = (0, import_react.useRef)(null);
|
|
32
|
-
const revoke = () => {
|
|
33
|
-
if (previewRef.current) URL.revokeObjectURL(previewRef.current);
|
|
34
|
-
previewRef.current = null;
|
|
35
|
-
};
|
|
36
|
-
(0, import_react.useEffect)(() => revoke, []);
|
|
37
|
-
const start = async (file, upload, onError) => {
|
|
38
|
-
revoke();
|
|
39
|
-
const objectUrl = URL.createObjectURL(file);
|
|
40
|
-
previewRef.current = objectUrl;
|
|
41
|
-
setPreview(objectUrl);
|
|
42
|
-
setUri(null);
|
|
43
|
-
setUploading(true);
|
|
44
|
-
try {
|
|
45
|
-
setUri(await upload(file));
|
|
46
|
-
} catch (err) {
|
|
47
|
-
const toast = (0, import_ipfs_upload.uploadFailureToast)(err);
|
|
48
|
-
onError(toast.description ?? toast.title);
|
|
49
|
-
} finally {
|
|
50
|
-
setUploading(false);
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
const clear = () => {
|
|
54
|
-
revoke();
|
|
55
|
-
setPreview(null);
|
|
56
|
-
setUri(null);
|
|
57
|
-
};
|
|
58
|
-
return { preview, uri, uploading, start, clear };
|
|
59
|
-
}
|
|
60
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
61
|
-
0 && (module.exports = {
|
|
62
|
-
useIpfsUpload
|
|
63
|
-
});
|
|
64
|
-
//# sourceMappingURL=use-ipfs-upload.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/fast-mint/use-ipfs-upload.ts"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useRef, useState } from \"react\";\nimport { uploadFailureToast } from \"../../utils/ipfs-upload.js\";\n\nexport function useIpfsUpload() {\n const [preview, setPreview] = useState<string | null>(null);\n const [uri, setUri] = useState<string | null>(null);\n const [uploading, setUploading] = useState(false);\n const previewRef = useRef<string | null>(null);\n\n const revoke = () => {\n if (previewRef.current) URL.revokeObjectURL(previewRef.current);\n previewRef.current = null;\n };\n\n useEffect(() => revoke, []);\n\n const start = async (file: File, upload: (file: File) => Promise<string>, onError: (message: string) => void) => {\n revoke();\n const objectUrl = URL.createObjectURL(file);\n previewRef.current = objectUrl;\n setPreview(objectUrl);\n setUri(null);\n setUploading(true);\n try {\n setUri(await upload(file));\n } catch (err) {\n const toast = uploadFailureToast(err);\n onError(toast.description ?? toast.title);\n } finally {\n setUploading(false);\n }\n };\n\n const clear = () => {\n revoke();\n setPreview(null);\n setUri(null);\n };\n\n return { preview, uri, uploading, start, clear };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAA4C;AAC5C,yBAAmC;AAE5B,SAAS,gBAAgB;AAC9B,QAAM,CAAC,SAAS,UAAU,QAAI,uBAAwB,IAAI;AAC1D,QAAM,CAAC,KAAK,MAAM,QAAI,uBAAwB,IAAI;AAClD,QAAM,CAAC,WAAW,YAAY,QAAI,uBAAS,KAAK;AAChD,QAAM,iBAAa,qBAAsB,IAAI;AAE7C,QAAM,SAAS,MAAM;AACnB,QAAI,WAAW,QAAS,KAAI,gBAAgB,WAAW,OAAO;AAC9D,eAAW,UAAU;AAAA,EACvB;AAEA,8BAAU,MAAM,QAAQ,CAAC,CAAC;AAE1B,QAAM,QAAQ,OAAO,MAAY,QAAyC,YAAuC;AAC/G,WAAO;AACP,UAAM,YAAY,IAAI,gBAAgB,IAAI;AAC1C,eAAW,UAAU;AACrB,eAAW,SAAS;AACpB,WAAO,IAAI;AACX,iBAAa,IAAI;AACjB,QAAI;AACF,aAAO,MAAM,OAAO,IAAI,CAAC;AAAA,IAC3B,SAAS,KAAK;AACZ,YAAM,YAAQ,uCAAmB,GAAG;AACpC,cAAQ,MAAM,eAAe,MAAM,KAAK;AAAA,IAC1C,UAAE;AACA,mBAAa,KAAK;AAAA,IACpB;AAAA,EACF;AAEA,QAAM,QAAQ,MAAM;AAClB,WAAO;AACP,eAAW,IAAI;AACf,WAAO,IAAI;AAAA,EACb;AAEA,SAAO,EAAE,SAAS,KAAK,WAAW,OAAO,MAAM;AACjD;","names":[]}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
declare function useIpfsUpload(): {
|
|
2
|
-
preview: string | null;
|
|
3
|
-
uri: string | null;
|
|
4
|
-
uploading: boolean;
|
|
5
|
-
start: (file: File, upload: (file: File) => Promise<string>, onError: (message: string) => void) => Promise<void>;
|
|
6
|
-
clear: () => void;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export { useIpfsUpload };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
declare function useIpfsUpload(): {
|
|
2
|
-
preview: string | null;
|
|
3
|
-
uri: string | null;
|
|
4
|
-
uploading: boolean;
|
|
5
|
-
start: (file: File, upload: (file: File) => Promise<string>, onError: (message: string) => void) => Promise<void>;
|
|
6
|
-
clear: () => void;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export { useIpfsUpload };
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useEffect, useRef, useState } from "react";
|
|
3
|
-
import { uploadFailureToast } from "../../utils/ipfs-upload.js";
|
|
4
|
-
function useIpfsUpload() {
|
|
5
|
-
const [preview, setPreview] = useState(null);
|
|
6
|
-
const [uri, setUri] = useState(null);
|
|
7
|
-
const [uploading, setUploading] = useState(false);
|
|
8
|
-
const previewRef = useRef(null);
|
|
9
|
-
const revoke = () => {
|
|
10
|
-
if (previewRef.current) URL.revokeObjectURL(previewRef.current);
|
|
11
|
-
previewRef.current = null;
|
|
12
|
-
};
|
|
13
|
-
useEffect(() => revoke, []);
|
|
14
|
-
const start = async (file, upload, onError) => {
|
|
15
|
-
revoke();
|
|
16
|
-
const objectUrl = URL.createObjectURL(file);
|
|
17
|
-
previewRef.current = objectUrl;
|
|
18
|
-
setPreview(objectUrl);
|
|
19
|
-
setUri(null);
|
|
20
|
-
setUploading(true);
|
|
21
|
-
try {
|
|
22
|
-
setUri(await upload(file));
|
|
23
|
-
} catch (err) {
|
|
24
|
-
const toast = uploadFailureToast(err);
|
|
25
|
-
onError(toast.description ?? toast.title);
|
|
26
|
-
} finally {
|
|
27
|
-
setUploading(false);
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
const clear = () => {
|
|
31
|
-
revoke();
|
|
32
|
-
setPreview(null);
|
|
33
|
-
setUri(null);
|
|
34
|
-
};
|
|
35
|
-
return { preview, uri, uploading, start, clear };
|
|
36
|
-
}
|
|
37
|
-
export {
|
|
38
|
-
useIpfsUpload
|
|
39
|
-
};
|
|
40
|
-
//# sourceMappingURL=use-ipfs-upload.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/fast-mint/use-ipfs-upload.ts"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useRef, useState } from \"react\";\nimport { uploadFailureToast } from \"../../utils/ipfs-upload.js\";\n\nexport function useIpfsUpload() {\n const [preview, setPreview] = useState<string | null>(null);\n const [uri, setUri] = useState<string | null>(null);\n const [uploading, setUploading] = useState(false);\n const previewRef = useRef<string | null>(null);\n\n const revoke = () => {\n if (previewRef.current) URL.revokeObjectURL(previewRef.current);\n previewRef.current = null;\n };\n\n useEffect(() => revoke, []);\n\n const start = async (file: File, upload: (file: File) => Promise<string>, onError: (message: string) => void) => {\n revoke();\n const objectUrl = URL.createObjectURL(file);\n previewRef.current = objectUrl;\n setPreview(objectUrl);\n setUri(null);\n setUploading(true);\n try {\n setUri(await upload(file));\n } catch (err) {\n const toast = uploadFailureToast(err);\n onError(toast.description ?? toast.title);\n } finally {\n setUploading(false);\n }\n };\n\n const clear = () => {\n revoke();\n setPreview(null);\n setUri(null);\n };\n\n return { preview, uri, uploading, start, clear };\n}\n"],"mappings":";AAEA,SAAS,WAAW,QAAQ,gBAAgB;AAC5C,SAAS,0BAA0B;AAE5B,SAAS,gBAAgB;AAC9B,QAAM,CAAC,SAAS,UAAU,IAAI,SAAwB,IAAI;AAC1D,QAAM,CAAC,KAAK,MAAM,IAAI,SAAwB,IAAI;AAClD,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,KAAK;AAChD,QAAM,aAAa,OAAsB,IAAI;AAE7C,QAAM,SAAS,MAAM;AACnB,QAAI,WAAW,QAAS,KAAI,gBAAgB,WAAW,OAAO;AAC9D,eAAW,UAAU;AAAA,EACvB;AAEA,YAAU,MAAM,QAAQ,CAAC,CAAC;AAE1B,QAAM,QAAQ,OAAO,MAAY,QAAyC,YAAuC;AAC/G,WAAO;AACP,UAAM,YAAY,IAAI,gBAAgB,IAAI;AAC1C,eAAW,UAAU;AACrB,eAAW,SAAS;AACpB,WAAO,IAAI;AACX,iBAAa,IAAI;AACjB,QAAI;AACF,aAAO,MAAM,OAAO,IAAI,CAAC;AAAA,IAC3B,SAAS,KAAK;AACZ,YAAM,QAAQ,mBAAmB,GAAG;AACpC,cAAQ,MAAM,eAAe,MAAM,KAAK;AAAA,IAC1C,UAAE;AACA,mBAAa,KAAK;AAAA,IACpB;AAAA,EACF;AAEA,QAAM,QAAQ,MAAM;AAClB,WAAO;AACP,eAAW,IAAI;AACf,WAAO,IAAI;AAAA,EACb;AAEA,SAAO,EAAE,SAAS,KAAK,WAAW,OAAO,MAAM;AACjD;","names":[]}
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
"use client";
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
-
var use_launchpad_image_upload_exports = {};
|
|
21
|
-
__export(use_launchpad_image_upload_exports, {
|
|
22
|
-
useLaunchpadImageUpload: () => useLaunchpadImageUpload
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(use_launchpad_image_upload_exports);
|
|
25
|
-
var import_react = require("react");
|
|
26
|
-
var import_upload_limits = require("./upload-limits.js");
|
|
27
|
-
var import_medialane_app = require("../components/medialane-app.js");
|
|
28
|
-
var import_ipfs_upload = require("./ipfs-upload.js");
|
|
29
|
-
function useLaunchpadImageUpload({ successMessage, failureMessage = "Image upload failed" }) {
|
|
30
|
-
const app = (0, import_medialane_app.useMedialaneApp)();
|
|
31
|
-
const [imageFile, setImageFile] = (0, import_react.useState)(null);
|
|
32
|
-
const [imagePreview, setImagePreview] = (0, import_react.useState)(null);
|
|
33
|
-
const [imageUri, setImageUri] = (0, import_react.useState)(null);
|
|
34
|
-
const [imageUploading, setImageUploading] = (0, import_react.useState)(false);
|
|
35
|
-
const [uploadError, setUploadError] = (0, import_react.useState)(null);
|
|
36
|
-
const [uploadSuccess, setUploadSuccess] = (0, import_react.useState)(null);
|
|
37
|
-
const fileInputRef = (0, import_react.useRef)(null);
|
|
38
|
-
const previewUrlRef = (0, import_react.useRef)(null);
|
|
39
|
-
(0, import_react.useEffect)(() => {
|
|
40
|
-
return () => {
|
|
41
|
-
if (previewUrlRef.current) URL.revokeObjectURL(previewUrlRef.current);
|
|
42
|
-
};
|
|
43
|
-
}, []);
|
|
44
|
-
const clearImage = () => {
|
|
45
|
-
setImageFile(null);
|
|
46
|
-
setImagePreview(null);
|
|
47
|
-
setImageUri(null);
|
|
48
|
-
setUploadError(null);
|
|
49
|
-
setUploadSuccess(null);
|
|
50
|
-
if (fileInputRef.current) fileInputRef.current.value = "";
|
|
51
|
-
};
|
|
52
|
-
const handleImageSelect = async (file) => {
|
|
53
|
-
setUploadError(null);
|
|
54
|
-
setUploadSuccess(null);
|
|
55
|
-
const fileError = (0, import_upload_limits.uploadError)(file, "image");
|
|
56
|
-
if (fileError) {
|
|
57
|
-
setUploadError(fileError);
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
setImageFile(file);
|
|
61
|
-
if (previewUrlRef.current) URL.revokeObjectURL(previewUrlRef.current);
|
|
62
|
-
const objectUrl = URL.createObjectURL(file);
|
|
63
|
-
previewUrlRef.current = objectUrl;
|
|
64
|
-
setImagePreview(objectUrl);
|
|
65
|
-
setImageUri(null);
|
|
66
|
-
setImageUploading(true);
|
|
67
|
-
try {
|
|
68
|
-
await app.ensureSignedIn?.();
|
|
69
|
-
const uploaded = await Promise.race([
|
|
70
|
-
(0, import_ipfs_upload.uploadFileToIpfs)(app.getClient().api, file, "image"),
|
|
71
|
-
new Promise(
|
|
72
|
-
(_, reject) => setTimeout(() => reject(new Error("the image service is slow right now \u2014 please try again")), 6e4)
|
|
73
|
-
)
|
|
74
|
-
]);
|
|
75
|
-
setImageUri(uploaded.uri);
|
|
76
|
-
setUploadSuccess(successMessage);
|
|
77
|
-
} catch (error) {
|
|
78
|
-
setImageUri(null);
|
|
79
|
-
const msg = error instanceof Error ? error.message : void 0;
|
|
80
|
-
setUploadError(msg ? `${failureMessage}: ${msg}` : failureMessage);
|
|
81
|
-
} finally {
|
|
82
|
-
setImageUploading(false);
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
return {
|
|
86
|
-
imageFile,
|
|
87
|
-
imagePreview,
|
|
88
|
-
imageUri,
|
|
89
|
-
imageUploading,
|
|
90
|
-
uploadError,
|
|
91
|
-
uploadSuccess,
|
|
92
|
-
fileInputRef,
|
|
93
|
-
setImagePreview,
|
|
94
|
-
setImageUri,
|
|
95
|
-
handleImageSelect,
|
|
96
|
-
clearImage
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
100
|
-
0 && (module.exports = {
|
|
101
|
-
useLaunchpadImageUpload
|
|
102
|
-
});
|
|
103
|
-
//# sourceMappingURL=use-launchpad-image-upload.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/use-launchpad-image-upload.ts"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useRef, useState } from \"react\";\nimport { uploadError as checkUpload } from \"./upload-limits.js\";\nimport { useMedialaneApp } from \"../components/medialane-app.js\";\nimport { uploadFileToIpfs } from \"./ipfs-upload.js\";\n\ninterface UseLaunchpadImageUploadOptions {\n successMessage: string;\n failureMessage?: string;\n}\n\nexport function useLaunchpadImageUpload({ successMessage, failureMessage = \"Image upload failed\" }: UseLaunchpadImageUploadOptions) {\n const app = useMedialaneApp();\n const [imageFile, setImageFile] = useState<File | null>(null);\n const [imagePreview, setImagePreview] = useState<string | null>(null);\n const [imageUri, setImageUri] = useState<string | null>(null);\n const [imageUploading, setImageUploading] = useState(false);\n const [uploadError, setUploadError] = useState<string | null>(null);\n const [uploadSuccess, setUploadSuccess] = useState<string | null>(null);\n const fileInputRef = useRef<HTMLInputElement>(null);\n const previewUrlRef = useRef<string | null>(null);\n\n useEffect(() => {\n return () => {\n if (previewUrlRef.current) URL.revokeObjectURL(previewUrlRef.current);\n };\n }, []);\n\n const clearImage = () => {\n setImageFile(null);\n setImagePreview(null);\n setImageUri(null);\n setUploadError(null);\n setUploadSuccess(null);\n if (fileInputRef.current) fileInputRef.current.value = \"\";\n };\n\n const handleImageSelect = async (file: File) => {\n setUploadError(null);\n setUploadSuccess(null);\n\n const fileError = checkUpload(file, \"image\");\n if (fileError) {\n setUploadError(fileError);\n return;\n }\n\n setImageFile(file);\n if (previewUrlRef.current) URL.revokeObjectURL(previewUrlRef.current);\n const objectUrl = URL.createObjectURL(file);\n previewUrlRef.current = objectUrl;\n setImagePreview(objectUrl);\n setImageUri(null);\n setImageUploading(true);\n\n try {\n await app.ensureSignedIn?.();\n const uploaded = await Promise.race([\n uploadFileToIpfs(app.getClient().api, file, \"image\"),\n new Promise<never>((_, reject) =>\n setTimeout(() => reject(new Error(\"the image service is slow right now — please try again\")), 60_000),\n ),\n ]);\n setImageUri(uploaded.uri);\n setUploadSuccess(successMessage);\n } catch (error) {\n setImageUri(null);\n const msg = error instanceof Error ? error.message : undefined;\n setUploadError(msg ? `${failureMessage}: ${msg}` : failureMessage);\n } finally {\n setImageUploading(false);\n }\n };\n\n return {\n imageFile,\n imagePreview,\n imageUri,\n imageUploading,\n uploadError,\n uploadSuccess,\n fileInputRef,\n setImagePreview,\n setImageUri,\n handleImageSelect,\n clearImage,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAA4C;AAC5C,2BAA2C;AAC3C,2BAAgC;AAChC,yBAAiC;AAO1B,SAAS,wBAAwB,EAAE,gBAAgB,iBAAiB,sBAAsB,GAAmC;AAClI,QAAM,UAAM,sCAAgB;AAC5B,QAAM,CAAC,WAAW,YAAY,QAAI,uBAAsB,IAAI;AAC5D,QAAM,CAAC,cAAc,eAAe,QAAI,uBAAwB,IAAI;AACpE,QAAM,CAAC,UAAU,WAAW,QAAI,uBAAwB,IAAI;AAC5D,QAAM,CAAC,gBAAgB,iBAAiB,QAAI,uBAAS,KAAK;AAC1D,QAAM,CAAC,aAAa,cAAc,QAAI,uBAAwB,IAAI;AAClE,QAAM,CAAC,eAAe,gBAAgB,QAAI,uBAAwB,IAAI;AACtE,QAAM,mBAAe,qBAAyB,IAAI;AAClD,QAAM,oBAAgB,qBAAsB,IAAI;AAEhD,8BAAU,MAAM;AACd,WAAO,MAAM;AACX,UAAI,cAAc,QAAS,KAAI,gBAAgB,cAAc,OAAO;AAAA,IACtE;A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names":["checkUpload"]}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
interface UseLaunchpadImageUploadOptions {
|
|
4
|
-
successMessage: string;
|
|
5
|
-
failureMessage?: string;
|
|
6
|
-
}
|
|
7
|
-
declare function useLaunchpadImageUpload({ successMessage, failureMessage }: UseLaunchpadImageUploadOptions): {
|
|
8
|
-
imageFile: File | null;
|
|
9
|
-
imagePreview: string | null;
|
|
10
|
-
imageUri: string | null;
|
|
11
|
-
imageUploading: boolean;
|
|
12
|
-
uploadError: string | null;
|
|
13
|
-
uploadSuccess: string | null;
|
|
14
|
-
fileInputRef: React.RefObject<HTMLInputElement | null>;
|
|
15
|
-
setImagePreview: React.Dispatch<React.SetStateAction<string | null>>;
|
|
16
|
-
setImageUri: React.Dispatch<React.SetStateAction<string | null>>;
|
|
17
|
-
handleImageSelect: (file: File) => Promise<void>;
|
|
18
|
-
clearImage: () => void;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export { useLaunchpadImageUpload };
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
interface UseLaunchpadImageUploadOptions {
|
|
4
|
-
successMessage: string;
|
|
5
|
-
failureMessage?: string;
|
|
6
|
-
}
|
|
7
|
-
declare function useLaunchpadImageUpload({ successMessage, failureMessage }: UseLaunchpadImageUploadOptions): {
|
|
8
|
-
imageFile: File | null;
|
|
9
|
-
imagePreview: string | null;
|
|
10
|
-
imageUri: string | null;
|
|
11
|
-
imageUploading: boolean;
|
|
12
|
-
uploadError: string | null;
|
|
13
|
-
uploadSuccess: string | null;
|
|
14
|
-
fileInputRef: React.RefObject<HTMLInputElement | null>;
|
|
15
|
-
setImagePreview: React.Dispatch<React.SetStateAction<string | null>>;
|
|
16
|
-
setImageUri: React.Dispatch<React.SetStateAction<string | null>>;
|
|
17
|
-
handleImageSelect: (file: File) => Promise<void>;
|
|
18
|
-
clearImage: () => void;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export { useLaunchpadImageUpload };
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useEffect, useRef, useState } from "react";
|
|
3
|
-
import { uploadError as checkUpload } from "./upload-limits.js";
|
|
4
|
-
import { useMedialaneApp } from "../components/medialane-app.js";
|
|
5
|
-
import { uploadFileToIpfs } from "./ipfs-upload.js";
|
|
6
|
-
function useLaunchpadImageUpload({ successMessage, failureMessage = "Image upload failed" }) {
|
|
7
|
-
const app = useMedialaneApp();
|
|
8
|
-
const [imageFile, setImageFile] = useState(null);
|
|
9
|
-
const [imagePreview, setImagePreview] = useState(null);
|
|
10
|
-
const [imageUri, setImageUri] = useState(null);
|
|
11
|
-
const [imageUploading, setImageUploading] = useState(false);
|
|
12
|
-
const [uploadError, setUploadError] = useState(null);
|
|
13
|
-
const [uploadSuccess, setUploadSuccess] = useState(null);
|
|
14
|
-
const fileInputRef = useRef(null);
|
|
15
|
-
const previewUrlRef = useRef(null);
|
|
16
|
-
useEffect(() => {
|
|
17
|
-
return () => {
|
|
18
|
-
if (previewUrlRef.current) URL.revokeObjectURL(previewUrlRef.current);
|
|
19
|
-
};
|
|
20
|
-
}, []);
|
|
21
|
-
const clearImage = () => {
|
|
22
|
-
setImageFile(null);
|
|
23
|
-
setImagePreview(null);
|
|
24
|
-
setImageUri(null);
|
|
25
|
-
setUploadError(null);
|
|
26
|
-
setUploadSuccess(null);
|
|
27
|
-
if (fileInputRef.current) fileInputRef.current.value = "";
|
|
28
|
-
};
|
|
29
|
-
const handleImageSelect = async (file) => {
|
|
30
|
-
setUploadError(null);
|
|
31
|
-
setUploadSuccess(null);
|
|
32
|
-
const fileError = checkUpload(file, "image");
|
|
33
|
-
if (fileError) {
|
|
34
|
-
setUploadError(fileError);
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
setImageFile(file);
|
|
38
|
-
if (previewUrlRef.current) URL.revokeObjectURL(previewUrlRef.current);
|
|
39
|
-
const objectUrl = URL.createObjectURL(file);
|
|
40
|
-
previewUrlRef.current = objectUrl;
|
|
41
|
-
setImagePreview(objectUrl);
|
|
42
|
-
setImageUri(null);
|
|
43
|
-
setImageUploading(true);
|
|
44
|
-
try {
|
|
45
|
-
await app.ensureSignedIn?.();
|
|
46
|
-
const uploaded = await Promise.race([
|
|
47
|
-
uploadFileToIpfs(app.getClient().api, file, "image"),
|
|
48
|
-
new Promise(
|
|
49
|
-
(_, reject) => setTimeout(() => reject(new Error("the image service is slow right now \u2014 please try again")), 6e4)
|
|
50
|
-
)
|
|
51
|
-
]);
|
|
52
|
-
setImageUri(uploaded.uri);
|
|
53
|
-
setUploadSuccess(successMessage);
|
|
54
|
-
} catch (error) {
|
|
55
|
-
setImageUri(null);
|
|
56
|
-
const msg = error instanceof Error ? error.message : void 0;
|
|
57
|
-
setUploadError(msg ? `${failureMessage}: ${msg}` : failureMessage);
|
|
58
|
-
} finally {
|
|
59
|
-
setImageUploading(false);
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
return {
|
|
63
|
-
imageFile,
|
|
64
|
-
imagePreview,
|
|
65
|
-
imageUri,
|
|
66
|
-
imageUploading,
|
|
67
|
-
uploadError,
|
|
68
|
-
uploadSuccess,
|
|
69
|
-
fileInputRef,
|
|
70
|
-
setImagePreview,
|
|
71
|
-
setImageUri,
|
|
72
|
-
handleImageSelect,
|
|
73
|
-
clearImage
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
export {
|
|
77
|
-
useLaunchpadImageUpload
|
|
78
|
-
};
|
|
79
|
-
//# sourceMappingURL=use-launchpad-image-upload.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/use-launchpad-image-upload.ts"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useRef, useState } from \"react\";\nimport { uploadError as checkUpload } from \"./upload-limits.js\";\nimport { useMedialaneApp } from \"../components/medialane-app.js\";\nimport { uploadFileToIpfs } from \"./ipfs-upload.js\";\n\ninterface UseLaunchpadImageUploadOptions {\n successMessage: string;\n failureMessage?: string;\n}\n\nexport function useLaunchpadImageUpload({ successMessage, failureMessage = \"Image upload failed\" }: UseLaunchpadImageUploadOptions) {\n const app = useMedialaneApp();\n const [imageFile, setImageFile] = useState<File | null>(null);\n const [imagePreview, setImagePreview] = useState<string | null>(null);\n const [imageUri, setImageUri] = useState<string | null>(null);\n const [imageUploading, setImageUploading] = useState(false);\n const [uploadError, setUploadError] = useState<string | null>(null);\n const [uploadSuccess, setUploadSuccess] = useState<string | null>(null);\n const fileInputRef = useRef<HTMLInputElement>(null);\n const previewUrlRef = useRef<string | null>(null);\n\n useEffect(() => {\n return () => {\n if (previewUrlRef.current) URL.revokeObjectURL(previewUrlRef.current);\n };\n }, []);\n\n const clearImage = () => {\n setImageFile(null);\n setImagePreview(null);\n setImageUri(null);\n setUploadError(null);\n setUploadSuccess(null);\n if (fileInputRef.current) fileInputRef.current.value = \"\";\n };\n\n const handleImageSelect = async (file: File) => {\n setUploadError(null);\n setUploadSuccess(null);\n\n const fileError = checkUpload(file, \"image\");\n if (fileError) {\n setUploadError(fileError);\n return;\n }\n\n setImageFile(file);\n if (previewUrlRef.current) URL.revokeObjectURL(previewUrlRef.current);\n const objectUrl = URL.createObjectURL(file);\n previewUrlRef.current = objectUrl;\n setImagePreview(objectUrl);\n setImageUri(null);\n setImageUploading(true);\n\n try {\n await app.ensureSignedIn?.();\n const uploaded = await Promise.race([\n uploadFileToIpfs(app.getClient().api, file, \"image\"),\n new Promise<never>((_, reject) =>\n setTimeout(() => reject(new Error(\"the image service is slow right now — please try again\")), 60_000),\n ),\n ]);\n setImageUri(uploaded.uri);\n setUploadSuccess(successMessage);\n } catch (error) {\n setImageUri(null);\n const msg = error instanceof Error ? error.message : undefined;\n setUploadError(msg ? `${failureMessage}: ${msg}` : failureMessage);\n } finally {\n setImageUploading(false);\n }\n };\n\n return {\n imageFile,\n imagePreview,\n imageUri,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