@medialane/ui 0.78.1 → 0.79.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.
@@ -19,18 +19,25 @@ var __copyProps = (to, from, except, desc) => {
19
19
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
20
  var license_terms_builder_exports = {};
21
21
  __export(license_terms_builder_exports, {
22
+ DURATION_UNITS: () => DURATION_UNITS,
22
23
  EMPTY_SPONSORSHIP_TERMS: () => EMPTY_SPONSORSHIP_TERMS,
23
24
  LicenseTermsBuilder: () => LicenseTermsBuilder,
24
25
  MEDIA_TYPES: () => MEDIA_TYPES,
26
+ toDurationDays: () => toDurationDays,
25
27
  toLicenseMetadata: () => toLicenseMetadata
26
28
  });
27
29
  module.exports = __toCommonJS(license_terms_builder_exports);
28
30
  var import_jsx_runtime = require("react/jsx-runtime");
29
- var import_react = require("react");
30
- var import_lucide_react = require("lucide-react");
31
31
  var import_cn = require("../utils/cn.js");
32
32
  var import_currency_icon = require("./currency-icon.js");
33
33
  var import_ip = require("../data/ip.js");
34
+ const DURATION_UNITS = ["Days", "Weeks", "Months", "Years"];
35
+ const DURATION_UNIT_DAYS = { Days: 1, Weeks: 7, Months: 30, Years: 365 };
36
+ function toDurationDays(terms) {
37
+ const raw = Number(terms.durationValue || "0");
38
+ if (!raw || raw <= 0) return 0;
39
+ return Math.round(raw * DURATION_UNIT_DAYS[terms.durationUnit]);
40
+ }
34
41
  const MEDIA_TYPES = [
35
42
  "Social Media",
36
43
  "Video",
@@ -44,9 +51,10 @@ const MEDIA_TYPES = [
44
51
  const EMPTY_SPONSORSHIP_TERMS = {
45
52
  amount: "",
46
53
  paymentTokenSymbol: "",
47
- durationDays: "30",
54
+ durationValue: "",
55
+ durationUnit: "Days",
48
56
  transferable: true,
49
- royaltyPercent: "5",
57
+ royaltyPercent: "0",
50
58
  licenseText: "",
51
59
  licenseType: "CC BY-SA",
52
60
  commercialUse: "Yes",
@@ -115,7 +123,6 @@ function LicenseTermsBuilder({
115
123
  disabled,
116
124
  className
117
125
  }) {
118
- const [panelOpen, setPanelOpen] = (0, import_react.useState)(false);
119
126
  const set = (key, v) => onChange({ ...value, [key]: v });
120
127
  const handleLicenseTypeChange = (licenseType) => {
121
128
  const def = import_ip.LICENSE_TYPES.find((l) => l.value === licenseType);
@@ -169,23 +176,6 @@ function LicenseTermsBuilder({
169
176
  symbol
170
177
  )) })
171
178
  ] }),
172
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-1.5", children: [
173
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { className: FIELD_LABEL, children: "Resale royalty (%)" }),
174
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
175
- "input",
176
- {
177
- type: "number",
178
- min: 0,
179
- max: 100,
180
- step: "0.1",
181
- disabled,
182
- value: value.royaltyPercent,
183
- onChange: (e) => set("royaltyPercent", e.target.value),
184
- className: INPUT_BASE
185
- }
186
- ),
187
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: FIELD_HELP, children: "You get this share automatically if the license is ever resold." })
188
- ] }),
189
179
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "flex items-start gap-2.5 cursor-pointer select-none", children: [
190
180
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
191
181
  "input",
@@ -202,212 +192,203 @@ function LicenseTermsBuilder({
202
192
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: (0, import_cn.cn)(FIELD_HELP, "block"), children: "Off means it's meant to stay with the sponsor who accepts it \u2014 resale still isn't blocked on-chain, this is just the stated intent." })
203
193
  ] })
204
194
  ] }),
205
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "rounded-xl border border-border overflow-hidden bg-card/40", children: [
206
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
207
- "button",
208
- {
209
- type: "button",
210
- onClick: () => setPanelOpen((o) => !o),
211
- className: "w-full flex items-center justify-between gap-3 px-4 py-3 text-left transition-colors hover:bg-card/80",
212
- children: [
213
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "flex items-center gap-2.5 min-w-0", children: [
214
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.ScrollText, { className: "h-4 w-4 text-brand-purple shrink-0" }),
215
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "min-w-0", children: [
216
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "block text-sm font-semibold", children: "How long, where, and what for" }),
217
- !panelOpen ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "block text-xs text-muted-foreground truncate", children: [
218
- value.durationDays || "30",
219
- " days \xB7 ",
220
- value.territory,
221
- " \xB7 ",
222
- value.licenseType
223
- ] }) : null
224
- ] })
225
- ] }),
226
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.ChevronDown, { className: (0, import_cn.cn)("h-4 w-4 transition-transform text-muted-foreground shrink-0", panelOpen && "rotate-180") })
227
- ]
228
- }
229
- ),
230
- panelOpen ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "px-4 pb-4 space-y-4 border-t border-border pt-4", children: [
231
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-1.5", children: [
232
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { className: FIELD_LABEL, children: "License length (days)" }),
233
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
234
- "input",
235
- {
236
- type: "number",
237
- min: 1,
238
- disabled,
239
- value: value.durationDays,
240
- onChange: (e) => set("durationDays", e.target.value),
241
- className: INPUT_BASE
242
- }
243
- ),
244
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: FIELD_HELP, children: "Counted from the moment the deal is accepted, not from today." })
245
- ] }),
246
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-1.5", children: [
247
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { className: FIELD_LABEL, children: "License type" }),
248
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
249
- "select",
250
- {
251
- disabled,
252
- value: value.licenseType,
253
- onChange: (e) => handleLicenseTypeChange(e.target.value),
254
- className: INPUT_BASE,
255
- children: import_ip.LICENSE_TYPES.map((l) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: l.value, children: l.label }, l.value))
256
- }
257
- ),
258
- selectedLicense ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: FIELD_HELP, children: selectedLicense.description }) : null
259
- ] }),
260
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-1.5", children: [
261
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { className: FIELD_LABEL, children: "Commercial use" }),
262
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToggleGroup, { value: value.commercialUse, options: ["Yes", "No"], onChange: (v) => set("commercialUse", v), disabled })
263
- ] }),
264
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-1.5", children: [
265
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { className: FIELD_LABEL, children: "Derivatives" }),
266
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToggleGroup, { value: value.derivatives, options: ["Allowed", "Not Allowed", "Share-Alike"], onChange: (v) => set("derivatives", v), disabled })
267
- ] }),
268
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-1.5", children: [
269
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { className: FIELD_LABEL, children: "Attribution" }),
270
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToggleGroup, { value: value.attribution, options: ["Required", "Not Required"], onChange: (v) => set("attribution", v), disabled })
271
- ] }),
272
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-1.5", children: [
273
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { className: FIELD_LABEL, children: "Territory" }),
274
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
275
- "select",
276
- {
277
- disabled,
278
- value: value.territory,
279
- onChange: (e) => set("territory", e.target.value),
280
- className: INPUT_BASE,
281
- children: import_ip.GEOGRAPHIC_SCOPES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: t, children: t }, t))
282
- }
283
- )
284
- ] }),
285
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-1.5", children: [
286
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { className: FIELD_LABEL, children: "AI policy" }),
287
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
288
- "select",
289
- {
290
- disabled,
291
- value: value.aiPolicy,
292
- onChange: (e) => set("aiPolicy", e.target.value),
293
- className: INPUT_BASE,
294
- children: import_ip.AI_POLICIES.map((p) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: p, children: p }, p))
295
- }
296
- ),
297
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: FIELD_HELP, children: "Whether this work can be used to train AI models." })
298
- ] }),
299
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-1.5", children: [
300
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: FIELD_LABEL, children: [
301
- "Scope ",
302
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "font-normal text-muted-foreground", children: "(optional)" })
303
- ] }),
304
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
305
- "input",
306
- {
307
- type: "text",
308
- disabled,
309
- value: value.scope,
310
- onChange: (e) => set("scope", e.target.value),
311
- placeholder: "e.g. Instagram + YouTube only",
312
- className: INPUT_BASE
313
- }
314
- )
315
- ] }),
316
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-1.5", children: [
317
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: FIELD_LABEL, children: [
318
- "Deliverables ",
319
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "font-normal text-muted-foreground", children: "(optional)" })
320
- ] }),
321
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
322
- "textarea",
323
- {
324
- disabled,
325
- value: value.deliverables,
326
- onChange: (e) => set("deliverables", e.target.value),
327
- placeholder: "e.g. 3 posts, 1 video",
328
- rows: 2,
329
- className: (0, import_cn.cn)(INPUT_BASE, "h-auto py-2.5 resize-y")
330
- }
331
- )
332
- ] }),
195
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-1.5", children: [
196
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { className: FIELD_LABEL, children: "License length" }),
197
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "grid grid-cols-[1fr_auto] gap-2", children: [
333
198
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
334
- YesNoToggle,
199
+ "input",
335
200
  {
336
- label: "Exclusive to this sponsor",
337
- help: "No other sponsors during the license term.",
338
- checked: value.exclusive,
339
- onChange: (v) => set("exclusive", v),
340
- disabled
201
+ type: "number",
202
+ min: 1,
203
+ disabled,
204
+ value: value.durationValue,
205
+ onChange: (e) => set("durationValue", e.target.value),
206
+ placeholder: "e.g. 30",
207
+ className: INPUT_BASE
341
208
  }
342
209
  ),
343
210
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
344
- YesNoToggle,
211
+ "select",
345
212
  {
346
- label: "Content approval required",
347
- help: "Sponsor reviews content before it's published.",
348
- checked: value.approvalRequired,
349
- onChange: (v) => set("approvalRequired", v),
350
- disabled
213
+ disabled,
214
+ value: value.durationUnit,
215
+ onChange: (e) => set("durationUnit", e.target.value),
216
+ className: (0, import_cn.cn)(INPUT_BASE, "w-28"),
217
+ children: DURATION_UNITS.map((u) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: u, children: u }, u))
351
218
  }
352
- ),
353
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-1.5", children: [
354
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: FIELD_LABEL, children: [
355
- "Media ",
356
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "font-normal text-muted-foreground", children: "(optional)" })
357
- ] }),
358
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex flex-wrap gap-1.5", children: MEDIA_TYPES.map((m) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
359
- "button",
360
- {
361
- type: "button",
362
- disabled,
363
- onClick: () => toggleMedia(m),
364
- className: (0, import_cn.cn)(
365
- "h-8 px-2.5 rounded-full border text-xs font-medium transition-colors disabled:opacity-50",
366
- value.media.includes(m) ? "border-brand-purple bg-brand-purple/10 text-foreground" : "border-border bg-card text-muted-foreground hover:text-foreground"
367
- ),
368
- children: m
369
- },
370
- m
371
- )) }),
372
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
373
- "input",
374
- {
375
- type: "text",
376
- disabled,
377
- value: value.mediaOther,
378
- onChange: (e) => set("mediaOther", e.target.value),
379
- placeholder: "Other media type",
380
- className: (0, import_cn.cn)(INPUT_BASE, "mt-1.5")
381
- }
382
- )
383
- ] }),
384
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-1.5", children: [
385
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: FIELD_LABEL, children: [
386
- "Additional terms ",
387
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "font-normal text-muted-foreground", children: "(optional)" })
388
- ] }),
389
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
390
- "textarea",
391
- {
392
- disabled,
393
- value: value.licenseText,
394
- onChange: (e) => set("licenseText", e.target.value),
395
- placeholder: "Anything else worth spelling out.",
396
- rows: 3,
397
- className: (0, import_cn.cn)(INPUT_BASE, "h-auto py-2.5 resize-y")
398
- }
219
+ )
220
+ ] }),
221
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: FIELD_HELP, children: "Counted from the moment the deal is accepted, not from today." })
222
+ ] }),
223
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-1.5", children: [
224
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { className: FIELD_LABEL, children: "License type" }),
225
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
226
+ "select",
227
+ {
228
+ disabled,
229
+ value: value.licenseType,
230
+ onChange: (e) => handleLicenseTypeChange(e.target.value),
231
+ className: INPUT_BASE,
232
+ children: import_ip.LICENSE_TYPES.map((l) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: l.value, children: l.label }, l.value))
233
+ }
234
+ ),
235
+ selectedLicense ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: FIELD_HELP, children: selectedLicense.description }) : null
236
+ ] }),
237
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-1.5", children: [
238
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { className: FIELD_LABEL, children: "Commercial use" }),
239
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToggleGroup, { value: value.commercialUse, options: ["Yes", "No"], onChange: (v) => set("commercialUse", v), disabled })
240
+ ] }),
241
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-1.5", children: [
242
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { className: FIELD_LABEL, children: "Derivatives" }),
243
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToggleGroup, { value: value.derivatives, options: ["Allowed", "Not Allowed", "Share-Alike"], onChange: (v) => set("derivatives", v), disabled })
244
+ ] }),
245
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-1.5", children: [
246
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { className: FIELD_LABEL, children: "Attribution" }),
247
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToggleGroup, { value: value.attribution, options: ["Required", "Not Required"], onChange: (v) => set("attribution", v), disabled })
248
+ ] }),
249
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-1.5", children: [
250
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: FIELD_LABEL, children: [
251
+ "Territory ",
252
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "font-normal text-muted-foreground", children: "(optional)" })
253
+ ] }),
254
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
255
+ "input",
256
+ {
257
+ type: "text",
258
+ disabled,
259
+ value: value.territory,
260
+ onChange: (e) => set("territory", e.target.value),
261
+ placeholder: "e.g. Worldwide, Brazil only, excluding China",
262
+ className: INPUT_BASE
263
+ }
264
+ )
265
+ ] }),
266
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-1.5", children: [
267
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { className: FIELD_LABEL, children: "AI policy" }),
268
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
269
+ "select",
270
+ {
271
+ disabled,
272
+ value: value.aiPolicy,
273
+ onChange: (e) => set("aiPolicy", e.target.value),
274
+ className: INPUT_BASE,
275
+ children: import_ip.AI_POLICIES.map((p) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: p, children: p }, p))
276
+ }
277
+ ),
278
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: FIELD_HELP, children: "Whether this work can be used to train AI models." })
279
+ ] }),
280
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-1.5", children: [
281
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: FIELD_LABEL, children: [
282
+ "Scope ",
283
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "font-normal text-muted-foreground", children: "(optional)" })
284
+ ] }),
285
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
286
+ "input",
287
+ {
288
+ type: "text",
289
+ disabled,
290
+ value: value.scope,
291
+ onChange: (e) => set("scope", e.target.value),
292
+ placeholder: "e.g. Instagram + YouTube only",
293
+ className: INPUT_BASE
294
+ }
295
+ )
296
+ ] }),
297
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-1.5", children: [
298
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: FIELD_LABEL, children: [
299
+ "Deliverables ",
300
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "font-normal text-muted-foreground", children: "(optional)" })
301
+ ] }),
302
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
303
+ "textarea",
304
+ {
305
+ disabled,
306
+ value: value.deliverables,
307
+ onChange: (e) => set("deliverables", e.target.value),
308
+ placeholder: "e.g. 3 posts, 1 video",
309
+ rows: 2,
310
+ className: (0, import_cn.cn)(INPUT_BASE, "h-auto py-2.5 resize-y")
311
+ }
312
+ )
313
+ ] }),
314
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
315
+ YesNoToggle,
316
+ {
317
+ label: "Exclusive to this sponsor",
318
+ help: "No other sponsors during the license term.",
319
+ checked: value.exclusive,
320
+ onChange: (v) => set("exclusive", v),
321
+ disabled
322
+ }
323
+ ),
324
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
325
+ YesNoToggle,
326
+ {
327
+ label: "Content approval required",
328
+ help: "Sponsor reviews content before it's published.",
329
+ checked: value.approvalRequired,
330
+ onChange: (v) => set("approvalRequired", v),
331
+ disabled
332
+ }
333
+ ),
334
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-1.5", children: [
335
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: FIELD_LABEL, children: [
336
+ "Media ",
337
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "font-normal text-muted-foreground", children: "(optional)" })
338
+ ] }),
339
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex flex-wrap gap-1.5", children: MEDIA_TYPES.map((m) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
340
+ "button",
341
+ {
342
+ type: "button",
343
+ disabled,
344
+ onClick: () => toggleMedia(m),
345
+ className: (0, import_cn.cn)(
346
+ "h-8 px-2.5 rounded-full border text-xs font-medium transition-colors disabled:opacity-50",
347
+ value.media.includes(m) ? "border-brand-purple bg-brand-purple/10 text-foreground" : "border-border bg-card text-muted-foreground hover:text-foreground"
399
348
  ),
400
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: FIELD_HELP, children: "Saved permanently and shown to anyone who holds the license." })
401
- ] })
402
- ] }) : null
349
+ children: m
350
+ },
351
+ m
352
+ )) }),
353
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
354
+ "input",
355
+ {
356
+ type: "text",
357
+ disabled,
358
+ value: value.mediaOther,
359
+ onChange: (e) => set("mediaOther", e.target.value),
360
+ placeholder: "Other media type",
361
+ className: (0, import_cn.cn)(INPUT_BASE, "mt-1.5")
362
+ }
363
+ )
364
+ ] }),
365
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-1.5", children: [
366
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: FIELD_LABEL, children: [
367
+ "Additional terms ",
368
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "font-normal text-muted-foreground", children: "(optional)" })
369
+ ] }),
370
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
371
+ "textarea",
372
+ {
373
+ disabled,
374
+ value: value.licenseText,
375
+ onChange: (e) => set("licenseText", e.target.value),
376
+ placeholder: "Anything else worth spelling out.",
377
+ rows: 3,
378
+ className: (0, import_cn.cn)(INPUT_BASE, "h-auto py-2.5 resize-y")
379
+ }
380
+ ),
381
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: FIELD_HELP, children: "Saved permanently and shown to anyone who holds the license." })
403
382
  ] })
404
383
  ] });
405
384
  }
406
385
  // Annotate the CommonJS export names for ESM import in node:
407
386
  0 && (module.exports = {
387
+ DURATION_UNITS,
408
388
  EMPTY_SPONSORSHIP_TERMS,
409
389
  LicenseTermsBuilder,
410
390
  MEDIA_TYPES,
391
+ toDurationDays,
411
392
  toLicenseMetadata
412
393
  });
413
394
  //# sourceMappingURL=license-terms-builder.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/license-terms-builder.tsx"],"sourcesContent":["\"use client\";\n\nimport { useState } from \"react\";\nimport { ChevronDown, ScrollText } from \"lucide-react\";\nimport { cn } from \"../utils/cn.js\";\nimport { CurrencyIcon } from \"./currency-icon.js\";\nimport { LICENSE_TYPES, GEOGRAPHIC_SCOPES, AI_POLICIES } from \"../data/ip.js\";\n\n/** Common sponsorship media/channel types — deliberately not part of the\n * general IP taxonomy in `data/ip.ts` (that's about the asset itself;\n * this is about the sponsorship deal's channels), so it stays local here. */\nexport const MEDIA_TYPES = [\n \"Social Media\", \"Video\", \"Photo\", \"Article/Blog\", \"Print\", \"Broadcast\", \"Podcast/Audio\", \"Livestream\",\n] as const;\n\n/**\n * The deal terms a sponsorship offer/proposal needs, in plain-language shape\n * — no bps, no IPFS, no ByteArray. `royaltyPercent` is a plain 0–100 number\n * (multiply by 100 for the contract's basis-points argument). Every field\n * here is declarative metadata carried in the pinned IPFS document (see\n * `toLicenseMetadata`) — the contract never reads any of it, so none of it\n * is enforced beyond the atomic accept-and-mint payment itself. This\n * component only collects and validates the data, it never fetches or\n * uploads anything itself.\n */\nexport interface SponsorshipTerms {\n amount: string;\n paymentTokenSymbol: string;\n durationDays: string;\n transferable: boolean;\n royaltyPercent: string;\n /** Free-text notes that don't fit any structured field below. */\n licenseText: string;\n licenseType: string;\n commercialUse: \"Yes\" | \"No\";\n derivatives: \"Allowed\" | \"Not Allowed\" | \"Share-Alike\";\n attribution: \"Required\" | \"Not Required\";\n territory: string;\n aiPolicy: string;\n /** e.g. \"Instagram + YouTube only\" — too deal-specific to bound into an enum. */\n scope: string;\n /** e.g. \"3 posts, 1 video\" */\n deliverables: string;\n exclusive: boolean;\n approvalRequired: boolean;\n media: string[];\n mediaOther: string;\n}\n\nexport const EMPTY_SPONSORSHIP_TERMS: SponsorshipTerms = {\n amount: \"\",\n paymentTokenSymbol: \"\",\n durationDays: \"30\",\n transferable: true,\n royaltyPercent: \"5\",\n licenseText: \"\",\n licenseType: \"CC BY-SA\",\n commercialUse: \"Yes\",\n derivatives: \"Share-Alike\",\n attribution: \"Required\",\n territory: \"Worldwide\",\n aiPolicy: \"Allowed\",\n scope: \"\",\n deliverables: \"\",\n exclusive: false,\n approvalRequired: false,\n media: [],\n mediaOther: \"\",\n};\n\n/** Shapes the pinned-IPFS-JSON payload — the single place both apps build\n * this object, so it can't drift across call sites. Purely additive; the\n * contract never reads any of it. */\nexport function toLicenseMetadata(terms: SponsorshipTerms): Record<string, unknown> {\n return {\n terms: terms.licenseText,\n transferable: terms.transferable,\n royaltyPercent: Number(terms.royaltyPercent || \"0\"),\n licenseType: terms.licenseType,\n commercialUse: terms.commercialUse,\n derivatives: terms.derivatives,\n attribution: terms.attribution,\n territory: terms.territory,\n aiPolicy: terms.aiPolicy,\n scope: terms.scope,\n deliverables: terms.deliverables,\n exclusive: terms.exclusive,\n approvalRequired: terms.approvalRequired,\n media: terms.media,\n mediaOther: terms.mediaOther,\n };\n}\n\nexport interface LicenseTermsBuilderProps {\n value: SponsorshipTerms;\n onChange: (next: SponsorshipTerms) => void;\n /** Payment token symbols to offer — e.g. from SUPPORTED_TOKENS. */\n tokenOptions: string[];\n /** Copy override for the amount field — \"Minimum bid\" for an owner's\n * offer, \"Amount you'll pay\" for a sponsor's proposal. Default: \"Amount\". */\n amountLabel?: string;\n disabled?: boolean;\n className?: string;\n}\n\nconst FIELD_LABEL = \"text-xs font-semibold text-foreground\";\nconst FIELD_HELP = \"text-xs text-muted-foreground\";\nconst INPUT_BASE =\n \"w-full h-10 rounded-xl border border-border bg-card px-3 text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-brand-purple/40 focus:border-brand-purple/40 disabled:opacity-50\";\n\nfunction ToggleGroup({ value, options, onChange, disabled }: { value: string; options: readonly string[]; onChange: (v: string) => void; disabled?: boolean }) {\n return (\n <div className=\"flex rounded-lg border border-border overflow-hidden w-full\">\n {options.map((opt, i) => (\n <button\n key={opt}\n type=\"button\"\n disabled={disabled}\n onClick={() => onChange(opt)}\n className={cn(\n \"flex-1 px-3 py-2 text-xs sm:text-sm transition-colors disabled:opacity-50\",\n i > 0 && \"border-l border-border\",\n value === opt\n ? \"bg-primary text-primary-foreground font-medium\"\n : \"bg-background hover:bg-muted text-muted-foreground\",\n )}\n >\n {opt}\n </button>\n ))}\n </div>\n );\n}\n\nfunction YesNoToggle({ label, help, checked, onChange, disabled }: { label: string; help: string; checked: boolean; onChange: (v: boolean) => void; disabled?: boolean }) {\n return (\n <div className=\"space-y-1.5\">\n <label className={FIELD_LABEL}>{label}</label>\n <ToggleGroup value={checked ? \"Yes\" : \"No\"} options={[\"Yes\", \"No\"]} onChange={(v) => onChange(v === \"Yes\")} disabled={disabled} />\n <p className={FIELD_HELP}>{help}</p>\n </div>\n );\n}\n\nexport function LicenseTermsBuilder({\n value, onChange, tokenOptions, amountLabel = \"Amount\", disabled, className,\n}: LicenseTermsBuilderProps) {\n const [panelOpen, setPanelOpen] = useState(false);\n const set = <K extends keyof SponsorshipTerms>(key: K, v: SponsorshipTerms[K]) =>\n onChange({ ...value, [key]: v });\n\n const handleLicenseTypeChange = (licenseType: string) => {\n const def = LICENSE_TYPES.find((l) => l.value === licenseType);\n onChange({\n ...value,\n licenseType,\n ...(def ? { commercialUse: def.commercialUse, derivatives: def.derivatives, attribution: def.attribution } : {}),\n });\n };\n\n const selectedLicense = LICENSE_TYPES.find((l) => l.value === value.licenseType);\n const toggleMedia = (m: string) => {\n const next = value.media.includes(m) ? value.media.filter((x) => x !== m) : [...value.media, m];\n set(\"media\", next);\n };\n\n return (\n <div className={cn(\"space-y-4\", className)}>\n <div className=\"space-y-1.5\">\n <label className={FIELD_LABEL}>{amountLabel}</label>\n <input\n type=\"number\"\n min={0}\n step=\"0.01\"\n inputMode=\"decimal\"\n disabled={disabled}\n value={value.amount}\n onChange={(e) => set(\"amount\", e.target.value)}\n placeholder=\"0.00\"\n className={INPUT_BASE}\n />\n </div>\n\n <div className=\"space-y-1.5\">\n <label className={FIELD_LABEL}>Currency</label>\n <div className=\"grid grid-cols-3 sm:grid-cols-5 gap-1.5\">\n {tokenOptions.map((symbol) => (\n <button\n key={symbol}\n type=\"button\"\n disabled={disabled}\n onClick={() => set(\"paymentTokenSymbol\", symbol)}\n aria-pressed={value.paymentTokenSymbol === symbol}\n className={cn(\n \"h-10 px-2 rounded-xl border text-xs font-semibold flex items-center justify-center gap-1.5 transition-colors disabled:opacity-50\",\n value.paymentTokenSymbol === symbol\n ? \"border-brand-purple bg-brand-purple/10 text-foreground\"\n : \"border-border bg-card text-muted-foreground hover:text-foreground\",\n )}\n >\n <CurrencyIcon symbol={symbol} size={14} />\n {symbol}\n </button>\n ))}\n </div>\n </div>\n\n <div className=\"space-y-1.5\">\n <label className={FIELD_LABEL}>Resale royalty (%)</label>\n <input\n type=\"number\"\n min={0}\n max={100}\n step=\"0.1\"\n disabled={disabled}\n value={value.royaltyPercent}\n onChange={(e) => set(\"royaltyPercent\", e.target.value)}\n className={INPUT_BASE}\n />\n <p className={FIELD_HELP}>You get this share automatically if the license is ever resold.</p>\n </div>\n\n <label className=\"flex items-start gap-2.5 cursor-pointer select-none\">\n <input\n type=\"checkbox\"\n disabled={disabled}\n checked={value.transferable}\n onChange={(e) => set(\"transferable\", e.target.checked)}\n className=\"mt-0.5 h-4 w-4 rounded border-border text-brand-purple focus:ring-brand-purple/40\"\n />\n <span className=\"text-sm\">\n <span className=\"font-medium\">Sponsor can resell this license</span>\n <span className={cn(FIELD_HELP, \"block\")}>Off means it&apos;s meant to stay with the sponsor who accepts it — resale still isn&apos;t blocked on-chain, this is just the stated intent.</span>\n </span>\n </label>\n\n <div className=\"rounded-xl border border-border overflow-hidden bg-card/40\">\n <button\n type=\"button\"\n onClick={() => setPanelOpen((o) => !o)}\n className=\"w-full flex items-center justify-between gap-3 px-4 py-3 text-left transition-colors hover:bg-card/80\"\n >\n <span className=\"flex items-center gap-2.5 min-w-0\">\n <ScrollText className=\"h-4 w-4 text-brand-purple shrink-0\" />\n <span className=\"min-w-0\">\n <span className=\"block text-sm font-semibold\">How long, where, and what for</span>\n {!panelOpen ? (\n <span className=\"block text-xs text-muted-foreground truncate\">\n {value.durationDays || \"30\"} days · {value.territory} · {value.licenseType}\n </span>\n ) : null}\n </span>\n </span>\n <ChevronDown className={cn(\"h-4 w-4 transition-transform text-muted-foreground shrink-0\", panelOpen && \"rotate-180\")} />\n </button>\n\n {panelOpen ? (\n <div className=\"px-4 pb-4 space-y-4 border-t border-border pt-4\">\n <div className=\"space-y-1.5\">\n <label className={FIELD_LABEL}>License length (days)</label>\n <input\n type=\"number\"\n min={1}\n disabled={disabled}\n value={value.durationDays}\n onChange={(e) => set(\"durationDays\", e.target.value)}\n className={INPUT_BASE}\n />\n <p className={FIELD_HELP}>Counted from the moment the deal is accepted, not from today.</p>\n </div>\n\n <div className=\"space-y-1.5\">\n <label className={FIELD_LABEL}>License type</label>\n <select\n disabled={disabled}\n value={value.licenseType}\n onChange={(e) => handleLicenseTypeChange(e.target.value)}\n className={INPUT_BASE}\n >\n {LICENSE_TYPES.map((l) => (\n <option key={l.value} value={l.value}>{l.label}</option>\n ))}\n </select>\n {selectedLicense ? <p className={FIELD_HELP}>{selectedLicense.description}</p> : null}\n </div>\n\n <div className=\"space-y-1.5\">\n <label className={FIELD_LABEL}>Commercial use</label>\n <ToggleGroup value={value.commercialUse} options={[\"Yes\", \"No\"]} onChange={(v) => set(\"commercialUse\", v as SponsorshipTerms[\"commercialUse\"])} disabled={disabled} />\n </div>\n\n <div className=\"space-y-1.5\">\n <label className={FIELD_LABEL}>Derivatives</label>\n <ToggleGroup value={value.derivatives} options={[\"Allowed\", \"Not Allowed\", \"Share-Alike\"]} onChange={(v) => set(\"derivatives\", v as SponsorshipTerms[\"derivatives\"])} disabled={disabled} />\n </div>\n\n <div className=\"space-y-1.5\">\n <label className={FIELD_LABEL}>Attribution</label>\n <ToggleGroup value={value.attribution} options={[\"Required\", \"Not Required\"]} onChange={(v) => set(\"attribution\", v as SponsorshipTerms[\"attribution\"])} disabled={disabled} />\n </div>\n\n <div className=\"space-y-1.5\">\n <label className={FIELD_LABEL}>Territory</label>\n <select\n disabled={disabled}\n value={value.territory}\n onChange={(e) => set(\"territory\", e.target.value)}\n className={INPUT_BASE}\n >\n {GEOGRAPHIC_SCOPES.map((t) => (\n <option key={t} value={t}>{t}</option>\n ))}\n </select>\n </div>\n\n <div className=\"space-y-1.5\">\n <label className={FIELD_LABEL}>AI policy</label>\n <select\n disabled={disabled}\n value={value.aiPolicy}\n onChange={(e) => set(\"aiPolicy\", e.target.value)}\n className={INPUT_BASE}\n >\n {AI_POLICIES.map((p) => (\n <option key={p} value={p}>{p}</option>\n ))}\n </select>\n <p className={FIELD_HELP}>Whether this work can be used to train AI models.</p>\n </div>\n\n <div className=\"space-y-1.5\">\n <label className={FIELD_LABEL}>Scope <span className=\"font-normal text-muted-foreground\">(optional)</span></label>\n <input\n type=\"text\"\n disabled={disabled}\n value={value.scope}\n onChange={(e) => set(\"scope\", e.target.value)}\n placeholder=\"e.g. Instagram + YouTube only\"\n className={INPUT_BASE}\n />\n </div>\n\n <div className=\"space-y-1.5\">\n <label className={FIELD_LABEL}>Deliverables <span className=\"font-normal text-muted-foreground\">(optional)</span></label>\n <textarea\n disabled={disabled}\n value={value.deliverables}\n onChange={(e) => set(\"deliverables\", e.target.value)}\n placeholder=\"e.g. 3 posts, 1 video\"\n rows={2}\n className={cn(INPUT_BASE, \"h-auto py-2.5 resize-y\")}\n />\n </div>\n\n <YesNoToggle\n label=\"Exclusive to this sponsor\"\n help=\"No other sponsors during the license term.\"\n checked={value.exclusive}\n onChange={(v) => set(\"exclusive\", v)}\n disabled={disabled}\n />\n\n <YesNoToggle\n label=\"Content approval required\"\n help=\"Sponsor reviews content before it's published.\"\n checked={value.approvalRequired}\n onChange={(v) => set(\"approvalRequired\", v)}\n disabled={disabled}\n />\n\n <div className=\"space-y-1.5\">\n <label className={FIELD_LABEL}>Media <span className=\"font-normal text-muted-foreground\">(optional)</span></label>\n <div className=\"flex flex-wrap gap-1.5\">\n {MEDIA_TYPES.map((m) => (\n <button\n key={m}\n type=\"button\"\n disabled={disabled}\n onClick={() => toggleMedia(m)}\n className={cn(\n \"h-8 px-2.5 rounded-full border text-xs font-medium transition-colors disabled:opacity-50\",\n value.media.includes(m)\n ? \"border-brand-purple bg-brand-purple/10 text-foreground\"\n : \"border-border bg-card text-muted-foreground hover:text-foreground\",\n )}\n >\n {m}\n </button>\n ))}\n </div>\n <input\n type=\"text\"\n disabled={disabled}\n value={value.mediaOther}\n onChange={(e) => set(\"mediaOther\", e.target.value)}\n placeholder=\"Other media type\"\n className={cn(INPUT_BASE, \"mt-1.5\")}\n />\n </div>\n\n <div className=\"space-y-1.5\">\n <label className={FIELD_LABEL}>Additional terms <span className=\"font-normal text-muted-foreground\">(optional)</span></label>\n <textarea\n disabled={disabled}\n value={value.licenseText}\n onChange={(e) => set(\"licenseText\", e.target.value)}\n placeholder=\"Anything else worth spelling out.\"\n rows={3}\n className={cn(INPUT_BASE, \"h-auto py-2.5 resize-y\")}\n />\n <p className={FIELD_HELP}>Saved permanently and shown to anyone who holds the license.</p>\n </div>\n </div>\n ) : null}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAkHQ;AAhHR,mBAAyB;AACzB,0BAAwC;AACxC,gBAAmB;AACnB,2BAA6B;AAC7B,gBAA8D;AAK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K;AAAA,cAClD,aAAY;AAAA,cACZ,MAAM;AAAA,cACN,eAAW,cAAG,YAAY,wBAAwB;AAAA;AAAA,UACpD;AAAA,UACA,4CAAC,OAAE,WAAW,YAAY,0EAA4D;AAAA,WACxF;AAAA,SACF,IACE;AAAA,OACN;AAAA,KACF;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../src/components/license-terms-builder.tsx"],"sourcesContent":["\"use client\";\n\nimport { cn } from \"../utils/cn.js\";\nimport { CurrencyIcon } from \"./currency-icon.js\";\nimport { LICENSE_TYPES, AI_POLICIES } from \"../data/ip.js\";\n\n/** Duration units — the on-chain `duration` arg is seconds, but nobody\n * should be forced to think in days for a multi-year deal (or forced into\n * days at all — this is declarative, not contract-enforced). */\nexport const DURATION_UNITS = [\"Days\", \"Weeks\", \"Months\", \"Years\"] as const;\nexport type DurationUnit = (typeof DURATION_UNITS)[number];\nconst DURATION_UNIT_DAYS: Record<DurationUnit, number> = { Days: 1, Weeks: 7, Months: 30, Years: 365 };\n\n/** Converts the user-entered value + unit into whole days for the contract's\n * `duration` arg (seconds = days * 86400, done by the caller). */\nexport function toDurationDays(terms: SponsorshipTerms): number {\n const raw = Number(terms.durationValue || \"0\");\n if (!raw || raw <= 0) return 0;\n return Math.round(raw * DURATION_UNIT_DAYS[terms.durationUnit]);\n}\n\n/** Common sponsorship media/channel types — deliberately not part of the\n * general IP taxonomy in `data/ip.ts` (that's about the asset itself;\n * this is about the sponsorship deal's channels), so it stays local here. */\nexport const MEDIA_TYPES = [\n \"Social Media\", \"Video\", \"Photo\", \"Article/Blog\", \"Print\", \"Broadcast\", \"Podcast/Audio\", \"Livestream\",\n] as const;\n\n/**\n * The deal terms a sponsorship offer/proposal needs, in plain-language shape\n * — no bps, no IPFS, no ByteArray. `royaltyPercent` is a plain 0–100 number\n * (multiply by 100 for the contract's basis-points argument). Every field\n * here is declarative metadata carried in the pinned IPFS document (see\n * `toLicenseMetadata`) — the contract never reads any of it, so none of it\n * is enforced beyond the atomic accept-and-mint payment itself. This\n * component only collects and validates the data, it never fetches or\n * uploads anything itself.\n */\nexport interface SponsorshipTerms {\n amount: string;\n paymentTokenSymbol: string;\n /** No default — the user must explicitly set this, never silently inherit one.\n * Paired with `durationUnit`; convert with `toDurationDays()`. */\n durationValue: string;\n durationUnit: DurationUnit;\n transferable: boolean;\n /** Not surfaced in the UI (no resale-royalty concept here) — always \"0\". Kept\n * on the type because `create_offer`/`propose_sponsorship` still take a\n * `royaltyBps` argument. */\n royaltyPercent: string;\n /** Free-text notes that don't fit any structured field below. */\n licenseText: string;\n licenseType: string;\n commercialUse: \"Yes\" | \"No\";\n derivatives: \"Allowed\" | \"Not Allowed\" | \"Share-Alike\";\n attribution: \"Required\" | \"Not Required\";\n /** Free text — \"Worldwide\" is a fine default, but real deals often name a\n * specific country or an exclusion, which a fixed list can't cover. */\n territory: string;\n aiPolicy: string;\n /** e.g. \"Instagram + YouTube only\" — too deal-specific to bound into an enum. */\n scope: string;\n /** e.g. \"3 posts, 1 video\" */\n deliverables: string;\n exclusive: boolean;\n approvalRequired: boolean;\n media: string[];\n mediaOther: string;\n}\n\nexport const EMPTY_SPONSORSHIP_TERMS: SponsorshipTerms = {\n amount: \"\",\n paymentTokenSymbol: \"\",\n durationValue: \"\",\n durationUnit: \"Days\",\n transferable: true,\n royaltyPercent: \"0\",\n licenseText: \"\",\n licenseType: \"CC BY-SA\",\n commercialUse: \"Yes\",\n derivatives: \"Share-Alike\",\n attribution: \"Required\",\n territory: \"Worldwide\",\n aiPolicy: \"Allowed\",\n scope: \"\",\n deliverables: \"\",\n exclusive: false,\n approvalRequired: false,\n media: [],\n mediaOther: \"\",\n};\n\n/** Shapes the pinned-IPFS-JSON payload — the single place both apps build\n * this object, so it can't drift across call sites. Purely additive; the\n * contract never reads any of it. */\nexport function toLicenseMetadata(terms: SponsorshipTerms): Record<string, unknown> {\n return {\n terms: terms.licenseText,\n transferable: terms.transferable,\n royaltyPercent: Number(terms.royaltyPercent || \"0\"),\n licenseType: terms.licenseType,\n commercialUse: terms.commercialUse,\n derivatives: terms.derivatives,\n attribution: terms.attribution,\n territory: terms.territory,\n aiPolicy: terms.aiPolicy,\n scope: terms.scope,\n deliverables: terms.deliverables,\n exclusive: terms.exclusive,\n approvalRequired: terms.approvalRequired,\n media: terms.media,\n mediaOther: terms.mediaOther,\n };\n}\n\nexport interface LicenseTermsBuilderProps {\n value: SponsorshipTerms;\n onChange: (next: SponsorshipTerms) => void;\n /** Payment token symbols to offer — e.g. from SUPPORTED_TOKENS. */\n tokenOptions: string[];\n /** Copy override for the amount field — \"Minimum bid\" for an owner's\n * offer, \"Amount you'll pay\" for a sponsor's proposal. Default: \"Amount\". */\n amountLabel?: string;\n disabled?: boolean;\n className?: string;\n}\n\nconst FIELD_LABEL = \"text-xs font-semibold text-foreground\";\nconst FIELD_HELP = \"text-xs text-muted-foreground\";\nconst INPUT_BASE =\n \"w-full h-10 rounded-xl border border-border bg-card px-3 text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-brand-purple/40 focus:border-brand-purple/40 disabled:opacity-50\";\n\nfunction ToggleGroup({ value, options, onChange, disabled }: { value: string; options: readonly string[]; onChange: (v: string) => void; disabled?: boolean }) {\n return (\n <div className=\"flex rounded-lg border border-border overflow-hidden w-full\">\n {options.map((opt, i) => (\n <button\n key={opt}\n type=\"button\"\n disabled={disabled}\n onClick={() => onChange(opt)}\n className={cn(\n \"flex-1 px-3 py-2 text-xs sm:text-sm transition-colors disabled:opacity-50\",\n i > 0 && \"border-l border-border\",\n value === opt\n ? \"bg-primary text-primary-foreground font-medium\"\n : \"bg-background hover:bg-muted text-muted-foreground\",\n )}\n >\n {opt}\n </button>\n ))}\n </div>\n );\n}\n\nfunction YesNoToggle({ label, help, checked, onChange, disabled }: { label: string; help: string; checked: boolean; onChange: (v: boolean) => void; disabled?: boolean }) {\n return (\n <div className=\"space-y-1.5\">\n <label className={FIELD_LABEL}>{label}</label>\n <ToggleGroup value={checked ? \"Yes\" : \"No\"} options={[\"Yes\", \"No\"]} onChange={(v) => onChange(v === \"Yes\")} disabled={disabled} />\n <p className={FIELD_HELP}>{help}</p>\n </div>\n );\n}\n\nexport function LicenseTermsBuilder({\n value, onChange, tokenOptions, amountLabel = \"Amount\", disabled, className,\n}: LicenseTermsBuilderProps) {\n const set = <K extends keyof SponsorshipTerms>(key: K, v: SponsorshipTerms[K]) =>\n onChange({ ...value, [key]: v });\n\n const handleLicenseTypeChange = (licenseType: string) => {\n const def = LICENSE_TYPES.find((l) => l.value === licenseType);\n onChange({\n ...value,\n licenseType,\n ...(def ? { commercialUse: def.commercialUse, derivatives: def.derivatives, attribution: def.attribution } : {}),\n });\n };\n\n const selectedLicense = LICENSE_TYPES.find((l) => l.value === value.licenseType);\n const toggleMedia = (m: string) => {\n const next = value.media.includes(m) ? value.media.filter((x) => x !== m) : [...value.media, m];\n set(\"media\", next);\n };\n\n return (\n <div className={cn(\"space-y-4\", className)}>\n <div className=\"space-y-1.5\">\n <label className={FIELD_LABEL}>{amountLabel}</label>\n <input\n type=\"number\"\n min={0}\n step=\"0.01\"\n inputMode=\"decimal\"\n disabled={disabled}\n value={value.amount}\n onChange={(e) => set(\"amount\", e.target.value)}\n placeholder=\"0.00\"\n className={INPUT_BASE}\n />\n </div>\n\n <div className=\"space-y-1.5\">\n <label className={FIELD_LABEL}>Currency</label>\n <div className=\"grid grid-cols-3 sm:grid-cols-5 gap-1.5\">\n {tokenOptions.map((symbol) => (\n <button\n key={symbol}\n type=\"button\"\n disabled={disabled}\n onClick={() => set(\"paymentTokenSymbol\", symbol)}\n aria-pressed={value.paymentTokenSymbol === symbol}\n className={cn(\n \"h-10 px-2 rounded-xl border text-xs font-semibold flex items-center justify-center gap-1.5 transition-colors disabled:opacity-50\",\n value.paymentTokenSymbol === symbol\n ? \"border-brand-purple bg-brand-purple/10 text-foreground\"\n : \"border-border bg-card text-muted-foreground hover:text-foreground\",\n )}\n >\n <CurrencyIcon symbol={symbol} size={14} />\n {symbol}\n </button>\n ))}\n </div>\n </div>\n\n <label className=\"flex items-start gap-2.5 cursor-pointer select-none\">\n <input\n type=\"checkbox\"\n disabled={disabled}\n checked={value.transferable}\n onChange={(e) => set(\"transferable\", e.target.checked)}\n className=\"mt-0.5 h-4 w-4 rounded border-border text-brand-purple focus:ring-brand-purple/40\"\n />\n <span className=\"text-sm\">\n <span className=\"font-medium\">Sponsor can resell this license</span>\n <span className={cn(FIELD_HELP, \"block\")}>Off means it&apos;s meant to stay with the sponsor who accepts it — resale still isn&apos;t blocked on-chain, this is just the stated intent.</span>\n </span>\n </label>\n\n <div className=\"space-y-1.5\">\n <label className={FIELD_LABEL}>License length</label>\n <div className=\"grid grid-cols-[1fr_auto] gap-2\">\n <input\n type=\"number\"\n min={1}\n disabled={disabled}\n value={value.durationValue}\n onChange={(e) => set(\"durationValue\", e.target.value)}\n placeholder=\"e.g. 30\"\n className={INPUT_BASE}\n />\n <select\n disabled={disabled}\n value={value.durationUnit}\n onChange={(e) => set(\"durationUnit\", e.target.value as DurationUnit)}\n className={cn(INPUT_BASE, \"w-28\")}\n >\n {DURATION_UNITS.map((u) => (\n <option key={u} value={u}>{u}</option>\n ))}\n </select>\n </div>\n <p className={FIELD_HELP}>Counted from the moment the deal is accepted, not from today.</p>\n </div>\n\n <div className=\"space-y-1.5\">\n <label className={FIELD_LABEL}>License type</label>\n <select\n disabled={disabled}\n value={value.licenseType}\n onChange={(e) => handleLicenseTypeChange(e.target.value)}\n className={INPUT_BASE}\n >\n {LICENSE_TYPES.map((l) => (\n <option key={l.value} value={l.value}>{l.label}</option>\n ))}\n </select>\n {selectedLicense ? <p className={FIELD_HELP}>{selectedLicense.description}</p> : null}\n </div>\n\n <div className=\"space-y-1.5\">\n <label className={FIELD_LABEL}>Commercial use</label>\n <ToggleGroup value={value.commercialUse} options={[\"Yes\", \"No\"]} onChange={(v) => set(\"commercialUse\", v as SponsorshipTerms[\"commercialUse\"])} disabled={disabled} />\n </div>\n\n <div className=\"space-y-1.5\">\n <label className={FIELD_LABEL}>Derivatives</label>\n <ToggleGroup value={value.derivatives} options={[\"Allowed\", \"Not Allowed\", \"Share-Alike\"]} onChange={(v) => set(\"derivatives\", v as SponsorshipTerms[\"derivatives\"])} disabled={disabled} />\n </div>\n\n <div className=\"space-y-1.5\">\n <label className={FIELD_LABEL}>Attribution</label>\n <ToggleGroup value={value.attribution} options={[\"Required\", \"Not Required\"]} onChange={(v) => set(\"attribution\", v as SponsorshipTerms[\"attribution\"])} disabled={disabled} />\n </div>\n\n <div className=\"space-y-1.5\">\n <label className={FIELD_LABEL}>Territory <span className=\"font-normal text-muted-foreground\">(optional)</span></label>\n <input\n type=\"text\"\n disabled={disabled}\n value={value.territory}\n onChange={(e) => set(\"territory\", e.target.value)}\n placeholder=\"e.g. Worldwide, Brazil only, excluding China\"\n className={INPUT_BASE}\n />\n </div>\n\n <div className=\"space-y-1.5\">\n <label className={FIELD_LABEL}>AI policy</label>\n <select\n disabled={disabled}\n value={value.aiPolicy}\n onChange={(e) => set(\"aiPolicy\", e.target.value)}\n className={INPUT_BASE}\n >\n {AI_POLICIES.map((p) => (\n <option key={p} value={p}>{p}</option>\n ))}\n </select>\n <p className={FIELD_HELP}>Whether this work can be used to train AI models.</p>\n </div>\n\n <div className=\"space-y-1.5\">\n <label className={FIELD_LABEL}>Scope <span className=\"font-normal text-muted-foreground\">(optional)</span></label>\n <input\n type=\"text\"\n disabled={disabled}\n value={value.scope}\n onChange={(e) => set(\"scope\", e.target.value)}\n placeholder=\"e.g. Instagram + YouTube only\"\n className={INPUT_BASE}\n />\n </div>\n\n <div className=\"space-y-1.5\">\n <label className={FIELD_LABEL}>Deliverables <span className=\"font-normal text-muted-foreground\">(optional)</span></label>\n <textarea\n disabled={disabled}\n value={value.deliverables}\n onChange={(e) => set(\"deliverables\", e.target.value)}\n placeholder=\"e.g. 3 posts, 1 video\"\n rows={2}\n className={cn(INPUT_BASE, \"h-auto py-2.5 resize-y\")}\n />\n </div>\n\n <YesNoToggle\n label=\"Exclusive to this sponsor\"\n help=\"No other sponsors during the license term.\"\n checked={value.exclusive}\n onChange={(v) => set(\"exclusive\", v)}\n disabled={disabled}\n />\n\n <YesNoToggle\n label=\"Content approval required\"\n help=\"Sponsor reviews content before it's published.\"\n checked={value.approvalRequired}\n onChange={(v) => set(\"approvalRequired\", v)}\n disabled={disabled}\n />\n\n <div className=\"space-y-1.5\">\n <label className={FIELD_LABEL}>Media <span className=\"font-normal text-muted-foreground\">(optional)</span></label>\n <div className=\"flex flex-wrap gap-1.5\">\n {MEDIA_TYPES.map((m) => (\n <button\n key={m}\n type=\"button\"\n disabled={disabled}\n onClick={() => toggleMedia(m)}\n className={cn(\n \"h-8 px-2.5 rounded-full border text-xs font-medium transition-colors disabled:opacity-50\",\n value.media.includes(m)\n ? \"border-brand-purple bg-brand-purple/10 text-foreground\"\n : \"border-border bg-card text-muted-foreground hover:text-foreground\",\n )}\n >\n {m}\n </button>\n ))}\n </div>\n <input\n type=\"text\"\n disabled={disabled}\n value={value.mediaOther}\n onChange={(e) => set(\"mediaOther\", e.target.value)}\n placeholder=\"Other media type\"\n className={cn(INPUT_BASE, \"mt-1.5\")}\n />\n </div>\n\n <div className=\"space-y-1.5\">\n <label className={FIELD_LABEL}>Additional terms <span className=\"font-normal text-muted-foreground\">(optional)</span></label>\n <textarea\n disabled={disabled}\n value={value.licenseText}\n onChange={(e) => set(\"licenseText\", e.target.value)}\n placeholder=\"Anything else worth spelling out.\"\n rows={3}\n className={cn(INPUT_BASE, \"h-auto py-2.5 resize-y\")}\n />\n <p className={FIELD_HELP}>Saved permanently and shown to anyone who holds the license.</p>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAwIQ;AAtIR,gBAAmB;AACnB,2BAA6B;AAC7B,gBAA2C;AAKpC,MAAM,iBAAiB,CAAC,QAAQ,SAAS,UAAU,OAAO;AAEjE,MAA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