strapi-plugin-hubspot 0.16.0 → 0.16.1

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.
Files changed (27) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/_chunks/{Forms-BW_zGc1P.js → Forms-D0QXkYAN.js} +193 -110
  3. package/dist/_chunks/{Forms-6EoEYzAc.mjs → Forms-DEoZGrEt.mjs} +195 -112
  4. package/dist/_chunks/{HubspotFormInput-oMhm1UJm.js → HubspotFormInput-4ZMYXWM_.js} +1 -1
  5. package/dist/_chunks/{HubspotFormInput-V5w4y1fb.mjs → HubspotFormInput-CPep55GL.mjs} +1 -1
  6. package/dist/_chunks/{HubspotObjectInput-Bmo6YQgs.js → HubspotObjectInput-BTqYXJIa.js} +3 -3
  7. package/dist/_chunks/{HubspotObjectInput-DhsnSguG.mjs → HubspotObjectInput-CQszIx1W.mjs} +3 -3
  8. package/dist/_chunks/{HubspotPropertyInput-luFfnxqy.js → HubspotPropertyInput-2MgIKlR_.js} +3 -3
  9. package/dist/_chunks/{HubspotPropertyInput-CrYP4pc0.mjs → HubspotPropertyInput-ClNph0f1.mjs} +3 -3
  10. package/dist/_chunks/{Settings-CjcWj9I6.mjs → Settings-CZ-qQSKT.mjs} +2 -2
  11. package/dist/_chunks/{Settings-B3A22i7Z.js → Settings-DhiHQC6U.js} +2 -2
  12. package/dist/_chunks/{en-C7ls2EUl.js → en-CSgFmKmM.js} +1 -1
  13. package/dist/_chunks/{en-D6GHgMOt.mjs → en-Dh3bMS6N.mjs} +1 -1
  14. package/dist/_chunks/{fr-pOP8ZXqM.js → fr-D_EhZS0P.js} +1 -1
  15. package/dist/_chunks/{fr-CfohMY8n.mjs → fr-aWOIOlS9.mjs} +1 -1
  16. package/dist/_chunks/{index-CodpLKZx.js → index-ciliGv0E.js} +6 -6
  17. package/dist/_chunks/{index-7cL9PRh1.mjs → index-gKM4jVf8.mjs} +6 -6
  18. package/dist/_chunks/{objectLabels-CSWGIgNb.js → objectLabels-BjYfdhRB.js} +1 -1
  19. package/dist/_chunks/{objectLabels-Dnj14fsp.mjs → objectLabels-DQpSLUaJ.mjs} +1 -1
  20. package/dist/_chunks/{useHubspotSchema-BsmQgJgx.mjs → useHubspotSchema-CE7tJgOM.mjs} +1 -1
  21. package/dist/_chunks/{useHubspotSchema-DiRN3HrN.js → useHubspotSchema-KKVppjC2.js} +1 -1
  22. package/dist/admin/index.js +1 -1
  23. package/dist/admin/index.mjs +1 -1
  24. package/dist/admin/src/builder/Sortable.d.ts +25 -12
  25. package/dist/admin/src/builder/__tests__/relocateField.test.d.ts +1 -0
  26. package/dist/admin/src/builder/relocateField.d.ts +14 -0
  27. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.16.1 — 2026-09-22
6
+
7
+ ### Changed
8
+ - Fields in the builder can be dragged from one step to another (the grip
9
+ handle is no longer limited to reordering inside the current step). Arrow
10
+ buttons still move a field into the neighbouring step.
11
+
5
12
  ## 0.16.0 — 2026-09-22
6
13
 
7
14
  ### Added — submission policies
@@ -7,12 +7,12 @@ const index = require("./index-DkTxsEqL.js");
7
7
  const designSystem = require("@strapi/design-system");
8
8
  const icons = require("@strapi/icons");
9
9
  const admin = require("@strapi/strapi/admin");
10
- const index$1 = require("./index-CodpLKZx.js");
10
+ const index$1 = require("./index-ciliGv0E.js");
11
11
  const core = require("@dnd-kit/core");
12
12
  const sortable = require("@dnd-kit/sortable");
13
13
  const utilities = require("@dnd-kit/utilities");
14
- const objectLabels = require("./objectLabels-CSWGIgNb.js");
15
- const useHubspotSchema = require("./useHubspotSchema-DiRN3HrN.js");
14
+ const objectLabels = require("./objectLabels-BjYfdhRB.js");
15
+ const useHubspotSchema = require("./useHubspotSchema-KKVppjC2.js");
16
16
  function _interopNamespace(e) {
17
17
  if (e && e.__esModule) return e;
18
18
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
@@ -173,32 +173,107 @@ const ConditionEditor = ({ condition, candidates, onChange }) => {
173
173
  ] })
174
174
  ] });
175
175
  };
176
- function SortableList({
177
- ids,
178
- onReorder,
179
- children
176
+ function relocateField(steps, fieldId, overId) {
177
+ const next = steps.map((step) => ({ ...step, fields: [...step.fields] }));
178
+ let fromStep = -1;
179
+ let fromIndex = -1;
180
+ for (let i = 0; i < next.length; i += 1) {
181
+ const index2 = next[i].fields.findIndex((field2) => field2.id === fieldId);
182
+ if (index2 !== -1) {
183
+ fromStep = i;
184
+ fromIndex = index2;
185
+ break;
186
+ }
187
+ }
188
+ if (fromStep === -1) return steps;
189
+ let toStep = -1;
190
+ let toIndex = -1;
191
+ const containerId = overId.startsWith("container:") ? overId.slice("container:".length) : "";
192
+ if (containerId) {
193
+ toStep = next.findIndex((step) => step.id === containerId);
194
+ toIndex = toStep === -1 ? -1 : next[toStep].fields.length;
195
+ } else {
196
+ for (let i = 0; i < next.length; i += 1) {
197
+ const index2 = next[i].fields.findIndex((field2) => field2.id === overId);
198
+ if (index2 !== -1) {
199
+ toStep = i;
200
+ toIndex = index2;
201
+ break;
202
+ }
203
+ }
204
+ if (toStep === -1) {
205
+ toStep = next.findIndex((step) => step.id === overId);
206
+ toIndex = toStep === -1 ? -1 : next[toStep].fields.length;
207
+ }
208
+ }
209
+ if (toStep === -1 || toIndex === -1) return steps;
210
+ if (fromStep === toStep) {
211
+ if (fromIndex === toIndex) return steps;
212
+ next[fromStep].fields = sortable.arrayMove(next[fromStep].fields, fromIndex, toIndex);
213
+ return next;
214
+ }
215
+ const [field] = next[fromStep].fields.splice(fromIndex, 1);
216
+ if (!field) return steps;
217
+ next[toStep].fields.splice(toIndex, 0, field);
218
+ return next;
219
+ }
220
+ const collisionDetection = (args) => {
221
+ const type = args.active.data.current?.type;
222
+ const droppableContainers = args.droppableContainers.filter((container) => {
223
+ const other = container.data.current?.type;
224
+ if (type === "step") return other === "step";
225
+ if (type === "field") return other === "field" || other === "container";
226
+ return true;
227
+ });
228
+ return core.closestCorners({ ...args, droppableContainers });
229
+ };
230
+ function SortableBoard({
231
+ children,
232
+ onDragEnd
180
233
  }) {
181
234
  const sensors = core.useSensors(
182
235
  // An 8px activation distance keeps clicks (selection!) from starting drags.
183
236
  core.useSensor(core.PointerSensor, { activationConstraint: { distance: 8 } }),
184
237
  core.useSensor(core.KeyboardSensor, { coordinateGetter: sortable.sortableKeyboardCoordinates })
185
238
  );
186
- const handleDragEnd = (event) => {
187
- const { active, over } = event;
188
- if (!over || active.id === over.id) return;
189
- const from = ids.indexOf(String(active.id));
190
- const to = ids.indexOf(String(over.id));
191
- if (from === -1 || to === -1) return;
192
- onReorder(sortable.arrayMove(ids, from, to));
193
- };
194
- return /* @__PURE__ */ jsxRuntime.jsx(core.DndContext, { sensors, collisionDetection: core.closestCenter, onDragEnd: handleDragEnd, children: /* @__PURE__ */ jsxRuntime.jsx(sortable.SortableContext, { items: ids, strategy: sortable.verticalListSortingStrategy, children }) });
239
+ return /* @__PURE__ */ jsxRuntime.jsx(core.DndContext, { sensors, collisionDetection, onDragEnd, children });
240
+ }
241
+ function SortableGroup({
242
+ ids,
243
+ children
244
+ }) {
245
+ return /* @__PURE__ */ jsxRuntime.jsx(sortable.SortableContext, { items: ids, strategy: sortable.verticalListSortingStrategy, children });
246
+ }
247
+ function SortableContainer({
248
+ stepId,
249
+ children
250
+ }) {
251
+ const { setNodeRef, isOver } = core.useDroppable({
252
+ id: `container:${stepId}`,
253
+ data: { type: "container", stepId }
254
+ });
255
+ return /* @__PURE__ */ jsxRuntime.jsx(
256
+ "div",
257
+ {
258
+ ref: setNodeRef,
259
+ style: {
260
+ minHeight: 8,
261
+ borderRadius: 4,
262
+ outline: isOver ? "2px dashed currentColor" : void 0,
263
+ outlineOffset: 4
264
+ },
265
+ children
266
+ }
267
+ );
195
268
  }
196
269
  function SortableItem({
197
270
  id,
271
+ data,
198
272
  children
199
273
  }) {
200
274
  const { attributes, listeners, setNodeRef, transform, transition, isDragging } = sortable.useSortable({
201
- id
275
+ id,
276
+ data
202
277
  });
203
278
  return /* @__PURE__ */ jsxRuntime.jsx(
204
279
  "div",
@@ -889,14 +964,28 @@ const FormEditor = () => {
889
964
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 6, alignItems: "flex-start", children: [
890
965
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { flex: "1", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 4, children: [
891
966
  /* @__PURE__ */ jsxRuntime.jsx(
892
- SortableList,
967
+ SortableBoard,
893
968
  {
894
- ids: definition.steps.map((s) => s.id),
895
- onReorder: (ids) => patchDefinition((steps) => reorderByIds(steps, ids)),
896
- children: definition.steps.map((step, stepIndex) => /* @__PURE__ */ jsxRuntime.jsx(
969
+ onDragEnd: ({ active, over }) => {
970
+ if (!over || active.id === over.id) return;
971
+ const kind = active.data.current?.type;
972
+ if (kind === "step") {
973
+ const ids = definition.steps.map((s) => s.id);
974
+ const from = ids.indexOf(String(active.id));
975
+ const to = ids.indexOf(String(over.id));
976
+ if (from === -1 || to === -1) return;
977
+ patchDefinition((steps) => reorderByIds(steps, sortable.arrayMove(ids, from, to)));
978
+ return;
979
+ }
980
+ if (kind === "field") {
981
+ patchDefinition((steps) => relocateField(steps, String(active.id), String(over.id)));
982
+ }
983
+ },
984
+ children: /* @__PURE__ */ jsxRuntime.jsx(SortableGroup, { ids: definition.steps.map((s) => s.id), children: definition.steps.map((step, stepIndex) => /* @__PURE__ */ jsxRuntime.jsx(
897
985
  SortableItem,
898
986
  {
899
987
  id: step.id,
988
+ data: { type: "step" },
900
989
  children: (stepHandle) => /* @__PURE__ */ jsxRuntime.jsxs(
901
990
  designSystem.Box,
902
991
  {
@@ -972,95 +1061,89 @@ const FormEditor = () => {
972
1061
  ] })
973
1062
  ] }),
974
1063
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 2, children: [
975
- /* @__PURE__ */ jsxRuntime.jsx(
976
- SortableList,
977
- {
978
- ids: step.fields.map((f) => f.id),
979
- onReorder: (ids) => patchStep(step.id, { fields: reorderByIds(step.fields, ids) }),
980
- children: step.fields.map((field, fieldIndex) => {
981
- const flags = fieldFlags(field.id);
982
- const isSelected = selection.kind === "field" && selection.fieldId === field.id;
983
- return /* @__PURE__ */ jsxRuntime.jsx(
984
- SortableItem,
1064
+ /* @__PURE__ */ jsxRuntime.jsx(SortableContainer, { stepId: step.id, children: /* @__PURE__ */ jsxRuntime.jsx(SortableGroup, { ids: step.fields.map((f) => f.id), children: step.fields.map((field, fieldIndex) => {
1065
+ const flags = fieldFlags(field.id);
1066
+ const isSelected = selection.kind === "field" && selection.fieldId === field.id;
1067
+ return /* @__PURE__ */ jsxRuntime.jsx(
1068
+ SortableItem,
1069
+ {
1070
+ id: field.id,
1071
+ data: { type: "field", stepId: step.id },
1072
+ children: (fieldHandle) => /* @__PURE__ */ jsxRuntime.jsx(
1073
+ designSystem.Box,
985
1074
  {
986
- id: field.id,
987
- children: (fieldHandle) => /* @__PURE__ */ jsxRuntime.jsx(
988
- designSystem.Box,
989
- {
990
- background: isSelected ? "primary100" : "neutral100",
991
- hasRadius: true,
992
- padding: 3,
993
- onClick: (e) => {
994
- e.stopPropagation();
995
- setSelection({ kind: "field", fieldId: field.id });
996
- },
997
- style: { cursor: "pointer" },
998
- children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", alignItems: "center", children: [
999
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, alignItems: "center", wrap: "wrap", children: [
1000
- /* @__PURE__ */ jsxRuntime.jsx(
1001
- "span",
1002
- {
1003
- ...fieldHandle.attributes,
1004
- ...fieldHandle.listeners,
1005
- onClick: (e) => e.stopPropagation(),
1006
- style: { cursor: "grab", display: "inline-flex" },
1007
- "aria-label": t("editor.drag-field", "Drag to reorder the field"),
1008
- children: /* @__PURE__ */ jsxRuntime.jsx(icons.Drag, {})
1009
- }
1010
- ),
1011
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontWeight: "semiBold", children: field.label || field.name || "—" }),
1012
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { children: field.type }),
1013
- field.required && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { backgroundColor: "neutral150", textColor: "neutral600", children: t("editor.required", "required") }),
1014
- field.hubspot?.property && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Badge, { backgroundColor: "primary100", textColor: "primary700", children: [
1015
- field.hubspot.object ?? "contact",
1016
- ".",
1017
- field.hubspot.property
1018
- ] }),
1019
- field.visibleIf?.rules?.length ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { backgroundColor: "alternative100", textColor: "alternative700", children: t("editor.conditional", "Conditional") }) : null,
1020
- (flags.error || flags.problem) && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { backgroundColor: "danger100", textColor: "danger700", children: flags.error?.code ?? flags.problem?.code })
1021
- ] }),
1022
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 1, onClick: (e) => e.stopPropagation(), children: [
1023
- /* @__PURE__ */ jsxRuntime.jsx(
1024
- designSystem.IconButton,
1025
- {
1026
- label: t("editor.field-up", "Move up"),
1027
- onClick: () => moveField(stepIndex, fieldIndex, -1),
1028
- disabled: stepIndex === 0 && fieldIndex === 0,
1029
- children: /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowUp, {})
1030
- }
1031
- ),
1032
- /* @__PURE__ */ jsxRuntime.jsx(
1033
- designSystem.IconButton,
1034
- {
1035
- label: t("editor.field-down", "Move down"),
1036
- onClick: () => moveField(stepIndex, fieldIndex, 1),
1037
- disabled: stepIndex === definition.steps.length - 1 && fieldIndex === step.fields.length - 1,
1038
- children: /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowDown, {})
1039
- }
1040
- ),
1041
- /* @__PURE__ */ jsxRuntime.jsx(
1042
- designSystem.IconButton,
1043
- {
1044
- label: t("editor.field-delete", "Delete the field"),
1045
- onClick: () => {
1046
- setSelection({ kind: "form" });
1047
- patchStep(step.id, {
1048
- fields: step.fields.filter((f) => f.id !== field.id)
1049
- });
1050
- },
1051
- children: /* @__PURE__ */ jsxRuntime.jsx(icons.Trash, {})
1052
- }
1053
- )
1054
- ] })
1055
- ] })
1056
- }
1057
- )
1058
- },
1059
- field.id
1060
- );
1061
- })
1062
- }
1063
- ),
1075
+ background: isSelected ? "primary100" : "neutral100",
1076
+ hasRadius: true,
1077
+ padding: 3,
1078
+ onClick: (e) => {
1079
+ e.stopPropagation();
1080
+ setSelection({ kind: "field", fieldId: field.id });
1081
+ },
1082
+ style: { cursor: "pointer" },
1083
+ children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", alignItems: "center", children: [
1084
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, alignItems: "center", wrap: "wrap", children: [
1085
+ /* @__PURE__ */ jsxRuntime.jsx(
1086
+ "span",
1087
+ {
1088
+ ...fieldHandle.attributes,
1089
+ ...fieldHandle.listeners,
1090
+ onClick: (e) => e.stopPropagation(),
1091
+ style: { cursor: "grab", display: "inline-flex" },
1092
+ "aria-label": t("editor.drag-field", "Drag to move the field, including to another step"),
1093
+ children: /* @__PURE__ */ jsxRuntime.jsx(icons.Drag, {})
1094
+ }
1095
+ ),
1096
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontWeight: "semiBold", children: field.label || field.name || "—" }),
1097
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { children: field.type }),
1098
+ field.required && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { backgroundColor: "neutral150", textColor: "neutral600", children: t("editor.required", "required") }),
1099
+ field.hubspot?.property && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Badge, { backgroundColor: "primary100", textColor: "primary700", children: [
1100
+ field.hubspot.object ?? "contact",
1101
+ ".",
1102
+ field.hubspot.property
1103
+ ] }),
1104
+ field.visibleIf?.rules?.length ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { backgroundColor: "alternative100", textColor: "alternative700", children: t("editor.conditional", "Conditional") }) : null,
1105
+ (flags.error || flags.problem) && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { backgroundColor: "danger100", textColor: "danger700", children: flags.error?.code ?? flags.problem?.code })
1106
+ ] }),
1107
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 1, onClick: (e) => e.stopPropagation(), children: [
1108
+ /* @__PURE__ */ jsxRuntime.jsx(
1109
+ designSystem.IconButton,
1110
+ {
1111
+ label: t("editor.field-up", "Move up"),
1112
+ onClick: () => moveField(stepIndex, fieldIndex, -1),
1113
+ disabled: stepIndex === 0 && fieldIndex === 0,
1114
+ children: /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowUp, {})
1115
+ }
1116
+ ),
1117
+ /* @__PURE__ */ jsxRuntime.jsx(
1118
+ designSystem.IconButton,
1119
+ {
1120
+ label: t("editor.field-down", "Move down"),
1121
+ onClick: () => moveField(stepIndex, fieldIndex, 1),
1122
+ disabled: stepIndex === definition.steps.length - 1 && fieldIndex === step.fields.length - 1,
1123
+ children: /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowDown, {})
1124
+ }
1125
+ ),
1126
+ /* @__PURE__ */ jsxRuntime.jsx(
1127
+ designSystem.IconButton,
1128
+ {
1129
+ label: t("editor.field-delete", "Delete the field"),
1130
+ onClick: () => {
1131
+ setSelection({ kind: "form" });
1132
+ patchStep(step.id, {
1133
+ fields: step.fields.filter((f) => f.id !== field.id)
1134
+ });
1135
+ },
1136
+ children: /* @__PURE__ */ jsxRuntime.jsx(icons.Trash, {})
1137
+ }
1138
+ )
1139
+ ] })
1140
+ ] })
1141
+ }
1142
+ )
1143
+ },
1144
+ field.id
1145
+ );
1146
+ }) }) }),
1064
1147
  /* @__PURE__ */ jsxRuntime.jsx(
1065
1148
  designSystem.Button,
1066
1149
  {
@@ -1081,7 +1164,7 @@ const FormEditor = () => {
1081
1164
  )
1082
1165
  },
1083
1166
  step.id
1084
- ))
1167
+ )) })
1085
1168
  }
1086
1169
  ),
1087
1170
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -5,12 +5,12 @@ import { u as useIntl } from "./index-CEh8vkxY.mjs";
5
5
  import { Typography, Flex, Box, SingleSelect, SingleSelectOption, MultiSelect, MultiSelectOption, TextInput, IconButton, Button, Combobox, ComboboxOption, Field, Textarea, Checkbox, Divider, Loader, Badge, Table, Thead, Tr, Th, Tbody, Td, Modal } from "@strapi/design-system";
6
6
  import { Trash, Plus, ArrowClockwise, ArrowLeft, Drag, ArrowUp, ArrowDown, List, Duplicate, Download } from "@strapi/icons";
7
7
  import { useFetchClient } from "@strapi/strapi/admin";
8
- import { g as getTranslation, P as PLUGIN_ID } from "./index-7cL9PRh1.mjs";
9
- import { useSensors, useSensor, PointerSensor, KeyboardSensor, DndContext, closestCenter } from "@dnd-kit/core";
10
- import { sortableKeyboardCoordinates, SortableContext, verticalListSortingStrategy, useSortable, arrayMove } from "@dnd-kit/sortable";
8
+ import { g as getTranslation, P as PLUGIN_ID } from "./index-gKM4jVf8.mjs";
9
+ import { useSensors, useSensor, PointerSensor, KeyboardSensor, DndContext, useDroppable, closestCorners } from "@dnd-kit/core";
10
+ import { arrayMove, sortableKeyboardCoordinates, SortableContext, verticalListSortingStrategy, useSortable } from "@dnd-kit/sortable";
11
11
  import { CSS } from "@dnd-kit/utilities";
12
- import { o as objectLabel } from "./objectLabels-Dnj14fsp.mjs";
13
- import { u as useHubspotSchema } from "./useHubspotSchema-BsmQgJgx.mjs";
12
+ import { o as objectLabel } from "./objectLabels-DQpSLUaJ.mjs";
13
+ import { u as useHubspotSchema } from "./useHubspotSchema-CE7tJgOM.mjs";
14
14
  const OPERATORS = [
15
15
  "eq",
16
16
  "neq",
@@ -153,32 +153,107 @@ const ConditionEditor = ({ condition, candidates, onChange }) => {
153
153
  ] })
154
154
  ] });
155
155
  };
156
- function SortableList({
157
- ids,
158
- onReorder,
159
- children
156
+ function relocateField(steps, fieldId, overId) {
157
+ const next = steps.map((step) => ({ ...step, fields: [...step.fields] }));
158
+ let fromStep = -1;
159
+ let fromIndex = -1;
160
+ for (let i = 0; i < next.length; i += 1) {
161
+ const index = next[i].fields.findIndex((field2) => field2.id === fieldId);
162
+ if (index !== -1) {
163
+ fromStep = i;
164
+ fromIndex = index;
165
+ break;
166
+ }
167
+ }
168
+ if (fromStep === -1) return steps;
169
+ let toStep = -1;
170
+ let toIndex = -1;
171
+ const containerId = overId.startsWith("container:") ? overId.slice("container:".length) : "";
172
+ if (containerId) {
173
+ toStep = next.findIndex((step) => step.id === containerId);
174
+ toIndex = toStep === -1 ? -1 : next[toStep].fields.length;
175
+ } else {
176
+ for (let i = 0; i < next.length; i += 1) {
177
+ const index = next[i].fields.findIndex((field2) => field2.id === overId);
178
+ if (index !== -1) {
179
+ toStep = i;
180
+ toIndex = index;
181
+ break;
182
+ }
183
+ }
184
+ if (toStep === -1) {
185
+ toStep = next.findIndex((step) => step.id === overId);
186
+ toIndex = toStep === -1 ? -1 : next[toStep].fields.length;
187
+ }
188
+ }
189
+ if (toStep === -1 || toIndex === -1) return steps;
190
+ if (fromStep === toStep) {
191
+ if (fromIndex === toIndex) return steps;
192
+ next[fromStep].fields = arrayMove(next[fromStep].fields, fromIndex, toIndex);
193
+ return next;
194
+ }
195
+ const [field] = next[fromStep].fields.splice(fromIndex, 1);
196
+ if (!field) return steps;
197
+ next[toStep].fields.splice(toIndex, 0, field);
198
+ return next;
199
+ }
200
+ const collisionDetection = (args) => {
201
+ const type = args.active.data.current?.type;
202
+ const droppableContainers = args.droppableContainers.filter((container) => {
203
+ const other = container.data.current?.type;
204
+ if (type === "step") return other === "step";
205
+ if (type === "field") return other === "field" || other === "container";
206
+ return true;
207
+ });
208
+ return closestCorners({ ...args, droppableContainers });
209
+ };
210
+ function SortableBoard({
211
+ children,
212
+ onDragEnd
160
213
  }) {
161
214
  const sensors = useSensors(
162
215
  // An 8px activation distance keeps clicks (selection!) from starting drags.
163
216
  useSensor(PointerSensor, { activationConstraint: { distance: 8 } }),
164
217
  useSensor(KeyboardSensor, { coordinateGetter: sortableKeyboardCoordinates })
165
218
  );
166
- const handleDragEnd = (event) => {
167
- const { active, over } = event;
168
- if (!over || active.id === over.id) return;
169
- const from = ids.indexOf(String(active.id));
170
- const to = ids.indexOf(String(over.id));
171
- if (from === -1 || to === -1) return;
172
- onReorder(arrayMove(ids, from, to));
173
- };
174
- return /* @__PURE__ */ jsx(DndContext, { sensors, collisionDetection: closestCenter, onDragEnd: handleDragEnd, children: /* @__PURE__ */ jsx(SortableContext, { items: ids, strategy: verticalListSortingStrategy, children }) });
219
+ return /* @__PURE__ */ jsx(DndContext, { sensors, collisionDetection, onDragEnd, children });
220
+ }
221
+ function SortableGroup({
222
+ ids,
223
+ children
224
+ }) {
225
+ return /* @__PURE__ */ jsx(SortableContext, { items: ids, strategy: verticalListSortingStrategy, children });
226
+ }
227
+ function SortableContainer({
228
+ stepId,
229
+ children
230
+ }) {
231
+ const { setNodeRef, isOver } = useDroppable({
232
+ id: `container:${stepId}`,
233
+ data: { type: "container", stepId }
234
+ });
235
+ return /* @__PURE__ */ jsx(
236
+ "div",
237
+ {
238
+ ref: setNodeRef,
239
+ style: {
240
+ minHeight: 8,
241
+ borderRadius: 4,
242
+ outline: isOver ? "2px dashed currentColor" : void 0,
243
+ outlineOffset: 4
244
+ },
245
+ children
246
+ }
247
+ );
175
248
  }
176
249
  function SortableItem({
177
250
  id,
251
+ data,
178
252
  children
179
253
  }) {
180
254
  const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable({
181
- id
255
+ id,
256
+ data
182
257
  });
183
258
  return /* @__PURE__ */ jsx(
184
259
  "div",
@@ -869,14 +944,28 @@ const FormEditor = () => {
869
944
  /* @__PURE__ */ jsxs(Flex, { gap: 6, alignItems: "flex-start", children: [
870
945
  /* @__PURE__ */ jsx(Box, { flex: "1", children: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 4, children: [
871
946
  /* @__PURE__ */ jsx(
872
- SortableList,
947
+ SortableBoard,
873
948
  {
874
- ids: definition.steps.map((s) => s.id),
875
- onReorder: (ids) => patchDefinition((steps) => reorderByIds(steps, ids)),
876
- children: definition.steps.map((step, stepIndex) => /* @__PURE__ */ jsx(
949
+ onDragEnd: ({ active, over }) => {
950
+ if (!over || active.id === over.id) return;
951
+ const kind = active.data.current?.type;
952
+ if (kind === "step") {
953
+ const ids = definition.steps.map((s) => s.id);
954
+ const from = ids.indexOf(String(active.id));
955
+ const to = ids.indexOf(String(over.id));
956
+ if (from === -1 || to === -1) return;
957
+ patchDefinition((steps) => reorderByIds(steps, arrayMove(ids, from, to)));
958
+ return;
959
+ }
960
+ if (kind === "field") {
961
+ patchDefinition((steps) => relocateField(steps, String(active.id), String(over.id)));
962
+ }
963
+ },
964
+ children: /* @__PURE__ */ jsx(SortableGroup, { ids: definition.steps.map((s) => s.id), children: definition.steps.map((step, stepIndex) => /* @__PURE__ */ jsx(
877
965
  SortableItem,
878
966
  {
879
967
  id: step.id,
968
+ data: { type: "step" },
880
969
  children: (stepHandle) => /* @__PURE__ */ jsxs(
881
970
  Box,
882
971
  {
@@ -952,95 +1041,89 @@ const FormEditor = () => {
952
1041
  ] })
953
1042
  ] }),
954
1043
  /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 2, children: [
955
- /* @__PURE__ */ jsx(
956
- SortableList,
957
- {
958
- ids: step.fields.map((f) => f.id),
959
- onReorder: (ids) => patchStep(step.id, { fields: reorderByIds(step.fields, ids) }),
960
- children: step.fields.map((field, fieldIndex) => {
961
- const flags = fieldFlags(field.id);
962
- const isSelected = selection.kind === "field" && selection.fieldId === field.id;
963
- return /* @__PURE__ */ jsx(
964
- SortableItem,
1044
+ /* @__PURE__ */ jsx(SortableContainer, { stepId: step.id, children: /* @__PURE__ */ jsx(SortableGroup, { ids: step.fields.map((f) => f.id), children: step.fields.map((field, fieldIndex) => {
1045
+ const flags = fieldFlags(field.id);
1046
+ const isSelected = selection.kind === "field" && selection.fieldId === field.id;
1047
+ return /* @__PURE__ */ jsx(
1048
+ SortableItem,
1049
+ {
1050
+ id: field.id,
1051
+ data: { type: "field", stepId: step.id },
1052
+ children: (fieldHandle) => /* @__PURE__ */ jsx(
1053
+ Box,
965
1054
  {
966
- id: field.id,
967
- children: (fieldHandle) => /* @__PURE__ */ jsx(
968
- Box,
969
- {
970
- background: isSelected ? "primary100" : "neutral100",
971
- hasRadius: true,
972
- padding: 3,
973
- onClick: (e) => {
974
- e.stopPropagation();
975
- setSelection({ kind: "field", fieldId: field.id });
976
- },
977
- style: { cursor: "pointer" },
978
- children: /* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", alignItems: "center", children: [
979
- /* @__PURE__ */ jsxs(Flex, { gap: 2, alignItems: "center", wrap: "wrap", children: [
980
- /* @__PURE__ */ jsx(
981
- "span",
982
- {
983
- ...fieldHandle.attributes,
984
- ...fieldHandle.listeners,
985
- onClick: (e) => e.stopPropagation(),
986
- style: { cursor: "grab", display: "inline-flex" },
987
- "aria-label": t("editor.drag-field", "Drag to reorder the field"),
988
- children: /* @__PURE__ */ jsx(Drag, {})
989
- }
990
- ),
991
- /* @__PURE__ */ jsx(Typography, { fontWeight: "semiBold", children: field.label || field.name || "—" }),
992
- /* @__PURE__ */ jsx(Badge, { children: field.type }),
993
- field.required && /* @__PURE__ */ jsx(Badge, { backgroundColor: "neutral150", textColor: "neutral600", children: t("editor.required", "required") }),
994
- field.hubspot?.property && /* @__PURE__ */ jsxs(Badge, { backgroundColor: "primary100", textColor: "primary700", children: [
995
- field.hubspot.object ?? "contact",
996
- ".",
997
- field.hubspot.property
998
- ] }),
999
- field.visibleIf?.rules?.length ? /* @__PURE__ */ jsx(Badge, { backgroundColor: "alternative100", textColor: "alternative700", children: t("editor.conditional", "Conditional") }) : null,
1000
- (flags.error || flags.problem) && /* @__PURE__ */ jsx(Badge, { backgroundColor: "danger100", textColor: "danger700", children: flags.error?.code ?? flags.problem?.code })
1001
- ] }),
1002
- /* @__PURE__ */ jsxs(Flex, { gap: 1, onClick: (e) => e.stopPropagation(), children: [
1003
- /* @__PURE__ */ jsx(
1004
- IconButton,
1005
- {
1006
- label: t("editor.field-up", "Move up"),
1007
- onClick: () => moveField(stepIndex, fieldIndex, -1),
1008
- disabled: stepIndex === 0 && fieldIndex === 0,
1009
- children: /* @__PURE__ */ jsx(ArrowUp, {})
1010
- }
1011
- ),
1012
- /* @__PURE__ */ jsx(
1013
- IconButton,
1014
- {
1015
- label: t("editor.field-down", "Move down"),
1016
- onClick: () => moveField(stepIndex, fieldIndex, 1),
1017
- disabled: stepIndex === definition.steps.length - 1 && fieldIndex === step.fields.length - 1,
1018
- children: /* @__PURE__ */ jsx(ArrowDown, {})
1019
- }
1020
- ),
1021
- /* @__PURE__ */ jsx(
1022
- IconButton,
1023
- {
1024
- label: t("editor.field-delete", "Delete the field"),
1025
- onClick: () => {
1026
- setSelection({ kind: "form" });
1027
- patchStep(step.id, {
1028
- fields: step.fields.filter((f) => f.id !== field.id)
1029
- });
1030
- },
1031
- children: /* @__PURE__ */ jsx(Trash, {})
1032
- }
1033
- )
1034
- ] })
1035
- ] })
1036
- }
1037
- )
1038
- },
1039
- field.id
1040
- );
1041
- })
1042
- }
1043
- ),
1055
+ background: isSelected ? "primary100" : "neutral100",
1056
+ hasRadius: true,
1057
+ padding: 3,
1058
+ onClick: (e) => {
1059
+ e.stopPropagation();
1060
+ setSelection({ kind: "field", fieldId: field.id });
1061
+ },
1062
+ style: { cursor: "pointer" },
1063
+ children: /* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", alignItems: "center", children: [
1064
+ /* @__PURE__ */ jsxs(Flex, { gap: 2, alignItems: "center", wrap: "wrap", children: [
1065
+ /* @__PURE__ */ jsx(
1066
+ "span",
1067
+ {
1068
+ ...fieldHandle.attributes,
1069
+ ...fieldHandle.listeners,
1070
+ onClick: (e) => e.stopPropagation(),
1071
+ style: { cursor: "grab", display: "inline-flex" },
1072
+ "aria-label": t("editor.drag-field", "Drag to move the field, including to another step"),
1073
+ children: /* @__PURE__ */ jsx(Drag, {})
1074
+ }
1075
+ ),
1076
+ /* @__PURE__ */ jsx(Typography, { fontWeight: "semiBold", children: field.label || field.name || "—" }),
1077
+ /* @__PURE__ */ jsx(Badge, { children: field.type }),
1078
+ field.required && /* @__PURE__ */ jsx(Badge, { backgroundColor: "neutral150", textColor: "neutral600", children: t("editor.required", "required") }),
1079
+ field.hubspot?.property && /* @__PURE__ */ jsxs(Badge, { backgroundColor: "primary100", textColor: "primary700", children: [
1080
+ field.hubspot.object ?? "contact",
1081
+ ".",
1082
+ field.hubspot.property
1083
+ ] }),
1084
+ field.visibleIf?.rules?.length ? /* @__PURE__ */ jsx(Badge, { backgroundColor: "alternative100", textColor: "alternative700", children: t("editor.conditional", "Conditional") }) : null,
1085
+ (flags.error || flags.problem) && /* @__PURE__ */ jsx(Badge, { backgroundColor: "danger100", textColor: "danger700", children: flags.error?.code ?? flags.problem?.code })
1086
+ ] }),
1087
+ /* @__PURE__ */ jsxs(Flex, { gap: 1, onClick: (e) => e.stopPropagation(), children: [
1088
+ /* @__PURE__ */ jsx(
1089
+ IconButton,
1090
+ {
1091
+ label: t("editor.field-up", "Move up"),
1092
+ onClick: () => moveField(stepIndex, fieldIndex, -1),
1093
+ disabled: stepIndex === 0 && fieldIndex === 0,
1094
+ children: /* @__PURE__ */ jsx(ArrowUp, {})
1095
+ }
1096
+ ),
1097
+ /* @__PURE__ */ jsx(
1098
+ IconButton,
1099
+ {
1100
+ label: t("editor.field-down", "Move down"),
1101
+ onClick: () => moveField(stepIndex, fieldIndex, 1),
1102
+ disabled: stepIndex === definition.steps.length - 1 && fieldIndex === step.fields.length - 1,
1103
+ children: /* @__PURE__ */ jsx(ArrowDown, {})
1104
+ }
1105
+ ),
1106
+ /* @__PURE__ */ jsx(
1107
+ IconButton,
1108
+ {
1109
+ label: t("editor.field-delete", "Delete the field"),
1110
+ onClick: () => {
1111
+ setSelection({ kind: "form" });
1112
+ patchStep(step.id, {
1113
+ fields: step.fields.filter((f) => f.id !== field.id)
1114
+ });
1115
+ },
1116
+ children: /* @__PURE__ */ jsx(Trash, {})
1117
+ }
1118
+ )
1119
+ ] })
1120
+ ] })
1121
+ }
1122
+ )
1123
+ },
1124
+ field.id
1125
+ );
1126
+ }) }) }),
1044
1127
  /* @__PURE__ */ jsx(
1045
1128
  Button,
1046
1129
  {
@@ -1061,7 +1144,7 @@ const FormEditor = () => {
1061
1144
  )
1062
1145
  },
1063
1146
  step.id
1064
- ))
1147
+ )) })
1065
1148
  }
1066
1149
  ),
1067
1150
  /* @__PURE__ */ jsx(
@@ -5,7 +5,7 @@ const React = require("react");
5
5
  const index = require("./index-DkTxsEqL.js");
6
6
  const designSystem = require("@strapi/design-system");
7
7
  const admin = require("@strapi/strapi/admin");
8
- const index$1 = require("./index-CodpLKZx.js");
8
+ const index$1 = require("./index-ciliGv0E.js");
9
9
  function _interopNamespace(e) {
10
10
  if (e && e.__esModule) return e;
11
11
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
@@ -3,7 +3,7 @@ import * as React from "react";
3
3
  import { u as useIntl } from "./index-CEh8vkxY.mjs";
4
4
  import { Field, Flex, Loader, Combobox, ComboboxOption } from "@strapi/design-system";
5
5
  import { useFetchClient } from "@strapi/strapi/admin";
6
- import { P as PLUGIN_ID, g as getTranslation } from "./index-7cL9PRh1.mjs";
6
+ import { P as PLUGIN_ID, g as getTranslation } from "./index-gKM4jVf8.mjs";
7
7
  const HubspotFormInput = React.forwardRef(
8
8
  ({ name, value, onChange, disabled, error, required, label, hint, labelAction }, ref) => {
9
9
  const { formatMessage } = useIntl();
@@ -4,9 +4,9 @@ const jsxRuntime = require("react/jsx-runtime");
4
4
  const React = require("react");
5
5
  const index = require("./index-DkTxsEqL.js");
6
6
  const designSystem = require("@strapi/design-system");
7
- const index$1 = require("./index-CodpLKZx.js");
8
- const objectLabels = require("./objectLabels-CSWGIgNb.js");
9
- const useHubspotSchema = require("./useHubspotSchema-DiRN3HrN.js");
7
+ const index$1 = require("./index-ciliGv0E.js");
8
+ const objectLabels = require("./objectLabels-BjYfdhRB.js");
9
+ const useHubspotSchema = require("./useHubspotSchema-KKVppjC2.js");
10
10
  function _interopNamespace(e) {
11
11
  if (e && e.__esModule) return e;
12
12
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
@@ -2,9 +2,9 @@ import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import * as React from "react";
3
3
  import { u as useIntl } from "./index-CEh8vkxY.mjs";
4
4
  import { Field, Flex, Loader, SingleSelect, SingleSelectOption } from "@strapi/design-system";
5
- import { g as getTranslation } from "./index-7cL9PRh1.mjs";
6
- import { o as objectLabel } from "./objectLabels-Dnj14fsp.mjs";
7
- import { u as useHubspotSchema } from "./useHubspotSchema-BsmQgJgx.mjs";
5
+ import { g as getTranslation } from "./index-gKM4jVf8.mjs";
6
+ import { o as objectLabel } from "./objectLabels-DQpSLUaJ.mjs";
7
+ import { u as useHubspotSchema } from "./useHubspotSchema-CE7tJgOM.mjs";
8
8
  const HubspotObjectInput = React.forwardRef(
9
9
  ({ name, value, onChange, disabled, error, required, label, hint, labelAction }, ref) => {
10
10
  const intl = useIntl();
@@ -6,9 +6,9 @@ const index = require("./index-DkTxsEqL.js");
6
6
  const designSystem = require("@strapi/design-system");
7
7
  const icons = require("@strapi/icons");
8
8
  const admin = require("@strapi/strapi/admin");
9
- const index$1 = require("./index-CodpLKZx.js");
10
- const objectLabels = require("./objectLabels-CSWGIgNb.js");
11
- const useHubspotSchema = require("./useHubspotSchema-DiRN3HrN.js");
9
+ const index$1 = require("./index-ciliGv0E.js");
10
+ const objectLabels = require("./objectLabels-BjYfdhRB.js");
11
+ const useHubspotSchema = require("./useHubspotSchema-KKVppjC2.js");
12
12
  function _interopNamespace(e) {
13
13
  if (e && e.__esModule) return e;
14
14
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
@@ -4,9 +4,9 @@ import { u as useIntl } from "./index-CEh8vkxY.mjs";
4
4
  import { Field, Flex, Loader, Combobox, ComboboxOption, IconButton, Button, Typography, Link } from "@strapi/design-system";
5
5
  import { ArrowClockwise } from "@strapi/icons";
6
6
  import { useField } from "@strapi/strapi/admin";
7
- import { g as getTranslation } from "./index-7cL9PRh1.mjs";
8
- import { o as objectLabel } from "./objectLabels-Dnj14fsp.mjs";
9
- import { u as useHubspotSchema } from "./useHubspotSchema-BsmQgJgx.mjs";
7
+ import { g as getTranslation } from "./index-gKM4jVf8.mjs";
8
+ import { o as objectLabel } from "./objectLabels-DQpSLUaJ.mjs";
9
+ import { u as useHubspotSchema } from "./useHubspotSchema-CE7tJgOM.mjs";
10
10
  const oneLine = {
11
11
  display: "block",
12
12
  whiteSpace: "nowrap",
@@ -3,9 +3,9 @@ import * as React from "react";
3
3
  import { u as useIntl } from "./index-CEh8vkxY.mjs";
4
4
  import { Flex, Divider, Typography, Button, Box, Link, Badge, Loader, Field, SingleSelect, SingleSelectOption, Checkbox } from "@strapi/design-system";
5
5
  import { useFetchClient } from "@strapi/strapi/admin";
6
- import { g as getTranslation, P as PLUGIN_ID } from "./index-7cL9PRh1.mjs";
6
+ import { g as getTranslation, P as PLUGIN_ID } from "./index-gKM4jVf8.mjs";
7
7
  import { Link as Link$1 } from "react-router-dom";
8
- import { o as objectLabel } from "./objectLabels-Dnj14fsp.mjs";
8
+ import { o as objectLabel } from "./objectLabels-DQpSLUaJ.mjs";
9
9
  const AuditSection = ({ configured }) => {
10
10
  const intl = useIntl();
11
11
  const { formatMessage } = intl;
@@ -5,9 +5,9 @@ const React = require("react");
5
5
  const index = require("./index-DkTxsEqL.js");
6
6
  const designSystem = require("@strapi/design-system");
7
7
  const admin = require("@strapi/strapi/admin");
8
- const index$1 = require("./index-CodpLKZx.js");
8
+ const index$1 = require("./index-ciliGv0E.js");
9
9
  const reactRouterDom = require("react-router-dom");
10
- const objectLabels = require("./objectLabels-CSWGIgNb.js");
10
+ const objectLabels = require("./objectLabels-BjYfdhRB.js");
11
11
  function _interopNamespace(e) {
12
12
  if (e && e.__esModule) return e;
13
13
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
@@ -297,6 +297,6 @@ const en = {
297
297
  "company.datum.nafLabel": "NAF label",
298
298
  "company.datum.headcount": "Headcount range",
299
299
  "editor.drag-step": "Drag to reorder the step",
300
- "editor.drag-field": "Drag to reorder the field"
300
+ "editor.drag-field": "Drag to move the field, including to another step"
301
301
  };
302
302
  exports.default = en;
@@ -295,7 +295,7 @@ const en = {
295
295
  "company.datum.nafLabel": "NAF label",
296
296
  "company.datum.headcount": "Headcount range",
297
297
  "editor.drag-step": "Drag to reorder the step",
298
- "editor.drag-field": "Drag to reorder the field"
298
+ "editor.drag-field": "Drag to move the field, including to another step"
299
299
  };
300
300
  export {
301
301
  en as default
@@ -297,6 +297,6 @@ const fr = {
297
297
  "company.datum.nafLabel": "Libellé NAF",
298
298
  "company.datum.headcount": "Tranche d'effectif",
299
299
  "editor.drag-step": "Glisser pour réordonner l'étape",
300
- "editor.drag-field": "Glisser pour réordonner le champ"
300
+ "editor.drag-field": "Glisser pour déplacer le champ, y compris vers une autre étape"
301
301
  };
302
302
  exports.default = fr;
@@ -295,7 +295,7 @@ const fr = {
295
295
  "company.datum.nafLabel": "Libellé NAF",
296
296
  "company.datum.headcount": "Tranche d'effectif",
297
297
  "editor.drag-step": "Glisser pour réordonner l'étape",
298
- "editor.drag-field": "Glisser pour réordonner le champ"
298
+ "editor.drag-field": "Glisser pour déplacer le champ, y compris vers une autre étape"
299
299
  };
300
300
  export {
301
301
  fr as default
@@ -26,7 +26,7 @@ const index = {
26
26
  icon: icons.PaperPlane,
27
27
  intlLabel: { id: `${PLUGIN_ID}.menu.label`, defaultMessage: "HubSpot Forms" },
28
28
  permissions: [{ action: `plugin::${PLUGIN_ID}.forms`, subject: null }],
29
- Component: async () => (await Promise.resolve().then(() => require("./Forms-BW_zGc1P.js"))).default
29
+ Component: async () => (await Promise.resolve().then(() => require("./Forms-D0QXkYAN.js"))).default
30
30
  });
31
31
  app.customFields.register({
32
32
  name: "property",
@@ -41,7 +41,7 @@ const index = {
41
41
  defaultMessage: "Picked from the portal's real properties"
42
42
  },
43
43
  components: {
44
- Input: async () => Promise.resolve().then(() => require("./HubspotPropertyInput-luFfnxqy.js"))
44
+ Input: async () => Promise.resolve().then(() => require("./HubspotPropertyInput-2MgIKlR_.js"))
45
45
  },
46
46
  // Exposed in the Content-Type Builder. Without this, `objectField` could
47
47
  // only be set by hand-editing schema.json — which is not how anyone
@@ -104,7 +104,7 @@ const index = {
104
104
  defaultMessage: "Picked from the portal's configured objects"
105
105
  },
106
106
  components: {
107
- Input: async () => Promise.resolve().then(() => require("./HubspotObjectInput-Bmo6YQgs.js"))
107
+ Input: async () => Promise.resolve().then(() => require("./HubspotObjectInput-BTqYXJIa.js"))
108
108
  }
109
109
  });
110
110
  app.customFields.register({
@@ -120,7 +120,7 @@ const index = {
120
120
  defaultMessage: "A form built in the HubSpot form builder, stored by slug"
121
121
  },
122
122
  components: {
123
- Input: async () => Promise.resolve().then(() => require("./HubspotFormInput-oMhm1UJm.js"))
123
+ Input: async () => Promise.resolve().then(() => require("./HubspotFormInput-4ZMYXWM_.js"))
124
124
  }
125
125
  });
126
126
  app.createSettingSection(
@@ -136,7 +136,7 @@ const index = {
136
136
  // Mirrors the RBAC action registered server-side: a role without it
137
137
  // doesn't see the link at all — the routes refuse it anyway.
138
138
  permissions: [{ action: `plugin::${PLUGIN_ID}.settings`, subject: null }],
139
- Component: async () => (await Promise.resolve().then(() => require("./Settings-B3A22i7Z.js"))).default
139
+ Component: async () => (await Promise.resolve().then(() => require("./Settings-DhiHQC6U.js"))).default
140
140
  }
141
141
  ]
142
142
  );
@@ -146,7 +146,7 @@ const index = {
146
146
  return Promise.all(
147
147
  locales.map(async (locale) => {
148
148
  try {
149
- const { default: data } = await __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => Promise.resolve().then(() => require("./en-C7ls2EUl.js")), "./translations/fr.json": () => Promise.resolve().then(() => require("./fr-pOP8ZXqM.js")) }), `./translations/${locale}.json`, 3);
149
+ const { default: data } = await __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => Promise.resolve().then(() => require("./en-CSgFmKmM.js")), "./translations/fr.json": () => Promise.resolve().then(() => require("./fr-D_EhZS0P.js")) }), `./translations/${locale}.json`, 3);
150
150
  return { data: prefixPluginTranslations(data), locale };
151
151
  } catch {
152
152
  return { data: {}, locale };
@@ -25,7 +25,7 @@ const index = {
25
25
  icon: PaperPlane,
26
26
  intlLabel: { id: `${PLUGIN_ID}.menu.label`, defaultMessage: "HubSpot Forms" },
27
27
  permissions: [{ action: `plugin::${PLUGIN_ID}.forms`, subject: null }],
28
- Component: async () => (await import("./Forms-6EoEYzAc.mjs")).default
28
+ Component: async () => (await import("./Forms-DEoZGrEt.mjs")).default
29
29
  });
30
30
  app.customFields.register({
31
31
  name: "property",
@@ -40,7 +40,7 @@ const index = {
40
40
  defaultMessage: "Picked from the portal's real properties"
41
41
  },
42
42
  components: {
43
- Input: async () => import("./HubspotPropertyInput-CrYP4pc0.mjs")
43
+ Input: async () => import("./HubspotPropertyInput-ClNph0f1.mjs")
44
44
  },
45
45
  // Exposed in the Content-Type Builder. Without this, `objectField` could
46
46
  // only be set by hand-editing schema.json — which is not how anyone
@@ -103,7 +103,7 @@ const index = {
103
103
  defaultMessage: "Picked from the portal's configured objects"
104
104
  },
105
105
  components: {
106
- Input: async () => import("./HubspotObjectInput-DhsnSguG.mjs")
106
+ Input: async () => import("./HubspotObjectInput-CQszIx1W.mjs")
107
107
  }
108
108
  });
109
109
  app.customFields.register({
@@ -119,7 +119,7 @@ const index = {
119
119
  defaultMessage: "A form built in the HubSpot form builder, stored by slug"
120
120
  },
121
121
  components: {
122
- Input: async () => import("./HubspotFormInput-V5w4y1fb.mjs")
122
+ Input: async () => import("./HubspotFormInput-CPep55GL.mjs")
123
123
  }
124
124
  });
125
125
  app.createSettingSection(
@@ -135,7 +135,7 @@ const index = {
135
135
  // Mirrors the RBAC action registered server-side: a role without it
136
136
  // doesn't see the link at all — the routes refuse it anyway.
137
137
  permissions: [{ action: `plugin::${PLUGIN_ID}.settings`, subject: null }],
138
- Component: async () => (await import("./Settings-CjcWj9I6.mjs")).default
138
+ Component: async () => (await import("./Settings-CZ-qQSKT.mjs")).default
139
139
  }
140
140
  ]
141
141
  );
@@ -145,7 +145,7 @@ const index = {
145
145
  return Promise.all(
146
146
  locales.map(async (locale) => {
147
147
  try {
148
- const { default: data } = await __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => import("./en-D6GHgMOt.mjs"), "./translations/fr.json": () => import("./fr-CfohMY8n.mjs") }), `./translations/${locale}.json`, 3);
148
+ const { default: data } = await __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => import("./en-Dh3bMS6N.mjs"), "./translations/fr.json": () => import("./fr-aWOIOlS9.mjs") }), `./translations/${locale}.json`, 3);
149
149
  return { data: prefixPluginTranslations(data), locale };
150
150
  } catch {
151
151
  return { data: {}, locale };
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const index = require("./index-CodpLKZx.js");
2
+ const index = require("./index-ciliGv0E.js");
3
3
  const STANDARD = /* @__PURE__ */ new Set([
4
4
  "contact",
5
5
  "company",
@@ -1,4 +1,4 @@
1
- import { g as getTranslation } from "./index-7cL9PRh1.mjs";
1
+ import { g as getTranslation } from "./index-gKM4jVf8.mjs";
2
2
  const STANDARD = /* @__PURE__ */ new Set([
3
3
  "contact",
4
4
  "company",
@@ -1,6 +1,6 @@
1
1
  import * as React from "react";
2
2
  import { useFetchClient } from "@strapi/strapi/admin";
3
- import { P as PLUGIN_ID } from "./index-7cL9PRh1.mjs";
3
+ import { P as PLUGIN_ID } from "./index-gKM4jVf8.mjs";
4
4
  let cached = null;
5
5
  let inFlight = null;
6
6
  const listeners = /* @__PURE__ */ new Set();
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  const React = require("react");
3
3
  const admin = require("@strapi/strapi/admin");
4
- const index = require("./index-CodpLKZx.js");
4
+ const index = require("./index-ciliGv0E.js");
5
5
  function _interopNamespace(e) {
6
6
  if (e && e.__esModule) return e;
7
7
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
- const index = require("../_chunks/index-CodpLKZx.js");
2
+ const index = require("../_chunks/index-ciliGv0E.js");
3
3
  require("@strapi/icons");
4
4
  module.exports = index.index;
@@ -1,4 +1,4 @@
1
- import { i } from "../_chunks/index-7cL9PRh1.mjs";
1
+ import { i } from "../_chunks/index-gKM4jVf8.mjs";
2
2
  import "@strapi/icons";
3
3
  export {
4
4
  i as default
@@ -1,25 +1,38 @@
1
1
  import * as React from "react";
2
- import { arrayMove } from "@dnd-kit/sortable";
3
- export { arrayMove };
2
+ import { type DragEndEvent } from "@dnd-kit/core";
3
+ import { arrayMove, relocateField } from "./relocateField";
4
+ export { arrayMove, relocateField };
5
+ export type { DragEndEvent };
4
6
  /** The drag-handle props to spread on the grip element. */
5
7
  export interface HandleProps {
6
8
  attributes: React.HTMLAttributes<HTMLElement>;
7
9
  listeners: Record<string, unknown> | undefined;
8
10
  }
9
- /**
10
- * One vertical sortable list. Each list gets its OWN DndContext: steps sort
11
- * among steps, a step's fields sort among themselves — no cross-container
12
- * ambiguity, and the arrow buttons keep covering cross-step moves (they also
13
- * stay the accessible path).
14
- */
15
- export declare function SortableList({ ids, onReorder, children, }: {
11
+ export type SortableData = {
12
+ type: "step";
13
+ } | {
14
+ type: "field";
15
+ stepId: string;
16
+ } | {
17
+ type: "container";
18
+ stepId: string;
19
+ };
20
+ export declare function SortableBoard({ children, onDragEnd, }: {
21
+ children: React.ReactNode;
22
+ onDragEnd: (event: DragEndEvent) => void;
23
+ }): React.JSX.Element;
24
+ export declare function SortableGroup({ ids, children, }: {
16
25
  ids: string[];
17
- /** Called with the reordered ids after a completed drag. */
18
- onReorder: (ids: string[]) => void;
26
+ children: React.ReactNode;
27
+ }): React.JSX.Element;
28
+ /** Drop target for a step's field list — including when the list is empty. */
29
+ export declare function SortableContainer({ stepId, children, }: {
30
+ stepId: string;
19
31
  children: React.ReactNode;
20
32
  }): React.JSX.Element;
21
33
  /** A sortable row: wraps the card, hands the grip props to its children. */
22
- export declare function SortableItem({ id, children, }: {
34
+ export declare function SortableItem({ id, data, children, }: {
23
35
  id: string;
36
+ data?: SortableData;
24
37
  children: (handle: HandleProps) => React.ReactNode;
25
38
  }): React.JSX.Element;
@@ -0,0 +1,14 @@
1
+ import { arrayMove } from "@dnd-kit/sortable";
2
+ export { arrayMove };
3
+ /**
4
+ * Move `fieldId` onto `overId` across steps.
5
+ *
6
+ * `overId` is another field (insert at that index), a step id (append),
7
+ * or `container:${stepId}` (the empty-area droppable of that step).
8
+ */
9
+ export declare function relocateField<S extends {
10
+ id: string;
11
+ fields: F[];
12
+ }, F extends {
13
+ id: string;
14
+ }>(steps: S[], fieldId: string, overId: string): S[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "strapi-plugin-hubspot",
3
- "version": "0.16.0",
3
+ "version": "0.16.1",
4
4
  "description": "The form builder for HubSpot in Strapi — multi-step forms with conditional fields mapped to real CRM properties, a public submit pipeline with retries, and save-time mapping validation.",
5
5
  "keywords": [
6
6
  "strapi",