@medialane/ui 0.396.0 → 0.398.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/add-guardian-dialog.cjs +3 -2
- package/dist/components/account/add-guardian-dialog.cjs.map +1 -1
- package/dist/components/account/add-guardian-dialog.js +3 -2
- package/dist/components/account/add-guardian-dialog.js.map +1 -1
- package/dist/components/account/input-otp.d.cts +2 -2
- package/dist/components/account/input-otp.d.ts +2 -2
- package/dist/components/approve-mint-dialog.cjs +7 -7
- package/dist/components/approve-mint-dialog.cjs.map +1 -1
- package/dist/components/approve-mint-dialog.js +7 -7
- package/dist/components/approve-mint-dialog.js.map +1 -1
- package/dist/components/asset-picker.cjs +5 -5
- package/dist/components/asset-picker.cjs.map +1 -1
- package/dist/components/asset-picker.js +5 -5
- package/dist/components/asset-picker.js.map +1 -1
- package/dist/components/asset-search-picker.cjs +1 -1
- package/dist/components/asset-search-picker.cjs.map +1 -1
- package/dist/components/asset-search-picker.js +1 -1
- package/dist/components/asset-search-picker.js.map +1 -1
- package/dist/components/button.d.cts +1 -1
- package/dist/components/button.d.ts +1 -1
- package/dist/components/coin-launch-preview.cjs +1 -1
- package/dist/components/coin-launch-preview.cjs.map +1 -1
- package/dist/components/coin-launch-preview.js +1 -1
- package/dist/components/coin-launch-preview.js.map +1 -1
- package/dist/components/create-aside.cjs +140 -0
- package/dist/components/create-aside.cjs.map +1 -0
- package/dist/components/create-aside.d.cts +101 -0
- package/dist/components/create-aside.d.ts +101 -0
- package/dist/components/create-aside.js +133 -0
- package/dist/components/create-aside.js.map +1 -0
- package/dist/components/create-sponsorship-aside.cjs +1 -1
- package/dist/components/create-sponsorship-aside.cjs.map +1 -1
- package/dist/components/create-sponsorship-aside.js +1 -1
- package/dist/components/create-sponsorship-aside.js.map +1 -1
- package/dist/components/drop/create/asset-editor.cjs +49 -34
- package/dist/components/drop/create/asset-editor.cjs.map +1 -1
- package/dist/components/drop/create/asset-editor.js +50 -35
- package/dist/components/drop/create/asset-editor.js.map +1 -1
- package/dist/components/drop/create/assets-panel.cjs +9 -9
- package/dist/components/drop/create/assets-panel.cjs.map +1 -1
- package/dist/components/drop/create/assets-panel.js +9 -9
- package/dist/components/drop/create/assets-panel.js.map +1 -1
- package/dist/components/drop/create/collection-panel.cjs +20 -8
- package/dist/components/drop/create/collection-panel.cjs.map +1 -1
- package/dist/components/drop/create/collection-panel.js +21 -9
- package/dist/components/drop/create/collection-panel.js.map +1 -1
- package/dist/components/drop/create/drop-create.cjs +2 -2
- package/dist/components/drop/create/drop-create.cjs.map +1 -1
- package/dist/components/drop/create/drop-create.js +2 -2
- package/dist/components/drop/create/drop-create.js.map +1 -1
- package/dist/components/drop/create/drop-fields.cjs +4 -5
- package/dist/components/drop/create/drop-fields.cjs.map +1 -1
- package/dist/components/drop/create/drop-fields.js +4 -5
- package/dist/components/drop/create/drop-fields.js.map +1 -1
- package/dist/components/drop/create/launch-dialog.cjs +1 -1
- package/dist/components/drop/create/launch-dialog.cjs.map +1 -1
- package/dist/components/drop/create/launch-dialog.js +1 -1
- package/dist/components/drop/create/launch-dialog.js.map +1 -1
- package/dist/components/drop/create/settings-panel.cjs +1 -1
- package/dist/components/drop/create/settings-panel.cjs.map +1 -1
- package/dist/components/drop/create/settings-panel.js +1 -1
- package/dist/components/drop/create/settings-panel.js.map +1 -1
- package/dist/components/external-link-field.cjs +1 -2
- package/dist/components/external-link-field.cjs.map +1 -1
- package/dist/components/external-link-field.js +2 -3
- package/dist/components/external-link-field.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 +7 -10
- package/dist/components/fast-mint/asset-form-parts.d.ts +7 -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/collection-section.cjs +8 -9
- package/dist/components/fast-mint/collection-section.cjs.map +1 -1
- package/dist/components/fast-mint/collection-section.d.cts +2 -2
- package/dist/components/fast-mint/collection-section.d.ts +2 -2
- package/dist/components/fast-mint/collection-section.js +8 -9
- package/dist/components/fast-mint/collection-section.js.map +1 -1
- package/dist/components/fast-mint/create-then-add.cjs +4 -5
- package/dist/components/fast-mint/create-then-add.cjs.map +1 -1
- package/dist/components/fast-mint/create-then-add.d.cts +2 -3
- package/dist/components/fast-mint/create-then-add.d.ts +2 -3
- package/dist/components/fast-mint/create-then-add.js +4 -5
- package/dist/components/fast-mint/create-then-add.js.map +1 -1
- package/dist/components/fast-mint/dropzone.cjs +9 -1
- package/dist/components/fast-mint/dropzone.cjs.map +1 -1
- package/dist/components/fast-mint/dropzone.js +9 -1
- package/dist/components/fast-mint/dropzone.js.map +1 -1
- package/dist/components/fast-mint/fast-mint.cjs +69 -58
- package/dist/components/fast-mint/fast-mint.cjs.map +1 -1
- package/dist/components/fast-mint/fast-mint.js +70 -59
- package/dist/components/fast-mint/fast-mint.js.map +1 -1
- package/dist/components/fast-mint/formats/nft.cjs +12 -12
- package/dist/components/fast-mint/formats/nft.cjs.map +1 -1
- package/dist/components/fast-mint/formats/nft.d.cts +2 -0
- package/dist/components/fast-mint/formats/nft.d.ts +2 -0
- package/dist/components/fast-mint/formats/nft.js +12 -12
- package/dist/components/fast-mint/formats/nft.js.map +1 -1
- package/dist/components/fast-mint/formats/pop.cjs +4 -4
- package/dist/components/fast-mint/formats/pop.cjs.map +1 -1
- package/dist/components/fast-mint/formats/pop.d.cts +2 -0
- package/dist/components/fast-mint/formats/pop.d.ts +2 -0
- package/dist/components/fast-mint/formats/pop.js +4 -4
- package/dist/components/fast-mint/formats/pop.js.map +1 -1
- package/dist/components/fast-mint/formats/registry.d.cts +2 -0
- package/dist/components/fast-mint/formats/registry.d.ts +2 -0
- package/dist/components/fast-mint/formats/tiers.cjs +25 -16
- package/dist/components/fast-mint/formats/tiers.cjs.map +1 -1
- package/dist/components/fast-mint/formats/tiers.d.cts +2 -0
- package/dist/components/fast-mint/formats/tiers.d.ts +2 -0
- package/dist/components/fast-mint/formats/tiers.js +25 -16
- package/dist/components/fast-mint/formats/tiers.js.map +1 -1
- package/dist/components/fast-mint/formats/types.cjs.map +1 -1
- package/dist/components/fast-mint/formats/types.d.cts +3 -1
- package/dist/components/fast-mint/formats/types.d.ts +3 -1
- package/dist/components/fast-mint/formats/types.js.map +1 -1
- package/dist/components/fast-mint/ip-type-section.cjs +2 -2
- package/dist/components/fast-mint/ip-type-section.cjs.map +1 -1
- package/dist/components/fast-mint/ip-type-section.js +2 -2
- package/dist/components/fast-mint/ip-type-section.js.map +1 -1
- package/dist/components/fast-mint/success-view.d.cts +2 -0
- package/dist/components/fast-mint/success-view.d.ts +2 -0
- package/dist/components/image-upload-field.cjs +139 -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 +105 -0
- package/dist/components/image-upload-field.js.map +1 -0
- package/dist/components/ip-type-fields.cjs +7 -6
- package/dist/components/ip-type-fields.cjs.map +1 -1
- package/dist/components/ip-type-fields.js +7 -6
- package/dist/components/ip-type-fields.js.map +1 -1
- package/dist/components/launchpad/coin-create.cjs +13 -56
- package/dist/components/launchpad/coin-create.cjs.map +1 -1
- package/dist/components/launchpad/coin-create.js +14 -57
- package/dist/components/launchpad/coin-create.js.map +1 -1
- package/dist/components/launchpad/collection-create-form.cjs +28 -87
- package/dist/components/launchpad/collection-create-form.cjs.map +1 -1
- package/dist/components/launchpad/collection-create-form.js +28 -87
- package/dist/components/launchpad/collection-create-form.js.map +1 -1
- package/dist/components/launchpad/collection-create-presets.cjs +31 -37
- package/dist/components/launchpad/collection-create-presets.cjs.map +1 -1
- package/dist/components/launchpad/collection-create-presets.d.cts +0 -3
- package/dist/components/launchpad/collection-create-presets.d.ts +0 -3
- package/dist/components/launchpad/collection-create-presets.js +31 -37
- package/dist/components/launchpad/collection-create-presets.js.map +1 -1
- package/dist/components/launchpad/edition-mint-fields.cjs +21 -105
- package/dist/components/launchpad/edition-mint-fields.cjs.map +1 -1
- package/dist/components/launchpad/edition-mint-fields.d.cts +5 -8
- package/dist/components/launchpad/edition-mint-fields.d.ts +5 -8
- package/dist/components/launchpad/edition-mint-fields.js +24 -98
- package/dist/components/launchpad/edition-mint-fields.js.map +1 -1
- package/dist/components/launchpad/edition-mint-schema.cjs +5 -4
- package/dist/components/launchpad/edition-mint-schema.cjs.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-schema.js +5 -4
- package/dist/components/launchpad/edition-mint-schema.js.map +1 -1
- package/dist/components/launchpad/edition-mint.cjs +36 -52
- package/dist/components/launchpad/edition-mint.cjs.map +1 -1
- package/dist/components/launchpad/edition-mint.js +36 -52
- package/dist/components/launchpad/edition-mint.js.map +1 -1
- package/dist/components/launchpad/pop-create-fields.cjs +46 -128
- package/dist/components/launchpad/pop-create-fields.cjs.map +1 -1
- package/dist/components/launchpad/pop-create-fields.d.cts +5 -8
- package/dist/components/launchpad/pop-create-fields.d.ts +5 -8
- package/dist/components/launchpad/pop-create-fields.js +46 -120
- package/dist/components/launchpad/pop-create-fields.js.map +1 -1
- package/dist/components/launchpad/pop-create-schema.cjs +2 -2
- package/dist/components/launchpad/pop-create-schema.cjs.map +1 -1
- package/dist/components/launchpad/pop-create-schema.js +2 -2
- package/dist/components/launchpad/pop-create-schema.js.map +1 -1
- package/dist/components/launchpad/pop-create.cjs +24 -36
- package/dist/components/launchpad/pop-create.cjs.map +1 -1
- package/dist/components/launchpad/pop-create.js +24 -36
- package/dist/components/launchpad/pop-create.js.map +1 -1
- package/dist/components/launchpad/remix-mint.cjs +42 -73
- package/dist/components/launchpad/remix-mint.cjs.map +1 -1
- package/dist/components/launchpad/remix-mint.js +43 -74
- package/dist/components/launchpad/remix-mint.js.map +1 -1
- package/dist/components/launchpad/single-edition-mint.cjs +37 -95
- package/dist/components/launchpad/single-edition-mint.cjs.map +1 -1
- package/dist/components/launchpad/single-edition-mint.js +38 -96
- package/dist/components/launchpad/single-edition-mint.js.map +1 -1
- package/dist/components/launchpad/sponsorship-create.cjs +17 -16
- package/dist/components/launchpad/sponsorship-create.cjs.map +1 -1
- package/dist/components/launchpad/sponsorship-create.js +17 -16
- package/dist/components/launchpad/sponsorship-create.js.map +1 -1
- package/dist/components/launchpad/tier-mint-form.cjs +21 -75
- package/dist/components/launchpad/tier-mint-form.cjs.map +1 -1
- package/dist/components/launchpad/tier-mint-form.js +22 -76
- package/dist/components/launchpad/tier-mint-form.js.map +1 -1
- package/dist/components/launchpad/tier-mint-presets.cjs +21 -21
- package/dist/components/launchpad/tier-mint-presets.cjs.map +1 -1
- package/dist/components/launchpad/tier-mint-presets.d.cts +2 -2
- package/dist/components/launchpad/tier-mint-presets.d.ts +2 -2
- package/dist/components/launchpad/tier-mint-presets.js +21 -21
- package/dist/components/launchpad/tier-mint-presets.js.map +1 -1
- package/dist/components/license-terms-builder.cjs +4 -4
- package/dist/components/license-terms-builder.cjs.map +1 -1
- package/dist/components/license-terms-builder.js +4 -4
- package/dist/components/license-terms-builder.js.map +1 -1
- package/dist/components/medialane-collection-card.cjs +1 -1
- package/dist/components/medialane-collection-card.cjs.map +1 -1
- package/dist/components/medialane-collection-card.js +1 -1
- package/dist/components/medialane-collection-card.js.map +1 -1
- package/dist/components/report-dialog.cjs +3 -3
- package/dist/components/report-dialog.cjs.map +1 -1
- package/dist/components/report-dialog.js +3 -3
- package/dist/components/report-dialog.js.map +1 -1
- package/dist/components/transaction-dialog.cjs +2 -2
- package/dist/components/transaction-dialog.cjs.map +1 -1
- package/dist/components/transaction-dialog.js +2 -2
- package/dist/components/transaction-dialog.js.map +1 -1
- package/dist/components/transfer-dialog.cjs +2 -1
- package/dist/components/transfer-dialog.cjs.map +1 -1
- package/dist/components/transfer-dialog.js +2 -1
- package/dist/components/transfer-dialog.js.map +1 -1
- package/dist/components/wallet/export-key-section.cjs +3 -2
- package/dist/components/wallet/export-key-section.cjs.map +1 -1
- package/dist/components/wallet/export-key-section.js +3 -2
- package/dist/components/wallet/export-key-section.js.map +1 -1
- package/dist/data/ip-templates.cjs +3 -3
- package/dist/data/ip-templates.cjs.map +1 -1
- package/dist/data/ip-templates.js +3 -3
- package/dist/data/ip-templates.js.map +1 -1
- package/dist/data/launchpad-services.cjs +21 -21
- package/dist/data/launchpad-services.cjs.map +1 -1
- package/dist/data/launchpad-services.js +21 -21
- package/dist/data/launchpad-services.js.map +1 -1
- package/dist/data/nav-commands.cjs +5 -5
- package/dist/data/nav-commands.cjs.map +1 -1
- package/dist/data/nav-commands.js +5 -5
- package/dist/data/nav-commands.js.map +1 -1
- package/dist/i18n/catalog/pt.cjs +278 -206
- package/dist/i18n/catalog/pt.cjs.map +1 -1
- package/dist/i18n/catalog/pt.js +278 -206
- package/dist/i18n/catalog/pt.js.map +1 -1
- package/dist/i18n/tools/scan.cjs +47 -2
- package/dist/i18n/tools/scan.cjs.map +1 -1
- package/dist/i18n/tools/scan.d.cts +6 -1
- package/dist/i18n/tools/scan.d.ts +6 -1
- package/dist/i18n/tools/scan.js +45 -1
- package/dist/i18n/tools/scan.js.map +1 -1
- package/dist/index.cjs +14 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +9 -2
- package/dist/index.js.map +1 -1
- package/dist/utils/drop/draft.cjs +3 -3
- package/dist/utils/drop/draft.cjs.map +1 -1
- package/dist/utils/drop/draft.js +3 -3
- package/dist/utils/drop/draft.js.map +1 -1
- package/dist/utils/ipfs-upload.cjs +13 -8
- package/dist/utils/ipfs-upload.cjs.map +1 -1
- package/dist/utils/ipfs-upload.d.cts +3 -4
- package/dist/utils/ipfs-upload.d.ts +3 -4
- package/dist/utils/ipfs-upload.js +13 -9
- package/dist/utils/ipfs-upload.js.map +1 -1
- package/dist/utils/launchpad-rules.cjs +4 -3
- package/dist/utils/launchpad-rules.cjs.map +1 -1
- package/dist/utils/launchpad-rules.d.cts +1 -1
- package/dist/utils/launchpad-rules.d.ts +1 -1
- package/dist/utils/launchpad-rules.js +4 -3
- package/dist/utils/launchpad-rules.js.map +1 -1
- package/dist/utils/order-form.cjs +3 -2
- package/dist/utils/order-form.cjs.map +1 -1
- package/dist/utils/order-form.js +3 -2
- package/dist/utils/order-form.js.map +1 -1
- package/dist/utils/upload-limits.cjs +10 -4
- package/dist/utils/upload-limits.cjs.map +1 -1
- package/dist/utils/upload-limits.d.cts +2 -1
- package/dist/utils/upload-limits.d.ts +2 -1
- package/dist/utils/upload-limits.js +11 -5
- package/dist/utils/upload-limits.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 +27 -0
- package/dist/utils/use-file-upload.d.ts +27 -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 +20 -0
- package/dist/utils/use-image-upload.d.ts +20 -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
|
@@ -41,7 +41,7 @@ function PopFields({ shared, state, update }) {
|
|
|
41
41
|
}) })
|
|
42
42
|
] }),
|
|
43
43
|
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
44
|
-
/* @__PURE__ */ jsx("label", { className: "text-sm font-medium", htmlFor: "fast-mint-symbol", children: t("
|
|
44
|
+
/* @__PURE__ */ jsx("label", { className: "text-sm font-medium", htmlFor: "fast-mint-symbol", children: t("Short code") }),
|
|
45
45
|
/* @__PURE__ */ jsx(
|
|
46
46
|
Input,
|
|
47
47
|
{
|
|
@@ -54,7 +54,7 @@ function PopFields({ shared, state, update }) {
|
|
|
54
54
|
)
|
|
55
55
|
] }),
|
|
56
56
|
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
57
|
-
/* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children: t("
|
|
57
|
+
/* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children: t("Claims close") }),
|
|
58
58
|
/* @__PURE__ */ jsxs("div", { className: "flex gap-2 items-center", children: [
|
|
59
59
|
/* @__PURE__ */ jsx(Input, { type: "date", "aria-label": t("Claim window closing date"), value: state.claimEndDate, onChange: (e) => update({ claimEndDate: e.target.value }), className: "flex-1" }),
|
|
60
60
|
/* @__PURE__ */ jsx(Input, { type: "time", "aria-label": t("Claim window closing time"), value: state.claimEndTime, onChange: (e) => update({ claimEndTime: e.target.value }), className: "w-28" })
|
|
@@ -105,7 +105,7 @@ const POP_FORMAT = defineFormat({
|
|
|
105
105
|
const { client, signer, onStep } = runtime;
|
|
106
106
|
const values = shared.form.getValues();
|
|
107
107
|
const uploadToken = await runtime.getUploadToken();
|
|
108
|
-
if (!uploadToken) throw new Error("Sign in first");
|
|
108
|
+
if (!uploadToken) throw new Error(msg("Sign in first"));
|
|
109
109
|
onStep({ label: msg("Creating"), index: 1, total: 1 });
|
|
110
110
|
const baseUri = await uploadJsonToIpfs(client.api, {
|
|
111
111
|
...buildCollectionMetadata({
|
|
@@ -127,7 +127,7 @@ const POP_FORMAT = defineFormat({
|
|
|
127
127
|
await executeIntent(signer, client, intent);
|
|
128
128
|
return {
|
|
129
129
|
headline: msg("Certificate created"),
|
|
130
|
-
detail: msg("It
|
|
130
|
+
detail: msg("It's saved permanently with you as the owner."),
|
|
131
131
|
name: values.name,
|
|
132
132
|
links: [{ href: "/launchpad/pop", label: msg("Open POP"), icon: Award }],
|
|
133
133
|
reward: "launch_launchpad"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/fast-mint/formats/pop.tsx"],"sourcesContent":["\"use client\";\n\nimport { Award } from \"lucide-react\";\nimport { buildCollectionMetadata } from \"@medialane/sdk\";\nimport { executeIntent } from \"@medialane/sdk/starknet\";\nimport { Input } from \"../../input.js\";\nimport { getMintFormatCopy } from \"../../../data/launchpad-services.js\";\nimport { cn } from \"../../../utils/cn.js\";\nimport { uploadJsonToIpfs } from \"../../../utils/ipfs-upload.js\";\nimport { getDefaultClaimWindow } from \"../../../utils/launchpad-defaults.js\";\nimport { isSymbol } from \"../../../utils/launchpad-rules.js\";\nimport { claimEndTimestamp, popEventAttributes, popEventIntent } from \"../../../utils/launchpad-actions.js\";\nimport { EVENT_TYPES, type PopEventType } from \"../../launchpad/pop-create-fields.js\";\nimport { defineFormat, type FormatFieldsProps } from \"./types.js\";\nimport { useT } from \"../../../i18n/provider.js\";\nimport { msg } from \"../../../i18n/translate.js\";\n\ninterface PopState {\n eventType: PopEventType;\n isPublic: boolean;\n claimEndDate: string;\n claimEndTime: string;\n}\n\nfunction PopFields({ shared, state, update }: FormatFieldsProps<PopState>) {\n const t = useT();\n return (\n <>\n <div className=\"space-y-2\">\n <label className=\"text-sm font-medium\">{t(\"What kind of event is this?\")}</label>\n <div className=\"grid grid-cols-4 gap-2\">\n {EVENT_TYPES.map(({ value, label, icon: Icon }) => {\n const selected = state.eventType === value;\n return (\n <button\n key={value}\n type=\"button\"\n aria-pressed={selected}\n onClick={() => update({ eventType: value })}\n className={cn(\n \"flex flex-col items-center gap-1.5 p-3 rounded-xl text-center transition-all\",\n selected\n ? \"bg-brand-blue/15 text-brand-blue\"\n : \"bg-background/40 text-muted-foreground\",\n )}\n >\n <Icon className=\"h-5 w-5\" />\n <span className=\"text-2xs font-semibold leading-tight\">{t(label)}</span>\n </button>\n );\n })}\n </div>\n </div>\n\n <div className=\"space-y-2\">\n <label className=\"text-sm font-medium\" htmlFor=\"fast-mint-symbol\">{t(\"
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/fast-mint/formats/pop.tsx"],"sourcesContent":["\"use client\";\n\nimport { Award } from \"lucide-react\";\nimport { buildCollectionMetadata } from \"@medialane/sdk\";\nimport { executeIntent } from \"@medialane/sdk/starknet\";\nimport { Input } from \"../../input.js\";\nimport { getMintFormatCopy } from \"../../../data/launchpad-services.js\";\nimport { cn } from \"../../../utils/cn.js\";\nimport { uploadJsonToIpfs } from \"../../../utils/ipfs-upload.js\";\nimport { getDefaultClaimWindow } from \"../../../utils/launchpad-defaults.js\";\nimport { isSymbol } from \"../../../utils/launchpad-rules.js\";\nimport { claimEndTimestamp, popEventAttributes, popEventIntent } from \"../../../utils/launchpad-actions.js\";\nimport { EVENT_TYPES, type PopEventType } from \"../../launchpad/pop-create-fields.js\";\nimport { defineFormat, type FormatFieldsProps } from \"./types.js\";\nimport { useT } from \"../../../i18n/provider.js\";\nimport { msg } from \"../../../i18n/translate.js\";\n\ninterface PopState {\n eventType: PopEventType;\n isPublic: boolean;\n claimEndDate: string;\n claimEndTime: string;\n}\n\nfunction PopFields({ shared, state, update }: FormatFieldsProps<PopState>) {\n const t = useT();\n return (\n <>\n <div className=\"space-y-2\">\n <label className=\"text-sm font-medium\">{t(\"What kind of event is this?\")}</label>\n <div className=\"grid grid-cols-4 gap-2\">\n {EVENT_TYPES.map(({ value, label, icon: Icon }) => {\n const selected = state.eventType === value;\n return (\n <button\n key={value}\n type=\"button\"\n aria-pressed={selected}\n onClick={() => update({ eventType: value })}\n className={cn(\n \"flex flex-col items-center gap-1.5 p-3 rounded-xl text-center transition-all\",\n selected\n ? \"bg-brand-blue/15 text-brand-blue\"\n : \"bg-background/40 text-muted-foreground\",\n )}\n >\n <Icon className=\"h-5 w-5\" />\n <span className=\"text-2xs font-semibold leading-tight\">{t(label)}</span>\n </button>\n );\n })}\n </div>\n </div>\n\n <div className=\"space-y-2\">\n <label className=\"text-sm font-medium\" htmlFor=\"fast-mint-symbol\">{t(\"Short code\")}</label>\n <Input\n id=\"fast-mint-symbol\"\n value={shared.draft.symbol}\n onChange={(e) => shared.draft.setSymbol(e.target.value.toUpperCase())}\n placeholder={t(\"SKHACK\")}\n className=\"max-w-[160px]\"\n />\n </div>\n\n <div className=\"space-y-2\">\n <label className=\"text-sm font-medium\">{t(\"Claims close\")}</label>\n <div className=\"flex gap-2 items-center\">\n <Input type=\"date\" aria-label={t(\"Claim window closing date\")} value={state.claimEndDate} onChange={(e) => update({ claimEndDate: e.target.value })} className=\"flex-1\" />\n <Input type=\"time\" aria-label={t(\"Claim window closing time\")} value={state.claimEndTime} onChange={(e) => update({ claimEndTime: e.target.value })} className=\"w-28\" />\n </div>\n </div>\n\n <div className=\"panel flex items-center justify-between p-4\">\n <div className=\"space-y-0.5\">\n <p className=\"text-sm font-medium\">{t(\"Event visibility\")}</p>\n <p className=\"text-xs text-muted-foreground\">\n {state.isPublic ? t(\"Listed publicly on the POP launchpad\") : t(\"Only accessible via direct link\")}\n </p>\n </div>\n <button\n type=\"button\"\n role=\"switch\"\n aria-label={t(\"Event visibility\")}\n aria-checked={state.isPublic}\n onClick={() => update({ isPublic: !state.isPublic })}\n className={cn(\n \"relative inline-flex h-6 w-11 shrink-0 rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n state.isPublic ? \"bg-brand-blue\" : \"bg-muted-foreground/30\",\n )}\n >\n <span\n className={cn(\n \"pointer-events-none block h-5 w-5 rounded-full bg-white shadow-sm transition-transform\",\n state.isPublic ? \"translate-x-5\" : \"translate-x-0\",\n )}\n />\n </button>\n </div>\n </>\n );\n}\n\nexport const POP_FORMAT = defineFormat<PopState>({\n key: \"pop\",\n title: getMintFormatCopy(\"pop-protocol\").name,\n hint: getMintFormatCopy(\"pop-protocol\").hint,\n icon: Award,\n submitLabel: () => msg(\"Create certificate\"),\n initial: () => ({ eventType: \"Conference\", isPublic: false, ...getDefaultClaimWindow() }),\n Fields: PopFields,\n isReady: (shared, state) =>\n isSymbol(shared.draft.symbol) &&\n !!state.claimEndDate &&\n claimEndTimestamp(state.claimEndDate, state.claimEndTime || \"23:59\") * 1000 > Date.now(),\n previewLabel: (shared) => shared.draft.symbol || \"POP\",\n submit: async (shared, state, runtime) => {\n const { client, signer, onStep } = runtime;\n const values = shared.form.getValues();\n const uploadToken = await runtime.getUploadToken();\n if (!uploadToken) throw new Error(msg(\"Sign in first\"));\n\n onStep({ label: msg(\"Creating\"), index: 1, total: 1 });\n const baseUri = await uploadJsonToIpfs(client.api, {\n ...buildCollectionMetadata({\n name: values.name,\n description: values.description,\n image: shared.image,\n externalLink: values.external_url,\n owner: shared.walletAddress,\n }),\n attributes: popEventAttributes(state.eventType, state.isPublic),\n });\n const intent = await popEventIntent(client.api, {\n owner: shared.walletAddress,\n name: values.name,\n symbol: shared.draft.symbol,\n baseUri,\n claimEndTimestamp: claimEndTimestamp(state.claimEndDate, state.claimEndTime || \"23:59\"),\n });\n await executeIntent(signer, client, intent);\n\n return {\n headline: msg(\"Certificate created\"),\n detail: msg(\"It's saved permanently with you as the owner.\"),\n name: values.name,\n links: [{ href: \"/launchpad/pop\", label: msg(\"Open POP\"), icon: Award }],\n reward: \"launch_launchpad\",\n };\n },\n});\n"],"mappings":";AA2BI,mBAEI,KAKM,YAPV;AAzBJ,SAAS,aAAa;AACtB,SAAS,+BAA+B;AACxC,SAAS,q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AQ,IAAI,+CAA+C;AAAA,MAC3D,MAAM,OAAO;AAAA,MACb,OAAO,CAAC,EAAE,MAAM,kBAAkB,OAAO,IAAI,UAAU,GAAG,MAAM,MAAM,CAAC;AAAA,MACvE,QAAQ;AAAA,IACV;AAAA,EACF;AACF,CAAC;","names":[]}
|
|
@@ -12,6 +12,8 @@ import '../types.cjs';
|
|
|
12
12
|
import 'starknet';
|
|
13
13
|
import '../use-new-collection-draft.cjs';
|
|
14
14
|
import '../create-then-add.cjs';
|
|
15
|
+
import '../../../i18n/make-t.cjs';
|
|
16
|
+
import '../../../i18n/translate.cjs';
|
|
15
17
|
|
|
16
18
|
declare const FORMATS: readonly FormatDefinition[];
|
|
17
19
|
declare function getFormat(key: MintFormat): FormatDefinition;
|
|
@@ -12,6 +12,8 @@ import '../types.js';
|
|
|
12
12
|
import 'starknet';
|
|
13
13
|
import '../use-new-collection-draft.js';
|
|
14
14
|
import '../create-then-add.js';
|
|
15
|
+
import '../../../i18n/make-t.js';
|
|
16
|
+
import '../../../i18n/translate.js';
|
|
15
17
|
|
|
16
18
|
declare const FORMATS: readonly FormatDefinition[];
|
|
17
19
|
declare function getFormat(key: MintFormat): FormatDefinition;
|
|
@@ -40,7 +40,7 @@ var import_types = require("./types.js");
|
|
|
40
40
|
var import_provider = require("../../../i18n/provider.js");
|
|
41
41
|
var import_translate = require("../../../i18n/translate.js");
|
|
42
42
|
function makeTierFormat(config) {
|
|
43
|
-
const { preset,
|
|
43
|
+
const { preset, text } = config;
|
|
44
44
|
const copy = (0, import_launchpad_services.getMintFormatCopy)(config.service);
|
|
45
45
|
const ownCollections = (shared) => shared.collections.filter((c) => (0, import_sdk.getService)(c.service)?.id === preset.service && !!c.contractAddress);
|
|
46
46
|
function Fields({ shared, state, update }) {
|
|
@@ -49,7 +49,7 @@ function makeTierFormat(config) {
|
|
|
49
49
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
50
50
|
import_collection_section.CollectionSection,
|
|
51
51
|
{
|
|
52
|
-
|
|
52
|
+
label: text.collectionLabel,
|
|
53
53
|
mode: state.mode,
|
|
54
54
|
onModeChange: (mode) => update({ mode }),
|
|
55
55
|
collections: ownCollections(shared),
|
|
@@ -61,10 +61,7 @@ function makeTierFormat(config) {
|
|
|
61
61
|
}
|
|
62
62
|
),
|
|
63
63
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-2", children: [
|
|
64
|
-
/* @__PURE__ */ (0, import_jsx_runtime.
|
|
65
|
-
t(config.supplyLabel),
|
|
66
|
-
" *"
|
|
67
|
-
] }),
|
|
64
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { className: "text-sm font-medium", htmlFor: `fast-mint-${config.key}-supply`, children: t(config.supplyLabel) }),
|
|
68
65
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
69
66
|
import_input.Input,
|
|
70
67
|
{
|
|
@@ -83,7 +80,7 @@ function makeTierFormat(config) {
|
|
|
83
80
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_input.Input, { type: "date", "aria-label": t("Valid from"), value: state.startDate, onChange: (e) => update({ startDate: e.target.value }) }),
|
|
84
81
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_input.Input, { type: "date", "aria-label": t("Valid until"), value: state.endDate, onChange: (e) => update({ endDate: e.target.value }) })
|
|
85
82
|
] }),
|
|
86
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-xs text-muted-foreground", children: preset.copy.validUntilHint })
|
|
83
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-xs text-muted-foreground", children: t(preset.copy.validUntilHint) })
|
|
87
84
|
] }),
|
|
88
85
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_licensing_section.LicensingSection, { form: shared.form })
|
|
89
86
|
] });
|
|
@@ -101,19 +98,19 @@ function makeTierFormat(config) {
|
|
|
101
98
|
if (state.mode === "new") return shared.draft.name.trim().length > 0 && shared.draft.symbol.trim().length > 0;
|
|
102
99
|
return state.existingContract !== "";
|
|
103
100
|
},
|
|
104
|
-
previewLabel: (shared, state) => state.mode === "new" ? shared.draft.name ||
|
|
101
|
+
previewLabel: (shared, state, t) => state.mode === "new" ? shared.draft.name || t(text.newCollection) : ownCollections(shared).find((c) => c.contractAddress === state.existingContract)?.name || void 0,
|
|
105
102
|
submit: async (shared, state, runtime) => {
|
|
106
103
|
const { client, signer, onStep } = runtime;
|
|
107
104
|
const owner = shared.walletAddress;
|
|
108
105
|
const values = shared.form.getValues();
|
|
109
106
|
const supply = state.supply.trim();
|
|
110
107
|
const uploadToken = await runtime.getUploadToken();
|
|
111
|
-
if (!uploadToken) throw new Error("Sign in first");
|
|
108
|
+
if (!uploadToken) throw new Error((0, import_translate.msg)("Sign in first"));
|
|
112
109
|
const existing = runtime.resume ?? (state.mode === "existing" && state.existingContract ? state.existingContract : null);
|
|
113
110
|
const contract = await (0, import_create_then_add.createThenAdd)({
|
|
114
111
|
existing,
|
|
115
|
-
|
|
116
|
-
labels: { create:
|
|
112
|
+
unfinished: text.unfinished,
|
|
113
|
+
labels: { create: text.creating, add: text.adding },
|
|
117
114
|
onStep,
|
|
118
115
|
create: async () => {
|
|
119
116
|
const baseUri = await (0, import_ipfs_upload.uploadJsonToIpfs)(
|
|
@@ -135,7 +132,7 @@ function makeTierFormat(config) {
|
|
|
135
132
|
});
|
|
136
133
|
const { receipt } = await (0, import_starknet.executeIntent)(signer, client, created);
|
|
137
134
|
const deployed = (0, import_starknet.deployedCollectionFromReceipt)(receipt, preset.service);
|
|
138
|
-
if (!deployed) throw new Error(
|
|
135
|
+
if (!deployed) throw new Error(text.unreadable);
|
|
139
136
|
return deployed;
|
|
140
137
|
},
|
|
141
138
|
add: async (address) => {
|
|
@@ -186,20 +183,32 @@ const TICKETS_FORMAT = makeTierFormat({
|
|
|
186
183
|
preset: import_tier_mint_presets.TICKETS_TIER_PRESET,
|
|
187
184
|
service: "ip-tickets",
|
|
188
185
|
icon: import_lucide_react.Ticket,
|
|
189
|
-
noun: "ticket collection",
|
|
190
186
|
supplyLabel: (0, import_translate.msg)("Number of tickets"),
|
|
191
187
|
submitLabel: (0, import_translate.msg)("Create tickets"),
|
|
192
|
-
|
|
188
|
+
text: {
|
|
189
|
+
collectionLabel: (0, import_translate.msg)("Ticket collection"),
|
|
190
|
+
newCollection: (0, import_translate.msg)("New ticket collection"),
|
|
191
|
+
creating: (0, import_translate.msg)("Creating the ticket collection"),
|
|
192
|
+
adding: (0, import_translate.msg)("Publishing tickets"),
|
|
193
|
+
unfinished: (0, import_translate.msg)("Your ticket collection was created, but the last step did not finish."),
|
|
194
|
+
unreadable: (0, import_translate.msg)("The ticket collection was created, but its address couldn't be read \u2014 check My Collections.")
|
|
195
|
+
}
|
|
193
196
|
});
|
|
194
197
|
const CLUB_FORMAT = makeTierFormat({
|
|
195
198
|
key: "club",
|
|
196
199
|
preset: import_tier_mint_presets.CLUB_TIER_PRESET,
|
|
197
200
|
service: "ip-club",
|
|
198
201
|
icon: import_lucide_react.Users,
|
|
199
|
-
noun: "club",
|
|
200
202
|
supplyLabel: (0, import_translate.msg)("Number of memberships"),
|
|
201
203
|
submitLabel: (0, import_translate.msg)("Create membership"),
|
|
202
|
-
|
|
204
|
+
text: {
|
|
205
|
+
collectionLabel: (0, import_translate.msg)("Club"),
|
|
206
|
+
newCollection: (0, import_translate.msg)("New club"),
|
|
207
|
+
creating: (0, import_translate.msg)("Creating the club"),
|
|
208
|
+
adding: (0, import_translate.msg)("Publishing memberships"),
|
|
209
|
+
unfinished: (0, import_translate.msg)("Your club was created, but the last step did not finish."),
|
|
210
|
+
unreadable: (0, import_translate.msg)("The club was created, but its address couldn't be read \u2014 check My Collections.")
|
|
211
|
+
}
|
|
203
212
|
});
|
|
204
213
|
// Annotate the CommonJS export names for ESM import in node:
|
|
205
214
|
0 && (module.exports = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/fast-mint/formats/tiers.tsx"],"sourcesContent":["\"use client\";\n\nimport { Eye, Ticket, Users } from \"lucide-react\";\nimport { buildCollectionMetadata, collectionHref, getService } from \"@medialane/sdk\";\nimport { deployedCollectionFromReceipt, executeIntent, executeIntents } from \"@medialane/sdk/starknet\";\nimport { Input } from \"../../input.js\";\nimport { getMintFormatCopy } from \"../../../data/launchpad-services.js\";\nimport { pinAssetMetadata, uploadJsonToIpfs } from \"../../../utils/ipfs-upload.js\";\nimport { isPositiveInteger } from \"../../../utils/launchpad-rules.js\";\nimport { dateToUnixTimestamp, serviceCollectionIntent, tierIntents, tierTraits } from \"../../../utils/launchpad-actions.js\";\nimport { CLUB_TIER_PRESET, TICKETS_TIER_PRESET, type TierMintPreset } from \"../../launchpad/tier-mint-presets.js\";\nimport { CollectionSection, type CollectionMode } from \"../collection-section.js\";\nimport { LicensingSection } from \"../licensing-section.js\";\nimport { createThenAdd } from \"../create-then-add.js\";\nimport { defineFormat, type FormatFieldsProps, type FormatShared } from \"./types.js\";\nimport { useT } from \"../../../i18n/provider.js\";\nimport { msg } from \"../../../i18n/translate.js\";\n\ninterface TierState {\n mode: CollectionMode;\n existingContract: string;\n supply: string;\n startDate: string;\n endDate: string;\n}\n\nfunction makeTierFormat(config: {\n key: \"tickets\" | \"club\";\n service: string;\n preset: TierMintPreset;\n icon: typeof Ticket;\n noun: string;\n supplyLabel: string;\n submitLabel: string;\n addLabel: string;\n}) {\n const { preset, noun } = config;\n const copy = getMintFormatCopy(config.service);\n\n const ownCollections = (shared: FormatShared) =>\n shared.collections.filter((c) => getService(c.service)?.id === preset.service && !!c.contractAddress);\n\n function Fields({ shared, state, update }: FormatFieldsProps<TierState>) {\n const t = useT();\n return (\n <>\n <CollectionSection\n noun={noun}\n mode={state.mode}\n onModeChange={(mode) => update({ mode })}\n collections={ownCollections(shared)}\n value={state.existingContract}\n onValue={(existingContract) => update({ existingContract })}\n valueOf={(c) => c.contractAddress}\n draft={shared.draft}\n previewImage={shared.previewImage}\n />\n\n <div className=\"space-y-2\">\n <label className=\"text-sm font-medium\" htmlFor={`fast-mint-${config.key}-supply`}>{t(config.supplyLabel)} *</label>\n <Input\n id={`fast-mint-${config.key}-supply`}\n type=\"number\"\n min={1}\n value={state.supply}\n onChange={(e) => update({ supply: e.target.value })}\n className=\"max-w-[160px]\"\n />\n </div>\n\n <div className=\"space-y-2\">\n <label className=\"text-sm font-medium\">{t(\"Valid\")}</label>\n <div className=\"grid grid-cols-2 gap-2\">\n <Input type=\"date\" aria-label={t(\"Valid from\")} value={state.startDate} onChange={(e) => update({ startDate: e.target.value })} />\n <Input type=\"date\" aria-label={t(\"Valid until\")} value={state.endDate} onChange={(e) => update({ endDate: e.target.value })} />\n </div>\n <p className=\"text-xs text-muted-foreground\">{preset.copy.validUntilHint}</p>\n </div>\n\n <LicensingSection form={shared.form} />\n </>\n );\n }\n\n return defineFormat<TierState>({\n key: config.key,\n title: copy.name,\n hint: copy.hint,\n icon: config.icon,\n submitLabel: () => config.submitLabel,\n initial: () => ({ mode: \"existing\", existingContract: \"\", supply: \"100\", startDate: \"\", endDate: \"\" }),\n Fields,\n isReady: (shared, state) => {\n if (!isPositiveInteger(state.supply)) return false;\n if (state.mode === \"new\") return shared.draft.name.trim().length > 0 && shared.draft.symbol.trim().length > 0;\n return state.existingContract !== \"\";\n },\n previewLabel: (shared, state) =>\n state.mode === \"new\"\n ? shared.draft.name || `New ${noun}`\n : ownCollections(shared).find((c) => c.contractAddress === state.existingContract)?.name || undefined,\n submit: async (shared, state, runtime) => {\n const { client, signer, onStep } = runtime;\n const owner = shared.walletAddress;\n const values = shared.form.getValues();\n const supply = state.supply.trim();\n\n const uploadToken = await runtime.getUploadToken();\n if (!uploadToken) throw new Error(\"Sign in first\");\n\n const existing = (runtime.resume as string | null) ?? (state.mode === \"existing\" && state.existingContract ? state.existingContract : null);\n\n const contract = await createThenAdd<string, string>({\n existing,\n noun,\n labels: { create: `Creating the ${noun}`, add: config.addLabel },\n onStep,\n create: async () => {\n const baseUri = await uploadJsonToIpfs(\n client.api,\n buildCollectionMetadata({\n name: shared.draft.name,\n description: shared.draft.description,\n image: shared.image,\n externalLink: values.external_url,\n owner,\n }),\n );\n const created = await serviceCollectionIntent(client.api, {\n owner,\n name: shared.draft.name,\n symbol: shared.draft.symbol,\n baseUri,\n service: preset.service,\n });\n const { receipt } = await executeIntent(signer, client, created);\n const deployed = deployedCollectionFromReceipt(receipt, preset.service);\n if (!deployed) throw new Error(`The ${noun} was deployed, but its address couldn't be read — check My Collections.`);\n return deployed;\n },\n add: async (address) => {\n const pinned = await pinAssetMetadata(client.api, {\n name: values.name,\n description: values.description,\n imageUri: shared.image,\n externalUrl: values.external_url,\n ipType: \"NFT\",\n licenseType: values.licenseType,\n commercialUse: values.commercialUse,\n derivatives: values.derivatives,\n attribution: values.attribution,\n geographicScope: values.geographicScope,\n aiPolicy: values.aiPolicy,\n royalty: String(values.royalty),\n creator: owner,\n templateTraits: tierTraits(preset.traitType, supply, address),\n });\n const intents = await tierIntents(client.api, {\n owner,\n contract: address,\n service: preset.service,\n tierId: await preset.predictNextId(client.api, address),\n maxSupply: supply,\n startTime: dateToUnixTimestamp(state.startDate),\n endTime: dateToUnixTimestamp(state.endDate),\n royaltyBps: Math.round(values.royalty * 100),\n metadataUri: pinned.uri,\n });\n await executeIntents(signer, client, intents);\n return address;\n },\n });\n\n return {\n headline: preset.success.title,\n detail: preset.success.description,\n name: values.name,\n collectionLabel: ownCollections(shared).find((c) => c.contractAddress === contract)?.name || (state.mode === \"new\" ? shared.draft.name : undefined),\n links: [{ href: collectionHref(\"STARKNET\", contract), label: msg(\"View collection\"), icon: Eye }],\n reward: \"launch_launchpad\",\n };\n },\n });\n}\n\nexport const TICKETS_FORMAT = makeTierFormat({\n key: \"tickets\",\n preset: TICKETS_TIER_PRESET,\n service: \"ip-tickets\",\n icon: Ticket,\n noun: \"ticket collection\",\n supplyLabel: msg(\"Number of tickets\"),\n submitLabel: msg(\"Create tickets\"),\n addLabel: msg(\"Minting tickets\"),\n});\n\nexport const CLUB_FORMAT = makeTierFormat({\n key: \"club\",\n preset: CLUB_TIER_PRESET,\n service: \"ip-club\",\n icon: Users,\n noun: \"club\",\n supplyLabel: msg(\"Number of memberships\"),\n submitLabel: msg(\"Create membership\"),\n addLabel: msg(\"Minting memberships\"),\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA6CM;AA3CN,0BAAmC;AACnC,iBAAoE;AACpE,sBAA6E;AAC7E,mBAAsB;AACtB,gCAAkC;AAClC,yBAAmD;AACnD,6BAAkC;AAClC,+BAAsF;AACtF,+BAA2E;AAC3E,gCAAuD;AACvD,+BAAiC;AACjC,6BAA8B;AAC9B,mBAAwE;AACxE,sBAAqB;AACrB,uBAAoB;AAUpB,SAAS,eAAe,QASrB;AACD,QAAM,EAAE,QAAQ,KAAK,IAAI;AACzB,QAAM,WAAO,6CAAkB,OAAO,OAAO;AAE7C,QAAM,iBAAiB,CAAC,WACtB,OAAO,YAAY,OAAO,CAAC,UAAM,uBAAW,EAAE,OAAO,GAAG,OAAO,OAAO,WAAW,CAAC,CAAC,EAAE,eAAe;AAEtG,WAAS,OAAO,EAAE,QAAQ,OAAO,OAAO,GAAiC;AACzE,UAAM,QAAI,sBAAK;AACb,WACE,4EACE;AAAA;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA,MAAM,MAAM;AAAA,UACZ,cAAc,CAAC,SAAS,OAAO,EAAE,KAAK,CAAC;AAAA,UACvC,aAAa,eAAe,MAAM;AAAA,UAClC,OAAO,MAAM;AAAA,UACb,SAAS,CAAC,qBAAqB,OAAO,EAAE,iBAAiB,CAAC;AAAA,UAC1D,SAAS,CAAC,MAAM,EAAE;AAAA,UAClB,OAAO,OAAO;AAAA,UACd,cAAc,OAAO;AAAA;AAAA,MACvB;AAAA,MAEA,6CAAC,SAAI,WAAU,aACb;AAAA,qDAAC,WAAM,WAAU,uBAAsB,SAAS,aAAa,OAAO,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,SAAS,MAAM,SAAS,QAAQ,OAAO,MAAM,OAAO;AAAA,QACzI,OAAO,CAAC,EAAE,UAAM,2BAAe,YAAY,QAAQ,GAAG,WAAO,sBAAI,iBAAiB,GAAG,MAAM,wBAAI,CAAC;AAAA,QAChG,QAAQ;AAAA,MACV;AAAA,IACF;AAAA,EACF,CAAC;AACH;AAEO,MAAM,iBAAiB,eAAe;AAAA,EAC3C,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,MAAM;AAAA,EACN,MAAM;AAAA,EACN,iBAAa,sBAAI,mBAAmB;AAAA,EACpC,iBAAa,sBAAI,gBAAgB;AAAA,EACjC,cAAU,sBAAI,iBAAiB;AACjC,CAAC;AAEM,MAAM,cAAc,eAAe;AAAA,EACxC,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,MAAM;AAAA,EACN,MAAM;AAAA,EACN,iBAAa,sBAAI,uBAAuB;AAAA,EACxC,iBAAa,sBAAI,mBAAmB;AAAA,EACpC,cAAU,sBAAI,qBAAqB;AACrC,CAAC;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/fast-mint/formats/tiers.tsx"],"sourcesContent":["\"use client\";\n\nimport { Eye, Ticket, Users } from \"lucide-react\";\nimport { buildCollectionMetadata, collectionHref, getService } from \"@medialane/sdk\";\nimport { deployedCollectionFromReceipt, executeIntent, executeIntents } from \"@medialane/sdk/starknet\";\nimport { Input } from \"../../input.js\";\nimport { getMintFormatCopy } from \"../../../data/launchpad-services.js\";\nimport { pinAssetMetadata, uploadJsonToIpfs } from \"../../../utils/ipfs-upload.js\";\nimport { isPositiveInteger } from \"../../../utils/launchpad-rules.js\";\nimport { dateToUnixTimestamp, serviceCollectionIntent, tierIntents, tierTraits } from \"../../../utils/launchpad-actions.js\";\nimport { CLUB_TIER_PRESET, TICKETS_TIER_PRESET, type TierMintPreset } from \"../../launchpad/tier-mint-presets.js\";\nimport { CollectionSection, type CollectionMode } from \"../collection-section.js\";\nimport { LicensingSection } from \"../licensing-section.js\";\nimport { createThenAdd } from \"../create-then-add.js\";\nimport { defineFormat, type FormatFieldsProps, type FormatShared } from \"./types.js\";\nimport { useT } from \"../../../i18n/provider.js\";\nimport { msg } from \"../../../i18n/translate.js\";\n\ninterface TierState {\n mode: CollectionMode;\n existingContract: string;\n supply: string;\n startDate: string;\n endDate: string;\n}\n\ninterface TierText {\n collectionLabel: string;\n newCollection: string;\n creating: string;\n adding: string;\n unfinished: string;\n unreadable: string;\n}\n\nfunction makeTierFormat(config: {\n key: \"tickets\" | \"club\";\n service: string;\n preset: TierMintPreset;\n icon: typeof Ticket;\n supplyLabel: string;\n submitLabel: string;\n text: TierText;\n}) {\n const { preset, text } = config;\n const copy = getMintFormatCopy(config.service);\n\n const ownCollections = (shared: FormatShared) =>\n shared.collections.filter((c) => getService(c.service)?.id === preset.service && !!c.contractAddress);\n\n function Fields({ shared, state, update }: FormatFieldsProps<TierState>) {\n const t = useT();\n return (\n <>\n <CollectionSection\n label={text.collectionLabel}\n mode={state.mode}\n onModeChange={(mode) => update({ mode })}\n collections={ownCollections(shared)}\n value={state.existingContract}\n onValue={(existingContract) => update({ existingContract })}\n valueOf={(c) => c.contractAddress}\n draft={shared.draft}\n previewImage={shared.previewImage}\n />\n\n <div className=\"space-y-2\">\n <label className=\"text-sm font-medium\" htmlFor={`fast-mint-${config.key}-supply`}>{t(config.supplyLabel)}</label>\n <Input\n id={`fast-mint-${config.key}-supply`}\n type=\"number\"\n min={1}\n value={state.supply}\n onChange={(e) => update({ supply: e.target.value })}\n className=\"max-w-[160px]\"\n />\n </div>\n\n <div className=\"space-y-2\">\n <label className=\"text-sm font-medium\">{t(\"Valid\")}</label>\n <div className=\"grid grid-cols-2 gap-2\">\n <Input type=\"date\" aria-label={t(\"Valid from\")} value={state.startDate} onChange={(e) => update({ startDate: e.target.value })} />\n <Input type=\"date\" aria-label={t(\"Valid until\")} value={state.endDate} onChange={(e) => update({ endDate: e.target.value })} />\n </div>\n <p className=\"text-xs text-muted-foreground\">{t(preset.copy.validUntilHint)}</p>\n </div>\n\n <LicensingSection form={shared.form} />\n </>\n );\n }\n\n return defineFormat<TierState>({\n key: config.key,\n title: copy.name,\n hint: copy.hint,\n icon: config.icon,\n submitLabel: () => config.submitLabel,\n initial: () => ({ mode: \"existing\", existingContract: \"\", supply: \"100\", startDate: \"\", endDate: \"\" }),\n Fields,\n isReady: (shared, state) => {\n if (!isPositiveInteger(state.supply)) return false;\n if (state.mode === \"new\") return shared.draft.name.trim().length > 0 && shared.draft.symbol.trim().length > 0;\n return state.existingContract !== \"\";\n },\n previewLabel: (shared, state, t) =>\n state.mode === \"new\"\n ? shared.draft.name || t(text.newCollection)\n : ownCollections(shared).find((c) => c.contractAddress === state.existingContract)?.name || undefined,\n submit: async (shared, state, runtime) => {\n const { client, signer, onStep } = runtime;\n const owner = shared.walletAddress;\n const values = shared.form.getValues();\n const supply = state.supply.trim();\n\n const uploadToken = await runtime.getUploadToken();\n if (!uploadToken) throw new Error(msg(\"Sign in first\"));\n\n const existing = (runtime.resume as string | null) ?? (state.mode === \"existing\" && state.existingContract ? state.existingContract : null);\n\n const contract = await createThenAdd<string, string>({\n existing,\n unfinished: text.unfinished,\n labels: { create: text.creating, add: text.adding },\n onStep,\n create: async () => {\n const baseUri = await uploadJsonToIpfs(\n client.api,\n buildCollectionMetadata({\n name: shared.draft.name,\n description: shared.draft.description,\n image: shared.image,\n externalLink: values.external_url,\n owner,\n }),\n );\n const created = await serviceCollectionIntent(client.api, {\n owner,\n name: shared.draft.name,\n symbol: shared.draft.symbol,\n baseUri,\n service: preset.service,\n });\n const { receipt } = await executeIntent(signer, client, created);\n const deployed = deployedCollectionFromReceipt(receipt, preset.service);\n if (!deployed) throw new Error(text.unreadable);\n return deployed;\n },\n add: async (address) => {\n const pinned = await pinAssetMetadata(client.api, {\n name: values.name,\n description: values.description,\n imageUri: shared.image,\n externalUrl: values.external_url,\n ipType: \"NFT\",\n licenseType: values.licenseType,\n commercialUse: values.commercialUse,\n derivatives: values.derivatives,\n attribution: values.attribution,\n geographicScope: values.geographicScope,\n aiPolicy: values.aiPolicy,\n royalty: String(values.royalty),\n creator: owner,\n templateTraits: tierTraits(preset.traitType, supply, address),\n });\n const intents = await tierIntents(client.api, {\n owner,\n contract: address,\n service: preset.service,\n tierId: await preset.predictNextId(client.api, address),\n maxSupply: supply,\n startTime: dateToUnixTimestamp(state.startDate),\n endTime: dateToUnixTimestamp(state.endDate),\n royaltyBps: Math.round(values.royalty * 100),\n metadataUri: pinned.uri,\n });\n await executeIntents(signer, client, intents);\n return address;\n },\n });\n\n return {\n headline: preset.success.title,\n detail: preset.success.description,\n name: values.name,\n collectionLabel: ownCollections(shared).find((c) => c.contractAddress === contract)?.name || (state.mode === \"new\" ? shared.draft.name : undefined),\n links: [{ href: collectionHref(\"STARKNET\", contract), label: msg(\"View collection\"), icon: Eye }],\n reward: \"launch_launchpad\",\n };\n },\n });\n}\n\nexport const TICKETS_FORMAT = makeTierFormat({\n key: \"tickets\",\n preset: TICKETS_TIER_PRESET,\n service: \"ip-tickets\",\n icon: Ticket,\n supplyLabel: msg(\"Number of tickets\"),\n submitLabel: msg(\"Create tickets\"),\n text: {\n collectionLabel: msg(\"Ticket collection\"),\n newCollection: msg(\"New ticket collection\"),\n creating: msg(\"Creating the ticket collection\"),\n adding: msg(\"Publishing tickets\"),\n unfinished: msg(\"Your ticket collection was created, but the last step did not finish.\"),\n unreadable: msg(\"The ticket collection was created, but its address couldn't be read — check My Collections.\"),\n },\n});\n\nexport const CLUB_FORMAT = makeTierFormat({\n key: \"club\",\n preset: CLUB_TIER_PRESET,\n service: \"ip-club\",\n icon: Users,\n supplyLabel: msg(\"Number of memberships\"),\n submitLabel: msg(\"Create membership\"),\n text: {\n collectionLabel: msg(\"Club\"),\n newCollection: msg(\"New club\"),\n creating: msg(\"Creating the club\"),\n adding: msg(\"Publishing memberships\"),\n unfinished: msg(\"Your club was created, but the last step did not finish.\"),\n unreadable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AAG,MAAM,wBAAI,CAAC;AAAA,QAChG,QAAQ;AAAA,MACV;AAAA,IACF;AAAA,EACF,CAAC;AACH;AAEO,MAAM,iBAAiB,eAAe;AAAA,EAC3C,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,MAAM;AAAA,EACN,iBAAa,sBAAI,mBAAmB;AAAA,EACpC,iBAAa,sBAAI,gBAAgB;AAAA,EACjC,MAAM;AAAA,IACJ,qBAAiB,sBAAI,mBAAmB;AAAA,IACxC,mBAAe,sBAAI,uBAAuB;AAAA,IAC1C,cAAU,sBAAI,gCAAgC;AAAA,IAC9C,YAAQ,sBAAI,oBAAoB;AAAA,IAChC,gBAAY,sBAAI,uEAAuE;AAAA,IACvF,gBAAY,sBAAI,kGAA6F;AAAA,EAC/G;AACF,CAAC;AAEM,MAAM,cAAc,eAAe;AAAA,EACxC,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,MAAM;AAAA,EACN,iBAAa,sBAAI,uBAAuB;AAAA,EACxC,iBAAa,sBAAI,mBAAmB;AAAA,EACpC,MAAM;AAAA,IACJ,qBAAiB,sBAAI,MAAM;AAAA,IAC3B,mBAAe,sBAAI,UAAU;AAAA,IAC7B,cAAU,sBAAI,mBAAmB;AAAA,IACjC,YAAQ,sBAAI,wBAAwB;AAAA,IACpC,gBAAY,sBAAI,0DAA0D;AAAA,IAC1E,gBAAY,sBAAI,qFAAgF;AAAA,EAClG;AACF,CAAC;","names":[]}
|
|
@@ -12,6 +12,8 @@ import '../types.cjs';
|
|
|
12
12
|
import 'starknet';
|
|
13
13
|
import '../use-new-collection-draft.cjs';
|
|
14
14
|
import '../create-then-add.cjs';
|
|
15
|
+
import '../../../i18n/make-t.cjs';
|
|
16
|
+
import '../../../i18n/translate.cjs';
|
|
15
17
|
|
|
16
18
|
declare const TICKETS_FORMAT: FormatDefinition<unknown>;
|
|
17
19
|
declare const CLUB_FORMAT: FormatDefinition<unknown>;
|
|
@@ -12,6 +12,8 @@ import '../types.js';
|
|
|
12
12
|
import 'starknet';
|
|
13
13
|
import '../use-new-collection-draft.js';
|
|
14
14
|
import '../create-then-add.js';
|
|
15
|
+
import '../../../i18n/make-t.js';
|
|
16
|
+
import '../../../i18n/translate.js';
|
|
15
17
|
|
|
16
18
|
declare const TICKETS_FORMAT: FormatDefinition<unknown>;
|
|
17
19
|
declare const CLUB_FORMAT: FormatDefinition<unknown>;
|
|
@@ -16,7 +16,7 @@ import { defineFormat } from "./types.js";
|
|
|
16
16
|
import { useT } from "../../../i18n/provider.js";
|
|
17
17
|
import { msg } from "../../../i18n/translate.js";
|
|
18
18
|
function makeTierFormat(config) {
|
|
19
|
-
const { preset,
|
|
19
|
+
const { preset, text } = config;
|
|
20
20
|
const copy = getMintFormatCopy(config.service);
|
|
21
21
|
const ownCollections = (shared) => shared.collections.filter((c) => getService(c.service)?.id === preset.service && !!c.contractAddress);
|
|
22
22
|
function Fields({ shared, state, update }) {
|
|
@@ -25,7 +25,7 @@ function makeTierFormat(config) {
|
|
|
25
25
|
/* @__PURE__ */ jsx(
|
|
26
26
|
CollectionSection,
|
|
27
27
|
{
|
|
28
|
-
|
|
28
|
+
label: text.collectionLabel,
|
|
29
29
|
mode: state.mode,
|
|
30
30
|
onModeChange: (mode) => update({ mode }),
|
|
31
31
|
collections: ownCollections(shared),
|
|
@@ -37,10 +37,7 @@ function makeTierFormat(config) {
|
|
|
37
37
|
}
|
|
38
38
|
),
|
|
39
39
|
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
40
|
-
/* @__PURE__ */
|
|
41
|
-
t(config.supplyLabel),
|
|
42
|
-
" *"
|
|
43
|
-
] }),
|
|
40
|
+
/* @__PURE__ */ jsx("label", { className: "text-sm font-medium", htmlFor: `fast-mint-${config.key}-supply`, children: t(config.supplyLabel) }),
|
|
44
41
|
/* @__PURE__ */ jsx(
|
|
45
42
|
Input,
|
|
46
43
|
{
|
|
@@ -59,7 +56,7 @@ function makeTierFormat(config) {
|
|
|
59
56
|
/* @__PURE__ */ jsx(Input, { type: "date", "aria-label": t("Valid from"), value: state.startDate, onChange: (e) => update({ startDate: e.target.value }) }),
|
|
60
57
|
/* @__PURE__ */ jsx(Input, { type: "date", "aria-label": t("Valid until"), value: state.endDate, onChange: (e) => update({ endDate: e.target.value }) })
|
|
61
58
|
] }),
|
|
62
|
-
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: preset.copy.validUntilHint })
|
|
59
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: t(preset.copy.validUntilHint) })
|
|
63
60
|
] }),
|
|
64
61
|
/* @__PURE__ */ jsx(LicensingSection, { form: shared.form })
|
|
65
62
|
] });
|
|
@@ -77,19 +74,19 @@ function makeTierFormat(config) {
|
|
|
77
74
|
if (state.mode === "new") return shared.draft.name.trim().length > 0 && shared.draft.symbol.trim().length > 0;
|
|
78
75
|
return state.existingContract !== "";
|
|
79
76
|
},
|
|
80
|
-
previewLabel: (shared, state) => state.mode === "new" ? shared.draft.name ||
|
|
77
|
+
previewLabel: (shared, state, t) => state.mode === "new" ? shared.draft.name || t(text.newCollection) : ownCollections(shared).find((c) => c.contractAddress === state.existingContract)?.name || void 0,
|
|
81
78
|
submit: async (shared, state, runtime) => {
|
|
82
79
|
const { client, signer, onStep } = runtime;
|
|
83
80
|
const owner = shared.walletAddress;
|
|
84
81
|
const values = shared.form.getValues();
|
|
85
82
|
const supply = state.supply.trim();
|
|
86
83
|
const uploadToken = await runtime.getUploadToken();
|
|
87
|
-
if (!uploadToken) throw new Error("Sign in first");
|
|
84
|
+
if (!uploadToken) throw new Error(msg("Sign in first"));
|
|
88
85
|
const existing = runtime.resume ?? (state.mode === "existing" && state.existingContract ? state.existingContract : null);
|
|
89
86
|
const contract = await createThenAdd({
|
|
90
87
|
existing,
|
|
91
|
-
|
|
92
|
-
labels: { create:
|
|
88
|
+
unfinished: text.unfinished,
|
|
89
|
+
labels: { create: text.creating, add: text.adding },
|
|
93
90
|
onStep,
|
|
94
91
|
create: async () => {
|
|
95
92
|
const baseUri = await uploadJsonToIpfs(
|
|
@@ -111,7 +108,7 @@ function makeTierFormat(config) {
|
|
|
111
108
|
});
|
|
112
109
|
const { receipt } = await executeIntent(signer, client, created);
|
|
113
110
|
const deployed = deployedCollectionFromReceipt(receipt, preset.service);
|
|
114
|
-
if (!deployed) throw new Error(
|
|
111
|
+
if (!deployed) throw new Error(text.unreadable);
|
|
115
112
|
return deployed;
|
|
116
113
|
},
|
|
117
114
|
add: async (address) => {
|
|
@@ -162,20 +159,32 @@ const TICKETS_FORMAT = makeTierFormat({
|
|
|
162
159
|
preset: TICKETS_TIER_PRESET,
|
|
163
160
|
service: "ip-tickets",
|
|
164
161
|
icon: Ticket,
|
|
165
|
-
noun: "ticket collection",
|
|
166
162
|
supplyLabel: msg("Number of tickets"),
|
|
167
163
|
submitLabel: msg("Create tickets"),
|
|
168
|
-
|
|
164
|
+
text: {
|
|
165
|
+
collectionLabel: msg("Ticket collection"),
|
|
166
|
+
newCollection: msg("New ticket collection"),
|
|
167
|
+
creating: msg("Creating the ticket collection"),
|
|
168
|
+
adding: msg("Publishing tickets"),
|
|
169
|
+
unfinished: msg("Your ticket collection was created, but the last step did not finish."),
|
|
170
|
+
unreadable: msg("The ticket collection was created, but its address couldn't be read \u2014 check My Collections.")
|
|
171
|
+
}
|
|
169
172
|
});
|
|
170
173
|
const CLUB_FORMAT = makeTierFormat({
|
|
171
174
|
key: "club",
|
|
172
175
|
preset: CLUB_TIER_PRESET,
|
|
173
176
|
service: "ip-club",
|
|
174
177
|
icon: Users,
|
|
175
|
-
noun: "club",
|
|
176
178
|
supplyLabel: msg("Number of memberships"),
|
|
177
179
|
submitLabel: msg("Create membership"),
|
|
178
|
-
|
|
180
|
+
text: {
|
|
181
|
+
collectionLabel: msg("Club"),
|
|
182
|
+
newCollection: msg("New club"),
|
|
183
|
+
creating: msg("Creating the club"),
|
|
184
|
+
adding: msg("Publishing memberships"),
|
|
185
|
+
unfinished: msg("Your club was created, but the last step did not finish."),
|
|
186
|
+
unreadable: msg("The club was created, but its address couldn't be read \u2014 check My Collections.")
|
|
187
|
+
}
|
|
179
188
|
});
|
|
180
189
|
export {
|
|
181
190
|
CLUB_FORMAT,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/fast-mint/formats/tiers.tsx"],"sourcesContent":["\"use client\";\n\nimport { Eye, Ticket, Users } from \"lucide-react\";\nimport { buildCollectionMetadata, collectionHref, getService } from \"@medialane/sdk\";\nimport { deployedCollectionFromReceipt, executeIntent, executeIntents } from \"@medialane/sdk/starknet\";\nimport { Input } from \"../../input.js\";\nimport { getMintFormatCopy } from \"../../../data/launchpad-services.js\";\nimport { pinAssetMetadata, uploadJsonToIpfs } from \"../../../utils/ipfs-upload.js\";\nimport { isPositiveInteger } from \"../../../utils/launchpad-rules.js\";\nimport { dateToUnixTimestamp, serviceCollectionIntent, tierIntents, tierTraits } from \"../../../utils/launchpad-actions.js\";\nimport { CLUB_TIER_PRESET, TICKETS_TIER_PRESET, type TierMintPreset } from \"../../launchpad/tier-mint-presets.js\";\nimport { CollectionSection, type CollectionMode } from \"../collection-section.js\";\nimport { LicensingSection } from \"../licensing-section.js\";\nimport { createThenAdd } from \"../create-then-add.js\";\nimport { defineFormat, type FormatFieldsProps, type FormatShared } from \"./types.js\";\nimport { useT } from \"../../../i18n/provider.js\";\nimport { msg } from \"../../../i18n/translate.js\";\n\ninterface TierState {\n mode: CollectionMode;\n existingContract: string;\n supply: string;\n startDate: string;\n endDate: string;\n}\n\nfunction makeTierFormat(config: {\n key: \"tickets\" | \"club\";\n service: string;\n preset: TierMintPreset;\n icon: typeof Ticket;\n noun: string;\n supplyLabel: string;\n submitLabel: string;\n addLabel: string;\n}) {\n const { preset, noun } = config;\n const copy = getMintFormatCopy(config.service);\n\n const ownCollections = (shared: FormatShared) =>\n shared.collections.filter((c) => getService(c.service)?.id === preset.service && !!c.contractAddress);\n\n function Fields({ shared, state, update }: FormatFieldsProps<TierState>) {\n const t = useT();\n return (\n <>\n <CollectionSection\n noun={noun}\n mode={state.mode}\n onModeChange={(mode) => update({ mode })}\n collections={ownCollections(shared)}\n value={state.existingContract}\n onValue={(existingContract) => update({ existingContract })}\n valueOf={(c) => c.contractAddress}\n draft={shared.draft}\n previewImage={shared.previewImage}\n />\n\n <div className=\"space-y-2\">\n <label className=\"text-sm font-medium\" htmlFor={`fast-mint-${config.key}-supply`}>{t(config.supplyLabel)} *</label>\n <Input\n id={`fast-mint-${config.key}-supply`}\n type=\"number\"\n min={1}\n value={state.supply}\n onChange={(e) => update({ supply: e.target.value })}\n className=\"max-w-[160px]\"\n />\n </div>\n\n <div className=\"space-y-2\">\n <label className=\"text-sm font-medium\">{t(\"Valid\")}</label>\n <div className=\"grid grid-cols-2 gap-2\">\n <Input type=\"date\" aria-label={t(\"Valid from\")} value={state.startDate} onChange={(e) => update({ startDate: e.target.value })} />\n <Input type=\"date\" aria-label={t(\"Valid until\")} value={state.endDate} onChange={(e) => update({ endDate: e.target.value })} />\n </div>\n <p className=\"text-xs text-muted-foreground\">{preset.copy.validUntilHint}</p>\n </div>\n\n <LicensingSection form={shared.form} />\n </>\n );\n }\n\n return defineFormat<TierState>({\n key: config.key,\n title: copy.name,\n hint: copy.hint,\n icon: config.icon,\n submitLabel: () => config.submitLabel,\n initial: () => ({ mode: \"existing\", existingContract: \"\", supply: \"100\", startDate: \"\", endDate: \"\" }),\n Fields,\n isReady: (shared, state) => {\n if (!isPositiveInteger(state.supply)) return false;\n if (state.mode === \"new\") return shared.draft.name.trim().length > 0 && shared.draft.symbol.trim().length > 0;\n return state.existingContract !== \"\";\n },\n previewLabel: (shared, state) =>\n state.mode === \"new\"\n ? shared.draft.name || `New ${noun}`\n : ownCollections(shared).find((c) => c.contractAddress === state.existingContract)?.name || undefined,\n submit: async (shared, state, runtime) => {\n const { client, signer, onStep } = runtime;\n const owner = shared.walletAddress;\n const values = shared.form.getValues();\n const supply = state.supply.trim();\n\n const uploadToken = await runtime.getUploadToken();\n if (!uploadToken) throw new Error(\"Sign in first\");\n\n const existing = (runtime.resume as string | null) ?? (state.mode === \"existing\" && state.existingContract ? state.existingContract : null);\n\n const contract = await createThenAdd<string, string>({\n existing,\n noun,\n labels: { create: `Creating the ${noun}`, add: config.addLabel },\n onStep,\n create: async () => {\n const baseUri = await uploadJsonToIpfs(\n client.api,\n buildCollectionMetadata({\n name: shared.draft.name,\n description: shared.draft.description,\n image: shared.image,\n externalLink: values.external_url,\n owner,\n }),\n );\n const created = await serviceCollectionIntent(client.api, {\n owner,\n name: shared.draft.name,\n symbol: shared.draft.symbol,\n baseUri,\n service: preset.service,\n });\n const { receipt } = await executeIntent(signer, client, created);\n const deployed = deployedCollectionFromReceipt(receipt, preset.service);\n if (!deployed) throw new Error(`The ${noun} was deployed, but its address couldn't be read — check My Collections.`);\n return deployed;\n },\n add: async (address) => {\n const pinned = await pinAssetMetadata(client.api, {\n name: values.name,\n description: values.description,\n imageUri: shared.image,\n externalUrl: values.external_url,\n ipType: \"NFT\",\n licenseType: values.licenseType,\n commercialUse: values.commercialUse,\n derivatives: values.derivatives,\n attribution: values.attribution,\n geographicScope: values.geographicScope,\n aiPolicy: values.aiPolicy,\n royalty: String(values.royalty),\n creator: owner,\n templateTraits: tierTraits(preset.traitType, supply, address),\n });\n const intents = await tierIntents(client.api, {\n owner,\n contract: address,\n service: preset.service,\n tierId: await preset.predictNextId(client.api, address),\n maxSupply: supply,\n startTime: dateToUnixTimestamp(state.startDate),\n endTime: dateToUnixTimestamp(state.endDate),\n royaltyBps: Math.round(values.royalty * 100),\n metadataUri: pinned.uri,\n });\n await executeIntents(signer, client, intents);\n return address;\n },\n });\n\n return {\n headline: preset.success.title,\n detail: preset.success.description,\n name: values.name,\n collectionLabel: ownCollections(shared).find((c) => c.contractAddress === contract)?.name || (state.mode === \"new\" ? shared.draft.name : undefined),\n links: [{ href: collectionHref(\"STARKNET\", contract), label: msg(\"View collection\"), icon: Eye }],\n reward: \"launch_launchpad\",\n };\n },\n });\n}\n\nexport const TICKETS_FORMAT = makeTierFormat({\n key: \"tickets\",\n preset: TICKETS_TIER_PRESET,\n service: \"ip-tickets\",\n icon: Ticket,\n noun: \"ticket collection\",\n supplyLabel: msg(\"Number of tickets\"),\n submitLabel: msg(\"Create tickets\"),\n addLabel: msg(\"Minting tickets\"),\n});\n\nexport const CLUB_FORMAT = makeTierFormat({\n key: \"club\",\n preset: CLUB_TIER_PRESET,\n service: \"ip-club\",\n icon: Users,\n noun: \"club\",\n supplyLabel: msg(\"Number of memberships\"),\n submitLabel: msg(\"Create membership\"),\n addLabel: msg(\"Minting memberships\"),\n});\n"],"mappings":";AA6CM,mBACE,KAaE,YAdJ;AA3CN,SAAS,KAAK,QAAQ,aAAa;AACnC,SAAS,yBAAyB,gBAAgB,kBAAkB;AACpE,SAAS,+BAA+B,eAAe,sBAAsB;AAC7E,SAAS,aAAa;AACtB,SAAS,yBAAyB;AAClC,SAAS,kBAAkB,wBAAwB;AACnD,SAAS,yBAAyB;AAClC,SAAS,qBAAqB,yBAAyB,aAAa,kBAAkB;AACtF,SAAS,kBAAkB,2BAAgD;AAC3E,SAAS,yBAA8C;AACvD,SAAS,wBAAwB;AACjC,SAAS,qBAAqB;AAC9B,SAAS,oBAA+D;AACxE,SAAS,YAAY;AACrB,SAAS,WAAW;AAUpB,SAAS,eAAe,QASrB;AACD,QAAM,EAAE,QAAQ,KAAK,IAAI;AACzB,QAAM,OAAO,kBAAkB,OAAO,OAAO;AAE7C,QAAM,iBAAiB,CAAC,WACtB,OAAO,YAAY,OAAO,CAAC,MAAM,WAAW,EAAE,OAAO,GAAG,OAAO,OAAO,WAAW,CAAC,CAAC,EAAE,eAAe;AAEtG,WAAS,OAAO,EAAE,QAAQ,OAAO,OAAO,GAAiC;AACzE,UAAM,IAAI,KAAK;AACb,WACE,iCACE;AAAA;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA,MAAM,MAAM;AAAA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,YAAY,KAAK,MAAM,OAAO,UAAU,GAAG;AAAA,YAC3C,aAAa,OAAO;AAAA,UACtB,CAAC;AACD,gBAAM,eAAe,QAAQ,QAAQ,OAAO;AAC5C,iBAAO;AAAA,QACT;AAAA,MACF,CAAC;AAED,aAAO;AAAA,QACL,UAAU,OAAO,QAAQ;AAAA,QACzB,QAAQ,OAAO,QAAQ;AAAA,QACvB,MAAM,OAAO;AAAA,QACb,iBAAiB,eAAe,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,oBAAoB,QAAQ,GAAG,SAAS,MAAM,SAAS,QAAQ,OAAO,MAAM,OAAO;AAAA,QACzI,OAAO,CAAC,EAAE,MAAM,eAAe,YAAY,QAAQ,GAAG,OAAO,IAAI,iBAAiB,GAAG,MAAM,IAAI,CAAC;AAAA,QAChG,QAAQ;AAAA,MACV;AAAA,IACF;AAAA,EACF,CAAC;AACH;AAEO,MAAM,iBAAiB,eAAe;AAAA,EAC3C,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,MAAM;AAAA,EACN,MAAM;AAAA,EACN,aAAa,IAAI,mBAAmB;AAAA,EACpC,aAAa,IAAI,gBAAgB;AAAA,EACjC,UAAU,IAAI,iBAAiB;AACjC,CAAC;AAEM,MAAM,cAAc,eAAe;AAAA,EACxC,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,MAAM;AAAA,EACN,MAAM;AAAA,EACN,aAAa,IAAI,uBAAuB;AAAA,EACxC,aAAa,IAAI,mBAAmB;AAAA,EACpC,UAAU,IAAI,qBAAqB;AACrC,CAAC;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/fast-mint/formats/tiers.tsx"],"sourcesContent":["\"use client\";\n\nimport { Eye, Ticket, Users } from \"lucide-react\";\nimport { buildCollectionMetadata, collectionHref, getService } from \"@medialane/sdk\";\nimport { deployedCollectionFromReceipt, executeIntent, executeIntents } from \"@medialane/sdk/starknet\";\nimport { Input } from \"../../input.js\";\nimport { getMintFormatCopy } from \"../../../data/launchpad-services.js\";\nimport { pinAssetMetadata, uploadJsonToIpfs } from \"../../../utils/ipfs-upload.js\";\nimport { isPositiveInteger } from \"../../../utils/launchpad-rules.js\";\nimport { dateToUnixTimestamp, serviceCollectionIntent, tierIntents, tierTraits } from \"../../../utils/launchpad-actions.js\";\nimport { CLUB_TIER_PRESET, TICKETS_TIER_PRESET, type TierMintPreset } from \"../../launchpad/tier-mint-presets.js\";\nimport { CollectionSection, type CollectionMode } from \"../collection-section.js\";\nimport { LicensingSection } from \"../licensing-section.js\";\nimport { createThenAdd } from \"../create-then-add.js\";\nimport { defineFormat, type FormatFieldsProps, type FormatShared } from \"./types.js\";\nimport { useT } from \"../../../i18n/provider.js\";\nimport { msg } from \"../../../i18n/translate.js\";\n\ninterface TierState {\n mode: CollectionMode;\n existingContract: string;\n supply: string;\n startDate: string;\n endDate: string;\n}\n\ninterface TierText {\n collectionLabel: string;\n newCollection: string;\n creating: string;\n adding: string;\n unfinished: string;\n unreadable: string;\n}\n\nfunction makeTierFormat(config: {\n key: \"tickets\" | \"club\";\n service: string;\n preset: TierMintPreset;\n icon: typeof Ticket;\n supplyLabel: string;\n submitLabel: string;\n text: TierText;\n}) {\n const { preset, text } = config;\n const copy = getMintFormatCopy(config.service);\n\n const ownCollections = (shared: FormatShared) =>\n shared.collections.filter((c) => getService(c.service)?.id === preset.service && !!c.contractAddress);\n\n function Fields({ shared, state, update }: FormatFieldsProps<TierState>) {\n const t = useT();\n return (\n <>\n <CollectionSection\n label={text.collectionLabel}\n mode={state.mode}\n onModeChange={(mode) => update({ mode })}\n collections={ownCollections(shared)}\n value={state.existingContract}\n onValue={(existingContract) => update({ existingContract })}\n valueOf={(c) => c.contractAddress}\n draft={shared.draft}\n previewImage={shared.previewImage}\n />\n\n <div className=\"space-y-2\">\n <label className=\"text-sm font-medium\" htmlFor={`fast-mint-${config.key}-supply`}>{t(config.supplyLabel)}</label>\n <Input\n id={`fast-mint-${config.key}-supply`}\n type=\"number\"\n min={1}\n value={state.supply}\n onChange={(e) => update({ supply: e.target.value })}\n className=\"max-w-[160px]\"\n />\n </div>\n\n <div className=\"space-y-2\">\n <label className=\"text-sm font-medium\">{t(\"Valid\")}</label>\n <div className=\"grid grid-cols-2 gap-2\">\n <Input type=\"date\" aria-label={t(\"Valid from\")} value={state.startDate} onChange={(e) => update({ startDate: e.target.value })} />\n <Input type=\"date\" aria-label={t(\"Valid until\")} value={state.endDate} onChange={(e) => update({ endDate: e.target.value })} />\n </div>\n <p className=\"text-xs text-muted-foreground\">{t(preset.copy.validUntilHint)}</p>\n </div>\n\n <LicensingSection form={shared.form} />\n </>\n );\n }\n\n return defineFormat<TierState>({\n key: config.key,\n title: copy.name,\n hint: copy.hint,\n icon: config.icon,\n submitLabel: () => config.submitLabel,\n initial: () => ({ mode: \"existing\", existingContract: \"\", supply: \"100\", startDate: \"\", endDate: \"\" }),\n Fields,\n isReady: (shared, state) => {\n if (!isPositiveInteger(state.supply)) return false;\n if (state.mode === \"new\") return shared.draft.name.trim().length > 0 && shared.draft.symbol.trim().length > 0;\n return state.existingContract !== \"\";\n },\n previewLabel: (shared, state, t) =>\n state.mode === \"new\"\n ? shared.draft.name || t(text.newCollection)\n : ownCollections(shared).find((c) => c.contractAddress === state.existingContract)?.name || undefined,\n submit: async (shared, state, runtime) => {\n const { client, signer, onStep } = runtime;\n const owner = shared.walletAddress;\n const values = shared.form.getValues();\n const supply = state.supply.trim();\n\n const uploadToken = await runtime.getUploadToken();\n if (!uploadToken) throw new Error(msg(\"Sign in first\"));\n\n const existing = (runtime.resume as string | null) ?? (state.mode === \"existing\" && state.existingContract ? state.existingContract : null);\n\n const contract = await createThenAdd<string, string>({\n existing,\n unfinished: text.unfinished,\n labels: { create: text.creating, add: text.adding },\n onStep,\n create: async () => {\n const baseUri = await uploadJsonToIpfs(\n client.api,\n buildCollectionMetadata({\n name: shared.draft.name,\n description: shared.draft.description,\n image: shared.image,\n externalLink: values.external_url,\n owner,\n }),\n );\n const created = await serviceCollectionIntent(client.api, {\n owner,\n name: shared.draft.name,\n symbol: shared.draft.symbol,\n baseUri,\n service: preset.service,\n });\n const { receipt } = await executeIntent(signer, client, created);\n const deployed = deployedCollectionFromReceipt(receipt, preset.service);\n if (!deployed) throw new Error(text.unreadable);\n return deployed;\n },\n add: async (address) => {\n const pinned = await pinAssetMetadata(client.api, {\n name: values.name,\n description: values.description,\n imageUri: shared.image,\n externalUrl: values.external_url,\n ipType: \"NFT\",\n licenseType: values.licenseType,\n commercialUse: values.commercialUse,\n derivatives: values.derivatives,\n attribution: values.attribution,\n geographicScope: values.geographicScope,\n aiPolicy: values.aiPolicy,\n royalty: String(values.royalty),\n creator: owner,\n templateTraits: tierTraits(preset.traitType, supply, address),\n });\n const intents = await tierIntents(client.api, {\n owner,\n contract: address,\n service: preset.service,\n tierId: await preset.predictNextId(client.api, address),\n maxSupply: supply,\n startTime: dateToUnixTimestamp(state.startDate),\n endTime: dateToUnixTimestamp(state.endDate),\n royaltyBps: Math.round(values.royalty * 100),\n metadataUri: pinned.uri,\n });\n await executeIntents(signer, client, intents);\n return address;\n },\n });\n\n return {\n headline: preset.success.title,\n detail: preset.success.description,\n name: values.name,\n collectionLabel: ownCollections(shared).find((c) => c.contractAddress === contract)?.name || (state.mode === \"new\" ? shared.draft.name : undefined),\n links: [{ href: collectionHref(\"STARKNET\", contract), label: msg(\"View collection\"), icon: Eye }],\n reward: \"launch_launchpad\",\n };\n },\n });\n}\n\nexport const TICKETS_FORMAT = makeTierFormat({\n key: \"tickets\",\n preset: TICKETS_TIER_PRESET,\n service: \"ip-tickets\",\n icon: Ticket,\n supplyLabel: msg(\"Number of tickets\"),\n submitLabel: msg(\"Create tickets\"),\n text: {\n collectionLabel: msg(\"Ticket collection\"),\n newCollection: msg(\"New ticket collection\"),\n creating: msg(\"Creating the ticket collection\"),\n adding: msg(\"Publishing tickets\"),\n unfinished: msg(\"Your ticket collection was created, but the last step did not finish.\"),\n unreadable: msg(\"The ticket collection was created, but its address couldn't be read — check My Collections.\"),\n },\n});\n\nexport const CLUB_FORMAT = makeTierFormat({\n key: \"club\",\n preset: CLUB_TIER_PRESET,\n service: \"ip-club\",\n icon: Users,\n supplyLabel: msg(\"Number of memberships\"),\n submitLabel: msg(\"Create membership\"),\n text: {\n collectionLabel: msg(\"Club\"),\n newCollection: msg(\"New club\"),\n creating: msg(\"Creating the club\"),\n adding: msg(\"Publishing memberships\"),\n unfinished: msg(\"Your club was created, but the last step did not finish.\"),\n unreadable: msg(\"The club was created, but its address couldn't be read — check My Collections.\"),\n },\n});\n"],"mappings":";AAqDM,mBACE,KAYA,YAbF;AAnDN,SAAS,KAAK,QAAQ,aAAa;AACnC,SAAS,yBAAyB,gBAAgB,kBAAkB;AACpE,SAAS,+BAA+B,eAAe,sBAAsB;AAC7E,SAAS,aAAa;AACtB,SAAS,yBAAyB;AAClC,SAAS,kBAAkB,wBAAwB;AACnD,SAAS,yBAAyB;AAClC,SAAS,qBAAqB,yBAAyB,aAAa,kBAAkB;AACtF,SAAS,kBAAkB,2BAAgD;AAC3E,SAAS,yBAA8C;AACvD,SAAS,wBAAwB;AACjC,SAAS,qBAAqB;AAC9B,SAAS,oBAA+D;AACxE,SAAS,YAAY;AACrB,SAAS,WAAW;AAmBpB,SAAS,eAAe,QAQrB;AACD,QAAM,EAAE,QAAQ,KAAK,IAAI;AACzB,QAAM,OAAO,kBAAkB,OAAO,OAAO;AAE7C,QAAM,iBAAiB,CAAC,WACtB,OAAO,YAAY,OAAO,CAAC,MAAM,WAAW,EAAE,OAAO,GAAG,OAAO,OAAO,WAAW,CAAC,CAAC,EAAE,eAAe;AAEtG,WAAS,OAAO,EAAE,QAAQ,OAAO,OAAO,GAAiC;AACzE,UAAM,IAAI,KAAK;AACb,WACE,iCACE;AAAA;AAAA,QAAC;AAAA;AAAA,UACC,OAAO,KAAK;AAAA,UACZ,MAAM,MAAM;AAAA,UACZ,cAAc,CAAC,SAAS,OAAO,EAAE,KAA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AA,IACpC,YAAY,IAAI,0DAA0D;AAAA,IAC1E,YAAY,IAAI,qFAAgF;AAAA,EAClG;AACF,CAAC;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/fast-mint/formats/types.ts"],"sourcesContent":["import type { ComponentType, MutableRefObject } from \"react\";\nimport type { LucideIcon } from \"lucide-react\";\nimport type { UseFormReturn } from \"react-hook-form\";\nimport type { ApiCollection } from \"@medialane/sdk\";\nimport type { MedialaneClient } from \"@medialane/sdk/starknet\";\nimport type { IPType } from \"../../../data/ip.js\";\nimport type { MetadataField } from \"../../ip-type-fields.js\";\nimport type { FormValues } from \"../form.js\";\nimport type { FastMintSigner, MediaKind, MintedAsset } from \"../types.js\";\nimport type { useNewCollectionDraft } from \"../use-new-collection-draft.js\";\nimport type { StepInfo } from \"../create-then-add.js\";\n\nexport type MintFormat = \"single\" | \"editions\" | \"pop\" | \"tickets\" | \"club\";\n\nexport interface FormatShared {\n form: UseFormReturn<FormValues>;\n draft: ReturnType<typeof useNewCollectionDraft>;\n collections: ApiCollection[];\n walletAddress: string;\n mediaKind: MediaKind;\n mediaUri: string;\n mediaName: string;\n image: string;\n previewImage: string | null;\n ipType: IPType;\n onIpTypeChange: (type: IPType) => void;\n templateFieldsRef: MutableRefObject<MetadataField[]>;\n uploadDocument: (file: File) => Promise<string>;\n}\n\nexport interface FormatRuntime {\n client: MedialaneClient;\n signer: FastMintSigner;\n getUploadToken: () => Promise<string | null>;\n resume: unknown;\n onStep: (step: StepInfo) => void;\n}\n\nexport interface FormatLink {\n href: string;\n label: string;\n icon: LucideIcon;\n}\n\nexport interface FormatResult {\n headline: string;\n detail: string;\n name: string;\n collectionLabel?: string;\n links: FormatLink[];\n reward: string;\n asset?: MintedAsset;\n}\n\nexport interface FormatFieldsProps<S> {\n shared: FormatShared;\n state: S;\n update: (patch: Partial<S>) => void;\n}\n\nexport interface FormatDefinition<S = unknown> {\n key: MintFormat;\n title: string;\n hint: string;\n icon: LucideIcon;\n submitLabel: (state: S) => string;\n initial: () => S;\n Fields: ComponentType<FormatFieldsProps<S>>;\n isReady: (shared: FormatShared, state: S) => boolean;\n previewLabel: (shared: FormatShared, state: S) => string | undefined;\n submit: (shared: FormatShared, state: S, runtime: FormatRuntime) => Promise<FormatResult>;\n}\n\nexport function defineFormat<S>(format: FormatDefinition<S>): FormatDefinition {\n return format as unknown as FormatDefinition;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/fast-mint/formats/types.ts"],"sourcesContent":["import type { ComponentType, MutableRefObject } from \"react\";\nimport type { LucideIcon } from \"lucide-react\";\nimport type { UseFormReturn } from \"react-hook-form\";\nimport type { ApiCollection } from \"@medialane/sdk\";\nimport type { MedialaneClient } from \"@medialane/sdk/starknet\";\nimport type { IPType } from \"../../../data/ip.js\";\nimport type { MetadataField } from \"../../ip-type-fields.js\";\nimport type { FormValues } from \"../form.js\";\nimport type { FastMintSigner, MediaKind, MintedAsset } from \"../types.js\";\nimport type { useNewCollectionDraft } from \"../use-new-collection-draft.js\";\nimport type { StepInfo } from \"../create-then-add.js\";\nimport type { T } from \"../../../i18n/make-t.js\";\n\nexport type MintFormat = \"single\" | \"editions\" | \"pop\" | \"tickets\" | \"club\";\n\nexport interface FormatShared {\n form: UseFormReturn<FormValues>;\n draft: ReturnType<typeof useNewCollectionDraft>;\n collections: ApiCollection[];\n walletAddress: string;\n mediaKind: MediaKind;\n mediaUri: string;\n mediaName: string;\n image: string;\n previewImage: string | null;\n ipType: IPType;\n onIpTypeChange: (type: IPType) => void;\n templateFieldsRef: MutableRefObject<MetadataField[]>;\n uploadDocument: (file: File) => Promise<string>;\n}\n\nexport interface FormatRuntime {\n client: MedialaneClient;\n signer: FastMintSigner;\n getUploadToken: () => Promise<string | null>;\n resume: unknown;\n onStep: (step: StepInfo) => void;\n}\n\nexport interface FormatLink {\n href: string;\n label: string;\n icon: LucideIcon;\n}\n\nexport interface FormatResult {\n headline: string;\n detail: string;\n name: string;\n collectionLabel?: string;\n links: FormatLink[];\n reward: string;\n asset?: MintedAsset;\n}\n\nexport interface FormatFieldsProps<S> {\n shared: FormatShared;\n state: S;\n update: (patch: Partial<S>) => void;\n}\n\nexport interface FormatDefinition<S = unknown> {\n key: MintFormat;\n title: string;\n hint: string;\n icon: LucideIcon;\n submitLabel: (state: S) => string;\n initial: () => S;\n Fields: ComponentType<FormatFieldsProps<S>>;\n isReady: (shared: FormatShared, state: S) => boolean;\n previewLabel: (shared: FormatShared, state: S, t: T) => string | undefined;\n submit: (shared: FormatShared, state: S, runtime: FormatRuntime) => Promise<FormatResult>;\n}\n\nexport function defineFormat<S>(format: FormatDefinition<S>): FormatDefinition {\n return format as unknown as FormatDefinition;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA0EO,SAAS,aAAgB,QAA+C;AAC7E,SAAO;AACT;","names":[]}
|
|
@@ -9,8 +9,10 @@ import { FormValues } from '../form.cjs';
|
|
|
9
9
|
import { MintedAsset, MediaKind, FastMintSigner } from '../types.cjs';
|
|
10
10
|
import { useNewCollectionDraft } from '../use-new-collection-draft.cjs';
|
|
11
11
|
import { StepInfo } from '../create-then-add.cjs';
|
|
12
|
+
import { T } from '../../../i18n/make-t.cjs';
|
|
12
13
|
import 'react/jsx-runtime';
|
|
13
14
|
import 'starknet';
|
|
15
|
+
import '../../../i18n/translate.cjs';
|
|
14
16
|
|
|
15
17
|
type MintFormat = "single" | "editions" | "pop" | "tickets" | "club";
|
|
16
18
|
interface FormatShared {
|
|
@@ -63,7 +65,7 @@ interface FormatDefinition<S = unknown> {
|
|
|
63
65
|
initial: () => S;
|
|
64
66
|
Fields: ComponentType<FormatFieldsProps<S>>;
|
|
65
67
|
isReady: (shared: FormatShared, state: S) => boolean;
|
|
66
|
-
previewLabel: (shared: FormatShared, state: S) => string | undefined;
|
|
68
|
+
previewLabel: (shared: FormatShared, state: S, t: T) => string | undefined;
|
|
67
69
|
submit: (shared: FormatShared, state: S, runtime: FormatRuntime) => Promise<FormatResult>;
|
|
68
70
|
}
|
|
69
71
|
declare function defineFormat<S>(format: FormatDefinition<S>): FormatDefinition;
|
|
@@ -9,8 +9,10 @@ import { FormValues } from '../form.js';
|
|
|
9
9
|
import { MintedAsset, MediaKind, FastMintSigner } from '../types.js';
|
|
10
10
|
import { useNewCollectionDraft } from '../use-new-collection-draft.js';
|
|
11
11
|
import { StepInfo } from '../create-then-add.js';
|
|
12
|
+
import { T } from '../../../i18n/make-t.js';
|
|
12
13
|
import 'react/jsx-runtime';
|
|
13
14
|
import 'starknet';
|
|
15
|
+
import '../../../i18n/translate.js';
|
|
14
16
|
|
|
15
17
|
type MintFormat = "single" | "editions" | "pop" | "tickets" | "club";
|
|
16
18
|
interface FormatShared {
|
|
@@ -63,7 +65,7 @@ interface FormatDefinition<S = unknown> {
|
|
|
63
65
|
initial: () => S;
|
|
64
66
|
Fields: ComponentType<FormatFieldsProps<S>>;
|
|
65
67
|
isReady: (shared: FormatShared, state: S) => boolean;
|
|
66
|
-
previewLabel: (shared: FormatShared, state: S) => string | undefined;
|
|
68
|
+
previewLabel: (shared: FormatShared, state: S, t: T) => string | undefined;
|
|
67
69
|
submit: (shared: FormatShared, state: S, runtime: FormatRuntime) => Promise<FormatResult>;
|
|
68
70
|
}
|
|
69
71
|
declare function defineFormat<S>(format: FormatDefinition<S>): FormatDefinition;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/fast-mint/formats/types.ts"],"sourcesContent":["import type { ComponentType, MutableRefObject } from \"react\";\nimport type { LucideIcon } from \"lucide-react\";\nimport type { UseFormReturn } from \"react-hook-form\";\nimport type { ApiCollection } from \"@medialane/sdk\";\nimport type { MedialaneClient } from \"@medialane/sdk/starknet\";\nimport type { IPType } from \"../../../data/ip.js\";\nimport type { MetadataField } from \"../../ip-type-fields.js\";\nimport type { FormValues } from \"../form.js\";\nimport type { FastMintSigner, MediaKind, MintedAsset } from \"../types.js\";\nimport type { useNewCollectionDraft } from \"../use-new-collection-draft.js\";\nimport type { StepInfo } from \"../create-then-add.js\";\n\nexport type MintFormat = \"single\" | \"editions\" | \"pop\" | \"tickets\" | \"club\";\n\nexport interface FormatShared {\n form: UseFormReturn<FormValues>;\n draft: ReturnType<typeof useNewCollectionDraft>;\n collections: ApiCollection[];\n walletAddress: string;\n mediaKind: MediaKind;\n mediaUri: string;\n mediaName: string;\n image: string;\n previewImage: string | null;\n ipType: IPType;\n onIpTypeChange: (type: IPType) => void;\n templateFieldsRef: MutableRefObject<MetadataField[]>;\n uploadDocument: (file: File) => Promise<string>;\n}\n\nexport interface FormatRuntime {\n client: MedialaneClient;\n signer: FastMintSigner;\n getUploadToken: () => Promise<string | null>;\n resume: unknown;\n onStep: (step: StepInfo) => void;\n}\n\nexport interface FormatLink {\n href: string;\n label: string;\n icon: LucideIcon;\n}\n\nexport interface FormatResult {\n headline: string;\n detail: string;\n name: string;\n collectionLabel?: string;\n links: FormatLink[];\n reward: string;\n asset?: MintedAsset;\n}\n\nexport interface FormatFieldsProps<S> {\n shared: FormatShared;\n state: S;\n update: (patch: Partial<S>) => void;\n}\n\nexport interface FormatDefinition<S = unknown> {\n key: MintFormat;\n title: string;\n hint: string;\n icon: LucideIcon;\n submitLabel: (state: S) => string;\n initial: () => S;\n Fields: ComponentType<FormatFieldsProps<S>>;\n isReady: (shared: FormatShared, state: S) => boolean;\n previewLabel: (shared: FormatShared, state: S) => string | undefined;\n submit: (shared: FormatShared, state: S, runtime: FormatRuntime) => Promise<FormatResult>;\n}\n\nexport function defineFormat<S>(format: FormatDefinition<S>): FormatDefinition {\n return format as unknown as FormatDefinition;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/fast-mint/formats/types.ts"],"sourcesContent":["import type { ComponentType, MutableRefObject } from \"react\";\nimport type { LucideIcon } from \"lucide-react\";\nimport type { UseFormReturn } from \"react-hook-form\";\nimport type { ApiCollection } from \"@medialane/sdk\";\nimport type { MedialaneClient } from \"@medialane/sdk/starknet\";\nimport type { IPType } from \"../../../data/ip.js\";\nimport type { MetadataField } from \"../../ip-type-fields.js\";\nimport type { FormValues } from \"../form.js\";\nimport type { FastMintSigner, MediaKind, MintedAsset } from \"../types.js\";\nimport type { useNewCollectionDraft } from \"../use-new-collection-draft.js\";\nimport type { StepInfo } from \"../create-then-add.js\";\nimport type { T } from \"../../../i18n/make-t.js\";\n\nexport type MintFormat = \"single\" | \"editions\" | \"pop\" | \"tickets\" | \"club\";\n\nexport interface FormatShared {\n form: UseFormReturn<FormValues>;\n draft: ReturnType<typeof useNewCollectionDraft>;\n collections: ApiCollection[];\n walletAddress: string;\n mediaKind: MediaKind;\n mediaUri: string;\n mediaName: string;\n image: string;\n previewImage: string | null;\n ipType: IPType;\n onIpTypeChange: (type: IPType) => void;\n templateFieldsRef: MutableRefObject<MetadataField[]>;\n uploadDocument: (file: File) => Promise<string>;\n}\n\nexport interface FormatRuntime {\n client: MedialaneClient;\n signer: FastMintSigner;\n getUploadToken: () => Promise<string | null>;\n resume: unknown;\n onStep: (step: StepInfo) => void;\n}\n\nexport interface FormatLink {\n href: string;\n label: string;\n icon: LucideIcon;\n}\n\nexport interface FormatResult {\n headline: string;\n detail: string;\n name: string;\n collectionLabel?: string;\n links: FormatLink[];\n reward: string;\n asset?: MintedAsset;\n}\n\nexport interface FormatFieldsProps<S> {\n shared: FormatShared;\n state: S;\n update: (patch: Partial<S>) => void;\n}\n\nexport interface FormatDefinition<S = unknown> {\n key: MintFormat;\n title: string;\n hint: string;\n icon: LucideIcon;\n submitLabel: (state: S) => string;\n initial: () => S;\n Fields: ComponentType<FormatFieldsProps<S>>;\n isReady: (shared: FormatShared, state: S) => boolean;\n previewLabel: (shared: FormatShared, state: S, t: T) => string | undefined;\n submit: (shared: FormatShared, state: S, runtime: FormatRuntime) => Promise<FormatResult>;\n}\n\nexport function defineFormat<S>(format: FormatDefinition<S>): FormatDefinition {\n return format as unknown as FormatDefinition;\n}\n"],"mappings":"AA0EO,SAAS,aAAgB,QAA+C;AAC7E,SAAO;AACT;","names":[]}
|
|
@@ -44,14 +44,14 @@ function IpTypeSection({
|
|
|
44
44
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_collapsible.CollapsibleTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", { type: "button", className: "w-full flex items-center justify-between px-4 py-3.5 hover:bg-muted/30 transition-colors", children: [
|
|
45
45
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "flex items-center gap-2", children: [
|
|
46
46
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Layers, { className: "h-4 w-4 text-primary" }),
|
|
47
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-sm font-semibold", children: t("
|
|
47
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-sm font-semibold", children: t("More details") }),
|
|
48
48
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-xs text-muted-foreground font-normal", children: t("Optional") })
|
|
49
49
|
] }),
|
|
50
50
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.ChevronDown, { className: (0, import_cn.cn)("h-4 w-4 text-muted-foreground transition-transform", open && "rotate-180") })
|
|
51
51
|
] }) }),
|
|
52
52
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_collapsible.CollapsibleContent, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "px-4 pb-4 space-y-4 border-t border-border/60 pt-4", children: [
|
|
53
53
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-1.5", children: [
|
|
54
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { className: "text-xs font-medium text-muted-foreground", children: t("
|
|
54
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { className: "text-xs font-medium text-muted-foreground", children: t("Type of work") }),
|
|
55
55
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_select.Select, { value: ipType, onValueChange: (v) => onIpTypeChange(v), children: [
|
|
56
56
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_select.SelectTrigger, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_select.SelectValue, {}) }),
|
|
57
57
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_select.SelectContent, { children: import_ip.IP_TYPES.map((t2) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_select.SelectItem, { value: t2, children: t2 }, t2)) })
|