pxengine 0.1.32 → 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
@@ -35422,22 +35422,30 @@ var KeywordBundlesDisplay = ({ value }) => {
35422
35422
  var DEFAULT_PLATFORMS = ["Instagram", "YouTube", "TikTok"];
35423
35423
  var PlatformSelectEdit = ({
35424
35424
  value,
35425
- onChange,
35426
- config = {}
35425
+ onChange
35427
35426
  }) => {
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]);
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());
35434
35435
  const togglePlatform = (platform) => {
35435
- if (selectedPlatforms.includes(platform)) {
35436
- onChange(selectedPlatforms.filter((p) => p !== platform));
35436
+ if (isSelected(platform)) {
35437
+ onChange(
35438
+ selectedPlatforms.filter(
35439
+ (p) => p.toLowerCase() !== platform.toLowerCase()
35440
+ )
35441
+ );
35437
35442
  } else {
35438
35443
  onChange([...selectedPlatforms, platform]);
35439
35444
  }
35440
35445
  };
35446
+ const options = (0, import_react59.useMemo)(() => {
35447
+ return DEFAULT_PLATFORMS;
35448
+ }, []);
35441
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)(
35442
35450
  "label",
35443
35451
  {
@@ -35448,10 +35456,10 @@ var PlatformSelectEdit = ({
35448
35456
  {
35449
35457
  className: cn(
35450
35458
  "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"
35459
+ isSelected(platform) ? "bg-purple-600 border-purple-600" : "border-gray-300 group-hover:border-purple-400"
35452
35460
  ),
35453
35461
  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]" })
35462
+ children: isSelected(platform) && /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(Check, { className: "h-3.5 w-3.5 text-white stroke-[3]" })
35455
35463
  }
35456
35464
  ),
35457
35465
  /* @__PURE__ */ (0, import_jsx_runtime106.jsx)("span", { className: "text-sm font-medium text-foreground select-none", children: platform })
@@ -35461,10 +35469,17 @@ var PlatformSelectEdit = ({
35461
35469
  )) });
35462
35470
  };
35463
35471
  var PlatformSelectDisplay = ({ value }) => {
35464
- if (!value || !Array.isArray(value) || value.length === 0) {
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) {
35465
35480
  return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)("span", { className: "text-muted-foreground italic text-sm", children: "Not specified" });
35466
35481
  }
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)(
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)(
35468
35483
  "div",
35469
35484
  {
35470
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",
@@ -35554,10 +35569,7 @@ function buildCampaignSeedFields(data) {
35554
35569
  PlatformSelectEdit,
35555
35570
  {
35556
35571
  value: v,
35557
- onChange,
35558
- config: {
35559
- options: data.platform_options || data.available_platforms || data.platforms_list || []
35560
- }
35572
+ onChange
35561
35573
  }
35562
35574
  )
35563
35575
  };
@@ -35721,8 +35733,7 @@ function buildSearchSpecFields(data) {
35721
35733
  PlatformSelectEdit,
35722
35734
  {
35723
35735
  value: v,
35724
- onChange,
35725
- config: { options: data.platform_options || data.available_platforms || data.platforms_list || [] }
35736
+ onChange
35726
35737
  }
35727
35738
  )
35728
35739
  };
@@ -36732,10 +36743,7 @@ var CampaignConceptCard = import_react64.default.memo(
36732
36743
  PlatformSelectEdit,
36733
36744
  {
36734
36745
  value: v,
36735
- onChange,
36736
- config: {
36737
- options: data.platform_options || data.available_platforms || data.platforms_list || []
36738
- }
36746
+ onChange
36739
36747
  }
36740
36748
  )
36741
36749
  };
@@ -36765,7 +36773,7 @@ var CampaignConceptCard = import_react64.default.memo(
36765
36773
  }) });
36766
36774
  }
36767
36775
  if (typeof val === "object" && val !== null) {
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") });
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") });
36769
36777
  }
36770
36778
  return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "text-foreground text-sm", children: val !== void 0 && val !== null ? String(val) : "-" });
36771
36779
  }