strapi-plugin-hubspot 0.7.0 → 0.9.0
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/CHANGELOG.md +38 -0
- package/README.md +28 -0
- package/dist/_chunks/{Forms-CKA6ukB6.mjs → Forms-BsKys-Hc.mjs} +404 -42
- package/dist/_chunks/{Forms-HMZbTk_B.js → Forms-JuzNfsbL.js} +401 -39
- package/dist/_chunks/{HubspotFormInput-CKYRcNNU.mjs → HubspotFormInput-CIvHS5rp.mjs} +1 -1
- package/dist/_chunks/{HubspotFormInput-BequMb12.js → HubspotFormInput-ph9pe6xY.js} +1 -1
- package/dist/_chunks/{HubspotObjectInput-V3uhGK8k.mjs → HubspotObjectInput-BX1qYD2c.mjs} +3 -3
- package/dist/_chunks/{HubspotObjectInput-D-FGwsyS.js → HubspotObjectInput-dAd-lMdD.js} +3 -3
- package/dist/_chunks/{HubspotPropertyInput-Dn1QvOcu.js → HubspotPropertyInput-BM3ZaY8f.js} +3 -3
- package/dist/_chunks/{HubspotPropertyInput-DrBsx9jQ.mjs → HubspotPropertyInput-C2Z6472q.mjs} +3 -3
- package/dist/_chunks/{Settings-Cgp7M1Cv.js → Settings-Cdcjy9DA.js} +2 -2
- package/dist/_chunks/{Settings-BjkNbyna.mjs → Settings-DnwGetcc.mjs} +2 -2
- package/dist/_chunks/{en-Cun5LoUP.mjs → en-CcQWnXra.mjs} +50 -3
- package/dist/_chunks/{en-D5Ch9YFo.js → en-Cqfair98.js} +50 -3
- package/dist/_chunks/{fr-ClOWflse.mjs → fr-CBRZ9q8U.mjs} +50 -3
- package/dist/_chunks/{fr-CqlhHltZ.js → fr-D117-3Ta.js} +50 -3
- package/dist/_chunks/{index-D2Q34BuH.js → index-BbRtXnAL.js} +6 -6
- package/dist/_chunks/{index-FKsiOEPB.mjs → index-LTaVoyWJ.mjs} +6 -6
- package/dist/_chunks/{objectLabels-DBKevJle.mjs → objectLabels-DE2xGq7f.mjs} +1 -1
- package/dist/_chunks/{objectLabels-LAQ0M6-a.js → objectLabels-DU0Cagt_.js} +1 -1
- package/dist/_chunks/{useHubspotSchema-BC0Od-Wl.mjs → useHubspotSchema-BSKow0X3.mjs} +1 -1
- package/dist/_chunks/{useHubspotSchema-C08qBAyy.js → useHubspotSchema-DzBMAxv7.js} +1 -1
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/src/builder/types.d.ts +26 -0
- package/dist/admin/src/pages/Forms.d.ts +5 -1
- package/dist/admin/src/pages/Submissions.d.ts +8 -0
- package/dist/server/index.js +396 -21
- package/dist/server/index.mjs +396 -21
- package/dist/server/src/__tests__/importHubspot.test.d.ts +1 -0
- package/dist/server/src/__tests__/submissions.test.d.ts +1 -0
- package/dist/server/src/content-types.d.ts +3 -0
- package/dist/server/src/forms.d.ts +2 -0
- package/dist/server/src/formsAdmin.d.ts +19 -0
- package/dist/server/src/importHubspot.d.ts +85 -0
- package/dist/server/src/importLegacy.d.ts +1 -0
- package/dist/server/src/index.d.ts +32 -1
- package/dist/server/src/submissions.d.ts +28 -0
- package/dist/shared/types.d.ts +2 -0
- package/package.json +2 -2
|
@@ -7,9 +7,9 @@ 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-
|
|
11
|
-
const objectLabels = require("./objectLabels-
|
|
12
|
-
const useHubspotSchema = require("./useHubspotSchema-
|
|
10
|
+
const index$1 = require("./index-BbRtXnAL.js");
|
|
11
|
+
const objectLabels = require("./objectLabels-DU0Cagt_.js");
|
|
12
|
+
const useHubspotSchema = require("./useHubspotSchema-DzBMAxv7.js");
|
|
13
13
|
function _interopNamespace(e) {
|
|
14
14
|
if (e && e.__esModule) return e;
|
|
15
15
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
@@ -244,6 +244,43 @@ const FieldPanel = ({ field, candidates, problem, onChange }) => {
|
|
|
244
244
|
children: t("panel.required", "Required")
|
|
245
245
|
}
|
|
246
246
|
),
|
|
247
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 4, children: [
|
|
248
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { flex: "1", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { children: [
|
|
249
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: t("panel.icon", "Icon") }),
|
|
250
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
251
|
+
designSystem.TextInput,
|
|
252
|
+
{
|
|
253
|
+
value: field.icon ?? "",
|
|
254
|
+
placeholder: "i-lucide-building-2",
|
|
255
|
+
onChange: (e) => onChange({ icon: e.target.value })
|
|
256
|
+
}
|
|
257
|
+
)
|
|
258
|
+
] }) }),
|
|
259
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { flex: "1", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { children: [
|
|
260
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: t("panel.persist", "Answer memory") }),
|
|
261
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
262
|
+
designSystem.SingleSelect,
|
|
263
|
+
{
|
|
264
|
+
value: field.persist ?? "session",
|
|
265
|
+
onChange: (v) => onChange({ persist: v }),
|
|
266
|
+
children: [
|
|
267
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "session", children: t("panel.persist-session", "This visit only") }),
|
|
268
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "days30", children: t("panel.persist-days30", "30 days (non-identifying fields only)") })
|
|
269
|
+
]
|
|
270
|
+
}
|
|
271
|
+
)
|
|
272
|
+
] }) })
|
|
273
|
+
] }),
|
|
274
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { children: [
|
|
275
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: t("panel.class", "CSS classes") }),
|
|
276
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
277
|
+
designSystem.TextInput,
|
|
278
|
+
{
|
|
279
|
+
value: field.class ?? "",
|
|
280
|
+
onChange: (e) => onChange({ class: e.target.value })
|
|
281
|
+
}
|
|
282
|
+
)
|
|
283
|
+
] }),
|
|
247
284
|
isChoice && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 2, children: [
|
|
248
285
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", textColor: "neutral600", children: t("panel.options", "Choices") }),
|
|
249
286
|
(field.options ?? []).map((option, index2) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
@@ -390,6 +427,14 @@ const FormEditor = () => {
|
|
|
390
427
|
const [feedback, setFeedback] = React__namespace.useState(null);
|
|
391
428
|
const t = (id, defaultMessage, values) => formatMessage({ id: index$1.getTranslation(id), defaultMessage }, values);
|
|
392
429
|
const query = locale ? `?locale=${locale}` : "";
|
|
430
|
+
React__namespace.useEffect(() => {
|
|
431
|
+
if (!dirty) return void 0;
|
|
432
|
+
const warn = (event) => {
|
|
433
|
+
event.preventDefault();
|
|
434
|
+
};
|
|
435
|
+
window.addEventListener("beforeunload", warn);
|
|
436
|
+
return () => window.removeEventListener("beforeunload", warn);
|
|
437
|
+
}, [dirty]);
|
|
393
438
|
React__namespace.useEffect(() => {
|
|
394
439
|
get("/i18n/locales").then(({ data }) => Array.isArray(data) && setLocales(data)).catch(() => setLocales([]));
|
|
395
440
|
}, [get]);
|
|
@@ -482,6 +527,7 @@ const FormEditor = () => {
|
|
|
482
527
|
nextLabel: entry.nextLabel,
|
|
483
528
|
submitLabel: entry.submitLabel,
|
|
484
529
|
successMessage: entry.successMessage,
|
|
530
|
+
class: entry.class,
|
|
485
531
|
definition
|
|
486
532
|
}
|
|
487
533
|
);
|
|
@@ -587,6 +633,8 @@ const FormEditor = () => {
|
|
|
587
633
|
hasRadius: true,
|
|
588
634
|
shadow: "tableShadow",
|
|
589
635
|
padding: 4,
|
|
636
|
+
onClick: () => setSelection({ kind: "step", stepId: step.id }),
|
|
637
|
+
style: { cursor: "pointer" },
|
|
590
638
|
borderColor: selection.kind === "step" && selection.stepId === step.id ? "primary600" : void 0,
|
|
591
639
|
borderStyle: selection.kind === "step" && selection.stepId === step.id ? "solid" : void 0,
|
|
592
640
|
borderWidth: selection.kind === "step" && selection.stepId === step.id ? "1px" : void 0,
|
|
@@ -609,7 +657,7 @@ const FormEditor = () => {
|
|
|
609
657
|
]
|
|
610
658
|
}
|
|
611
659
|
),
|
|
612
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 1, children: [
|
|
660
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 1, onClick: (e) => e.stopPropagation(), children: [
|
|
613
661
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
614
662
|
designSystem.IconButton,
|
|
615
663
|
{
|
|
@@ -651,7 +699,10 @@ const FormEditor = () => {
|
|
|
651
699
|
background: isSelected ? "primary100" : "neutral100",
|
|
652
700
|
hasRadius: true,
|
|
653
701
|
padding: 3,
|
|
654
|
-
onClick: () =>
|
|
702
|
+
onClick: (e) => {
|
|
703
|
+
e.stopPropagation();
|
|
704
|
+
setSelection({ kind: "field", fieldId: field.id });
|
|
705
|
+
},
|
|
655
706
|
style: { cursor: "pointer" },
|
|
656
707
|
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", alignItems: "center", children: [
|
|
657
708
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, alignItems: "center", wrap: "wrap", children: [
|
|
@@ -709,7 +760,8 @@ const FormEditor = () => {
|
|
|
709
760
|
{
|
|
710
761
|
variant: "tertiary",
|
|
711
762
|
startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Plus, {}),
|
|
712
|
-
onClick: () => {
|
|
763
|
+
onClick: (e) => {
|
|
764
|
+
e.stopPropagation();
|
|
713
765
|
const field = newField(t("editor.new-field", "New field"));
|
|
714
766
|
patchStep(step.id, { fields: [...step.fields, field] });
|
|
715
767
|
setSelection({ kind: "field", fieldId: field.id });
|
|
@@ -766,6 +818,16 @@ const FormEditor = () => {
|
|
|
766
818
|
}
|
|
767
819
|
)
|
|
768
820
|
] }),
|
|
821
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { children: [
|
|
822
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: t("panel.class", "CSS classes") }),
|
|
823
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
824
|
+
designSystem.TextInput,
|
|
825
|
+
{
|
|
826
|
+
value: selectedStep.class ?? "",
|
|
827
|
+
onChange: (e) => patchStep(selectedStep.id, { class: e.target.value })
|
|
828
|
+
}
|
|
829
|
+
)
|
|
830
|
+
] }),
|
|
769
831
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", textColor: "neutral600", children: t("editor.step-condition", "Show this step only when…") }),
|
|
770
832
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
771
833
|
ConditionEditor,
|
|
@@ -839,6 +901,16 @@ const FormEditor = () => {
|
|
|
839
901
|
}
|
|
840
902
|
)
|
|
841
903
|
] }),
|
|
904
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { children: [
|
|
905
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: t("panel.class", "CSS classes") }),
|
|
906
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
907
|
+
designSystem.TextInput,
|
|
908
|
+
{
|
|
909
|
+
value: entry.class ?? "",
|
|
910
|
+
onChange: (e) => patchEntry({ class: e.target.value })
|
|
911
|
+
}
|
|
912
|
+
)
|
|
913
|
+
] }),
|
|
842
914
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: t(
|
|
843
915
|
"editor.form-hint",
|
|
844
916
|
"Select a step or a field to edit it. The public endpoint serves this form at /api/hubspot/forms/{slug}.",
|
|
@@ -858,6 +930,12 @@ const FormsList = () => {
|
|
|
858
930
|
const [error, setError] = React__namespace.useState(null);
|
|
859
931
|
const [sources, setSources] = React__namespace.useState([]);
|
|
860
932
|
const [sourceId, setSourceId] = React__namespace.useState("");
|
|
933
|
+
const [hsForms, setHsForms] = React__namespace.useState([]);
|
|
934
|
+
const [hsFormId, setHsFormId] = React__namespace.useState("");
|
|
935
|
+
const [hsError, setHsError] = React__namespace.useState(null);
|
|
936
|
+
const [report, setReport] = React__namespace.useState(
|
|
937
|
+
null
|
|
938
|
+
);
|
|
861
939
|
const t = (id, defaultMessage, values) => formatMessage({ id: index$1.getTranslation(id), defaultMessage }, values);
|
|
862
940
|
const load = React__namespace.useCallback(async () => {
|
|
863
941
|
const { data } = await get(`/${index$1.PLUGIN_ID}/builder/forms`);
|
|
@@ -868,6 +946,17 @@ const FormsList = () => {
|
|
|
868
946
|
get(
|
|
869
947
|
`/${index$1.PLUGIN_ID}/builder/import/sources`
|
|
870
948
|
).then(({ data }) => setSources(data.sources ?? [])).catch(() => setSources([]));
|
|
949
|
+
get(`/${index$1.PLUGIN_ID}/builder/import/hubspot`).then(({ data }) => setHsForms(data.configured ? data.forms ?? [] : [])).catch(
|
|
950
|
+
() => (
|
|
951
|
+
// Reachable settings but no portal list: almost always the missing scope.
|
|
952
|
+
setHsError(
|
|
953
|
+
t(
|
|
954
|
+
"forms.hubspot-list-error",
|
|
955
|
+
"Could not list the portal's forms — the token needs the `forms` read scope."
|
|
956
|
+
)
|
|
957
|
+
)
|
|
958
|
+
)
|
|
959
|
+
);
|
|
871
960
|
}, [load]);
|
|
872
961
|
const runImport = async () => {
|
|
873
962
|
if (!sourceId) return;
|
|
@@ -883,6 +972,48 @@ const FormsList = () => {
|
|
|
883
972
|
setBusy(false);
|
|
884
973
|
}
|
|
885
974
|
};
|
|
975
|
+
const runHubspotImport = async () => {
|
|
976
|
+
if (!hsFormId) return;
|
|
977
|
+
setBusy(true);
|
|
978
|
+
setError(null);
|
|
979
|
+
setReport(null);
|
|
980
|
+
try {
|
|
981
|
+
const { data } = await post(
|
|
982
|
+
`/${index$1.PLUGIN_ID}/builder/import/hubspot`,
|
|
983
|
+
{ formId: hsFormId }
|
|
984
|
+
);
|
|
985
|
+
if (data.skipped.length) {
|
|
986
|
+
setReport(data);
|
|
987
|
+
setBusy(false);
|
|
988
|
+
await load();
|
|
989
|
+
} else {
|
|
990
|
+
navigate(data.documentId);
|
|
991
|
+
}
|
|
992
|
+
} catch {
|
|
993
|
+
setError(t("forms.import-error", "Could not import the form."));
|
|
994
|
+
setBusy(false);
|
|
995
|
+
}
|
|
996
|
+
};
|
|
997
|
+
const skippedLine = (item) => {
|
|
998
|
+
const label = item.label ?? "";
|
|
999
|
+
const detail = item.detail ?? "";
|
|
1000
|
+
switch (item.code) {
|
|
1001
|
+
case "field-type":
|
|
1002
|
+
return t("forms.skipped-field-type", '"{label}" skipped — unsupported type ({detail})', { label, detail });
|
|
1003
|
+
case "hidden-field":
|
|
1004
|
+
return t("forms.skipped-hidden", '"{label}" skipped — hidden fields are not supported yet', { label });
|
|
1005
|
+
case "object":
|
|
1006
|
+
return t("forms.skipped-object", '"{label}" skipped — unmapped object ({detail})', { label, detail });
|
|
1007
|
+
case "duplicate":
|
|
1008
|
+
return t("forms.skipped-duplicate", '"{label}" skipped — the name "{detail}" is already used', { label, detail });
|
|
1009
|
+
case "condition":
|
|
1010
|
+
return t("forms.skipped-condition", 'Condition on "{label}" dropped — no equivalent operator ({detail})', { label, detail });
|
|
1011
|
+
case "rich-text":
|
|
1012
|
+
return t("forms.skipped-rich-text", "A content block was skipped — the builder has no rich-text element");
|
|
1013
|
+
case "legal-consent":
|
|
1014
|
+
return t("forms.skipped-consent", "The GDPR consent block was skipped — rebuild it as a field if needed");
|
|
1015
|
+
}
|
|
1016
|
+
};
|
|
886
1017
|
const create = async () => {
|
|
887
1018
|
if (!name.trim()) return;
|
|
888
1019
|
setBusy(true);
|
|
@@ -898,6 +1029,19 @@ const FormsList = () => {
|
|
|
898
1029
|
setBusy(false);
|
|
899
1030
|
}
|
|
900
1031
|
};
|
|
1032
|
+
const duplicate = async (row) => {
|
|
1033
|
+
setBusy(true);
|
|
1034
|
+
setError(null);
|
|
1035
|
+
try {
|
|
1036
|
+
const { data } = await post(
|
|
1037
|
+
`/${index$1.PLUGIN_ID}/builder/forms/${row.documentId}/duplicate`
|
|
1038
|
+
);
|
|
1039
|
+
navigate(data.documentId);
|
|
1040
|
+
} catch {
|
|
1041
|
+
setError(t("forms.duplicate-error", "Could not duplicate the form."));
|
|
1042
|
+
setBusy(false);
|
|
1043
|
+
}
|
|
1044
|
+
};
|
|
901
1045
|
const remove = async (row) => {
|
|
902
1046
|
if (!window.confirm(t("forms.delete-confirm", 'Delete "{name}" and all its locales?', { name: row.name }))) {
|
|
903
1047
|
return;
|
|
@@ -922,6 +1066,7 @@ const FormsList = () => {
|
|
|
922
1066
|
) })
|
|
923
1067
|
] }),
|
|
924
1068
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
1069
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "tertiary", startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.List, {}), onClick: () => navigate("submissions"), children: t("forms.submissions", "Submissions") }),
|
|
925
1070
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
926
1071
|
designSystem.TextInput,
|
|
927
1072
|
{
|
|
@@ -936,40 +1081,76 @@ const FormsList = () => {
|
|
|
936
1081
|
] })
|
|
937
1082
|
] }),
|
|
938
1083
|
error && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingBottom: 4, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "danger600", children: error }) }),
|
|
939
|
-
sources.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { background: "neutral0", hasRadius: true, shadow: "tableShadow", padding: 4, marginBottom: 4, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, {
|
|
1084
|
+
(sources.length > 0 || hsForms.length > 0 || hsError) && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { background: "neutral0", hasRadius: true, shadow: "tableShadow", padding: 4, marginBottom: 4, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 3, children: [
|
|
1085
|
+
hsForms.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, alignItems: "flex-end", justifyContent: "space-between", children: [
|
|
1086
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
|
|
1087
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "delta", tag: "h2", children: t("forms.import-hubspot-title", "Import from your HubSpot portal") }),
|
|
1088
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", tag: "p", children: t(
|
|
1089
|
+
"forms.import-hubspot-hint",
|
|
1090
|
+
"Translates a form built in HubSpot into a draft here, CRM mapping included. What the builder can't express is skipped and reported. Re-importing overwrites the draft."
|
|
1091
|
+
) })
|
|
1092
|
+
] }),
|
|
1093
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
1094
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1095
|
+
designSystem.SingleSelect,
|
|
1096
|
+
{
|
|
1097
|
+
"aria-label": t("forms.import-hubspot-source", "HubSpot form to import"),
|
|
1098
|
+
placeholder: t("forms.import-hubspot-source", "HubSpot form to import"),
|
|
1099
|
+
value: hsFormId,
|
|
1100
|
+
onChange: (v) => setHsFormId(String(v)),
|
|
1101
|
+
children: hsForms.map((f) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: f.id, children: f.name }, f.id))
|
|
1102
|
+
}
|
|
1103
|
+
),
|
|
1104
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "secondary", onClick: runHubspotImport, disabled: busy || !hsFormId, children: t("forms.import", "Import") })
|
|
1105
|
+
] })
|
|
1106
|
+
] }),
|
|
1107
|
+
hsError && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "warning700", children: hsError }),
|
|
1108
|
+
sources.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, alignItems: "flex-end", justifyContent: "space-between", children: [
|
|
1109
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
|
|
1110
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "delta", tag: "h2", children: t("forms.import-title", "Import an existing form") }),
|
|
1111
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", tag: "p", children: t(
|
|
1112
|
+
"forms.import-hint",
|
|
1113
|
+
"Converts a legacy content-type form (all locales) into a draft here — same slug, source untouched. Re-importing overwrites the draft."
|
|
1114
|
+
) })
|
|
1115
|
+
] }),
|
|
1116
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
1117
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1118
|
+
designSystem.SingleSelect,
|
|
1119
|
+
{
|
|
1120
|
+
"aria-label": t("forms.import-source", "Form to import"),
|
|
1121
|
+
placeholder: t("forms.import-source", "Form to import"),
|
|
1122
|
+
value: sourceId,
|
|
1123
|
+
onChange: (v) => setSourceId(String(v)),
|
|
1124
|
+
children: sources.map((s) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.SingleSelectOption, { value: s.documentId, children: [
|
|
1125
|
+
s.name,
|
|
1126
|
+
" ",
|
|
1127
|
+
s.slug ? `(${s.slug})` : ""
|
|
1128
|
+
] }, s.documentId))
|
|
1129
|
+
}
|
|
1130
|
+
),
|
|
1131
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "secondary", onClick: runImport, disabled: busy || !sourceId, children: t("forms.import", "Import") })
|
|
1132
|
+
] })
|
|
1133
|
+
] })
|
|
1134
|
+
] }) }),
|
|
1135
|
+
report && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { background: "warning100", hasRadius: true, padding: 4, marginBottom: 4, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", alignItems: "flex-start", gap: 4, children: [
|
|
940
1136
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
|
|
941
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "delta", tag: "h2", children: t("forms.
|
|
942
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
|
943
|
-
"forms.import-hint",
|
|
944
|
-
"Converts a legacy content-type form (all locales) into a draft here — same slug, source untouched. Re-importing overwrites the draft."
|
|
945
|
-
) })
|
|
1137
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "delta", tag: "h2", textColor: "warning700", children: t("forms.report-title", "Imported with gaps") }),
|
|
1138
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { tag: "ul", paddingTop: 2, style: { listStyle: "disc", paddingLeft: 16 }, children: report.skipped.map((item, i) => /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "warning700", children: skippedLine(item) }) }, i)) })
|
|
946
1139
|
] }),
|
|
947
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
948
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
949
|
-
|
|
950
|
-
{
|
|
951
|
-
"aria-label": t("forms.import-source", "Form to import"),
|
|
952
|
-
placeholder: t("forms.import-source", "Form to import"),
|
|
953
|
-
value: sourceId,
|
|
954
|
-
onChange: (v) => setSourceId(String(v)),
|
|
955
|
-
children: sources.map((s) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.SingleSelectOption, { value: s.documentId, children: [
|
|
956
|
-
s.name,
|
|
957
|
-
" ",
|
|
958
|
-
s.slug ? `(${s.slug})` : ""
|
|
959
|
-
] }, s.documentId))
|
|
960
|
-
}
|
|
961
|
-
),
|
|
962
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "secondary", onClick: runImport, disabled: busy || !sourceId, children: t("forms.import", "Import") })
|
|
1140
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, shrink: 0, children: [
|
|
1141
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "tertiary", onClick: () => setReport(null), children: t("forms.report-dismiss", "Dismiss") }),
|
|
1142
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: () => navigate(report.documentId), children: t("forms.report-open", "Open the form") })
|
|
963
1143
|
] })
|
|
964
1144
|
] }) }),
|
|
965
|
-
!rows ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Loader, { children: t("forms.loading", "Loading…") }) : rows.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { background: "neutral0", hasRadius: true, shadow: "tableShadow", padding: 8, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", children: t("forms.empty", "No form yet — name one above to open the builder.") }) }) : /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Table, { colCount:
|
|
1145
|
+
!rows ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Loader, { children: t("forms.loading", "Loading…") }) : rows.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { background: "neutral0", hasRadius: true, shadow: "tableShadow", padding: 8, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", children: t("forms.empty", "No form yet — name one above to open the builder.") }) }) : /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Table, { colCount: 7, rowCount: rows.length, children: [
|
|
966
1146
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Thead, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
|
|
967
1147
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", children: t("forms.col-name", "Name") }) }),
|
|
968
1148
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", children: t("forms.col-slug", "Slug") }) }),
|
|
969
1149
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", children: t("forms.col-structure", "Structure") }) }),
|
|
970
1150
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", children: t("forms.col-status", "Status") }) }),
|
|
1151
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", children: t("forms.col-submissions", "Submissions") }) }),
|
|
971
1152
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", children: t("forms.col-updated", "Updated") }) }),
|
|
972
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", children: t("forms.col-actions", "") }) })
|
|
1153
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", children: t("forms.col-actions", "Actions") }) })
|
|
973
1154
|
] }) }),
|
|
974
1155
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tbody, { children: rows.map((row) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
975
1156
|
designSystem.Tr,
|
|
@@ -979,21 +1160,41 @@ const FormsList = () => {
|
|
|
979
1160
|
children: [
|
|
980
1161
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontWeight: "semiBold", children: row.name }) }),
|
|
981
1162
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", children: row.slug }) }),
|
|
982
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", children: t("forms.structure", "{steps} steps · {fields} fields", {
|
|
1163
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", children: t("forms.structure", "{steps, plural, one {# step} other {# steps}} · {fields, plural, one {# field} other {# fields}}", {
|
|
983
1164
|
steps: row.steps,
|
|
984
1165
|
fields: row.fields
|
|
985
1166
|
}) }) }),
|
|
986
1167
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: row.published ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { backgroundColor: "success100", textColor: "success700", children: t("forms.published", "Published") }) : /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { backgroundColor: "secondary100", textColor: "secondary700", children: t("forms.draft", "Draft") }) }),
|
|
987
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, {
|
|
988
|
-
|
|
989
|
-
designSystem.IconButton,
|
|
1168
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { onClick: (e) => e.stopPropagation(), children: row.submissions > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1169
|
+
designSystem.Button,
|
|
990
1170
|
{
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
children:
|
|
1171
|
+
variant: "ghost",
|
|
1172
|
+
startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.List, {}),
|
|
1173
|
+
onClick: () => navigate(`submissions?form=${encodeURIComponent(row.slug)}`),
|
|
1174
|
+
children: row.submissions
|
|
995
1175
|
}
|
|
996
|
-
) })
|
|
1176
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", children: "—" }) }),
|
|
1177
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", children: row.updatedAt ? new Date(row.updatedAt).toLocaleString() : "—" }) }),
|
|
1178
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 1, children: [
|
|
1179
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1180
|
+
designSystem.IconButton,
|
|
1181
|
+
{
|
|
1182
|
+
label: t("forms.duplicate", "Duplicate"),
|
|
1183
|
+
onClick: () => duplicate(row),
|
|
1184
|
+
disabled: busy,
|
|
1185
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(icons.Duplicate, {})
|
|
1186
|
+
}
|
|
1187
|
+
),
|
|
1188
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1189
|
+
designSystem.IconButton,
|
|
1190
|
+
{
|
|
1191
|
+
label: t("forms.delete", "Delete"),
|
|
1192
|
+
onClick: () => remove(row),
|
|
1193
|
+
disabled: busy,
|
|
1194
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(icons.Trash, {})
|
|
1195
|
+
}
|
|
1196
|
+
)
|
|
1197
|
+
] }) })
|
|
997
1198
|
]
|
|
998
1199
|
},
|
|
999
1200
|
row.documentId
|
|
@@ -1001,8 +1202,169 @@ const FormsList = () => {
|
|
|
1001
1202
|
] })
|
|
1002
1203
|
] });
|
|
1003
1204
|
};
|
|
1205
|
+
const PAGE_SIZE = 20;
|
|
1206
|
+
const preview = (values, max = 3) => {
|
|
1207
|
+
const parts = Object.entries(values ?? {}).slice(0, max).map(([k, v]) => `${k}: ${String(v)}`);
|
|
1208
|
+
const more = Object.keys(values ?? {}).length - max;
|
|
1209
|
+
return parts.join(" · ") + (more > 0 ? ` · +${more}` : "");
|
|
1210
|
+
};
|
|
1211
|
+
const Submissions = () => {
|
|
1212
|
+
const { formatMessage } = index.useIntl();
|
|
1213
|
+
const { get } = admin.useFetchClient();
|
|
1214
|
+
const navigate = reactRouterDom.useNavigate();
|
|
1215
|
+
const [searchParams, setSearchParams] = reactRouterDom.useSearchParams();
|
|
1216
|
+
const form = searchParams.get("form") ?? "";
|
|
1217
|
+
const [forms, setForms] = React__namespace.useState([]);
|
|
1218
|
+
const [rows, setRows] = React__namespace.useState(null);
|
|
1219
|
+
const [total, setTotal] = React__namespace.useState(0);
|
|
1220
|
+
const [page, setPage] = React__namespace.useState(1);
|
|
1221
|
+
const [selected, setSelected] = React__namespace.useState(null);
|
|
1222
|
+
const [error, setError] = React__namespace.useState(null);
|
|
1223
|
+
const [exporting, setExporting] = React__namespace.useState(false);
|
|
1224
|
+
const t = (id, defaultMessage, values) => formatMessage({ id: index$1.getTranslation(id), defaultMessage }, values);
|
|
1225
|
+
React__namespace.useEffect(() => {
|
|
1226
|
+
get(`/${index$1.PLUGIN_ID}/builder/forms`).then(({ data }) => setForms(data.forms)).catch(() => setForms([]));
|
|
1227
|
+
}, [get]);
|
|
1228
|
+
React__namespace.useEffect(() => {
|
|
1229
|
+
setRows(null);
|
|
1230
|
+
const query = new URLSearchParams({ page: String(page), pageSize: String(PAGE_SIZE) });
|
|
1231
|
+
if (form) query.set("form", form);
|
|
1232
|
+
get(
|
|
1233
|
+
`/${index$1.PLUGIN_ID}/builder/submissions?${query}`
|
|
1234
|
+
).then(({ data }) => {
|
|
1235
|
+
setRows(data.submissions);
|
|
1236
|
+
setTotal(data.total);
|
|
1237
|
+
}).catch(() => setError(t("submissions.load-error", "Could not load the submissions.")));
|
|
1238
|
+
}, [get, form, page]);
|
|
1239
|
+
const changeForm = (slug) => {
|
|
1240
|
+
setPage(1);
|
|
1241
|
+
setSearchParams(slug ? { form: slug } : {});
|
|
1242
|
+
};
|
|
1243
|
+
const exportCsv = async () => {
|
|
1244
|
+
if (!form) return;
|
|
1245
|
+
setExporting(true);
|
|
1246
|
+
setError(null);
|
|
1247
|
+
try {
|
|
1248
|
+
const { data } = await get(
|
|
1249
|
+
`/${index$1.PLUGIN_ID}/builder/submissions/export?form=${encodeURIComponent(form)}`
|
|
1250
|
+
);
|
|
1251
|
+
const url = URL.createObjectURL(new Blob([data.csv], { type: "text/csv;charset=utf-8" }));
|
|
1252
|
+
const link = document.createElement("a");
|
|
1253
|
+
link.href = url;
|
|
1254
|
+
link.download = data.filename;
|
|
1255
|
+
link.click();
|
|
1256
|
+
URL.revokeObjectURL(url);
|
|
1257
|
+
} catch {
|
|
1258
|
+
setError(t("submissions.export-error", "Could not export the submissions."));
|
|
1259
|
+
} finally {
|
|
1260
|
+
setExporting(false);
|
|
1261
|
+
}
|
|
1262
|
+
};
|
|
1263
|
+
const pages = Math.max(1, Math.ceil(total / PAGE_SIZE));
|
|
1264
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { padding: 8, children: [
|
|
1265
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", alignItems: "flex-end", paddingBottom: 6, children: [
|
|
1266
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
|
|
1267
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, alignItems: "center", children: [
|
|
1268
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.IconButton, { label: t("submissions.back", "Back to the forms"), onClick: () => navigate(".."), children: /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowLeft, {}) }),
|
|
1269
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "alpha", tag: "h1", children: t("submissions.title", "Submissions") })
|
|
1270
|
+
] }),
|
|
1271
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "epsilon", textColor: "neutral600", tag: "p", children: t(
|
|
1272
|
+
"submissions.subtitle",
|
|
1273
|
+
"Every answer received by the built forms — stored whatever the CRM's mood."
|
|
1274
|
+
) })
|
|
1275
|
+
] }),
|
|
1276
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
1277
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1278
|
+
designSystem.SingleSelect,
|
|
1279
|
+
{
|
|
1280
|
+
"aria-label": t("submissions.filter", "Filter by form"),
|
|
1281
|
+
placeholder: t("submissions.all-forms", "All forms"),
|
|
1282
|
+
value: form,
|
|
1283
|
+
onChange: (v) => changeForm(String(v)),
|
|
1284
|
+
onClear: () => changeForm(""),
|
|
1285
|
+
children: forms.map((f) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: f.slug, children: f.name }, f.slug))
|
|
1286
|
+
}
|
|
1287
|
+
),
|
|
1288
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1289
|
+
designSystem.Button,
|
|
1290
|
+
{
|
|
1291
|
+
variant: "secondary",
|
|
1292
|
+
startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Download, {}),
|
|
1293
|
+
onClick: exportCsv,
|
|
1294
|
+
disabled: !form || exporting,
|
|
1295
|
+
title: form ? void 0 : t("submissions.export-pick", "Pick a form to export"),
|
|
1296
|
+
children: t("submissions.export", "Export CSV")
|
|
1297
|
+
}
|
|
1298
|
+
)
|
|
1299
|
+
] })
|
|
1300
|
+
] }),
|
|
1301
|
+
error && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingBottom: 4, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "danger600", children: error }) }),
|
|
1302
|
+
!rows ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Loader, { children: t("submissions.loading", "Loading…") }) : rows.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { background: "neutral0", hasRadius: true, shadow: "tableShadow", padding: 8, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", children: form ? t("submissions.empty-form", "No submission for this form yet.") : t("submissions.empty", "No submission yet.") }) }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1303
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Table, { colCount: 5, rowCount: rows.length, children: [
|
|
1304
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Thead, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
|
|
1305
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", children: t("submissions.col-date", "Date") }) }),
|
|
1306
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", children: t("submissions.col-form", "Form") }) }),
|
|
1307
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", children: t("submissions.col-email", "Email") }) }),
|
|
1308
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", children: t("submissions.col-answers", "Answers") }) }),
|
|
1309
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", children: t("submissions.col-crm", "CRM") }) })
|
|
1310
|
+
] }) }),
|
|
1311
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tbody, { children: rows.map((row) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1312
|
+
designSystem.Tr,
|
|
1313
|
+
{
|
|
1314
|
+
onClick: () => setSelected(row),
|
|
1315
|
+
style: { cursor: "pointer" },
|
|
1316
|
+
children: [
|
|
1317
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", children: row.createdAt ? new Date(row.createdAt).toLocaleString() : "—" }) }),
|
|
1318
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: row.formTitle || row.form }) }),
|
|
1319
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontWeight: "semiBold", children: row.email || "—" }) }),
|
|
1320
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", ellipsis: true, children: preview(row.values) }) }),
|
|
1321
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: row.hubspotSynced ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { backgroundColor: "success100", textColor: "success700", children: t("submissions.synced", "Synced") }) : /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { backgroundColor: "warning100", textColor: "warning700", children: t("submissions.not-synced", "Not synced") }) })
|
|
1322
|
+
]
|
|
1323
|
+
},
|
|
1324
|
+
row.documentId
|
|
1325
|
+
)) })
|
|
1326
|
+
] }),
|
|
1327
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", paddingTop: 4, children: [
|
|
1328
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", children: t("submissions.count", "{total, plural, one {# submission} other {# submissions}}", {
|
|
1329
|
+
total
|
|
1330
|
+
}) }),
|
|
1331
|
+
pages > 1 && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
1332
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "tertiary", disabled: page <= 1, onClick: () => setPage(page - 1), children: t("submissions.prev", "Previous") }),
|
|
1333
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", children: t("submissions.page", "{page} / {pages}", { page, pages }) }),
|
|
1334
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1335
|
+
designSystem.Button,
|
|
1336
|
+
{
|
|
1337
|
+
variant: "tertiary",
|
|
1338
|
+
disabled: page >= pages,
|
|
1339
|
+
onClick: () => setPage(page + 1),
|
|
1340
|
+
children: t("submissions.next", "Next")
|
|
1341
|
+
}
|
|
1342
|
+
)
|
|
1343
|
+
] })
|
|
1344
|
+
] })
|
|
1345
|
+
] }),
|
|
1346
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Root, { open: Boolean(selected), onOpenChange: (open) => !open && setSelected(null), children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Modal.Content, { children: [
|
|
1347
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Header, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Modal.Title, { children: [
|
|
1348
|
+
selected?.formTitle || selected?.form,
|
|
1349
|
+
" ",
|
|
1350
|
+
selected?.createdAt ? `— ${new Date(selected.createdAt).toLocaleString()}` : ""
|
|
1351
|
+
] }) }),
|
|
1352
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Body, { children: selected && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 3, children: [
|
|
1353
|
+
Object.entries(selected.values ?? {}).map(([key, value]) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
|
|
1354
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", textColor: "neutral600", tag: "p", children: key }),
|
|
1355
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "p", children: String(value) })
|
|
1356
|
+
] }, key)),
|
|
1357
|
+
selected.meta?.pagePath && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
|
|
1358
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", textColor: "neutral600", tag: "p", children: t("submissions.meta-page", "Submitted from") }),
|
|
1359
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "p", children: selected.meta.pagePath })
|
|
1360
|
+
] })
|
|
1361
|
+
] }) })
|
|
1362
|
+
] }) })
|
|
1363
|
+
] });
|
|
1364
|
+
};
|
|
1004
1365
|
const Forms = () => /* @__PURE__ */ jsxRuntime.jsxs(reactRouterDom.Routes, { children: [
|
|
1005
1366
|
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { index: true, element: /* @__PURE__ */ jsxRuntime.jsx(FormsList, {}) }),
|
|
1367
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path: "submissions", element: /* @__PURE__ */ jsxRuntime.jsx(Submissions, {}) }),
|
|
1006
1368
|
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path: ":documentId", element: /* @__PURE__ */ jsxRuntime.jsx(FormEditor, {}) })
|
|
1007
1369
|
] });
|
|
1008
1370
|
exports.default = Forms;
|
|
@@ -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-
|
|
6
|
+
import { P as PLUGIN_ID, g as getTranslation } from "./index-LTaVoyWJ.mjs";
|
|
7
7
|
const HubspotFormInput = React.forwardRef(
|
|
8
8
|
({ name, value, onChange, disabled, error, required, label, hint, labelAction }, ref) => {
|
|
9
9
|
const { formatMessage } = useIntl();
|
|
@@ -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-
|
|
8
|
+
const index$1 = require("./index-BbRtXnAL.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" } });
|
|
@@ -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-
|
|
6
|
-
import { o as objectLabel } from "./objectLabels-
|
|
7
|
-
import { u as useHubspotSchema } from "./useHubspotSchema-
|
|
5
|
+
import { g as getTranslation } from "./index-LTaVoyWJ.mjs";
|
|
6
|
+
import { o as objectLabel } from "./objectLabels-DE2xGq7f.mjs";
|
|
7
|
+
import { u as useHubspotSchema } from "./useHubspotSchema-BSKow0X3.mjs";
|
|
8
8
|
const HubspotObjectInput = React.forwardRef(
|
|
9
9
|
({ name, value, onChange, disabled, error, required, label, hint, labelAction }, ref) => {
|
|
10
10
|
const intl = 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-
|
|
8
|
-
const objectLabels = require("./objectLabels-
|
|
9
|
-
const useHubspotSchema = require("./useHubspotSchema-
|
|
7
|
+
const index$1 = require("./index-BbRtXnAL.js");
|
|
8
|
+
const objectLabels = require("./objectLabels-DU0Cagt_.js");
|
|
9
|
+
const useHubspotSchema = require("./useHubspotSchema-DzBMAxv7.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" } });
|