pxengine 0.1.31 → 0.1.33

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,75 @@ 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
+ }) => {
35427
+ const selectedPlatforms = (0, import_react59.useMemo)(() => {
35428
+ if (Array.isArray(value)) return value;
35429
+ if (typeof value === "string" && value.trim() !== "") {
35430
+ return value.split(",").map((s) => s.trim()).filter(Boolean);
35431
+ }
35432
+ return [];
35433
+ }, [value]);
35434
+ const isSelected = (p) => selectedPlatforms.some((s) => s.toLowerCase() === p.toLowerCase());
35435
+ const togglePlatform = (platform) => {
35436
+ if (isSelected(platform)) {
35437
+ onChange(
35438
+ selectedPlatforms.filter(
35439
+ (p) => p.toLowerCase() !== platform.toLowerCase()
35440
+ )
35441
+ );
35442
+ } else {
35443
+ onChange([...selectedPlatforms, platform]);
35444
+ }
35445
+ };
35446
+ const options = (0, import_react59.useMemo)(() => {
35447
+ return DEFAULT_PLATFORMS;
35448
+ }, []);
35449
+ 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)(
35450
+ "label",
35451
+ {
35452
+ className: "flex items-center gap-2 cursor-pointer group",
35453
+ children: [
35454
+ /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(
35455
+ "div",
35456
+ {
35457
+ className: cn(
35458
+ "w-5 h-5 rounded flex items-center justify-center border-2 transition-all",
35459
+ isSelected(platform) ? "bg-purple-600 border-purple-600" : "border-gray-300 group-hover:border-purple-400"
35460
+ ),
35461
+ onClick: () => togglePlatform(platform),
35462
+ children: isSelected(platform) && /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(Check, { className: "h-3.5 w-3.5 text-white stroke-[3]" })
35463
+ }
35464
+ ),
35465
+ /* @__PURE__ */ (0, import_jsx_runtime106.jsx)("span", { className: "text-sm font-medium text-foreground select-none", children: platform })
35466
+ ]
35467
+ },
35468
+ platform
35469
+ )) });
35470
+ };
35471
+ var PlatformSelectDisplay = ({ value }) => {
35472
+ const displayValues = (0, import_react59.useMemo)(() => {
35473
+ if (Array.isArray(value)) return value;
35474
+ if (typeof value === "string" && value.trim() !== "") {
35475
+ return value.split(",").map((s) => s.trim()).filter(Boolean);
35476
+ }
35477
+ return [];
35478
+ }, [value]);
35479
+ if (displayValues.length === 0) {
35480
+ return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)("span", { className: "text-muted-foreground italic text-sm", children: "Not specified" });
35481
+ }
35482
+ return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)("div", { className: "flex flex-wrap gap-2 pt-1", children: displayValues.map((platform) => /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(
35483
+ "div",
35484
+ {
35485
+ 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",
35486
+ children: platform
35487
+ },
35488
+ platform
35489
+ )) });
35490
+ };
35350
35491
 
35351
35492
  // src/molecules/creator-discovery/CampaignSeedCard/CampaignSeedCard.tsx
35352
35493
  var import_jsx_runtime107 = require("react/jsx-runtime");
@@ -35363,7 +35504,14 @@ var ObjectDisplay = ({ value }) => {
35363
35504
  var StringArrayDisplay = ({ value }) => {
35364
35505
  if (!Array.isArray(value) || value.length === 0)
35365
35506
  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)) });
35507
+ 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)(
35508
+ "div",
35509
+ {
35510
+ 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",
35511
+ children: item
35512
+ },
35513
+ item
35514
+ )) });
35367
35515
  };
35368
35516
  function buildCampaignSeedFields(data) {
35369
35517
  if (!data || typeof data !== "object") return [];
@@ -35397,7 +35545,7 @@ function buildCampaignSeedFields(data) {
35397
35545
  onChange(bundles);
35398
35546
  },
35399
35547
  placeholder: "Keyword 1, Keyword 2 (Priority: 1)...",
35400
- className: "min-h-[120px] bg-background border-gray-300"
35548
+ className: "min-h-[120px] bg-background text-foreground border-gray-300"
35401
35549
  }
35402
35550
  )
35403
35551
  };
@@ -35408,49 +35556,20 @@ function buildCampaignSeedFields(data) {
35408
35556
  label: "Geography",
35409
35557
  type: "custom",
35410
35558
  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
- )
35559
+ renderEdit: (v, onChange) => /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(CountrySelectEdit, { value: v, onChange })
35423
35560
  };
35424
35561
  }
35425
- if (key === "platforms" && Array.isArray(value)) {
35562
+ if (key === "platforms" || key === "target_platforms" || key === "targetPlatforms") {
35426
35563
  return {
35427
35564
  key,
35428
35565
  label: "Platforms",
35429
35566
  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
- },
35567
+ renderDisplay: (v) => /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(PlatformSelectDisplay, { value: v }),
35444
35568
  renderEdit: (v, onChange) => /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
35445
- Textarea,
35569
+ PlatformSelectEdit,
35446
35570
  {
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"
35571
+ value: v,
35572
+ onChange
35454
35573
  }
35455
35574
  )
35456
35575
  };
@@ -35472,9 +35591,9 @@ function buildCampaignSeedFields(data) {
35472
35591
  type: "custom",
35473
35592
  renderDisplay: (v) => {
35474
35593
  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()}` });
35594
+ return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("span", { className: "text-foreground font-medium", children: `${v.min?.toLocaleString()} - ${v.max?.toLocaleString()}` });
35476
35595
  }
35477
- return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("span", { className: "text-white font-medium", children: v });
35596
+ return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("span", { className: "text-foreground font-medium", children: v });
35478
35597
  }
35479
35598
  };
35480
35599
  }
@@ -35501,7 +35620,7 @@ function buildCampaignSeedFields(data) {
35501
35620
  onChange(newObj);
35502
35621
  },
35503
35622
  placeholder: "Enter key: value pairs (one per line)...",
35504
- className: "min-h-[120px] bg-background border-gray-300 font-mono text-xs"
35623
+ className: "min-h-[120px] bg-background text-foreground border-gray-300 font-mono text-xs"
35505
35624
  }
35506
35625
  )
35507
35626
  };
@@ -35570,7 +35689,14 @@ var ObjectDisplay2 = ({ value }) => {
35570
35689
  var StringArrayDisplay2 = ({ value }) => {
35571
35690
  if (!Array.isArray(value) || value.length === 0)
35572
35691
  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)) });
35692
+ 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)(
35693
+ "div",
35694
+ {
35695
+ 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",
35696
+ children: item
35697
+ },
35698
+ item
35699
+ )) });
35574
35700
  };
35575
35701
  function buildSearchSpecFields(data) {
35576
35702
  if (!data || typeof data !== "object") return [];
@@ -35594,11 +35720,28 @@ function buildSearchSpecFields(data) {
35594
35720
  renderEdit: (v, onChange) => /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(CountrySelectEdit, { value: v, onChange })
35595
35721
  };
35596
35722
  }
35597
- if ((key === "platforms" || key === "exclude_keywords" || key === "excludeKeywords") && Array.isArray(value)) {
35598
- const label = key === "platforms" ? "Platforms" : "Exclude Keywords";
35723
+ if (key === "platforms" && Array.isArray(value)) {
35599
35724
  return {
35600
35725
  key,
35601
- label,
35726
+ label: "Platforms",
35727
+ type: "custom",
35728
+ config: {
35729
+ options: data.platform_options || data.available_platforms || data.platforms_list || []
35730
+ },
35731
+ renderDisplay: (v) => /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(PlatformSelectDisplay, { value: v }),
35732
+ renderEdit: (v, onChange) => /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
35733
+ PlatformSelectEdit,
35734
+ {
35735
+ value: v,
35736
+ onChange
35737
+ }
35738
+ )
35739
+ };
35740
+ }
35741
+ if ((key === "exclude_keywords" || key === "excludeKeywords") && Array.isArray(value)) {
35742
+ return {
35743
+ key,
35744
+ label: "Exclude Keywords",
35602
35745
  type: "custom",
35603
35746
  renderDisplay: (v) => /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(StringArrayDisplay2, { value: v }),
35604
35747
  renderEdit: (v, onChange) => /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
@@ -35609,8 +35752,8 @@ function buildSearchSpecFields(data) {
35609
35752
  const items = e.target.value.split(",").map((s) => s.trim()).filter(Boolean);
35610
35753
  onChange(items);
35611
35754
  },
35612
- placeholder: `Enter ${label.toLowerCase()} separated by commas...`,
35613
- className: "min-h-[100px] bg-background border-gray-300"
35755
+ placeholder: "Enter exclude keywords separated by commas...",
35756
+ className: "min-h-[100px] bg-background text-foreground border-gray-300"
35614
35757
  }
35615
35758
  )
35616
35759
  };
@@ -35638,7 +35781,7 @@ function buildSearchSpecFields(data) {
35638
35781
  onChange(newObj);
35639
35782
  },
35640
35783
  placeholder: "Enter key: value pairs (one per line)...",
35641
- className: "min-h-[120px] bg-background border-gray-300 font-mono text-xs"
35784
+ className: "min-h-[120px] bg-background text-foreground border-gray-300 font-mono text-xs"
35642
35785
  }
35643
35786
  )
35644
35787
  };
@@ -36397,6 +36540,7 @@ var import_framer_motion = require("framer-motion");
36397
36540
  var import_jsx_runtime121 = require("react/jsx-runtime");
36398
36541
  var CampaignConceptCard = import_react64.default.memo(
36399
36542
  ({
36543
+ index,
36400
36544
  isRecommended,
36401
36545
  isOpen: controlledIsOpen,
36402
36546
  onToggle,
@@ -36411,7 +36555,6 @@ var CampaignConceptCard = import_react64.default.memo(
36411
36555
  ...formCardProps
36412
36556
  }) => {
36413
36557
  const [internalIsOpen, setInternalIsOpen] = (0, import_react64.useState)(false);
36414
- const [copied, setCopied] = (0, import_react64.useState)(false);
36415
36558
  const isOpen = controlledIsOpen !== void 0 ? controlledIsOpen : internalIsOpen;
36416
36559
  const handleToggle = () => {
36417
36560
  if (onToggle) {
@@ -36422,35 +36565,6 @@ var CampaignConceptCard = import_react64.default.memo(
36422
36565
  };
36423
36566
  const cardTitle = propsTitle || data.title || data.name || data.concept_name || data.conceptName || "Campaign Concept";
36424
36567
  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
36568
  const handleProceed = () => {
36455
36569
  onAction?.({
36456
36570
  type: "concept_selection",
@@ -36468,6 +36582,7 @@ var CampaignConceptCard = import_react64.default.memo(
36468
36582
  "secondary_kpis",
36469
36583
  "budget_allocation",
36470
36584
  "budgetAllocation",
36585
+ "geography",
36471
36586
  "estimated_creators",
36472
36587
  "estimatedCreators",
36473
36588
  "platforms",
@@ -36504,9 +36619,9 @@ var CampaignConceptCard = import_react64.default.memo(
36504
36619
  idx + 1,
36505
36620
  "."
36506
36621
  ] }),
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) }),
36622
+ /* @__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
36623
  /* @__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) })
36624
+ /* @__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
36625
  ] }, idx);
36511
36626
  }) });
36512
36627
  }
@@ -36518,9 +36633,9 @@ var CampaignConceptCard = import_react64.default.memo(
36518
36633
  idx + 1,
36519
36634
  "."
36520
36635
  ] }),
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) }),
36636
+ /* @__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
36637
  /* @__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) })
36638
+ /* @__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
36639
  ] }, k)) });
36525
36640
  }
36526
36641
  return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "text-muted-foreground text-sm", children: String(val) });
@@ -36541,41 +36656,27 @@ var CampaignConceptCard = import_react64.default.memo(
36541
36656
  onChange(newObj);
36542
36657
  },
36543
36658
  placeholder: "Tier name: percentage (one per line)...",
36544
- className: "min-h-[120px] bg-background border-gray-300 font-mono text-xs"
36659
+ className: "min-h-[120px] bg-background text-foreground border-gray-300 font-mono text-xs"
36545
36660
  }
36546
36661
  )
36547
36662
  };
36548
36663
  }
36664
+ if (field.key === "geography") {
36665
+ return {
36666
+ ...field,
36667
+ label: "Geography",
36668
+ renderDisplay: (v) => /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(CountrySelectDisplay, { value: v }),
36669
+ renderEdit: (v, onChange) => /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(CountrySelectEdit, { value: v, onChange })
36670
+ };
36671
+ }
36549
36672
  if (field.key === "estimatedCreators" || field.key === "estimated_creators") {
36550
36673
  return {
36551
36674
  ...field,
36552
36675
  label: "Estimated Creators",
36553
36676
  renderDisplay: (val) => {
36554
36677
  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) });
36678
+ const displayValue = typeof val === "object" && !Array.isArray(val) ? `${val.min ?? 0}-${val.max ?? 0}` : String(val);
36679
+ return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "text-foreground text-sm", children: displayValue });
36579
36680
  },
36580
36681
  renderEdit: (v, onChange) => /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
36581
36682
  Input,
@@ -36591,7 +36692,7 @@ var CampaignConceptCard = import_react64.default.memo(
36591
36692
  }
36592
36693
  },
36593
36694
  placeholder: "Min-Max (e.g. 10-30)...",
36594
- className: "bg-background border-gray-300"
36695
+ className: "bg-background text-foreground border-gray-300"
36595
36696
  }
36596
36697
  )
36597
36698
  };
@@ -36607,7 +36708,7 @@ var CampaignConceptCard = import_react64.default.memo(
36607
36708
  value: String(v || ""),
36608
36709
  onChange: (e) => onChange(e.target.value),
36609
36710
  placeholder: "Enter primary KPI...",
36610
- className: "bg-background border-gray-300"
36711
+ className: "bg-background text-foreground border-gray-300"
36611
36712
  }
36612
36713
  )
36613
36714
  };
@@ -36629,7 +36730,7 @@ var CampaignConceptCard = import_react64.default.memo(
36629
36730
  onChange(items);
36630
36731
  },
36631
36732
  placeholder: "Enter KPIs separated by commas...",
36632
- className: "min-h-[80px] bg-background border-gray-300"
36733
+ className: "min-h-[80px] bg-background text-foreground border-gray-300"
36633
36734
  }
36634
36735
  )
36635
36736
  };
@@ -36637,43 +36738,34 @@ var CampaignConceptCard = import_react64.default.memo(
36637
36738
  if (field.key === "platforms" || field.key === "target_platforms" || field.key === "targetPlatforms") {
36638
36739
  return {
36639
36740
  ...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
- },
36741
+ renderDisplay: (v) => /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(PlatformSelectDisplay, { value: v }),
36652
36742
  renderEdit: (v, onChange) => /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
36653
- Textarea,
36743
+ PlatformSelectEdit,
36654
36744
  {
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"
36745
+ value: v,
36746
+ onChange
36662
36747
  }
36663
36748
  )
36664
36749
  };
36665
36750
  }
36751
+ if (field.key === "description" || field.key === "creator_strategy" || field.key === "creatorStrategy") {
36752
+ return {
36753
+ ...field,
36754
+ type: "textarea",
36755
+ renderDisplay: (val) => /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "text-foreground text-sm leading-relaxed", children: val ? String(val) : "-" })
36756
+ };
36757
+ }
36666
36758
  return {
36667
36759
  ...field,
36668
36760
  renderDisplay: (val) => {
36669
36761
  if (Array.isArray(val)) {
36670
36762
  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) => {
36763
+ return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("div", { className: "flex flex-wrap gap-2 pt-1", children: val.map((item, idx) => {
36672
36764
  const label = typeof item === "object" && item !== null ? item.label || item.value || item.name || JSON.stringify(item) : String(item);
36673
36765
  return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
36674
36766
  "span",
36675
36767
  {
36676
- className: "inline-block bg-paperBackground border border-gray400 text-txtColor text-xs px-2 py-0.5 rounded-full",
36768
+ 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
36769
  children: label
36678
36770
  },
36679
36771
  idx
@@ -36681,9 +36773,9 @@ var CampaignConceptCard = import_react64.default.memo(
36681
36773
  }) });
36682
36774
  }
36683
36775
  if (typeof val === "object" && val !== null) {
36684
- 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") });
36776
+ return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("div", { className: "text-muted-foreground text-xs font-mono bg-paperBackground p-2 rounded mt-1 overflow-auto max-h-24", children: Object.entries(val).map(([k, v]) => `${k.replace(/_/g, " ")}: ${v}`).join("\n") });
36685
36777
  }
36686
- return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "text-txtColor text-sm", children: val !== void 0 && val !== null ? String(val) : "-" });
36778
+ return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "text-foreground text-sm", children: val !== void 0 && val !== null ? String(val) : "-" });
36687
36779
  }
36688
36780
  };
36689
36781
  });
@@ -36704,43 +36796,36 @@ var CampaignConceptCard = import_react64.default.memo(
36704
36796
  onClick: handleToggle,
36705
36797
  children: [
36706
36798
  /* @__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) }),
36799
+ /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("h3", { className: "mb-1 py-1 text-txtColor font-bold text-lg", children: [
36800
+ "Concept ",
36801
+ index !== void 0 ? index : "",
36802
+ " : ",
36803
+ typeof cardTitle === "object" ? JSON.stringify(cardTitle) : String(cardTitle)
36804
+ ] }),
36708
36805
  /* @__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" }) }),
36806
+ 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
36807
  !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
36808
  ] })
36712
36809
  ] }),
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
- ] })
36810
+ /* @__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)(
36811
+ "button",
36812
+ {
36813
+ onClick: (e) => {
36814
+ e.preventDefault();
36815
+ e.stopPropagation();
36816
+ handleToggle();
36817
+ },
36818
+ className: "p-2 bg-background hover:bg-gray200 dark:hover:bg-gray200 text-foreground rounded-lg shadow-lg",
36819
+ "aria-label": isOpen ? "Collapse" : "Expand",
36820
+ title: isOpen ? "Collapse" : "Expand",
36821
+ children: /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
36822
+ ChevronDown,
36823
+ {
36824
+ className: `h-4 w-4 transition-transform ${isOpen ? "rotate-0" : "-rotate-90"}`
36825
+ }
36826
+ )
36827
+ }
36828
+ ) })
36744
36829
  ]
36745
36830
  }
36746
36831
  ),
@@ -38679,7 +38764,7 @@ var PXEngineRenderer = ({
38679
38764
  if (id && !finalProps.id) {
38680
38765
  finalProps.id = id;
38681
38766
  }
38682
- const uniqueKey = id || `${componentName}-${index || Math.random().toString(36).substr(2, 9)}`;
38767
+ const uniqueKey = id || (index !== void 0 ? `${componentName}-${index}` : `${componentName}-root`);
38683
38768
  const normalizedName = componentName.charAt(0).toUpperCase() + componentName.slice(1);
38684
38769
  const resolveComponent = (identifier) => {
38685
38770
  const normalized = identifier.split(/[-_]/).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join("");
@@ -38946,6 +39031,8 @@ var PXEngineRenderer = ({
38946
39031
  PaginationNext,
38947
39032
  PaginationPrevious,
38948
39033
  PlatformIconGroup,
39034
+ PlatformSelectDisplay,
39035
+ PlatformSelectEdit,
38949
39036
  Popover,
38950
39037
  PopoverAtom,
38951
39038
  PopoverContent,