pxengine 0.1.31 → 0.1.32

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
@@ -214,6 +214,8 @@ __export(index_exports, {
214
214
  PaginationNext: () => PaginationNext,
215
215
  PaginationPrevious: () => PaginationPrevious,
216
216
  PlatformIconGroup: () => PlatformIconGroup,
217
+ PlatformSelectDisplay: () => PlatformSelectDisplay,
218
+ PlatformSelectEdit: () => PlatformSelectEdit,
217
219
  Popover: () => Popover,
218
220
  PopoverAtom: () => PopoverAtom,
219
221
  PopoverContent: () => PopoverContent,
@@ -33591,6 +33593,8 @@ __export(molecules_exports, {
33591
33593
  MCQCard: () => MCQCard,
33592
33594
  NotificationList: () => NotificationList,
33593
33595
  PlatformIconGroup: () => PlatformIconGroup,
33596
+ PlatformSelectDisplay: () => PlatformSelectDisplay,
33597
+ PlatformSelectEdit: () => PlatformSelectEdit,
33594
33598
  SearchSpecCard: () => SearchSpecCard,
33595
33599
  StatsGrid: () => StatsGrid,
33596
33600
  StepWizard: () => StepWizard,
@@ -33932,6 +33936,9 @@ var EditableField = import_react54.default.memo(
33932
33936
  className,
33933
33937
  renderDisplay,
33934
33938
  renderEdit,
33939
+ isLatestMessage,
33940
+ shouldStopPropagation = true,
33941
+ isChanged,
33935
33942
  ...rest
33936
33943
  }) => {
33937
33944
  void rest;
@@ -33963,15 +33970,14 @@ var EditableField = import_react54.default.memo(
33963
33970
  switch (type) {
33964
33971
  case "textarea":
33965
33972
  return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
33966
- Textarea,
33973
+ Input,
33967
33974
  {
33968
33975
  ref: inputRef,
33969
33976
  value: localValue || "",
33970
33977
  onChange: (e) => setLocalValue(e.target.value),
33971
33978
  onKeyDown: handleKeyDown,
33972
33979
  placeholder: config.placeholder,
33973
- rows: config.rows || 3,
33974
- className: "min-h-[80px] resize-none bg-background dark:bg-gray100 border-gray300"
33980
+ className: "bg-background text-foreground border border-purple-600 focus-visible:ring-0 focus-visible:ring-offset-0 focus:border-gray600"
33975
33981
  }
33976
33982
  );
33977
33983
  case "select":
@@ -34024,7 +34030,7 @@ var EditableField = import_react54.default.memo(
34024
34030
  min: config.numberConfig?.min,
34025
34031
  max: config.numberConfig?.max,
34026
34032
  step: config.numberConfig?.step,
34027
- className: "bg-background dark:bg-gray100 border-gray300"
34033
+ className: "bg-background text-foreground border border-purple-600 focus-visible:ring-0 focus-visible:ring-offset-0 focus:border-gray600"
34028
34034
  }
34029
34035
  );
34030
34036
  default:
@@ -34037,7 +34043,7 @@ var EditableField = import_react54.default.memo(
34037
34043
  onChange: (e) => setLocalValue(e.target.value),
34038
34044
  onKeyDown: handleKeyDown,
34039
34045
  placeholder: config.placeholder,
34040
- className: "bg-background dark:bg-gray100 border-gray300"
34046
+ className: "bg-background text-foreground border border-purple-600 focus-visible:ring-0 focus-visible:ring-offset-0 focus:border-gray600"
34041
34047
  }
34042
34048
  );
34043
34049
  }
@@ -34064,48 +34070,58 @@ var EditableField = import_react54.default.memo(
34064
34070
  /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
34065
34071
  "h4",
34066
34072
  {
34067
- className: "px-2 py-1 tracking-widest bg-background bg-purple200 text-purpleText dark:text-purple-400 text-[10px] font-bold rounded uppercase",
34073
+ className: "px-[6px] py-[2px] tracking-widest bg-purple200 hover:bg-purple200 text-purpleText text-xs font-normal rounded-[4px]",
34068
34074
  children: label
34069
34075
  }
34070
34076
  ),
34071
- !isEditingProp && /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("span", { className: "inline-flex items-center gap-1.5 text-[0.75rem] font-medium text-green-600 dark:text-green-500 bg-green-500/5 px-2 py-0.5 rounded-full ", children: [
34072
- "Suggested by an Agent",
34077
+ isEditingProp ? /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "flex items-center gap-3", children: [
34073
34078
  /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
34074
- "span",
34079
+ "button",
34075
34080
  {
34076
- className: "flex items-center gap-1 cursor-pointer text-foreground hover:text-green-700 transition-colors ml-1 pl-1.5 ",
34077
- onClick: onEdit,
34078
- children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(SquarePen, { className: "h-5 w-5" })
34079
- }
34080
- )
34081
- ] })
34082
- ] }) }),
34083
- isEditingProp ? /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "flex flex-col gap-3", children: [
34084
- renderInput(),
34085
- /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "flex items-center justify-end gap-2", children: [
34086
- /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
34087
- Button,
34088
- {
34089
- size: "icon",
34090
- variant: "outline",
34091
- className: "h-8 w-8 text-foreground rounded-lg",
34092
- onClick: onCancel,
34081
+ onClick: (e) => {
34082
+ e.stopPropagation();
34083
+ onCancel?.();
34084
+ },
34085
+ className: "text-gray-500 hover:text-gray-700 transition-colors",
34093
34086
  disabled: isSaving,
34094
- children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(X, { className: "h-4 w-4" })
34087
+ title: "Cancel",
34088
+ children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(X, { className: "h-5 w-5" })
34095
34089
  }
34096
34090
  ),
34097
34091
  /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
34098
- Button,
34092
+ "button",
34099
34093
  {
34100
- size: "icon",
34101
- className: "h-8 w-8 text-foreground rounded-lg shadow-none",
34102
- onClick: handleSave,
34094
+ onClick: (e) => {
34095
+ e.stopPropagation();
34096
+ handleSave();
34097
+ },
34098
+ className: "text-gray600 hover:text-gray600 transition-colors",
34103
34099
  disabled: isSaving,
34104
- children: isSaving ? /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(LoaderCircle, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(Save, { className: "h-4 w-4" })
34100
+ title: "Save",
34101
+ children: isSaving ? /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(LoaderCircle, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(Save, { className: "h-5 w-5" })
34102
+ }
34103
+ )
34104
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("span", { className: cn(
34105
+ "inline-flex items-center gap-1.5 text-[0.75rem] font-medium px-2 py-0.5 rounded-full",
34106
+ isChanged ? "bg-yellow100 text-warningcolor" : "text-green-600 dark:text-green-500 bg-green-500/5"
34107
+ ), children: [
34108
+ isChanged ? "Changed by you" : "Suggested by an Agent",
34109
+ isLatestMessage && /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
34110
+ "span",
34111
+ {
34112
+ className: "flex items-center gap-1 cursor-pointer text-foreground hover:text-green-700 transition-colors ml-1 pl-1.5 ",
34113
+ onClick: (e) => {
34114
+ if (shouldStopPropagation !== false) {
34115
+ e.stopPropagation();
34116
+ }
34117
+ onEdit?.();
34118
+ },
34119
+ children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(SquarePen, { className: "h-5 w-5" })
34105
34120
  }
34106
34121
  )
34107
34122
  ] })
34108
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
34123
+ ] }) }),
34124
+ isEditingProp ? /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { className: "flex flex-col gap-3", children: renderInput() }) : /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
34109
34125
  "div",
34110
34126
  {
34111
34127
  className: cn(
@@ -34236,35 +34252,56 @@ var FormCard = import_react56.default.memo(
34236
34252
  hideTitle = false,
34237
34253
  hideCopyButton = false,
34238
34254
  className,
34239
- footer
34255
+ footer,
34256
+ shouldStopPropagation = true
34240
34257
  }) => {
34241
34258
  const [copied, setCopied] = (0, import_react56.useState)(false);
34242
34259
  const [internalEditingFields, setInternalEditingFields] = (0, import_react56.useState)({});
34260
+ const [internalSavingFields, setInternalSavingFields] = (0, import_react56.useState)({});
34243
34261
  const [internalData, setInternalData] = (0, import_react56.useState)(data);
34262
+ const [userEditedFields, setUserEditedFields] = (0, import_react56.useState)({});
34244
34263
  import_react56.default.useEffect(() => {
34245
- setInternalData(data);
34246
- }, [data]);
34247
- const isExternallyControlled = !!(externalOnFieldEdit || externalOnFieldSave || externalOnFieldCancel);
34248
- const editingFields = isExternallyControlled ? externalEditingFields || {} : internalEditingFields;
34249
- const activeData = isExternallyControlled ? data : internalData;
34264
+ setInternalData((prev) => {
34265
+ const newData = { ...data };
34266
+ Object.keys(userEditedFields).forEach((key) => {
34267
+ if (userEditedFields[key] && prev[key] !== void 0) {
34268
+ newData[key] = prev[key];
34269
+ }
34270
+ });
34271
+ return newData;
34272
+ });
34273
+ }, [data, userEditedFields]);
34274
+ const isExternallyControlled = !!externalOnFieldEdit;
34275
+ const activeEditingFields = isExternallyControlled ? externalEditingFields || {} : internalEditingFields;
34276
+ const resolvedSavingFields = Object.keys(savingFields).length > 0 ? savingFields : internalSavingFields;
34277
+ const activeData = internalData;
34250
34278
  const handleFieldEdit = (key) => {
34251
- if (isExternallyControlled) {
34252
- externalOnFieldEdit?.(key);
34279
+ if (externalOnFieldEdit) {
34280
+ externalOnFieldEdit(key);
34253
34281
  } else {
34254
34282
  setInternalEditingFields((prev) => ({ ...prev, [key]: true }));
34255
34283
  }
34256
34284
  };
34257
- const handleFieldSave = (key, newValue) => {
34258
- if (isExternallyControlled) {
34259
- externalOnFieldSave?.(key, newValue);
34285
+ const handleFieldSave = async (key, newValue) => {
34286
+ setInternalData((prev) => ({ ...prev, [key]: newValue }));
34287
+ setUserEditedFields((prev) => ({ ...prev, [key]: true }));
34288
+ if (externalOnFieldSave) {
34289
+ setInternalSavingFields((prev) => ({ ...prev, [key]: true }));
34290
+ try {
34291
+ await externalOnFieldSave(key, newValue);
34292
+ } finally {
34293
+ setInternalSavingFields((prev) => ({ ...prev, [key]: false }));
34294
+ setInternalEditingFields((prev) => ({ ...prev, [key]: false }));
34295
+ }
34260
34296
  } else {
34261
- setInternalData((prev) => ({ ...prev, [key]: newValue }));
34262
34297
  setInternalEditingFields((prev) => ({ ...prev, [key]: false }));
34263
34298
  }
34264
34299
  };
34265
34300
  const handleFieldCancel = (key) => {
34266
- if (isExternallyControlled) {
34267
- externalOnFieldCancel?.(key);
34301
+ setInternalData((prev) => ({ ...prev, [key]: data[key] }));
34302
+ setUserEditedFields((prev) => ({ ...prev, [key]: false }));
34303
+ if (externalOnFieldCancel) {
34304
+ externalOnFieldCancel(key);
34268
34305
  } else {
34269
34306
  setInternalEditingFields((prev) => ({ ...prev, [key]: false }));
34270
34307
  }
@@ -34342,10 +34379,11 @@ var FormCard = import_react56.default.memo(
34342
34379
  value: activeData[field.key],
34343
34380
  type: field.type,
34344
34381
  config: field,
34345
- isEditing: editingFields[field.key],
34346
- isChanged: changedFields[field.key],
34347
- isSaving: savingFields[field.key],
34382
+ isEditing: activeEditingFields[field.key],
34383
+ isChanged: changedFields[field.key] || userEditedFields[field.key],
34384
+ isSaving: resolvedSavingFields[field.key],
34348
34385
  isLatestMessage,
34386
+ shouldStopPropagation,
34349
34387
  onEdit: () => handleFieldEdit(field.key),
34350
34388
  onSave: (val) => handleFieldSave(field.key, val),
34351
34389
  onCancel: () => handleFieldCancel(field.key),
@@ -35109,16 +35147,25 @@ var CountrySelectEdit = ({
35109
35147
  document.addEventListener("mousedown", handleClickOutside);
35110
35148
  return () => document.removeEventListener("mousedown", handleClickOutside);
35111
35149
  }, []);
35112
- const inputValue = Array.isArray(value) ? value : [];
35150
+ const inputValue = (0, import_react59.useMemo)(() => {
35151
+ if (Array.isArray(value)) return value;
35152
+ if (typeof value === "string" && value.trim() !== "") {
35153
+ const foundCountry = countries.find(
35154
+ (c) => c.name.toLowerCase() === value.toLowerCase() || c.code.toLowerCase() === value.toLowerCase()
35155
+ );
35156
+ return foundCountry ? [foundCountry.code] : [value];
35157
+ }
35158
+ return [];
35159
+ }, [value]);
35113
35160
  return /* @__PURE__ */ (0, import_jsx_runtime106.jsxs)("div", { className: "space-y-3", children: [
35114
35161
  /* @__PURE__ */ (0, import_jsx_runtime106.jsxs)("div", { className: "relative", ref: dropdownRef, children: [
35115
35162
  /* @__PURE__ */ (0, import_jsx_runtime106.jsxs)(
35116
35163
  "div",
35117
35164
  {
35118
- className: "flex-1 bg-white border border-gray200 rounded-md px-3 py-2 text-sm cursor-pointer flex items-center justify-between font-medium hover:border-purple500 transition-colors",
35165
+ className: "flex-1 bg-background border border-border rounded-md px-3 py-2 text-sm cursor-pointer flex items-center justify-between font-medium hover:border-purple500 transition-colors",
35119
35166
  onClick: () => setIsDropdownOpen(!isDropdownOpen),
35120
35167
  children: [
35121
- /* @__PURE__ */ (0, import_jsx_runtime106.jsx)("span", { className: "text-gray-700", children: inputValue.length > 0 ? `${inputValue.length} ${inputValue.length === 1 ? "country" : "countries"} selected` : "Select countries..." }),
35168
+ /* @__PURE__ */ (0, import_jsx_runtime106.jsx)("span", { className: "text-foreground", children: inputValue.length > 0 ? `${inputValue.length} ${inputValue.length === 1 ? "country" : "countries"} selected` : "Select countries..." }),
35122
35169
  /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(
35123
35170
  ChevronDown,
35124
35171
  {
@@ -35131,15 +35178,15 @@ var CountrySelectEdit = ({
35131
35178
  ]
35132
35179
  }
35133
35180
  ),
35134
- isDropdownOpen && /* @__PURE__ */ (0, import_jsx_runtime106.jsxs)("div", { className: "absolute top-full left-0 right-0 mt-1 bg-white border border-gray200 rounded-lg shadow-xl z-50 max-h-60 overflow-hidden animate-in fade-in slide-in-from-top-1", children: [
35135
- /* @__PURE__ */ (0, import_jsx_runtime106.jsx)("div", { className: "p-2 border-b border-gray-100", children: /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(
35181
+ isDropdownOpen && /* @__PURE__ */ (0, import_jsx_runtime106.jsxs)("div", { className: "relative z-10 top-full left-0 right-0 mt-1 bg-background border border-border rounded-lg shadow-xl z-50 max-h-60 overflow-hidden animate-in fade-in slide-in-from-top-1", children: [
35182
+ /* @__PURE__ */ (0, import_jsx_runtime106.jsx)("div", { className: "p-2 border-b border-border", children: /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(
35136
35183
  "input",
35137
35184
  {
35138
35185
  type: "text",
35139
35186
  placeholder: "Search countries...",
35140
35187
  value: searchTerm,
35141
35188
  onChange: (e) => setSearchTerm(e.target.value),
35142
- className: "w-full px-3 py-1.5 text-sm border border-gray-100 rounded-md bg-gray-50 focus:outline-none focus:ring-2 focus:ring-purple500/20 focus:border-purple500",
35189
+ className: "w-full px-3 py-1.5 text-foreground text-sm border border-border rounded-md bg-background focus:outline-none focus:ring-2 focus:ring-purple500/20 focus:border-purple500",
35143
35190
  onClick: (e) => e.stopPropagation()
35144
35191
  }
35145
35192
  ) }),
@@ -35167,8 +35214,8 @@ var CountrySelectEdit = ({
35167
35214
  },
35168
35215
  children: [
35169
35216
  /* @__PURE__ */ (0, import_jsx_runtime106.jsxs)("div", { className: "flex items-center gap-2", children: [
35170
- /* @__PURE__ */ (0, import_jsx_runtime106.jsx)("span", { className: "text-sm text-gray-700", children: country.name }),
35171
- /* @__PURE__ */ (0, import_jsx_runtime106.jsx)("span", { className: "text-xs text-gray-400 font-mono", children: country.code })
35217
+ /* @__PURE__ */ (0, import_jsx_runtime106.jsx)("span", { className: "text-sm text-foreground", children: country.name }),
35218
+ /* @__PURE__ */ (0, import_jsx_runtime106.jsx)("span", { className: "text-xs text-muted-foreground font-mono", children: country.code })
35172
35219
  ] }),
35173
35220
  inputValue.includes(country.code) && /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(Check, { className: "h-4 w-4 text-purple500" })
35174
35221
  ]
@@ -35180,8 +35227,7 @@ var CountrySelectEdit = ({
35180
35227
  inputValue.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime106.jsx)("div", { className: "flex flex-wrap gap-1.5", children: inputValue.map((countryCode) => /* @__PURE__ */ (0, import_jsx_runtime106.jsxs)(
35181
35228
  Badge2,
35182
35229
  {
35183
- variant: "secondary",
35184
- className: "bg-purple50 text-purple700 border-purple100 hover:bg-purple100 cursor-default flex items-center gap-1 pr-1",
35230
+ className: "flex items-center gap-1 px-2 py-1 bg-grayPill border border-foreground rounded-md text-white text-sm font-grotesk font-medium",
35185
35231
  children: [
35186
35232
  countryCode,
35187
35233
  /* @__PURE__ */ (0, import_jsx_runtime106.jsxs)(
@@ -35190,7 +35236,7 @@ var CountrySelectEdit = ({
35190
35236
  onClick: () => onChange(inputValue.filter((c) => c !== countryCode)),
35191
35237
  className: "hover:bg-purple200 rounded-full p-0.5 transition-colors",
35192
35238
  children: [
35193
- /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(ChevronDown, { className: "h-3 w-3 rotate-45" }),
35239
+ /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(X, { className: "h-3 w-3" }),
35194
35240
  " "
35195
35241
  ]
35196
35242
  }
@@ -35202,38 +35248,59 @@ var CountrySelectEdit = ({
35202
35248
  ] });
35203
35249
  };
35204
35250
  var CountrySelectDisplay = ({ value }) => {
35205
- if (!value || !Array.isArray(value) || value.length === 0) {
35206
- return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)("span", { className: "text-muted-foreground italic", children: "Not specified" });
35207
- }
35208
- return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)("div", { className: "flex flex-wrap gap-1.5", children: value.map((countryCode) => /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(
35209
- Badge2,
35210
- {
35211
- variant: "outline",
35212
- className: "text-foreground border-gray-200 py-1",
35213
- children: countryCode
35214
- },
35215
- countryCode
35216
- )) });
35251
+ const displayValues = (0, import_react59.useMemo)(() => {
35252
+ if (Array.isArray(value)) return value;
35253
+ if (typeof value === "string" && value.trim() !== "") return [value];
35254
+ return [];
35255
+ }, [value]);
35256
+ if (displayValues.length === 0) {
35257
+ return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)("span", { className: "text-muted-foreground italic text-sm", children: "Not specified" });
35258
+ }
35259
+ return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)("div", { className: "flex flex-wrap gap-2 pt-1", children: displayValues.map((item) => {
35260
+ const country = countries.find(
35261
+ (c) => c.code.toLowerCase() === item.toLowerCase() || c.name.toLowerCase() === item.toLowerCase()
35262
+ );
35263
+ return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(
35264
+ "div",
35265
+ {
35266
+ className: "flex items-center gap-2 px-3 py-1 bg-grayPill border border-foreground rounded-md text-foreground text-sm font-grotesk font-medium",
35267
+ children: country ? country.name : item
35268
+ },
35269
+ item
35270
+ );
35271
+ }) });
35217
35272
  };
35218
35273
  var KeywordBundlesEdit = ({
35219
35274
  value,
35220
35275
  onChange
35221
35276
  }) => {
35222
35277
  const bundles = Array.isArray(value) ? value : [];
35278
+ const parseKeywords = (v) => {
35279
+ if (Array.isArray(v)) return v;
35280
+ if (typeof v === "string") return v.split(",").map((s) => s.trim()).filter(Boolean);
35281
+ return [];
35282
+ };
35223
35283
  const groups = {};
35224
35284
  bundles.forEach((b, idx) => {
35225
- const p = Number(b?.priority) || 1;
35285
+ const p = Number(b?.priority) || idx + 1;
35226
35286
  if (!groups[p]) groups[p] = [];
35227
- groups[p].push({ bundle: b, index: idx });
35287
+ groups[p].push({
35288
+ bundle: {
35289
+ ...b,
35290
+ keywords: parseKeywords(b?.keywords),
35291
+ priority: p
35292
+ },
35293
+ index: idx
35294
+ });
35228
35295
  });
35229
35296
  const sortedPriorities = Object.keys(groups).map((n) => parseInt(n)).sort((a, b) => a - b);
35230
35297
  return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)("div", { className: "space-y-6 pt-2", children: sortedPriorities.map((priority) => /* @__PURE__ */ (0, import_jsx_runtime106.jsxs)("div", { className: "space-y-3", children: [
35231
35298
  /* @__PURE__ */ (0, import_jsx_runtime106.jsxs)("div", { className: "flex items-center gap-2", children: [
35232
- /* @__PURE__ */ (0, import_jsx_runtime106.jsxs)(Badge2, { className: "bg-purple500 hover:bg-purple500 py-1", children: [
35299
+ /* @__PURE__ */ (0, import_jsx_runtime106.jsxs)("div", { className: "inline-block px-3 py-1 bg-purple200 hover:bg-purple200 text-purpleText text-sm font-medium rounded-md uppercase", children: [
35233
35300
  "Priority ",
35234
35301
  priority
35235
35302
  ] }),
35236
- /* @__PURE__ */ (0, import_jsx_runtime106.jsx)("div", { className: "h-px flex-1 bg-gray-100" })
35303
+ /* @__PURE__ */ (0, import_jsx_runtime106.jsx)("div", { className: "h-px flex-1 bg-white/10" })
35237
35304
  ] }),
35238
35305
  groups[priority].map(({ bundle, index: bundleIndex }) => /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(
35239
35306
  "div",
@@ -35243,14 +35310,15 @@ var KeywordBundlesEdit = ({
35243
35310
  /* @__PURE__ */ (0, import_jsx_runtime106.jsx)("label", { className: "text-[10px] font-bold text-gray-400 uppercase tracking-widest pl-1", children: "Keywords" }),
35244
35311
  /* @__PURE__ */ (0, import_jsx_runtime106.jsxs)("div", { className: "space-y-3", children: [
35245
35312
  /* @__PURE__ */ (0, import_jsx_runtime106.jsx)("div", { className: "flex flex-wrap gap-1.5", children: Array.isArray(bundle.keywords) && bundle.keywords.map((keyword, kIndex) => /* @__PURE__ */ (0, import_jsx_runtime106.jsxs)(
35246
- Badge2,
35313
+ "div",
35247
35314
  {
35248
- className: "bg-white py-1 border-gray-200 text-gray-700 hover:bg-red-50 hover:text-red-600 hover:border-red-100 transition-all cursor-pointer group",
35315
+ className: "flex items-center gap-2 px-3 py-1 bg-grayPill border border-white rounded-md text-white text-sm font-medium hover:bg-red-900/40 hover:border-red-500 transition-all cursor-pointer group",
35249
35316
  onClick: () => {
35250
35317
  const updatedBundles = [...bundles];
35318
+ const currentKeywords = parseKeywords(updatedBundles[bundleIndex].keywords);
35251
35319
  updatedBundles[bundleIndex] = {
35252
- ...bundle,
35253
- keywords: bundle.keywords.filter(
35320
+ ...updatedBundles[bundleIndex],
35321
+ keywords: currentKeywords.filter(
35254
35322
  (_, i) => i !== kIndex
35255
35323
  )
35256
35324
  };
@@ -35258,7 +35326,7 @@ var KeywordBundlesEdit = ({
35258
35326
  },
35259
35327
  children: [
35260
35328
  keyword,
35261
- /* @__PURE__ */ (0, import_jsx_runtime106.jsx)("span", { className: "ml-1 opacity-0 group-hover:opacity-100 transition-opacity", children: "\xD7" })
35329
+ /* @__PURE__ */ (0, import_jsx_runtime106.jsx)("span", { className: "ml-1 opacity-60 group-hover:opacity-100 transition-opacity", children: "\xD7" })
35262
35330
  ]
35263
35331
  },
35264
35332
  kIndex
@@ -35268,7 +35336,7 @@ var KeywordBundlesEdit = ({
35268
35336
  {
35269
35337
  type: "text",
35270
35338
  placeholder: "Add keyword...",
35271
- className: "flex-1 px-3 py-1.5 text-sm border border-gray-200 rounded-md bg-white focus:outline-none focus:ring-2 focus:ring-purple-500/20 focus:border-purple-500",
35339
+ className: "flex-1 px-3 py-1.5 text-sm border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-purple-500/20 focus:border-purple500",
35272
35340
  onKeyPress: (e) => {
35273
35341
  if (e.key === "Enter") {
35274
35342
  const input = e.target;
@@ -35304,7 +35372,7 @@ var KeywordBundlesEdit = ({
35304
35372
  };
35305
35373
  onChange(updatedBundles);
35306
35374
  },
35307
- className: "w-20 px-3 py-1.5 text-sm border border-gray-200 rounded-md bg-white focus:ring-2 focus:ring-purple-500/20 focus:border-purple-500 outline-none"
35375
+ className: "w-20 px-3 py-1.5 text-sm border border-border rounded-md bg-background text-foreground focus:ring-2 focus:ring-purple-500/20 focus:border-purple-500 outline-none"
35308
35376
  }
35309
35377
  )
35310
35378
  ] })
@@ -35319,27 +35387,31 @@ var KeywordBundlesDisplay = ({ value }) => {
35319
35387
  if (bundles.length === 0)
35320
35388
  return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)("span", { className: "text-gray-500 italic text-sm", children: "Not specified" });
35321
35389
  const groups = {};
35322
- bundles.forEach((b) => {
35323
- const p = Number(b?.priority) || 1;
35324
- const keywords = Array.isArray(b?.keywords) ? b.keywords : [];
35390
+ bundles.forEach((b, idx) => {
35391
+ const p = Number(b?.priority) || idx + 1;
35392
+ let keywords = b?.keywords || [];
35393
+ if (typeof keywords === "string") {
35394
+ keywords = keywords.split(",").map((s) => s.trim()).filter(Boolean);
35395
+ }
35396
+ if (!Array.isArray(keywords)) keywords = [];
35325
35397
  if (!groups[p]) groups[p] = [];
35326
35398
  groups[p].push(...keywords);
35327
35399
  });
35328
35400
  const sortedPriorities = Object.keys(groups).map((n) => parseInt(n)).sort((a, b) => a - b);
35329
35401
  return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)("div", { className: "space-y-4 pt-2", children: sortedPriorities.map((priority) => {
35330
35402
  const deduped = Array.from(new Set(groups[priority]));
35331
- return /* @__PURE__ */ (0, import_jsx_runtime106.jsxs)("div", { className: "space-y-2", children: [
35403
+ return /* @__PURE__ */ (0, import_jsx_runtime106.jsxs)("div", { className: "space-y-3", children: [
35332
35404
  /* @__PURE__ */ (0, import_jsx_runtime106.jsxs)("div", { className: "flex items-center gap-2", children: [
35333
- /* @__PURE__ */ (0, import_jsx_runtime106.jsxs)("span", { className: "text-[10px] uppercase tracking-widest text-purple-400 font-bold", children: [
35405
+ /* @__PURE__ */ (0, import_jsx_runtime106.jsxs)("div", { className: "inline-block px-3 py-1 bg-purple200 hover:bg-purple200 text-purpleText text-sm font-medium rounded-md uppercase", children: [
35334
35406
  "Priority ",
35335
35407
  priority
35336
35408
  ] }),
35337
- /* @__PURE__ */ (0, import_jsx_runtime106.jsx)("div", { className: "h-[1px] flex-1 bg-white/10" })
35409
+ /* @__PURE__ */ (0, import_jsx_runtime106.jsx)("div", { className: "h-px flex-1 bg-white/10" })
35338
35410
  ] }),
35339
- /* @__PURE__ */ (0, import_jsx_runtime106.jsx)("div", { className: "flex flex-wrap gap-2", children: deduped.map((keyword) => /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(
35411
+ /* @__PURE__ */ (0, import_jsx_runtime106.jsx)("div", { className: "flex flex-wrap gap-2 pt-1", children: deduped.map((keyword) => /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(
35340
35412
  "div",
35341
35413
  {
35342
- className: "px-2 py-1 rounded bg-background border text-gray-300 text-sm font-medium py-1",
35414
+ className: "flex items-center gap-2 px-3 py-1 bg-grayPill border border-white rounded-md text-white text-sm font-medium",
35343
35415
  children: keyword
35344
35416
  },
35345
35417
  keyword
@@ -35347,6 +35419,60 @@ var KeywordBundlesDisplay = ({ value }) => {
35347
35419
  ] }, priority);
35348
35420
  }) });
35349
35421
  };
35422
+ var DEFAULT_PLATFORMS = ["Instagram", "YouTube", "TikTok"];
35423
+ var PlatformSelectEdit = ({
35424
+ value,
35425
+ onChange,
35426
+ config = {}
35427
+ }) => {
35428
+ const selectedPlatforms = Array.isArray(value) ? value : [];
35429
+ const options = (0, import_react59.useMemo)(() => {
35430
+ const providedOptions = config.options || DEFAULT_PLATFORMS;
35431
+ const combined = Array.from(/* @__PURE__ */ new Set([...providedOptions, ...selectedPlatforms]));
35432
+ return combined;
35433
+ }, [config.options, selectedPlatforms]);
35434
+ const togglePlatform = (platform) => {
35435
+ if (selectedPlatforms.includes(platform)) {
35436
+ onChange(selectedPlatforms.filter((p) => p !== platform));
35437
+ } else {
35438
+ onChange([...selectedPlatforms, platform]);
35439
+ }
35440
+ };
35441
+ return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)("div", { className: "flex flex-wrap gap-4 py-2", children: options.map((platform) => /* @__PURE__ */ (0, import_jsx_runtime106.jsxs)(
35442
+ "label",
35443
+ {
35444
+ className: "flex items-center gap-2 cursor-pointer group",
35445
+ children: [
35446
+ /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(
35447
+ "div",
35448
+ {
35449
+ className: cn(
35450
+ "w-5 h-5 rounded flex items-center justify-center border-2 transition-all",
35451
+ selectedPlatforms.includes(platform) ? "bg-purple-600 border-purple-600" : "border-gray-300 group-hover:border-purple-400"
35452
+ ),
35453
+ onClick: () => togglePlatform(platform),
35454
+ children: selectedPlatforms.includes(platform) && /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(Check, { className: "h-3.5 w-3.5 text-white stroke-[3]" })
35455
+ }
35456
+ ),
35457
+ /* @__PURE__ */ (0, import_jsx_runtime106.jsx)("span", { className: "text-sm font-medium text-foreground select-none", children: platform })
35458
+ ]
35459
+ },
35460
+ platform
35461
+ )) });
35462
+ };
35463
+ var PlatformSelectDisplay = ({ value }) => {
35464
+ if (!value || !Array.isArray(value) || value.length === 0) {
35465
+ return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)("span", { className: "text-muted-foreground italic text-sm", children: "Not specified" });
35466
+ }
35467
+ return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)("div", { className: "flex flex-wrap gap-2 pt-1", children: value.map((platform) => /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(
35468
+ "div",
35469
+ {
35470
+ className: "flex items-center gap-2 px-3 py-1 bg-grayPill border border-foreground rounded-md text-foreground text-sm font-grotesk font-medium",
35471
+ children: platform
35472
+ },
35473
+ platform
35474
+ )) });
35475
+ };
35350
35476
 
35351
35477
  // src/molecules/creator-discovery/CampaignSeedCard/CampaignSeedCard.tsx
35352
35478
  var import_jsx_runtime107 = require("react/jsx-runtime");
@@ -35363,7 +35489,14 @@ var ObjectDisplay = ({ value }) => {
35363
35489
  var StringArrayDisplay = ({ value }) => {
35364
35490
  if (!Array.isArray(value) || value.length === 0)
35365
35491
  return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("span", { className: "text-muted-foreground italic text-sm", children: "Not specified" });
35366
- return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("div", { className: "flex flex-wrap gap-1.5 pt-1", children: value.map((item) => /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(Badge2, { variant: "outline", className: "text-sm border-gray-200 py-1", children: item }, item)) });
35492
+ return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("div", { className: "flex flex-wrap gap-2 pt-1", children: value.map((item) => /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
35493
+ "div",
35494
+ {
35495
+ className: "flex items-center gap-2 px-3 py-1 bg-grayPill border border-foreground rounded-md text-foreground text-sm font-grotesk font-medium",
35496
+ children: item
35497
+ },
35498
+ item
35499
+ )) });
35367
35500
  };
35368
35501
  function buildCampaignSeedFields(data) {
35369
35502
  if (!data || typeof data !== "object") return [];
@@ -35397,7 +35530,7 @@ function buildCampaignSeedFields(data) {
35397
35530
  onChange(bundles);
35398
35531
  },
35399
35532
  placeholder: "Keyword 1, Keyword 2 (Priority: 1)...",
35400
- className: "min-h-[120px] bg-background border-gray-300"
35533
+ className: "min-h-[120px] bg-background text-foreground border-gray-300"
35401
35534
  }
35402
35535
  )
35403
35536
  };
@@ -35408,49 +35541,23 @@ function buildCampaignSeedFields(data) {
35408
35541
  label: "Geography",
35409
35542
  type: "custom",
35410
35543
  renderDisplay: (v) => /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(CountrySelectDisplay, { value: v }),
35411
- renderEdit: (v, onChange) => /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
35412
- Textarea,
35413
- {
35414
- value: Array.isArray(v) ? v.join(", ") : String(v || ""),
35415
- onChange: (e) => {
35416
- const items = e.target.value.split(",").map((s) => s.trim().toUpperCase()).filter(Boolean);
35417
- onChange(items);
35418
- },
35419
- placeholder: "Enter country codes (US, GB, PK) separated by commas...",
35420
- className: "min-h-[80px] bg-background border-gray-300"
35421
- }
35422
- )
35544
+ renderEdit: (v, onChange) => /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(CountrySelectEdit, { value: v, onChange })
35423
35545
  };
35424
35546
  }
35425
- if (key === "platforms" && Array.isArray(value)) {
35547
+ if (key === "platforms" || key === "target_platforms" || key === "targetPlatforms") {
35426
35548
  return {
35427
35549
  key,
35428
35550
  label: "Platforms",
35429
35551
  type: "custom",
35430
- renderDisplay: (v) => {
35431
- const platforms = Array.isArray(v) ? v : [v];
35432
- return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("div", { className: "flex flex-wrap gap-2", children: platforms.map((p) => /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
35433
- BadgeAtom,
35434
- {
35435
- id: `platform-${p}`,
35436
- type: "badge",
35437
- label: p,
35438
- variant: "outline",
35439
- className: "bg-background bg-purple200 border-gray400 text-white font-medium"
35440
- },
35441
- p
35442
- )) });
35443
- },
35552
+ renderDisplay: (v) => /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(PlatformSelectDisplay, { value: v }),
35444
35553
  renderEdit: (v, onChange) => /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
35445
- Textarea,
35554
+ PlatformSelectEdit,
35446
35555
  {
35447
- value: Array.isArray(v) ? v.join(", ") : String(v || ""),
35448
- onChange: (e) => {
35449
- const items = e.target.value.split(",").map((s) => s.trim()).filter(Boolean);
35450
- onChange(items);
35451
- },
35452
- placeholder: "Enter platforms separated by commas...",
35453
- className: "min-h-[80px] bg-background border-gray-300"
35556
+ value: v,
35557
+ onChange,
35558
+ config: {
35559
+ options: data.platform_options || data.available_platforms || data.platforms_list || []
35560
+ }
35454
35561
  }
35455
35562
  )
35456
35563
  };
@@ -35472,9 +35579,9 @@ function buildCampaignSeedFields(data) {
35472
35579
  type: "custom",
35473
35580
  renderDisplay: (v) => {
35474
35581
  if (typeof v === "object" && v !== null) {
35475
- return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("span", { className: "text-white font-medium", children: `${v.min?.toLocaleString()} - ${v.max?.toLocaleString()}` });
35582
+ return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("span", { className: "text-foreground font-medium", children: `${v.min?.toLocaleString()} - ${v.max?.toLocaleString()}` });
35476
35583
  }
35477
- return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("span", { className: "text-white font-medium", children: v });
35584
+ return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("span", { className: "text-foreground font-medium", children: v });
35478
35585
  }
35479
35586
  };
35480
35587
  }
@@ -35501,7 +35608,7 @@ function buildCampaignSeedFields(data) {
35501
35608
  onChange(newObj);
35502
35609
  },
35503
35610
  placeholder: "Enter key: value pairs (one per line)...",
35504
- className: "min-h-[120px] bg-background border-gray-300 font-mono text-xs"
35611
+ className: "min-h-[120px] bg-background text-foreground border-gray-300 font-mono text-xs"
35505
35612
  }
35506
35613
  )
35507
35614
  };
@@ -35570,7 +35677,14 @@ var ObjectDisplay2 = ({ value }) => {
35570
35677
  var StringArrayDisplay2 = ({ value }) => {
35571
35678
  if (!Array.isArray(value) || value.length === 0)
35572
35679
  return /* @__PURE__ */ (0, import_jsx_runtime108.jsx)("span", { className: "text-muted-foreground italic text-sm", children: "Not specified" });
35573
- return /* @__PURE__ */ (0, import_jsx_runtime108.jsx)("div", { className: "flex flex-wrap gap-1.5 pt-1", children: value.map((item) => /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(Badge2, { variant: "outline", className: "text-sm border-gray-200 py-1", children: item }, item)) });
35680
+ return /* @__PURE__ */ (0, import_jsx_runtime108.jsx)("div", { className: "flex flex-wrap gap-2 pt-1", children: value.map((item) => /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
35681
+ "div",
35682
+ {
35683
+ className: "flex items-center gap-2 px-3 py-1 bg-grayPill border border-foreground rounded-md text-foreground text-sm font-grotesk font-medium",
35684
+ children: item
35685
+ },
35686
+ item
35687
+ )) });
35574
35688
  };
35575
35689
  function buildSearchSpecFields(data) {
35576
35690
  if (!data || typeof data !== "object") return [];
@@ -35594,11 +35708,29 @@ function buildSearchSpecFields(data) {
35594
35708
  renderEdit: (v, onChange) => /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(CountrySelectEdit, { value: v, onChange })
35595
35709
  };
35596
35710
  }
35597
- if ((key === "platforms" || key === "exclude_keywords" || key === "excludeKeywords") && Array.isArray(value)) {
35598
- const label = key === "platforms" ? "Platforms" : "Exclude Keywords";
35711
+ if (key === "platforms" && Array.isArray(value)) {
35599
35712
  return {
35600
35713
  key,
35601
- label,
35714
+ label: "Platforms",
35715
+ type: "custom",
35716
+ config: {
35717
+ options: data.platform_options || data.available_platforms || data.platforms_list || []
35718
+ },
35719
+ renderDisplay: (v) => /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(PlatformSelectDisplay, { value: v }),
35720
+ renderEdit: (v, onChange) => /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
35721
+ PlatformSelectEdit,
35722
+ {
35723
+ value: v,
35724
+ onChange,
35725
+ config: { options: data.platform_options || data.available_platforms || data.platforms_list || [] }
35726
+ }
35727
+ )
35728
+ };
35729
+ }
35730
+ if ((key === "exclude_keywords" || key === "excludeKeywords") && Array.isArray(value)) {
35731
+ return {
35732
+ key,
35733
+ label: "Exclude Keywords",
35602
35734
  type: "custom",
35603
35735
  renderDisplay: (v) => /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(StringArrayDisplay2, { value: v }),
35604
35736
  renderEdit: (v, onChange) => /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
@@ -35609,8 +35741,8 @@ function buildSearchSpecFields(data) {
35609
35741
  const items = e.target.value.split(",").map((s) => s.trim()).filter(Boolean);
35610
35742
  onChange(items);
35611
35743
  },
35612
- placeholder: `Enter ${label.toLowerCase()} separated by commas...`,
35613
- className: "min-h-[100px] bg-background border-gray-300"
35744
+ placeholder: "Enter exclude keywords separated by commas...",
35745
+ className: "min-h-[100px] bg-background text-foreground border-gray-300"
35614
35746
  }
35615
35747
  )
35616
35748
  };
@@ -35638,7 +35770,7 @@ function buildSearchSpecFields(data) {
35638
35770
  onChange(newObj);
35639
35771
  },
35640
35772
  placeholder: "Enter key: value pairs (one per line)...",
35641
- className: "min-h-[120px] bg-background border-gray-300 font-mono text-xs"
35773
+ className: "min-h-[120px] bg-background text-foreground border-gray-300 font-mono text-xs"
35642
35774
  }
35643
35775
  )
35644
35776
  };
@@ -36397,6 +36529,7 @@ var import_framer_motion = require("framer-motion");
36397
36529
  var import_jsx_runtime121 = require("react/jsx-runtime");
36398
36530
  var CampaignConceptCard = import_react64.default.memo(
36399
36531
  ({
36532
+ index,
36400
36533
  isRecommended,
36401
36534
  isOpen: controlledIsOpen,
36402
36535
  onToggle,
@@ -36411,7 +36544,6 @@ var CampaignConceptCard = import_react64.default.memo(
36411
36544
  ...formCardProps
36412
36545
  }) => {
36413
36546
  const [internalIsOpen, setInternalIsOpen] = (0, import_react64.useState)(false);
36414
- const [copied, setCopied] = (0, import_react64.useState)(false);
36415
36547
  const isOpen = controlledIsOpen !== void 0 ? controlledIsOpen : internalIsOpen;
36416
36548
  const handleToggle = () => {
36417
36549
  if (onToggle) {
@@ -36422,35 +36554,6 @@ var CampaignConceptCard = import_react64.default.memo(
36422
36554
  };
36423
36555
  const cardTitle = propsTitle || data.title || data.name || data.concept_name || data.conceptName || "Campaign Concept";
36424
36556
  const isSelected = selectionStatus != null;
36425
- const flattenValue = (val) => {
36426
- if (val === null || val === void 0) return "-";
36427
- if (Array.isArray(val)) {
36428
- return val.map((item) => {
36429
- if (typeof item === "object" && item !== null) {
36430
- return item.label || item.value || item.name || JSON.stringify(item);
36431
- }
36432
- return String(item);
36433
- }).join(", ");
36434
- }
36435
- if (typeof val === "object") {
36436
- return Object.entries(val).map(([k, v]) => `${k.replace(/_/g, " ")}: ${v}`).join(", ");
36437
- }
36438
- return String(val);
36439
- };
36440
- const handleCopyAll = (e) => {
36441
- e.preventDefault();
36442
- e.stopPropagation();
36443
- const allFields = providedFields || generateFieldsFromData(data);
36444
- const lines = [
36445
- typeof cardTitle === "string" ? cardTitle : JSON.stringify(cardTitle),
36446
- "",
36447
- ...allFields.map((f) => `${f.label}: ${flattenValue(data[f.key])}`)
36448
- ];
36449
- navigator.clipboard.writeText(lines.join("\n")).then(() => {
36450
- setCopied(true);
36451
- setTimeout(() => setCopied(false), 2e3);
36452
- });
36453
- };
36454
36557
  const handleProceed = () => {
36455
36558
  onAction?.({
36456
36559
  type: "concept_selection",
@@ -36468,6 +36571,7 @@ var CampaignConceptCard = import_react64.default.memo(
36468
36571
  "secondary_kpis",
36469
36572
  "budget_allocation",
36470
36573
  "budgetAllocation",
36574
+ "geography",
36471
36575
  "estimated_creators",
36472
36576
  "estimatedCreators",
36473
36577
  "platforms",
@@ -36504,9 +36608,9 @@ var CampaignConceptCard = import_react64.default.memo(
36504
36608
  idx + 1,
36505
36609
  "."
36506
36610
  ] }),
36507
- /* @__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) }),
36611
+ /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "inline-flex items-center bg-grayPill border border-foreground px-2 py-1 text-foreground text-sm font-grotesk font-medium rounded-md", children: String(label) }),
36508
36612
  /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "text-foreground", children: "=" }),
36509
- /* @__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) })
36613
+ /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "inline-flex items-center bg-grayPill border border-foreground px-2 py-1 text-foreground text-sm rounded-md font-grotesk font-medium", children: formatVal(value) })
36510
36614
  ] }, idx);
36511
36615
  }) });
36512
36616
  }
@@ -36518,9 +36622,9 @@ var CampaignConceptCard = import_react64.default.memo(
36518
36622
  idx + 1,
36519
36623
  "."
36520
36624
  ] }),
36521
- /* @__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) }),
36625
+ /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "inline-flex items-center bg-grayPill border border-foreground px-2 py-1 text-foreground text-sm font-grotesk font-medium rounded-md", children: formatKey(k) }),
36522
36626
  /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "text-foreground", children: "=" }),
36523
- /* @__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) })
36627
+ /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "inline-flex items-center bg-grayPill border border-foreground px-2 py-1 text-foreground text-sm rounded-md font-grotesk font-medium", children: formatVal(v) })
36524
36628
  ] }, k)) });
36525
36629
  }
36526
36630
  return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "text-muted-foreground text-sm", children: String(val) });
@@ -36541,41 +36645,27 @@ var CampaignConceptCard = import_react64.default.memo(
36541
36645
  onChange(newObj);
36542
36646
  },
36543
36647
  placeholder: "Tier name: percentage (one per line)...",
36544
- className: "min-h-[120px] bg-background border-gray-300 font-mono text-xs"
36648
+ className: "min-h-[120px] bg-background text-foreground border-gray-300 font-mono text-xs"
36545
36649
  }
36546
36650
  )
36547
36651
  };
36548
36652
  }
36653
+ if (field.key === "geography") {
36654
+ return {
36655
+ ...field,
36656
+ label: "Geography",
36657
+ renderDisplay: (v) => /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(CountrySelectDisplay, { value: v }),
36658
+ renderEdit: (v, onChange) => /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(CountrySelectEdit, { value: v, onChange })
36659
+ };
36660
+ }
36549
36661
  if (field.key === "estimatedCreators" || field.key === "estimated_creators") {
36550
36662
  return {
36551
36663
  ...field,
36552
36664
  label: "Estimated Creators",
36553
36665
  renderDisplay: (val) => {
36554
36666
  if (!val) return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "text-muted-foreground text-sm", children: "-" });
36555
- if (typeof val === "object" && !Array.isArray(val)) {
36556
- return /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("div", { className: "flex items-center gap-2", children: [
36557
- /* @__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 }),
36558
- /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "text-foreground", children: "-" }),
36559
- /* @__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 })
36560
- ] });
36561
- }
36562
- if (typeof val === "string" && val.includes("-")) {
36563
- 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: [
36564
- /* @__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() }),
36565
- idx < arr.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "text-foreground", children: "-" })
36566
- ] }, idx)) });
36567
- }
36568
- if (Array.isArray(val)) {
36569
- 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)(
36570
- "span",
36571
- {
36572
- 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",
36573
- children: String(v)
36574
- },
36575
- idx
36576
- )) });
36577
- }
36578
- return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "text-txtColor font-medium", children: String(val) });
36667
+ const displayValue = typeof val === "object" && !Array.isArray(val) ? `${val.min ?? 0}-${val.max ?? 0}` : String(val);
36668
+ return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "text-foreground text-sm", children: displayValue });
36579
36669
  },
36580
36670
  renderEdit: (v, onChange) => /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
36581
36671
  Input,
@@ -36591,7 +36681,7 @@ var CampaignConceptCard = import_react64.default.memo(
36591
36681
  }
36592
36682
  },
36593
36683
  placeholder: "Min-Max (e.g. 10-30)...",
36594
- className: "bg-background border-gray-300"
36684
+ className: "bg-background text-foreground border-gray-300"
36595
36685
  }
36596
36686
  )
36597
36687
  };
@@ -36607,7 +36697,7 @@ var CampaignConceptCard = import_react64.default.memo(
36607
36697
  value: String(v || ""),
36608
36698
  onChange: (e) => onChange(e.target.value),
36609
36699
  placeholder: "Enter primary KPI...",
36610
- className: "bg-background border-gray-300"
36700
+ className: "bg-background text-foreground border-gray-300"
36611
36701
  }
36612
36702
  )
36613
36703
  };
@@ -36629,7 +36719,7 @@ var CampaignConceptCard = import_react64.default.memo(
36629
36719
  onChange(items);
36630
36720
  },
36631
36721
  placeholder: "Enter KPIs separated by commas...",
36632
- className: "min-h-[80px] bg-background border-gray-300"
36722
+ className: "min-h-[80px] bg-background text-foreground border-gray-300"
36633
36723
  }
36634
36724
  )
36635
36725
  };
@@ -36637,43 +36727,37 @@ var CampaignConceptCard = import_react64.default.memo(
36637
36727
  if (field.key === "platforms" || field.key === "target_platforms" || field.key === "targetPlatforms") {
36638
36728
  return {
36639
36729
  ...field,
36640
- renderDisplay: (val) => {
36641
- const platforms = Array.isArray(val) ? val.map(String) : typeof val === "string" ? val.split(/,\s*/).map((s) => s.trim()).filter(Boolean) : val ? [String(val)] : [];
36642
- if (platforms.length === 0) return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "text-muted-foreground text-sm", children: "-" });
36643
- 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)(
36644
- "span",
36645
- {
36646
- 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",
36647
- children: p
36648
- },
36649
- p
36650
- )) });
36651
- },
36730
+ renderDisplay: (v) => /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(PlatformSelectDisplay, { value: v }),
36652
36731
  renderEdit: (v, onChange) => /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
36653
- Textarea,
36732
+ PlatformSelectEdit,
36654
36733
  {
36655
- value: Array.isArray(v) ? v.join(", ") : String(v || ""),
36656
- onChange: (e) => {
36657
- const items = e.target.value.split(",").map((s) => s.trim()).filter(Boolean);
36658
- onChange(items);
36659
- },
36660
- placeholder: "Enter platforms separated by commas...",
36661
- className: "min-h-[80px] bg-background border-gray-300"
36734
+ value: v,
36735
+ onChange,
36736
+ config: {
36737
+ options: data.platform_options || data.available_platforms || data.platforms_list || []
36738
+ }
36662
36739
  }
36663
36740
  )
36664
36741
  };
36665
36742
  }
36743
+ if (field.key === "description" || field.key === "creator_strategy" || field.key === "creatorStrategy") {
36744
+ return {
36745
+ ...field,
36746
+ type: "textarea",
36747
+ renderDisplay: (val) => /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "text-foreground text-sm leading-relaxed", children: val ? String(val) : "-" })
36748
+ };
36749
+ }
36666
36750
  return {
36667
36751
  ...field,
36668
36752
  renderDisplay: (val) => {
36669
36753
  if (Array.isArray(val)) {
36670
36754
  if (val.length === 0) return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "text-muted-foreground text-sm", children: "-" });
36671
- return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("div", { className: "flex flex-wrap gap-1.5 pt-1", children: val.map((item, idx) => {
36755
+ return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("div", { className: "flex flex-wrap gap-2 pt-1", children: val.map((item, idx) => {
36672
36756
  const label = typeof item === "object" && item !== null ? item.label || item.value || item.name || JSON.stringify(item) : String(item);
36673
36757
  return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
36674
36758
  "span",
36675
36759
  {
36676
- className: "inline-block bg-paperBackground border border-gray400 text-txtColor text-xs px-2 py-0.5 rounded-full",
36760
+ className: "inline-flex items-center bg-grayPill border border-foreground px-3 py-1 text-foreground text-sm font-grotesk font-medium rounded-md",
36677
36761
  children: label
36678
36762
  },
36679
36763
  idx
@@ -36683,7 +36767,7 @@ var CampaignConceptCard = import_react64.default.memo(
36683
36767
  if (typeof val === "object" && val !== null) {
36684
36768
  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") });
36685
36769
  }
36686
- return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "text-txtColor text-sm", children: val !== void 0 && val !== null ? String(val) : "-" });
36770
+ return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "text-foreground text-sm", children: val !== void 0 && val !== null ? String(val) : "-" });
36687
36771
  }
36688
36772
  };
36689
36773
  });
@@ -36704,43 +36788,36 @@ var CampaignConceptCard = import_react64.default.memo(
36704
36788
  onClick: handleToggle,
36705
36789
  children: [
36706
36790
  /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("div", { className: "flex-1", children: [
36707
- /* @__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) }),
36791
+ /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("h3", { className: "mb-1 py-1 text-txtColor font-bold text-lg", children: [
36792
+ "Concept ",
36793
+ index !== void 0 ? index : "",
36794
+ " : ",
36795
+ typeof cardTitle === "object" ? JSON.stringify(cardTitle) : String(cardTitle)
36796
+ ] }),
36708
36797
  /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("div", { className: "flex flex-wrap gap-2", children: [
36709
- isRecommended && /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("div", { className: "inline-flex text-[10px] font-bold uppercase tracking-widest", children: /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "bg-green-600 text-white px-2 py-0.5 rounded border border-green-700", children: "Recommended" }) }),
36798
+ isRecommended && /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("div", { className: "inline-flex text-[10px] font-bold uppercase tracking-widest", children: /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "bg-green-600/20 text-green-600 px-2 py-1 rounded-[20px]", children: "Recommended" }) }),
36710
36799
  !effectiveIsLatest && selectionStatus && /* @__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" }) })
36711
36800
  ] })
36712
36801
  ] }),
36713
- /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("div", { className: "flex items-center gap-2 ml-3", onClick: (e) => e.stopPropagation(), children: [
36714
- /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
36715
- "button",
36716
- {
36717
- onClick: handleCopyAll,
36718
- title: "Copy all details",
36719
- className: "p-2 bg-background hover:bg-gray200 dark:hover:bg-gray200 text-foreground rounded-lg shadow-lg transition-all active:scale-95",
36720
- "aria-label": "Copy all details",
36721
- 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" })
36722
- }
36723
- ),
36724
- /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
36725
- "button",
36726
- {
36727
- onClick: (e) => {
36728
- e.preventDefault();
36729
- e.stopPropagation();
36730
- handleToggle();
36731
- },
36732
- className: "p-2 bg-background hover:bg-gray200 dark:hover:bg-gray200 text-foreground rounded-lg shadow-lg",
36733
- "aria-label": isOpen ? "Collapse" : "Expand",
36734
- title: isOpen ? "Collapse" : "Expand",
36735
- children: /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
36736
- ChevronDown,
36737
- {
36738
- className: `h-4 w-4 transition-transform ${isOpen ? "rotate-0" : "-rotate-90"}`
36739
- }
36740
- )
36741
- }
36742
- )
36743
- ] })
36802
+ /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("div", { className: "flex items-center gap-2 ml-3", onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
36803
+ "button",
36804
+ {
36805
+ onClick: (e) => {
36806
+ e.preventDefault();
36807
+ e.stopPropagation();
36808
+ handleToggle();
36809
+ },
36810
+ className: "p-2 bg-background hover:bg-gray200 dark:hover:bg-gray200 text-foreground rounded-lg shadow-lg",
36811
+ "aria-label": isOpen ? "Collapse" : "Expand",
36812
+ title: isOpen ? "Collapse" : "Expand",
36813
+ children: /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
36814
+ ChevronDown,
36815
+ {
36816
+ className: `h-4 w-4 transition-transform ${isOpen ? "rotate-0" : "-rotate-90"}`
36817
+ }
36818
+ )
36819
+ }
36820
+ ) })
36744
36821
  ]
36745
36822
  }
36746
36823
  ),
@@ -38679,7 +38756,7 @@ var PXEngineRenderer = ({
38679
38756
  if (id && !finalProps.id) {
38680
38757
  finalProps.id = id;
38681
38758
  }
38682
- const uniqueKey = id || `${componentName}-${index || Math.random().toString(36).substr(2, 9)}`;
38759
+ const uniqueKey = id || (index !== void 0 ? `${componentName}-${index}` : `${componentName}-root`);
38683
38760
  const normalizedName = componentName.charAt(0).toUpperCase() + componentName.slice(1);
38684
38761
  const resolveComponent = (identifier) => {
38685
38762
  const normalized = identifier.split(/[-_]/).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join("");
@@ -38946,6 +39023,8 @@ var PXEngineRenderer = ({
38946
39023
  PaginationNext,
38947
39024
  PaginationPrevious,
38948
39025
  PlatformIconGroup,
39026
+ PlatformSelectDisplay,
39027
+ PlatformSelectEdit,
38949
39028
  Popover,
38950
39029
  PopoverAtom,
38951
39030
  PopoverContent,