pxengine 0.1.25 → 0.1.28

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/index.cjs CHANGED
@@ -34202,7 +34202,7 @@ var import_react56 = __toESM(require("react"), 1);
34202
34202
  var import_jsx_runtime96 = require("react/jsx-runtime");
34203
34203
  var FormCard = import_react56.default.memo(
34204
34204
  ({
34205
- title,
34205
+ // title,
34206
34206
  fields,
34207
34207
  data,
34208
34208
  editingFields = {},
@@ -34218,7 +34218,6 @@ var FormCard = import_react56.default.memo(
34218
34218
  className,
34219
34219
  footer
34220
34220
  }) => {
34221
- const [showCopyButton, setShowCopyButton] = (0, import_react56.useState)(false);
34222
34221
  const handleCopyAll = () => {
34223
34222
  const text = fields.map((field) => {
34224
34223
  const value = data[field.key];
@@ -34233,10 +34232,8 @@ var FormCard = import_react56.default.memo(
34233
34232
  "relative w-full rounded-[20px] bg-background dark:bg-gray100 border border-gray400 shadow-lg overflow-hidden mb-6 font-noto",
34234
34233
  className
34235
34234
  ),
34236
- onMouseEnter: () => setShowCopyButton(true),
34237
- onMouseLeave: () => setShowCopyButton(false),
34238
34235
  children: [
34239
- showCopyButton && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
34236
+ /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
34240
34237
  "button",
34241
34238
  {
34242
34239
  onClick: handleCopyAll,
@@ -34246,13 +34243,6 @@ var FormCard = import_react56.default.memo(
34246
34243
  }
34247
34244
  ),
34248
34245
  /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)("div", { className: "p-6 relative", children: [
34249
- /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
34250
- "h3",
34251
- {
34252
- className: "text-gray900 mb-12",
34253
- children: title
34254
- }
34255
- ),
34256
34246
  showTimeline && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
34257
34247
  "div",
34258
34248
  {
@@ -35376,6 +35366,7 @@ var CampaignSeedCard = import_react60.default.memo(
35376
35366
  ({
35377
35367
  selectionStatus,
35378
35368
  isLatestMessage = true,
35369
+ hasUserResponded = false,
35379
35370
  className,
35380
35371
  fields: providedFields,
35381
35372
  data,
@@ -35392,6 +35383,7 @@ var CampaignSeedCard = import_react60.default.memo(
35392
35383
  data
35393
35384
  });
35394
35385
  };
35386
+ const effectiveIsLatest = isLatestMessage && !hasUserResponded;
35395
35387
  return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
35396
35388
  FormCard,
35397
35389
  {
@@ -35402,8 +35394,9 @@ var CampaignSeedCard = import_react60.default.memo(
35402
35394
  proceedLabel: "Continue to concepts",
35403
35395
  onProceed: handleProceed,
35404
35396
  showTimeline: true,
35397
+ isLatestMessage: effectiveIsLatest,
35405
35398
  className: cn("font-noto", className),
35406
- footer: !isLatestMessage && selectionStatus ? /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)("div", { className: "flex justify-end items-center gap-1.5 text-green-600 text-[10px] font-semibold py-4 pr-6", children: [
35399
+ footer: !effectiveIsLatest && (selectionStatus || hasUserResponded) ? /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)("div", { className: "flex justify-end items-center gap-1.5 text-green-600 text-[10px] font-semibold py-4 pr-6", children: [
35407
35400
  /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(CircleCheck, { className: "h-3.5 w-3.5" }),
35408
35401
  /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("span", { children: selectionStatus === "agent" ? "Suggested by Agent" : "Selected by you" })
35409
35402
  ] }) : formCardProps.footer
@@ -35478,6 +35471,7 @@ var SearchSpecCard = import_react61.default.memo(
35478
35471
  ({
35479
35472
  selectionStatus,
35480
35473
  isLatestMessage = true,
35474
+ hasUserResponded = false,
35481
35475
  className,
35482
35476
  fields: providedFields,
35483
35477
  data,
@@ -35496,6 +35490,7 @@ var SearchSpecCard = import_react61.default.memo(
35496
35490
  data: resolvedData
35497
35491
  });
35498
35492
  };
35493
+ const effectiveIsLatest = isLatestMessage && !hasUserResponded;
35499
35494
  return /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
35500
35495
  FormCard,
35501
35496
  {
@@ -35505,8 +35500,9 @@ var SearchSpecCard = import_react61.default.memo(
35505
35500
  fields,
35506
35501
  proceedLabel: "Continue with search",
35507
35502
  onProceed: handleProceed,
35503
+ isLatestMessage: effectiveIsLatest,
35508
35504
  className,
35509
- footer: !isLatestMessage && selectionStatus ? /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)("div", { className: "flex justify-end items-center gap-1.5 text-green-600 text-xs font-semibold py-1", children: [
35505
+ footer: !effectiveIsLatest && (selectionStatus || hasUserResponded) ? /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)("div", { className: "flex justify-end items-center gap-1.5 text-green-600 text-xs font-semibold py-1", children: [
35510
35506
  /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(CircleCheck, { className: "h-4 w-4" }),
35511
35507
  /* @__PURE__ */ (0, import_jsx_runtime108.jsx)("span", { children: selectionStatus === "agent" ? "Selected by Agent" : "Selected by User" })
35512
35508
  ] }) : formCardProps.footer
@@ -35530,11 +35526,15 @@ var MCQCard = import_react62.default.memo(
35530
35526
  isLatestMessage = true,
35531
35527
  isLoading = false,
35532
35528
  className,
35533
- selectionStatus,
35529
+ // selectionStatus,
35534
35530
  onAction,
35535
- disabled = false
35531
+ disabled = false,
35532
+ disableContinueInDiscovery
35533
+ // optional prop
35536
35534
  }) => {
35537
- const [selectedOption, setSelectedOption] = import_react62.default.useState(propsSelectedOption);
35535
+ const [selectedOption, setSelectedOption] = import_react62.default.useState(
35536
+ propsSelectedOption
35537
+ );
35538
35538
  const [isProceeded, setIsProceeded] = import_react62.default.useState(false);
35539
35539
  import_react62.default.useEffect(() => {
35540
35540
  if (propsSelectedOption) {
@@ -35542,6 +35542,7 @@ var MCQCard = import_react62.default.memo(
35542
35542
  setIsProceeded(true);
35543
35543
  }
35544
35544
  }, [propsSelectedOption]);
35545
+ const isDiscovery = disableContinueInDiscovery !== void 0 ? disableContinueInDiscovery : typeof window !== "undefined" && window.location.pathname.includes("creator-discovery");
35545
35546
  const handleOptionClick = (key, e) => {
35546
35547
  e.preventDefault();
35547
35548
  e.stopPropagation();
@@ -35560,11 +35561,13 @@ var MCQCard = import_react62.default.memo(
35560
35561
  onAction?.({
35561
35562
  type: "mcq_selection",
35562
35563
  value: result,
35563
- label: options[result] || result
35564
+ label: options && options[result] || result
35564
35565
  });
35565
35566
  }
35566
35567
  };
35567
- const isInteractionDisabled = disabled || !isLatestMessage || isProceeded;
35568
+ const isOptionsDisabled = disabled || !isLatestMessage || isProceeded && !disableContinueInDiscovery;
35569
+ const isContinueDisabled = disabled || !isLatestMessage || isProceeded || isDiscovery;
35570
+ const optionsEntries = options ? Object.entries(options) : [];
35568
35571
  return /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(
35569
35572
  "div",
35570
35573
  {
@@ -35574,7 +35577,7 @@ var MCQCard = import_react62.default.memo(
35574
35577
  ),
35575
35578
  children: [
35576
35579
  /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("div", { className: "mb-4", children: /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("h4", { className: "font-medium text-foreground px-3 py-1 rounded-md inline-block mb-2", children: question }) }),
35577
- /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("div", { className: "mb-6", children: /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("div", { className: "space-y-4", children: Object.entries(options).map(([key, label]) => {
35580
+ /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("div", { className: "mb-6", children: /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("div", { className: "space-y-4", children: optionsEntries.map(([key, label]) => {
35578
35581
  const isSelected = selectedOption === key;
35579
35582
  const isRecommended = key === recommended;
35580
35583
  return /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(
@@ -35584,8 +35587,8 @@ var MCQCard = import_react62.default.memo(
35584
35587
  className: cn(
35585
35588
  "cursor-pointer rounded-xl p-3 transition-colors relative",
35586
35589
  "border border-transparent bg-paperBackground",
35587
- !selectedOption && !isInteractionDisabled && "hover:border-gray500",
35588
- (isLoading || isInteractionDisabled) && "opacity-50 cursor-not-allowed"
35590
+ !selectedOption && !isOptionsDisabled && "hover:border-gray500",
35591
+ (isLoading || isOptionsDisabled) && "opacity-50 cursor-not-allowed"
35589
35592
  ),
35590
35593
  children: [
35591
35594
  /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("div", { className: "absolute top-1/2 left-4 transform -translate-y-1/2", children: /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(
@@ -35595,7 +35598,7 @@ var MCQCard = import_react62.default.memo(
35595
35598
  "w-5 h-5 rounded-full border flex items-center justify-center transition-colors",
35596
35599
  isSelected ? "border-purple100 bg-gray300" : cn(
35597
35600
  "border-gray300 bg-background",
35598
- !selectedOption && !isInteractionDisabled && "hover:border-purple100"
35601
+ !selectedOption && !isOptionsDisabled && "hover:border-purple100"
35599
35602
  )
35600
35603
  ),
35601
35604
  children: isSelected && /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("div", { className: "w-2.5 h-2.5 rounded-full bg-purple100" })
@@ -35627,8 +35630,8 @@ var MCQCard = import_react62.default.memo(
35627
35630
  /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(
35628
35631
  "button",
35629
35632
  {
35630
- onClick: (e) => handleProceed(e),
35631
- disabled: isInteractionDisabled || isLoading || !selectedOption && !recommended,
35633
+ onClick: handleProceed,
35634
+ disabled: isContinueDisabled || isLoading || !selectedOption && !recommended,
35632
35635
  className: cn(
35633
35636
  "flex-3 px-4 py-2 border rounded-full text-sm disabled:opacity-50 disabled:cursor-not-allowed transition-colors",
35634
35637
  "bg-purpleLight dark:bg-purple200 hover:bg-purpleText1 dark:hover:bg-purple100 text-purpleText2 dark:text-purpleText border-purpleText1 dark:border-purple-border dark:hover:text-white"
@@ -35636,10 +35639,7 @@ var MCQCard = import_react62.default.memo(
35636
35639
  children: isLoading ? "Sending..." : "Continue"
35637
35640
  }
35638
35641
  ),
35639
- isLatestMessage ? /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("div", { className: "flex-1" }) : /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("div", { className: "flex-1 text-right text-xs bg-green100 text-green-600 dark:text-green500", children: selectionStatus === "agent" ? /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)("div", { className: "flex flex-col gap-1 sm:flex-row sm:justify-end", children: [
35640
- /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("span", { className: "whitespace-nowrap", children: "Suggested by an Agent," }),
35641
- /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("span", { className: "whitespace-nowrap", children: "Approved by You" })
35642
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("span", { children: "Selected by you" }) })
35642
+ /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("div", { className: "flex-1" })
35643
35643
  ] })
35644
35644
  ]
35645
35645
  }
@@ -36225,11 +36225,13 @@ var CampaignConceptCard = import_react64.default.memo(
36225
36225
  title: propsTitle,
36226
36226
  selectionStatus,
36227
36227
  isLatestMessage = true,
36228
+ hasUserResponded = false,
36228
36229
  className,
36229
36230
  onAction,
36230
36231
  ...formCardProps
36231
36232
  }) => {
36232
36233
  const [internalIsOpen, setInternalIsOpen] = (0, import_react64.useState)(false);
36234
+ const [copied, setCopied] = (0, import_react64.useState)(false);
36233
36235
  const isOpen = controlledIsOpen !== void 0 ? controlledIsOpen : internalIsOpen;
36234
36236
  const handleToggle = () => {
36235
36237
  if (onToggle) {
@@ -36239,54 +36241,109 @@ var CampaignConceptCard = import_react64.default.memo(
36239
36241
  }
36240
36242
  };
36241
36243
  const cardTitle = propsTitle || data.title || data.name || data.concept_name || data.conceptName || "Campaign Concept";
36244
+ const isSelected = selectionStatus != null;
36245
+ const flattenValue = (val) => {
36246
+ if (val === null || val === void 0) return "-";
36247
+ if (Array.isArray(val)) {
36248
+ return val.map((item) => {
36249
+ if (typeof item === "object" && item !== null) {
36250
+ return item.label || item.value || item.name || JSON.stringify(item);
36251
+ }
36252
+ return String(item);
36253
+ }).join(", ");
36254
+ }
36255
+ if (typeof val === "object") {
36256
+ return Object.entries(val).map(([k, v]) => `${k.replace(/_/g, " ")}: ${v}`).join(", ");
36257
+ }
36258
+ return String(val);
36259
+ };
36260
+ const handleCopyAll = (e) => {
36261
+ e.preventDefault();
36262
+ e.stopPropagation();
36263
+ const allFields = providedFields || generateFieldsFromData(data);
36264
+ const lines = [
36265
+ typeof cardTitle === "string" ? cardTitle : JSON.stringify(cardTitle),
36266
+ "",
36267
+ ...allFields.map((f) => `${f.label}: ${flattenValue(data[f.key])}`)
36268
+ ];
36269
+ navigator.clipboard.writeText(lines.join("\n")).then(() => {
36270
+ setCopied(true);
36271
+ setTimeout(() => setCopied(false), 2e3);
36272
+ });
36273
+ };
36242
36274
  const handleProceed = () => {
36243
36275
  onAction?.({
36244
36276
  type: "concept_selection",
36245
- value: typeof cardTitle === "string" ? cardTitle : JSON.stringify(cardTitle),
36277
+ value: data.title || data.name || data.concept_name || data.conceptName,
36246
36278
  data
36247
36279
  });
36248
36280
  };
36281
+ const effectiveIsLatest = isLatestMessage && !hasUserResponded;
36249
36282
  const fields = (0, import_react64.useMemo)(() => {
36250
36283
  const baseFields = providedFields || generateFieldsFromData(data);
36251
- return baseFields.map((field) => {
36284
+ const FIELD_ORDER = [
36285
+ "description",
36286
+ "creator_strategy",
36287
+ "primary_kpi",
36288
+ "secondary_kpis",
36289
+ "budget_allocation",
36290
+ "budgetAllocation",
36291
+ "estimated_creators",
36292
+ "estimatedCreators",
36293
+ "platforms",
36294
+ "target_platforms",
36295
+ "targetPlatforms"
36296
+ ];
36297
+ const sorted = [...baseFields].sort((a, b) => {
36298
+ const ai = FIELD_ORDER.indexOf(a.key);
36299
+ const bi = FIELD_ORDER.indexOf(b.key);
36300
+ if (ai !== -1 && bi !== -1) return ai - bi;
36301
+ if (ai !== -1) return -1;
36302
+ if (bi !== -1) return 1;
36303
+ return 0;
36304
+ });
36305
+ return sorted.map((field) => {
36252
36306
  if (field.key === "budgetAllocation" || field.key === "budget_allocation") {
36307
+ const formatKey = (k) => k.replace(/_/g, " ").replace(/([a-z])([A-Z])/g, "$1 $2").replace(/\b\w/g, (c) => c.toUpperCase());
36308
+ const formatVal = (v) => {
36309
+ const n = Number(v);
36310
+ if (!isNaN(n) && String(v).trim() !== "") return `${n}%`;
36311
+ return String(v);
36312
+ };
36253
36313
  return {
36254
36314
  ...field,
36255
36315
  label: "Budget Allocation",
36256
36316
  renderDisplay: (val) => {
36257
- if (val && typeof val === "object" && !Array.isArray(val)) {
36258
- return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("div", { className: "flex flex-wrap gap-2 pt-1", children: Object.entries(val).map(([k, v]) => /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)(
36259
- "div",
36260
- {
36261
- className: "flex items-center gap-1.5 bg-background bg-gray400 border border-white/10 px-2 py-1 rounded shadow-sm",
36262
- children: [
36263
- /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("span", { className: "text-[10px] text-gray-400 font-bold uppercase tracking-tight", children: [
36264
- k.replace(/_/g, " "),
36265
- ":"
36266
- ] }),
36267
- /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "text-xs text-white font-medium", children: String(v) })
36268
- ]
36269
- },
36270
- k
36271
- )) });
36272
- }
36317
+ if (!val) return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "text-muted-foreground text-sm", children: "-" });
36273
36318
  if (Array.isArray(val)) {
36274
- return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("div", { className: "flex flex-wrap gap-2 pt-1", children: val.map((item, idx) => /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)(
36275
- "div",
36276
- {
36277
- className: "flex items-center gap-1.5 bg-background bg-gray400 border border-white/10 px-2 py-1 rounded shadow-sm",
36278
- children: [
36279
- item.label && /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("span", { className: "text-[10px] text-gray-400 font-bold uppercase tracking-tight", children: [
36280
- item.label,
36281
- ":"
36282
- ] }),
36283
- /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "text-xs text-white font-medium", children: String(item.value || item) })
36284
- ]
36285
- },
36286
- idx
36287
- )) });
36319
+ return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("div", { className: "space-y-2", children: val.map((item, idx) => {
36320
+ const label = item?.label ?? item?.key ?? `Item ${idx + 1}`;
36321
+ const value = item?.value ?? item;
36322
+ return /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("div", { className: "flex items-center gap-2", children: [
36323
+ /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("span", { className: "text-muted-foreground font-medium", children: [
36324
+ idx + 1,
36325
+ "."
36326
+ ] }),
36327
+ /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "inline-flex items-center bg-[#85888f] dark:bg-grayPill px-2 py-1 text-white dark:text-foreground text-sm font-medium rounded-md border border-[#85888f] dark:border-gray900 font-grotesk", children: String(label) }),
36328
+ /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "text-foreground", children: "=" }),
36329
+ /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "inline-flex items-center bg-[#85888f] dark:bg-grayPill px-2 py-1 text-white dark:text-foreground text-sm rounded-md border border-[#85888f] dark:border-gray900 font-grotesk font-medium", children: formatVal(value) })
36330
+ ] }, idx);
36331
+ }) });
36332
+ }
36333
+ if (typeof val === "object") {
36334
+ const entries = Object.entries(val);
36335
+ if (entries.length === 0) return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "text-muted-foreground text-sm", children: "-" });
36336
+ return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("div", { className: "space-y-2", children: entries.map(([k, v], idx) => /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("div", { className: "flex items-center gap-2", children: [
36337
+ /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("span", { className: "text-muted-foreground font-medium", children: [
36338
+ idx + 1,
36339
+ "."
36340
+ ] }),
36341
+ /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "inline-flex items-center bg-[#85888f] dark:bg-grayPill px-2 py-1 text-white dark:text-foreground text-sm font-medium rounded-md border border-[#85888f] dark:border-gray900 font-grotesk", children: formatKey(k) }),
36342
+ /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "text-foreground", children: "=" }),
36343
+ /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "inline-flex items-center bg-[#85888f] dark:bg-grayPill px-2 py-1 text-white dark:text-foreground text-sm rounded-md border border-[#85888f] dark:border-gray900 font-grotesk font-medium", children: formatVal(v) })
36344
+ ] }, k)) });
36288
36345
  }
36289
- return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "text-gray-300 text-sm", children: val ? String(val) : "-" });
36346
+ return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "text-muted-foreground text-sm", children: String(val) });
36290
36347
  }
36291
36348
  };
36292
36349
  }
@@ -36295,32 +36352,64 @@ var CampaignConceptCard = import_react64.default.memo(
36295
36352
  ...field,
36296
36353
  label: "Estimated Creators",
36297
36354
  renderDisplay: (val) => {
36355
+ if (!val) return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "text-muted-foreground text-sm", children: "-" });
36356
+ if (typeof val === "object" && !Array.isArray(val)) {
36357
+ return /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("div", { className: "flex items-center gap-2", children: [
36358
+ /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "inline-flex items-center px-2 py-1 bg-[#85888f] dark:bg-grayPill text-white dark:text-foreground text-sm font-medium rounded-md border font-grotesk", children: val.min ?? 0 }),
36359
+ /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "text-foreground", children: "-" }),
36360
+ /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "inline-flex items-center px-2 py-1 bg-[#85888f] dark:bg-grayPill text-white dark:text-foreground text-sm font-medium rounded-md border font-grotesk", children: val.max ?? 0 })
36361
+ ] });
36362
+ }
36363
+ if (typeof val === "string" && val.includes("-")) {
36364
+ return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("div", { className: "flex items-center gap-2", children: val.split("-").map((part, idx, arr) => /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)(import_react64.default.Fragment, { children: [
36365
+ /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "inline-flex items-center px-2 py-1 bg-[#85888f] dark:bg-grayPill text-white dark:text-foreground text-sm font-medium rounded-md border font-grotesk", children: part.trim() }),
36366
+ idx < arr.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "text-foreground", children: "-" })
36367
+ ] }, idx)) });
36368
+ }
36298
36369
  if (Array.isArray(val)) {
36299
- return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("div", { className: "flex gap-2 pt-1", children: val.map((v, idx) => /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
36300
- "div",
36370
+ return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("div", { className: "flex items-center gap-2", children: val.map((v, idx) => /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
36371
+ "span",
36301
36372
  {
36302
- className: "bg-background bg-purple200 border border-purple100/20 px-2 py-0.5 rounded text-white text-xs font-medium",
36373
+ className: "inline-flex items-center px-2 py-1 bg-[#85888f] dark:bg-grayPill text-white dark:text-foreground text-sm font-medium rounded-md border font-grotesk",
36303
36374
  children: String(v)
36304
36375
  },
36305
36376
  idx
36306
36377
  )) });
36307
36378
  }
36308
- return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "text-white font-medium", children: val ? String(val) : "-" });
36379
+ return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "text-txtColor font-medium", children: String(val) });
36309
36380
  }
36310
36381
  };
36311
36382
  }
36312
- if (field.key === "platforms") {
36383
+ if (field.key === "primary_kpi" || field.key === "primaryKpi") {
36313
36384
  return {
36314
36385
  ...field,
36386
+ label: field.label || "Primary KPI",
36387
+ renderDisplay: (val) => /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "text-foreground text-sm", children: val ? String(val) : "-" })
36388
+ };
36389
+ }
36390
+ if (field.key === "secondary_kpis" || field.key === "secondaryKpis") {
36391
+ return {
36392
+ ...field,
36393
+ label: field.label || "Secondary KPIs",
36315
36394
  renderDisplay: (val) => {
36316
- const platforms = Array.isArray(val) ? val : typeof val === "string" ? val.split(/,\s*/) : [val];
36317
- return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("div", { className: "flex flex-wrap gap-1.5 pt-1", children: platforms.map((p) => /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
36318
- "div",
36395
+ const display = Array.isArray(val) ? val.map(String).join(", ") : val ? String(val) : "-";
36396
+ return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "text-foreground text-sm", children: display });
36397
+ }
36398
+ };
36399
+ }
36400
+ if (field.key === "platforms" || field.key === "target_platforms" || field.key === "targetPlatforms") {
36401
+ return {
36402
+ ...field,
36403
+ renderDisplay: (val) => {
36404
+ const platforms = Array.isArray(val) ? val.map(String) : typeof val === "string" ? val.split(/,\s*/).map((s) => s.trim()).filter(Boolean) : val ? [String(val)] : [];
36405
+ if (platforms.length === 0) return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "text-muted-foreground text-sm", children: "-" });
36406
+ return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("div", { className: "flex flex-wrap gap-2 pt-1", children: platforms.map((p) => /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
36407
+ "span",
36319
36408
  {
36320
- className: "px-2 py-0.5 rounded-full bg-blue-500/10 border border-blue-500/20 text-blue-400 text-[10px] font-bold uppercase",
36321
- children: String(p)
36409
+ className: "inline-flex items-center bg-[#85888f] dark:bg-grayPill px-2 py-1 text-white dark:text-foreground text-sm font-medium rounded-md border border-[#85888f] dark:border-gray900 font-grotesk",
36410
+ children: p
36322
36411
  },
36323
- String(p)
36412
+ p
36324
36413
  )) });
36325
36414
  }
36326
36415
  };
@@ -36328,10 +36417,24 @@ var CampaignConceptCard = import_react64.default.memo(
36328
36417
  return {
36329
36418
  ...field,
36330
36419
  renderDisplay: (val) => {
36420
+ if (Array.isArray(val)) {
36421
+ if (val.length === 0) return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "text-muted-foreground text-sm", children: "-" });
36422
+ return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("div", { className: "flex flex-wrap gap-1.5 pt-1", children: val.map((item, idx) => {
36423
+ const label = typeof item === "object" && item !== null ? item.label || item.value || item.name || JSON.stringify(item) : String(item);
36424
+ return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
36425
+ "span",
36426
+ {
36427
+ className: "inline-block bg-paperBackground border border-gray400 text-txtColor text-xs px-2 py-0.5 rounded-full",
36428
+ children: label
36429
+ },
36430
+ idx
36431
+ );
36432
+ }) });
36433
+ }
36331
36434
  if (typeof val === "object" && val !== null) {
36332
- return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("div", { className: "text-gray-300 text-xs font-mono bg-black/20 p-2 rounded border border-white/5 mt-1 overflow-auto max-h-24", children: JSON.stringify(val, null, 2) });
36435
+ return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("div", { className: "text-muted-foreground text-xs font-mono bg-paperBackground p-2 rounded border border-gray400 mt-1 overflow-auto max-h-24", children: Object.entries(val).map(([k, v]) => `${k.replace(/_/g, " ")}: ${v}`).join("\n") });
36333
36436
  }
36334
- return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "text-gray-300 text-sm", children: String(val) });
36437
+ return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "text-txtColor text-sm", children: val !== void 0 && val !== null ? String(val) : "-" });
36335
36438
  }
36336
36439
  };
36337
36440
  });
@@ -36340,31 +36443,55 @@ var CampaignConceptCard = import_react64.default.memo(
36340
36443
  "div",
36341
36444
  {
36342
36445
  className: cn(
36343
- "w-full rounded-[20px] transition-all duration-300 bg-background dark:bg-gray50",
36344
- isOpen ? "border border-green-500/50 shadow-[0_0_15px_rgba(34,197,94,0.1)]" : "border border-gray400",
36446
+ "w-full rounded-xl border bg-background dark:bg-gray100 relative transition-all duration-300",
36447
+ isSelected || isRecommended ? "border-2 border-green500" : "border-gray400",
36345
36448
  className
36346
36449
  ),
36347
36450
  children: [
36348
36451
  /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)(
36349
36452
  "div",
36350
36453
  {
36351
- className: "flex items-center justify-between p-6 cursor-pointer select-none",
36454
+ className: "p-6 relative flex items-start justify-between cursor-pointer select-none",
36352
36455
  onClick: handleToggle,
36353
36456
  children: [
36354
- /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("div", { className: "flex flex-col gap-2", children: [
36355
- /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("h3", { className: "text-lg font-semibold text-white tracking-wide", children: typeof cardTitle === "object" ? JSON.stringify(cardTitle) : String(cardTitle) }),
36356
- isRecommended && /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("div", { className: "inline-flex text-[10px] font-bold uppercase tracking-widest text-[#22C55E]", children: /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "bg-[#22C55E]/10 px-2 py-0.5 rounded border border-[#22C55E]/20", children: "Recommended" }) })
36457
+ /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("div", { className: "flex-1", children: [
36458
+ /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("h2", { className: "mb-1 py-1 text-txtColor font-bold", children: typeof cardTitle === "object" ? JSON.stringify(cardTitle) : String(cardTitle) }),
36459
+ /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("div", { className: "flex flex-wrap gap-2", children: [
36460
+ isRecommended && /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("div", { className: "inline-flex text-[10px] font-bold uppercase tracking-widest text-[#22C55E]", children: /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "bg-[#22C55E]/10 px-2 py-0.5 rounded border border-[#22C55E]/20", children: "Recommended" }) }),
36461
+ !effectiveIsLatest && (selectionStatus || hasUserResponded) && /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("div", { className: "inline-flex text-[10px] font-bold uppercase tracking-widest text-[#3B82F6]", children: /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "bg-[#3B82F6]/10 px-2 py-0.5 rounded border border-[#3B82F6]/20", children: selectionStatus === "agent" ? "Selected by Agent" : "Selected by You" }) })
36462
+ ] })
36357
36463
  ] }),
36358
- /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
36359
- "div",
36360
- {
36361
- className: cn(
36362
- "p-2 rounded-lg bg-white/5 border border-white/10 text-gray-400 transition-transform duration-300",
36363
- isOpen && "rotate-180"
36364
- ),
36365
- children: /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(ChevronDown, { className: "h-4 w-4" })
36366
- }
36367
- )
36464
+ /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("div", { className: "flex items-center gap-2 ml-3", onClick: (e) => e.stopPropagation(), children: [
36465
+ /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
36466
+ "button",
36467
+ {
36468
+ onClick: handleCopyAll,
36469
+ title: "Copy all details",
36470
+ className: "p-2 bg-background hover:bg-gray200 dark:hover:bg-gray200 text-foreground rounded-lg shadow-lg transition-all active:scale-95",
36471
+ "aria-label": "Copy all details",
36472
+ children: copied ? /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(Check, { className: "h-4 w-4 text-green-500" }) : /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(Copy, { className: "h-4 w-4" })
36473
+ }
36474
+ ),
36475
+ /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
36476
+ "button",
36477
+ {
36478
+ onClick: (e) => {
36479
+ e.preventDefault();
36480
+ e.stopPropagation();
36481
+ handleToggle();
36482
+ },
36483
+ className: "p-2 bg-background hover:bg-gray200 dark:hover:bg-gray200 text-foreground rounded-lg shadow-lg",
36484
+ "aria-label": isOpen ? "Collapse" : "Expand",
36485
+ title: isOpen ? "Collapse" : "Expand",
36486
+ children: /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
36487
+ ChevronDown,
36488
+ {
36489
+ className: `h-4 w-4 transition-transform ${isOpen ? "rotate-0" : "-rotate-90"}`
36490
+ }
36491
+ )
36492
+ }
36493
+ )
36494
+ ] })
36368
36495
  ]
36369
36496
  }
36370
36497
  ),
@@ -36374,26 +36501,39 @@ var CampaignConceptCard = import_react64.default.memo(
36374
36501
  initial: { height: 0, opacity: 0 },
36375
36502
  animate: { height: "auto", opacity: 1 },
36376
36503
  exit: { height: 0, opacity: 0 },
36377
- transition: { duration: 0.3, ease: "easeInOut" },
36504
+ transition: { duration: 0.2, ease: "easeIn" },
36378
36505
  className: "overflow-hidden",
36379
- children: /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("div", { className: "px-6 pb-6 pt-0 border-t border-white/5", children: /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
36380
- FormCard,
36381
- {
36382
- ...formCardProps,
36383
- title: typeof cardTitle === "object" ? JSON.stringify(cardTitle) : String(cardTitle),
36384
- data,
36385
- fields,
36386
- showTimeline: true,
36387
- proceedLabel: "Continue with this concept",
36388
- onProceed: handleProceed,
36389
- className: "bg-transparent border-none shadow-none mb-0 p-0",
36390
- footer: !isLatestMessage && selectionStatus ? /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("div", { className: "flex justify-end items-center gap-1.5 text-green-600 text-[10px] font-semibold py-4 pr-6", children: [
36391
- /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(CircleCheck, { className: "h-3.5 w-3.5" }),
36392
- /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { children: selectionStatus === "agent" ? "Selected by Agent" : "Selected by You" })
36393
- ] }) : formCardProps.footer
36394
- }
36395
- ) })
36396
- }
36506
+ children: /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("div", { className: "p-6 w-full overflow-hidden relative", children: [
36507
+ /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
36508
+ "div",
36509
+ {
36510
+ className: "absolute left-[60px] top-[100px] bottom-[60px] w-[3px]",
36511
+ style: {
36512
+ background: `radial-gradient(circle closest-side, #3C3D3E 98%, transparent) 50%/2px 5px repeat-y, linear-gradient(#3C3D3E 50%, transparent 0) 50%/2px 10px repeat-y`
36513
+ }
36514
+ }
36515
+ ),
36516
+ /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
36517
+ FormCard,
36518
+ {
36519
+ ...formCardProps,
36520
+ title: typeof cardTitle === "object" ? JSON.stringify(cardTitle) : String(cardTitle),
36521
+ data,
36522
+ fields,
36523
+ showTimeline: true,
36524
+ proceedLabel: "Continue with this concept",
36525
+ onProceed: handleProceed,
36526
+ isLatestMessage: effectiveIsLatest,
36527
+ className: "bg-transparent border-none shadow-none mb-0 p-0",
36528
+ footer: !effectiveIsLatest && (selectionStatus || hasUserResponded) ? /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("div", { className: "flex justify-end items-center gap-1.5 text-green-600 text-[10px] font-semibold py-4 pr-6", children: [
36529
+ /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(CircleCheck, { className: "h-3.5 w-3.5" }),
36530
+ /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { children: selectionStatus === "agent" ? "Selected by Agent" : "Selected by You" })
36531
+ ] }) : formCardProps.footer
36532
+ }
36533
+ )
36534
+ ] })
36535
+ },
36536
+ "expanded-content"
36397
36537
  ) })
36398
36538
  ]
36399
36539
  }