strapi-plugin-hubspot 0.6.1 → 0.7.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 +15 -0
- package/dist/_chunks/{Forms-B2y_0-x4.mjs → Forms-CKA6ukB6.mjs} +4 -3
- package/dist/_chunks/{Forms-CaT0YEJo.js → Forms-HMZbTk_B.js} +23 -22
- package/dist/_chunks/HubspotFormInput-BequMb12.js +79 -0
- package/dist/_chunks/HubspotFormInput-CKYRcNNU.mjs +61 -0
- package/dist/_chunks/{HubspotObjectInput-Crpcpa8T.js → HubspotObjectInput-D-FGwsyS.js} +8 -7
- package/dist/_chunks/{HubspotObjectInput-DdLAUh0N.mjs → HubspotObjectInput-V3uhGK8k.mjs} +4 -3
- package/dist/_chunks/{HubspotPropertyInput-SnJMFsII.js → HubspotPropertyInput-Dn1QvOcu.js} +18 -17
- package/dist/_chunks/{HubspotPropertyInput-k7wMSmeF.mjs → HubspotPropertyInput-DrBsx9jQ.mjs} +4 -3
- package/dist/_chunks/{Settings-BMOmj4NJ.mjs → Settings-BjkNbyna.mjs} +3 -2
- package/dist/_chunks/{Settings-BPAAD-QW.js → Settings-Cgp7M1Cv.js} +16 -15
- package/dist/_chunks/{en-CJ9wYHgN.mjs → en-Cun5LoUP.mjs} +8 -1
- package/dist/_chunks/{en-C_-N8cjv.js → en-D5Ch9YFo.js} +8 -1
- package/dist/_chunks/{fr-DttDn-2Y.mjs → fr-ClOWflse.mjs} +8 -1
- package/dist/_chunks/{fr-BHObPoUp.js → fr-CqlhHltZ.js} +8 -1
- package/dist/_chunks/{objectLabels-C9ocOgVY.mjs → index-CEh8vkxY.mjs} +0 -14
- package/dist/_chunks/{index-D_CPrIHe.js → index-D2Q34BuH.js} +21 -5
- package/dist/_chunks/{objectLabels-VTt_-qTZ.js → index-DkTxsEqL.js} +0 -14
- package/dist/_chunks/{index-foVSGFWb.mjs → index-FKsiOEPB.mjs} +21 -5
- package/dist/_chunks/objectLabels-DBKevJle.mjs +16 -0
- package/dist/_chunks/objectLabels-LAQ0M6-a.js +15 -0
- package/dist/_chunks/{useHubspotSchema-Du3rLY_O.mjs → useHubspotSchema-BC0Od-Wl.mjs} +1 -1
- package/dist/_chunks/{useHubspotSchema-B8SctALV.js → useHubspotSchema-C08qBAyy.js} +1 -1
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/src/components/HubspotFormInput.d.ts +29 -0
- package/dist/server/index.js +33 -0
- package/dist/server/index.mjs +33 -0
- package/dist/server/src/formsAdmin.d.ts +7 -0
- package/dist/server/src/index.d.ts +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.7.0 — 2026-08-29
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
- `hubspot.form-picker` custom field: a searchable select over the forms
|
|
7
|
+
built in the builder, storing the chosen form's **slug** as a plain string —
|
|
8
|
+
for host content that references a form (a hero block, a landing…).
|
|
9
|
+
Unpublished forms stay selectable but are flagged; a slug whose form was
|
|
10
|
+
deleted is kept and flagged instead of silently dropped; a fetch failure
|
|
11
|
+
degrades to free text. Fed by `GET /hubspot/forms-options`, open to any
|
|
12
|
+
authenticated admin (the builder itself stays RBAC-gated).
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
- Removed an accidental self-dependency (`strapi-plugin-hubspot` listed in its
|
|
16
|
+
own `dependencies`) introduced by a stray `npm install`.
|
|
17
|
+
|
|
3
18
|
## 0.6.1 — 2026-08-28
|
|
4
19
|
|
|
5
20
|
### Fixed
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useParams, useSearchParams, Link, useNavigate, Routes, Route } from "react-router-dom";
|
|
3
3
|
import * as React from "react";
|
|
4
|
-
import { u as useIntl
|
|
4
|
+
import { u as useIntl } from "./index-CEh8vkxY.mjs";
|
|
5
5
|
import { Typography, Flex, Box, SingleSelect, SingleSelectOption, TextInput, IconButton, Button, Field, Checkbox, Divider, Combobox, ComboboxOption, Loader, Badge, Textarea, Table, Thead, Tr, Th, Tbody, Td } from "@strapi/design-system";
|
|
6
6
|
import { Trash, Plus, ArrowClockwise, ArrowLeft, ArrowUp, ArrowDown } from "@strapi/icons";
|
|
7
7
|
import { useFetchClient } from "@strapi/strapi/admin";
|
|
8
|
-
import { g as getTranslation, P as PLUGIN_ID } from "./index-
|
|
9
|
-
import {
|
|
8
|
+
import { g as getTranslation, P as PLUGIN_ID } from "./index-FKsiOEPB.mjs";
|
|
9
|
+
import { o as objectLabel } from "./objectLabels-DBKevJle.mjs";
|
|
10
|
+
import { u as useHubspotSchema } from "./useHubspotSchema-BC0Od-Wl.mjs";
|
|
10
11
|
const OPERATORS = ["eq", "neq", "contains", "empty", "notEmpty", "gt", "lt"];
|
|
11
12
|
const NEEDS_VALUE = /* @__PURE__ */ new Set(["eq", "neq", "contains", "gt", "lt"]);
|
|
12
13
|
const ConditionEditor = ({ condition, candidates, onChange }) => {
|
|
@@ -3,12 +3,13 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const reactRouterDom = require("react-router-dom");
|
|
5
5
|
const React = require("react");
|
|
6
|
-
const
|
|
6
|
+
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 = require("./index-
|
|
11
|
-
const
|
|
10
|
+
const index$1 = require("./index-D2Q34BuH.js");
|
|
11
|
+
const objectLabels = require("./objectLabels-LAQ0M6-a.js");
|
|
12
|
+
const useHubspotSchema = require("./useHubspotSchema-C08qBAyy.js");
|
|
12
13
|
function _interopNamespace(e) {
|
|
13
14
|
if (e && e.__esModule) return e;
|
|
14
15
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
@@ -30,8 +31,8 @@ const React__namespace = /* @__PURE__ */ _interopNamespace(React);
|
|
|
30
31
|
const OPERATORS = ["eq", "neq", "contains", "empty", "notEmpty", "gt", "lt"];
|
|
31
32
|
const NEEDS_VALUE = /* @__PURE__ */ new Set(["eq", "neq", "contains", "gt", "lt"]);
|
|
32
33
|
const ConditionEditor = ({ condition, candidates, onChange }) => {
|
|
33
|
-
const { formatMessage } =
|
|
34
|
-
const t = (id, defaultMessage) => formatMessage({ id: index.getTranslation(id), defaultMessage });
|
|
34
|
+
const { formatMessage } = index.useIntl();
|
|
35
|
+
const t = (id, defaultMessage) => formatMessage({ id: index$1.getTranslation(id), defaultMessage });
|
|
35
36
|
const opLabel = {
|
|
36
37
|
eq: t("condition.op.eq", "is"),
|
|
37
38
|
neq: t("condition.op.neq", "is not"),
|
|
@@ -146,10 +147,10 @@ function fieldsBefore(definition, beforeId) {
|
|
|
146
147
|
}
|
|
147
148
|
const slugifyName = (label) => label.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
|
|
148
149
|
const FieldPanel = ({ field, candidates, problem, onChange }) => {
|
|
149
|
-
const intl =
|
|
150
|
+
const intl = index.useIntl();
|
|
150
151
|
const { formatMessage } = intl;
|
|
151
152
|
const { schema, refresh, refreshing } = useHubspotSchema.useHubspotSchema();
|
|
152
|
-
const t = (id, defaultMessage, values) => formatMessage({ id: index.getTranslation(id), defaultMessage }, values);
|
|
153
|
+
const t = (id, defaultMessage, values) => formatMessage({ id: index$1.getTranslation(id), defaultMessage }, values);
|
|
153
154
|
const object = field.hubspot?.object || "contact";
|
|
154
155
|
const properties = (schema?.properties ?? []).filter((p) => p.object === object);
|
|
155
156
|
const selected = properties.find((p) => p.name === field.hubspot?.property);
|
|
@@ -373,7 +374,7 @@ const newField = (label) => ({
|
|
|
373
374
|
});
|
|
374
375
|
const newStep = () => ({ id: makeId("stp"), title: "", fields: [] });
|
|
375
376
|
const FormEditor = () => {
|
|
376
|
-
const { formatMessage } =
|
|
377
|
+
const { formatMessage } = index.useIntl();
|
|
377
378
|
const { get, post, put } = admin.useFetchClient();
|
|
378
379
|
const { documentId } = reactRouterDom.useParams();
|
|
379
380
|
const [searchParams, setSearchParams] = reactRouterDom.useSearchParams();
|
|
@@ -387,7 +388,7 @@ const FormEditor = () => {
|
|
|
387
388
|
const [errors, setErrors] = React__namespace.useState([]);
|
|
388
389
|
const [problems, setProblems] = React__namespace.useState([]);
|
|
389
390
|
const [feedback, setFeedback] = React__namespace.useState(null);
|
|
390
|
-
const t = (id, defaultMessage, values) => formatMessage({ id: index.getTranslation(id), defaultMessage }, values);
|
|
391
|
+
const t = (id, defaultMessage, values) => formatMessage({ id: index$1.getTranslation(id), defaultMessage }, values);
|
|
391
392
|
const query = locale ? `?locale=${locale}` : "";
|
|
392
393
|
React__namespace.useEffect(() => {
|
|
393
394
|
get("/i18n/locales").then(({ data }) => Array.isArray(data) && setLocales(data)).catch(() => setLocales([]));
|
|
@@ -399,7 +400,7 @@ const FormEditor = () => {
|
|
|
399
400
|
setErrors([]);
|
|
400
401
|
setProblems([]);
|
|
401
402
|
get(
|
|
402
|
-
`/${index.PLUGIN_ID}/builder/forms/${documentId}${query}`
|
|
403
|
+
`/${index$1.PLUGIN_ID}/builder/forms/${documentId}${query}`
|
|
403
404
|
).then(({ data }) => {
|
|
404
405
|
if (cancelled) return;
|
|
405
406
|
setEntry(data.form);
|
|
@@ -409,7 +410,7 @@ const FormEditor = () => {
|
|
|
409
410
|
if (cancelled || !locale) return;
|
|
410
411
|
try {
|
|
411
412
|
const { data } = await get(
|
|
412
|
-
`/${index.PLUGIN_ID}/builder/forms/${documentId}`
|
|
413
|
+
`/${index$1.PLUGIN_ID}/builder/forms/${documentId}`
|
|
413
414
|
);
|
|
414
415
|
if (cancelled) return;
|
|
415
416
|
setEntry({ ...data.form, locale });
|
|
@@ -473,7 +474,7 @@ const FormEditor = () => {
|
|
|
473
474
|
setErrors([]);
|
|
474
475
|
try {
|
|
475
476
|
const { data } = await put(
|
|
476
|
-
`/${index.PLUGIN_ID}/builder/forms/${documentId}${query}`,
|
|
477
|
+
`/${index$1.PLUGIN_ID}/builder/forms/${documentId}${query}`,
|
|
477
478
|
{
|
|
478
479
|
name: entry.name,
|
|
479
480
|
title: entry.title,
|
|
@@ -506,7 +507,7 @@ const FormEditor = () => {
|
|
|
506
507
|
setBusy(true);
|
|
507
508
|
setFeedback(null);
|
|
508
509
|
try {
|
|
509
|
-
await post(`/${index.PLUGIN_ID}/builder/forms/${documentId}/publish${query}`);
|
|
510
|
+
await post(`/${index$1.PLUGIN_ID}/builder/forms/${documentId}/publish${query}`);
|
|
510
511
|
setPublished(true);
|
|
511
512
|
setErrors([]);
|
|
512
513
|
setProblems([]);
|
|
@@ -526,7 +527,7 @@ const FormEditor = () => {
|
|
|
526
527
|
const unpublish = async () => {
|
|
527
528
|
setBusy(true);
|
|
528
529
|
try {
|
|
529
|
-
await post(`/${index.PLUGIN_ID}/builder/forms/${documentId}/unpublish${query}`);
|
|
530
|
+
await post(`/${index$1.PLUGIN_ID}/builder/forms/${documentId}/unpublish${query}`);
|
|
530
531
|
setPublished(false);
|
|
531
532
|
setFeedback({ tone: "success", text: t("editor.unpublished", "Form unpublished.") });
|
|
532
533
|
} catch {
|
|
@@ -544,7 +545,7 @@ const FormEditor = () => {
|
|
|
544
545
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { padding: 6, children: [
|
|
545
546
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", alignItems: "center", paddingBottom: 4, children: [
|
|
546
547
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 3, alignItems: "center", children: [
|
|
547
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Link, { to: `/plugins/${index.PLUGIN_ID}`, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.IconButton, { label: t("editor.back", "Back to the list"), tag: "span", children: /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowLeft, {}) }) }),
|
|
548
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Link, { to: `/plugins/${index$1.PLUGIN_ID}`, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.IconButton, { label: t("editor.back", "Back to the list"), tag: "span", children: /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowLeft, {}) }) }),
|
|
548
549
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
|
|
549
550
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, alignItems: "center", children: [
|
|
550
551
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "beta", tag: "h1", children: entry.name }),
|
|
@@ -848,7 +849,7 @@ const FormEditor = () => {
|
|
|
848
849
|
] });
|
|
849
850
|
};
|
|
850
851
|
const FormsList = () => {
|
|
851
|
-
const { formatMessage } =
|
|
852
|
+
const { formatMessage } = index.useIntl();
|
|
852
853
|
const { get, post, del } = admin.useFetchClient();
|
|
853
854
|
const navigate = reactRouterDom.useNavigate();
|
|
854
855
|
const [rows, setRows] = React__namespace.useState(null);
|
|
@@ -857,15 +858,15 @@ const FormsList = () => {
|
|
|
857
858
|
const [error, setError] = React__namespace.useState(null);
|
|
858
859
|
const [sources, setSources] = React__namespace.useState([]);
|
|
859
860
|
const [sourceId, setSourceId] = React__namespace.useState("");
|
|
860
|
-
const t = (id, defaultMessage, values) => formatMessage({ id: index.getTranslation(id), defaultMessage }, values);
|
|
861
|
+
const t = (id, defaultMessage, values) => formatMessage({ id: index$1.getTranslation(id), defaultMessage }, values);
|
|
861
862
|
const load = React__namespace.useCallback(async () => {
|
|
862
|
-
const { data } = await get(`/${index.PLUGIN_ID}/builder/forms`);
|
|
863
|
+
const { data } = await get(`/${index$1.PLUGIN_ID}/builder/forms`);
|
|
863
864
|
setRows(data.forms);
|
|
864
865
|
}, [get]);
|
|
865
866
|
React__namespace.useEffect(() => {
|
|
866
867
|
load().catch(() => setError(t("forms.load-error", "Could not load the forms.")));
|
|
867
868
|
get(
|
|
868
|
-
`/${index.PLUGIN_ID}/builder/import/sources`
|
|
869
|
+
`/${index$1.PLUGIN_ID}/builder/import/sources`
|
|
869
870
|
).then(({ data }) => setSources(data.sources ?? [])).catch(() => setSources([]));
|
|
870
871
|
}, [load]);
|
|
871
872
|
const runImport = async () => {
|
|
@@ -873,7 +874,7 @@ const FormsList = () => {
|
|
|
873
874
|
setBusy(true);
|
|
874
875
|
setError(null);
|
|
875
876
|
try {
|
|
876
|
-
const { data } = await post(`/${index.PLUGIN_ID}/builder/import`, {
|
|
877
|
+
const { data } = await post(`/${index$1.PLUGIN_ID}/builder/import`, {
|
|
877
878
|
documentId: sourceId
|
|
878
879
|
});
|
|
879
880
|
navigate(data.documentId);
|
|
@@ -888,7 +889,7 @@ const FormsList = () => {
|
|
|
888
889
|
setError(null);
|
|
889
890
|
try {
|
|
890
891
|
const { data } = await post(
|
|
891
|
-
`/${index.PLUGIN_ID}/builder/forms`,
|
|
892
|
+
`/${index$1.PLUGIN_ID}/builder/forms`,
|
|
892
893
|
{ name: name.trim() }
|
|
893
894
|
);
|
|
894
895
|
navigate(data.form.documentId);
|
|
@@ -903,7 +904,7 @@ const FormsList = () => {
|
|
|
903
904
|
}
|
|
904
905
|
setBusy(true);
|
|
905
906
|
try {
|
|
906
|
-
await del(`/${index.PLUGIN_ID}/builder/forms/${row.documentId}`);
|
|
907
|
+
await del(`/${index$1.PLUGIN_ID}/builder/forms/${row.documentId}`);
|
|
907
908
|
await load();
|
|
908
909
|
} catch {
|
|
909
910
|
setError(t("forms.delete-error", "Could not delete the form."));
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const index = require("./index-DkTxsEqL.js");
|
|
6
|
+
const designSystem = require("@strapi/design-system");
|
|
7
|
+
const admin = require("@strapi/strapi/admin");
|
|
8
|
+
const index$1 = require("./index-D2Q34BuH.js");
|
|
9
|
+
function _interopNamespace(e) {
|
|
10
|
+
if (e && e.__esModule) return e;
|
|
11
|
+
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
12
|
+
if (e) {
|
|
13
|
+
for (const k in e) {
|
|
14
|
+
if (k !== "default") {
|
|
15
|
+
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
16
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: () => e[k]
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
n.default = e;
|
|
24
|
+
return Object.freeze(n);
|
|
25
|
+
}
|
|
26
|
+
const React__namespace = /* @__PURE__ */ _interopNamespace(React);
|
|
27
|
+
const HubspotFormInput = React__namespace.forwardRef(
|
|
28
|
+
({ name, value, onChange, disabled, error, required, label, hint, labelAction }, ref) => {
|
|
29
|
+
const { formatMessage } = index.useIntl();
|
|
30
|
+
const { get } = admin.useFetchClient();
|
|
31
|
+
const [forms, setForms] = React__namespace.useState(null);
|
|
32
|
+
const [failed, setFailed] = React__namespace.useState(false);
|
|
33
|
+
const t = (id, defaultMessage, values) => formatMessage({ id: index$1.getTranslation(id), defaultMessage }, values);
|
|
34
|
+
React__namespace.useEffect(() => {
|
|
35
|
+
let cancelled = false;
|
|
36
|
+
get(`/${index$1.PLUGIN_ID}/forms-options`).then(({ data }) => !cancelled && setForms(data.forms ?? [])).catch(() => !cancelled && setFailed(true));
|
|
37
|
+
return () => {
|
|
38
|
+
cancelled = true;
|
|
39
|
+
};
|
|
40
|
+
}, [get]);
|
|
41
|
+
const emit = (next) => onChange({ target: { name, value: next ?? "", type: "string" } });
|
|
42
|
+
const known = forms ?? [];
|
|
43
|
+
const orphan = value && !known.some((f) => f.slug === value);
|
|
44
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { name, error, hint, required, children: [
|
|
45
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { action: labelAction, children: label }),
|
|
46
|
+
failed ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
47
|
+
designSystem.Field.Input,
|
|
48
|
+
{
|
|
49
|
+
ref,
|
|
50
|
+
value: value || "",
|
|
51
|
+
onChange: (e) => emit(e.target.value),
|
|
52
|
+
disabled,
|
|
53
|
+
placeholder: t("form-picker.fallback", "Form slug")
|
|
54
|
+
}
|
|
55
|
+
) : !forms ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { paddingTop: 2, paddingBottom: 2, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Loader, { small: true, children: t("form-picker.loading", "Loading the forms…") }) }) : /* @__PURE__ */ jsxRuntime.jsxs(
|
|
56
|
+
designSystem.Combobox,
|
|
57
|
+
{
|
|
58
|
+
ref,
|
|
59
|
+
value: value || "",
|
|
60
|
+
onChange: (next) => emit(next),
|
|
61
|
+
onClear: () => emit(""),
|
|
62
|
+
disabled,
|
|
63
|
+
placeholder: t("form-picker.placeholder", "Choose a form…"),
|
|
64
|
+
children: [
|
|
65
|
+
orphan && /* @__PURE__ */ jsxRuntime.jsx(designSystem.ComboboxOption, { value, children: t("form-picker.orphan", "{slug} — unknown form", { slug: value }) }),
|
|
66
|
+
known.map((form) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.ComboboxOption, { value: form.slug, children: form.published ? `${form.name} (${form.slug})` : t("form-picker.draft", "{name} ({slug}) — draft, not served yet", {
|
|
67
|
+
name: form.name,
|
|
68
|
+
slug: form.slug
|
|
69
|
+
}) }, form.slug))
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
),
|
|
73
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {}),
|
|
74
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
|
|
75
|
+
] });
|
|
76
|
+
}
|
|
77
|
+
);
|
|
78
|
+
HubspotFormInput.displayName = "HubspotFormInput";
|
|
79
|
+
exports.default = HubspotFormInput;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { u as useIntl } from "./index-CEh8vkxY.mjs";
|
|
4
|
+
import { Field, Flex, Loader, Combobox, ComboboxOption } from "@strapi/design-system";
|
|
5
|
+
import { useFetchClient } from "@strapi/strapi/admin";
|
|
6
|
+
import { P as PLUGIN_ID, g as getTranslation } from "./index-FKsiOEPB.mjs";
|
|
7
|
+
const HubspotFormInput = React.forwardRef(
|
|
8
|
+
({ name, value, onChange, disabled, error, required, label, hint, labelAction }, ref) => {
|
|
9
|
+
const { formatMessage } = useIntl();
|
|
10
|
+
const { get } = useFetchClient();
|
|
11
|
+
const [forms, setForms] = React.useState(null);
|
|
12
|
+
const [failed, setFailed] = React.useState(false);
|
|
13
|
+
const t = (id, defaultMessage, values) => formatMessage({ id: getTranslation(id), defaultMessage }, values);
|
|
14
|
+
React.useEffect(() => {
|
|
15
|
+
let cancelled = false;
|
|
16
|
+
get(`/${PLUGIN_ID}/forms-options`).then(({ data }) => !cancelled && setForms(data.forms ?? [])).catch(() => !cancelled && setFailed(true));
|
|
17
|
+
return () => {
|
|
18
|
+
cancelled = true;
|
|
19
|
+
};
|
|
20
|
+
}, [get]);
|
|
21
|
+
const emit = (next) => onChange({ target: { name, value: next ?? "", type: "string" } });
|
|
22
|
+
const known = forms ?? [];
|
|
23
|
+
const orphan = value && !known.some((f) => f.slug === value);
|
|
24
|
+
return /* @__PURE__ */ jsxs(Field.Root, { name, error, hint, required, children: [
|
|
25
|
+
/* @__PURE__ */ jsx(Field.Label, { action: labelAction, children: label }),
|
|
26
|
+
failed ? /* @__PURE__ */ jsx(
|
|
27
|
+
Field.Input,
|
|
28
|
+
{
|
|
29
|
+
ref,
|
|
30
|
+
value: value || "",
|
|
31
|
+
onChange: (e) => emit(e.target.value),
|
|
32
|
+
disabled,
|
|
33
|
+
placeholder: t("form-picker.fallback", "Form slug")
|
|
34
|
+
}
|
|
35
|
+
) : !forms ? /* @__PURE__ */ jsx(Flex, { paddingTop: 2, paddingBottom: 2, children: /* @__PURE__ */ jsx(Loader, { small: true, children: t("form-picker.loading", "Loading the forms…") }) }) : /* @__PURE__ */ jsxs(
|
|
36
|
+
Combobox,
|
|
37
|
+
{
|
|
38
|
+
ref,
|
|
39
|
+
value: value || "",
|
|
40
|
+
onChange: (next) => emit(next),
|
|
41
|
+
onClear: () => emit(""),
|
|
42
|
+
disabled,
|
|
43
|
+
placeholder: t("form-picker.placeholder", "Choose a form…"),
|
|
44
|
+
children: [
|
|
45
|
+
orphan && /* @__PURE__ */ jsx(ComboboxOption, { value, children: t("form-picker.orphan", "{slug} — unknown form", { slug: value }) }),
|
|
46
|
+
known.map((form) => /* @__PURE__ */ jsx(ComboboxOption, { value: form.slug, children: form.published ? `${form.name} (${form.slug})` : t("form-picker.draft", "{name} ({slug}) — draft, not served yet", {
|
|
47
|
+
name: form.name,
|
|
48
|
+
slug: form.slug
|
|
49
|
+
}) }, form.slug))
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
),
|
|
53
|
+
/* @__PURE__ */ jsx(Field.Hint, {}),
|
|
54
|
+
/* @__PURE__ */ jsx(Field.Error, {})
|
|
55
|
+
] });
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
HubspotFormInput.displayName = "HubspotFormInput";
|
|
59
|
+
export {
|
|
60
|
+
HubspotFormInput as default
|
|
61
|
+
};
|
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const React = require("react");
|
|
5
|
-
const
|
|
5
|
+
const index = require("./index-DkTxsEqL.js");
|
|
6
6
|
const designSystem = require("@strapi/design-system");
|
|
7
|
-
const index = require("./index-
|
|
8
|
-
const
|
|
7
|
+
const index$1 = require("./index-D2Q34BuH.js");
|
|
8
|
+
const objectLabels = require("./objectLabels-LAQ0M6-a.js");
|
|
9
|
+
const useHubspotSchema = require("./useHubspotSchema-C08qBAyy.js");
|
|
9
10
|
function _interopNamespace(e) {
|
|
10
11
|
if (e && e.__esModule) return e;
|
|
11
12
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
@@ -26,7 +27,7 @@ function _interopNamespace(e) {
|
|
|
26
27
|
const React__namespace = /* @__PURE__ */ _interopNamespace(React);
|
|
27
28
|
const HubspotObjectInput = React__namespace.forwardRef(
|
|
28
29
|
({ name, value, onChange, disabled, error, required, label, hint, labelAction }, ref) => {
|
|
29
|
-
const intl =
|
|
30
|
+
const intl = index.useIntl();
|
|
30
31
|
const { formatMessage } = intl;
|
|
31
32
|
const { schema } = useHubspotSchema.useHubspotSchema();
|
|
32
33
|
const emit = (next) => onChange({ target: { name, value: String(next ?? ""), type: "string" } });
|
|
@@ -38,7 +39,7 @@ const HubspotObjectInput = React__namespace.forwardRef(
|
|
|
38
39
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { name, error, hint, required, children: [
|
|
39
40
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { action: labelAction, children: label }),
|
|
40
41
|
!schema ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { paddingTop: 2, paddingBottom: 2, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Loader, { small: true, children: formatMessage({
|
|
41
|
-
id: index.getTranslation("object.loading"),
|
|
42
|
+
id: index$1.getTranslation("object.loading"),
|
|
42
43
|
defaultMessage: "Loading HubSpot objects…"
|
|
43
44
|
}) }) }) : schema.configured ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
44
45
|
designSystem.SingleSelect,
|
|
@@ -49,12 +50,12 @@ const HubspotObjectInput = React__namespace.forwardRef(
|
|
|
49
50
|
onClear: () => emit(""),
|
|
50
51
|
disabled,
|
|
51
52
|
placeholder: formatMessage({
|
|
52
|
-
id: index.getTranslation("object.placeholder"),
|
|
53
|
+
id: index$1.getTranslation("object.placeholder"),
|
|
53
54
|
defaultMessage: "Choose an object…"
|
|
54
55
|
}),
|
|
55
56
|
children: options.map((object) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: object, children: schema.unavailable.some((u) => u.object === object) ? formatMessage(
|
|
56
57
|
{
|
|
57
|
-
id: index.getTranslation("object.no-scope"),
|
|
58
|
+
id: index$1.getTranslation("object.no-scope"),
|
|
58
59
|
defaultMessage: "{object} — missing scope on the token"
|
|
59
60
|
},
|
|
60
61
|
{ object: objectLabels.objectLabel(intl, object) }
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import { u as useIntl
|
|
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 {
|
|
5
|
+
import { g as getTranslation } from "./index-FKsiOEPB.mjs";
|
|
6
|
+
import { o as objectLabel } from "./objectLabels-DBKevJle.mjs";
|
|
7
|
+
import { u as useHubspotSchema } from "./useHubspotSchema-BC0Od-Wl.mjs";
|
|
7
8
|
const HubspotObjectInput = React.forwardRef(
|
|
8
9
|
({ name, value, onChange, disabled, error, required, label, hint, labelAction }, ref) => {
|
|
9
10
|
const intl = useIntl();
|
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const React = require("react");
|
|
5
|
-
const
|
|
5
|
+
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 = require("./index-
|
|
10
|
-
const
|
|
9
|
+
const index$1 = require("./index-D2Q34BuH.js");
|
|
10
|
+
const objectLabels = require("./objectLabels-LAQ0M6-a.js");
|
|
11
|
+
const useHubspotSchema = require("./useHubspotSchema-C08qBAyy.js");
|
|
11
12
|
function _interopNamespace(e) {
|
|
12
13
|
if (e && e.__esModule) return e;
|
|
13
14
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
@@ -45,7 +46,7 @@ const HubspotPropertyInput = React__namespace.forwardRef(
|
|
|
45
46
|
hint,
|
|
46
47
|
labelAction
|
|
47
48
|
}, ref) => {
|
|
48
|
-
const intl =
|
|
49
|
+
const intl = index.useIntl();
|
|
49
50
|
const { formatMessage } = intl;
|
|
50
51
|
const { schema, loadError, refresh, refreshing } = useHubspotSchema.useHubspotSchema();
|
|
51
52
|
const objectFieldName = attribute?.options?.objectField || "hsObject";
|
|
@@ -90,7 +91,7 @@ const HubspotPropertyInput = React__namespace.forwardRef(
|
|
|
90
91
|
value,
|
|
91
92
|
label: elsewhere ? formatMessage(
|
|
92
93
|
{
|
|
93
|
-
id: index.getTranslation("picker.belongs-to"),
|
|
94
|
+
id: index$1.getTranslation("picker.belongs-to"),
|
|
94
95
|
defaultMessage: "{property} — belongs to {object}"
|
|
95
96
|
},
|
|
96
97
|
{
|
|
@@ -99,7 +100,7 @@ const HubspotPropertyInput = React__namespace.forwardRef(
|
|
|
99
100
|
}
|
|
100
101
|
) : formatMessage(
|
|
101
102
|
{
|
|
102
|
-
id: index.getTranslation("picker.unknown"),
|
|
103
|
+
id: index$1.getTranslation("picker.unknown"),
|
|
103
104
|
defaultMessage: "{property} — unknown to the portal"
|
|
104
105
|
},
|
|
105
106
|
{ property: value }
|
|
@@ -111,20 +112,20 @@ const HubspotPropertyInput = React__namespace.forwardRef(
|
|
|
111
112
|
const describe = () => {
|
|
112
113
|
if (loadError !== null) {
|
|
113
114
|
return loadError || formatMessage({
|
|
114
|
-
id: index.getTranslation("picker.load-error"),
|
|
115
|
+
id: index$1.getTranslation("picker.load-error"),
|
|
115
116
|
defaultMessage: "HubSpot properties unavailable"
|
|
116
117
|
});
|
|
117
118
|
}
|
|
118
119
|
if (schema && !schema.configured) {
|
|
119
120
|
return formatMessage({
|
|
120
|
-
id: index.getTranslation("picker.not-configured"),
|
|
121
|
+
id: index$1.getTranslation("picker.not-configured"),
|
|
121
122
|
defaultMessage: "No HubSpot API key — free text. Set it in Settings → HubSpot."
|
|
122
123
|
});
|
|
123
124
|
}
|
|
124
125
|
if (selectedObject && schema?.unavailable.some((u) => u.object === selectedObject)) {
|
|
125
126
|
return formatMessage(
|
|
126
127
|
{
|
|
127
|
-
id: index.getTranslation("picker.object-unavailable"),
|
|
128
|
+
id: index$1.getTranslation("picker.object-unavailable"),
|
|
128
129
|
defaultMessage: "Properties of “{object}” unreadable — missing scope on the token."
|
|
129
130
|
},
|
|
130
131
|
{ object: objectLabels.objectLabel(intl, selectedObject) }
|
|
@@ -160,7 +161,7 @@ const HubspotPropertyInput = React__namespace.forwardRef(
|
|
|
160
161
|
children: [
|
|
161
162
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { action: labelAction, children: label }),
|
|
162
163
|
!schema ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { paddingTop: 2, paddingBottom: 2, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Loader, { small: true, children: formatMessage({
|
|
163
|
-
id: index.getTranslation("picker.loading"),
|
|
164
|
+
id: index$1.getTranslation("picker.loading"),
|
|
164
165
|
defaultMessage: "Loading HubSpot properties…"
|
|
165
166
|
}) }) }) : schema.configured ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
166
167
|
designSystem.Combobox,
|
|
@@ -171,12 +172,12 @@ const HubspotPropertyInput = React__namespace.forwardRef(
|
|
|
171
172
|
onClear: () => emit(""),
|
|
172
173
|
disabled,
|
|
173
174
|
placeholder: formatMessage({
|
|
174
|
-
id: index.getTranslation("picker.placeholder"),
|
|
175
|
+
id: index$1.getTranslation("picker.placeholder"),
|
|
175
176
|
defaultMessage: "Search a property…"
|
|
176
177
|
}),
|
|
177
178
|
autocomplete: { type: "list", filter: "contains" },
|
|
178
179
|
noOptionsMessage: () => formatMessage({
|
|
179
|
-
id: index.getTranslation("picker.no-results"),
|
|
180
|
+
id: index$1.getTranslation("picker.no-results"),
|
|
180
181
|
defaultMessage: "No matching property — properties are managed in HubSpot."
|
|
181
182
|
}),
|
|
182
183
|
children: options.map((o) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.ComboboxOption, { value: o.value, textValue: o.label, children: /* @__PURE__ */ jsxRuntime.jsx("span", { title: o.label, style: oneLine, children: o.label }) }, o.value))
|
|
@@ -189,7 +190,7 @@ const HubspotPropertyInput = React__namespace.forwardRef(
|
|
|
189
190
|
onChange: (e) => emit(e.target.value),
|
|
190
191
|
disabled,
|
|
191
192
|
placeholder: formatMessage({
|
|
192
|
-
id: index.getTranslation("picker.free-placeholder"),
|
|
193
|
+
id: index$1.getTranslation("picker.free-placeholder"),
|
|
193
194
|
defaultMessage: "e.g. hs_role, numberofemployees"
|
|
194
195
|
})
|
|
195
196
|
}
|
|
@@ -199,7 +200,7 @@ const HubspotPropertyInput = React__namespace.forwardRef(
|
|
|
199
200
|
designSystem.IconButton,
|
|
200
201
|
{
|
|
201
202
|
label: formatMessage({
|
|
202
|
-
id: index.getTranslation("picker.refresh"),
|
|
203
|
+
id: index$1.getTranslation("picker.refresh"),
|
|
203
204
|
defaultMessage: "Refresh the properties from HubSpot"
|
|
204
205
|
}),
|
|
205
206
|
variant: "ghost",
|
|
@@ -218,7 +219,7 @@ const HubspotPropertyInput = React__namespace.forwardRef(
|
|
|
218
219
|
disabled,
|
|
219
220
|
children: formatMessage(
|
|
220
221
|
{
|
|
221
|
-
id: index.getTranslation("picker.import"),
|
|
222
|
+
id: index$1.getTranslation("picker.import"),
|
|
222
223
|
defaultMessage: "Import the {count} options from HubSpot"
|
|
223
224
|
},
|
|
224
225
|
{ count: selectedProperty?.options.length ?? 0 }
|
|
@@ -226,11 +227,11 @@ const HubspotPropertyInput = React__namespace.forwardRef(
|
|
|
226
227
|
}
|
|
227
228
|
) : null,
|
|
228
229
|
imported ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "success600", children: formatMessage({
|
|
229
|
-
id: index.getTranslation("picker.imported"),
|
|
230
|
+
id: index$1.getTranslation("picker.imported"),
|
|
230
231
|
defaultMessage: "Options imported — save to keep them."
|
|
231
232
|
}) }) : null,
|
|
232
233
|
crmLink ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Link, { href: crmLink, isExternal: true, children: formatMessage({
|
|
233
|
-
id: index.getTranslation("picker.view"),
|
|
234
|
+
id: index$1.getTranslation("picker.view"),
|
|
234
235
|
defaultMessage: "View in HubSpot"
|
|
235
236
|
}) }) : null
|
|
236
237
|
] }) : null,
|
package/dist/_chunks/{HubspotPropertyInput-k7wMSmeF.mjs → HubspotPropertyInput-DrBsx9jQ.mjs}
RENAMED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import { u as useIntl
|
|
3
|
+
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-
|
|
8
|
-
import {
|
|
7
|
+
import { g as getTranslation } from "./index-FKsiOEPB.mjs";
|
|
8
|
+
import { o as objectLabel } from "./objectLabels-DBKevJle.mjs";
|
|
9
|
+
import { u as useHubspotSchema } from "./useHubspotSchema-BC0Od-Wl.mjs";
|
|
9
10
|
const oneLine = {
|
|
10
11
|
display: "block",
|
|
11
12
|
whiteSpace: "nowrap",
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import { u as useIntl
|
|
3
|
+
import { u as useIntl } from "./index-CEh8vkxY.mjs";
|
|
4
4
|
import { Flex, Divider, Typography, Button, Box, Link, Badge, Loader, Field } from "@strapi/design-system";
|
|
5
5
|
import { useFetchClient } from "@strapi/strapi/admin";
|
|
6
|
-
import { g as getTranslation, P as PLUGIN_ID } from "./index-
|
|
6
|
+
import { g as getTranslation, P as PLUGIN_ID } from "./index-FKsiOEPB.mjs";
|
|
7
7
|
import { Link as Link$1 } from "react-router-dom";
|
|
8
|
+
import { o as objectLabel } from "./objectLabels-DBKevJle.mjs";
|
|
8
9
|
const AuditSection = ({ configured }) => {
|
|
9
10
|
const intl = useIntl();
|
|
10
11
|
const { formatMessage } = intl;
|
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const React = require("react");
|
|
5
|
-
const
|
|
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 = require("./index-
|
|
8
|
+
const index$1 = require("./index-D2Q34BuH.js");
|
|
9
9
|
const reactRouterDom = require("react-router-dom");
|
|
10
|
+
const objectLabels = require("./objectLabels-LAQ0M6-a.js");
|
|
10
11
|
function _interopNamespace(e) {
|
|
11
12
|
if (e && e.__esModule) return e;
|
|
12
13
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
@@ -26,13 +27,13 @@ function _interopNamespace(e) {
|
|
|
26
27
|
}
|
|
27
28
|
const React__namespace = /* @__PURE__ */ _interopNamespace(React);
|
|
28
29
|
const AuditSection = ({ configured }) => {
|
|
29
|
-
const intl =
|
|
30
|
+
const intl = index.useIntl();
|
|
30
31
|
const { formatMessage } = intl;
|
|
31
32
|
const { get } = admin.useFetchClient();
|
|
32
33
|
const [busy, setBusy] = React__namespace.useState(false);
|
|
33
34
|
const [error, setError] = React__namespace.useState(false);
|
|
34
35
|
const [result, setResult] = React__namespace.useState(null);
|
|
35
|
-
const t = (id, defaultMessage, values) => formatMessage({ id: index.getTranslation(id), defaultMessage }, values);
|
|
36
|
+
const t = (id, defaultMessage, values) => formatMessage({ id: index$1.getTranslation(id), defaultMessage }, values);
|
|
36
37
|
const problemText = (p) => {
|
|
37
38
|
switch (p.code) {
|
|
38
39
|
case "unknown":
|
|
@@ -62,7 +63,7 @@ const AuditSection = ({ configured }) => {
|
|
|
62
63
|
setError(false);
|
|
63
64
|
setResult(null);
|
|
64
65
|
try {
|
|
65
|
-
const { data } = await get(`/${index.PLUGIN_ID}/audit`);
|
|
66
|
+
const { data } = await get(`/${index$1.PLUGIN_ID}/audit`);
|
|
66
67
|
setResult(data);
|
|
67
68
|
} catch {
|
|
68
69
|
setError(true);
|
|
@@ -119,17 +120,17 @@ const AuditSection = ({ configured }) => {
|
|
|
119
120
|
] });
|
|
120
121
|
};
|
|
121
122
|
const FailuresSection = ({ configured }) => {
|
|
122
|
-
const { formatMessage } =
|
|
123
|
+
const { formatMessage } = index.useIntl();
|
|
123
124
|
const { get, post } = admin.useFetchClient();
|
|
124
125
|
const [total, setTotal] = React__namespace.useState(null);
|
|
125
126
|
const [busy, setBusy] = React__namespace.useState(false);
|
|
126
127
|
const [feedback, setFeedback] = React__namespace.useState(
|
|
127
128
|
null
|
|
128
129
|
);
|
|
129
|
-
const t = (id, defaultMessage, values) => formatMessage({ id: index.getTranslation(id), defaultMessage }, values);
|
|
130
|
+
const t = (id, defaultMessage, values) => formatMessage({ id: index$1.getTranslation(id), defaultMessage }, values);
|
|
130
131
|
const load = React__namespace.useCallback(async () => {
|
|
131
132
|
try {
|
|
132
|
-
const { data } = await get(`/${index.PLUGIN_ID}/failures`);
|
|
133
|
+
const { data } = await get(`/${index$1.PLUGIN_ID}/failures`);
|
|
133
134
|
setTotal(data.total);
|
|
134
135
|
} catch {
|
|
135
136
|
setTotal(null);
|
|
@@ -143,7 +144,7 @@ const FailuresSection = ({ configured }) => {
|
|
|
143
144
|
setFeedback(null);
|
|
144
145
|
try {
|
|
145
146
|
const { data } = await post(
|
|
146
|
-
`/${index.PLUGIN_ID}/failures/retry`
|
|
147
|
+
`/${index$1.PLUGIN_ID}/failures/retry`
|
|
147
148
|
);
|
|
148
149
|
setFeedback({
|
|
149
150
|
tone: data.failed ? "danger" : "success",
|
|
@@ -192,7 +193,7 @@ const FailuresSection = ({ configured }) => {
|
|
|
192
193
|
] });
|
|
193
194
|
};
|
|
194
195
|
const HubspotSettings = () => {
|
|
195
|
-
const { formatMessage } =
|
|
196
|
+
const { formatMessage } = index.useIntl();
|
|
196
197
|
const { get, put, del } = admin.useFetchClient();
|
|
197
198
|
const [settings, setSettings] = React__namespace.useState(null);
|
|
198
199
|
const [apiKey, setApiKey] = React__namespace.useState("");
|
|
@@ -200,9 +201,9 @@ const HubspotSettings = () => {
|
|
|
200
201
|
const [feedback, setFeedback] = React__namespace.useState(
|
|
201
202
|
null
|
|
202
203
|
);
|
|
203
|
-
const t = (id, defaultMessage, values) => formatMessage({ id: index.getTranslation(id), defaultMessage }, values);
|
|
204
|
+
const t = (id, defaultMessage, values) => formatMessage({ id: index$1.getTranslation(id), defaultMessage }, values);
|
|
204
205
|
const load = React__namespace.useCallback(async () => {
|
|
205
|
-
const { data } = await get(`/${index.PLUGIN_ID}/settings`);
|
|
206
|
+
const { data } = await get(`/${index$1.PLUGIN_ID}/settings`);
|
|
206
207
|
setSettings(data);
|
|
207
208
|
}, [get]);
|
|
208
209
|
React__namespace.useEffect(() => {
|
|
@@ -214,7 +215,7 @@ const HubspotSettings = () => {
|
|
|
214
215
|
setBusy(true);
|
|
215
216
|
setFeedback(null);
|
|
216
217
|
try {
|
|
217
|
-
const { data } = await put(`/${index.PLUGIN_ID}/settings`, { apiKey });
|
|
218
|
+
const { data } = await put(`/${index$1.PLUGIN_ID}/settings`, { apiKey });
|
|
218
219
|
setSettings(data);
|
|
219
220
|
setApiKey("");
|
|
220
221
|
setFeedback({ tone: "success", text: t("settings.saved", "Key saved.") });
|
|
@@ -228,7 +229,7 @@ const HubspotSettings = () => {
|
|
|
228
229
|
setBusy(true);
|
|
229
230
|
setFeedback(null);
|
|
230
231
|
try {
|
|
231
|
-
const { data } = await del(`/${index.PLUGIN_ID}/settings`);
|
|
232
|
+
const { data } = await del(`/${index$1.PLUGIN_ID}/settings`);
|
|
232
233
|
setSettings(data);
|
|
233
234
|
setApiKey("");
|
|
234
235
|
setFeedback({ tone: "success", text: t("settings.removed", "Key removed.") });
|
|
@@ -243,7 +244,7 @@ const HubspotSettings = () => {
|
|
|
243
244
|
setFeedback(null);
|
|
244
245
|
try {
|
|
245
246
|
const { data } = await get(
|
|
246
|
-
`/${index.PLUGIN_ID}/properties?refresh=1`
|
|
247
|
+
`/${index$1.PLUGIN_ID}/properties?refresh=1`
|
|
247
248
|
);
|
|
248
249
|
setFeedback(
|
|
249
250
|
data.configured ? {
|
|
@@ -190,7 +190,14 @@ const en = {
|
|
|
190
190
|
"forms.import-hint": "Converts a legacy content-type form (all locales) into a draft here — same slug, source untouched. Re-importing overwrites the draft.",
|
|
191
191
|
"forms.import-source": "Form to import",
|
|
192
192
|
"forms.import": "Import",
|
|
193
|
-
"forms.import-error": "Could not import the form."
|
|
193
|
+
"forms.import-error": "Could not import the form.",
|
|
194
|
+
"form-picker.label": "HubSpot form",
|
|
195
|
+
"form-picker.description": "A form built in the HubSpot form builder, stored by slug",
|
|
196
|
+
"form-picker.loading": "Loading the forms…",
|
|
197
|
+
"form-picker.placeholder": "Choose a form…",
|
|
198
|
+
"form-picker.fallback": "Form slug",
|
|
199
|
+
"form-picker.orphan": "{slug} — unknown form",
|
|
200
|
+
"form-picker.draft": "{name} ({slug}) — draft, not served yet"
|
|
194
201
|
};
|
|
195
202
|
export {
|
|
196
203
|
en as default
|
|
@@ -192,6 +192,13 @@ const en = {
|
|
|
192
192
|
"forms.import-hint": "Converts a legacy content-type form (all locales) into a draft here — same slug, source untouched. Re-importing overwrites the draft.",
|
|
193
193
|
"forms.import-source": "Form to import",
|
|
194
194
|
"forms.import": "Import",
|
|
195
|
-
"forms.import-error": "Could not import the form."
|
|
195
|
+
"forms.import-error": "Could not import the form.",
|
|
196
|
+
"form-picker.label": "HubSpot form",
|
|
197
|
+
"form-picker.description": "A form built in the HubSpot form builder, stored by slug",
|
|
198
|
+
"form-picker.loading": "Loading the forms…",
|
|
199
|
+
"form-picker.placeholder": "Choose a form…",
|
|
200
|
+
"form-picker.fallback": "Form slug",
|
|
201
|
+
"form-picker.orphan": "{slug} — unknown form",
|
|
202
|
+
"form-picker.draft": "{name} ({slug}) — draft, not served yet"
|
|
196
203
|
};
|
|
197
204
|
exports.default = en;
|
|
@@ -190,7 +190,14 @@ const fr = {
|
|
|
190
190
|
"forms.import-hint": "Convertit un formulaire du content type historique (toutes locales) en brouillon ici — même slug, source intacte. Ré-importer écrase le brouillon.",
|
|
191
191
|
"forms.import-source": "Formulaire à importer",
|
|
192
192
|
"forms.import": "Importer",
|
|
193
|
-
"forms.import-error": "Impossible d'importer le formulaire."
|
|
193
|
+
"forms.import-error": "Impossible d'importer le formulaire.",
|
|
194
|
+
"form-picker.label": "Formulaire HubSpot",
|
|
195
|
+
"form-picker.description": "Un formulaire construit dans le form builder HubSpot, stocké par slug",
|
|
196
|
+
"form-picker.loading": "Chargement des formulaires…",
|
|
197
|
+
"form-picker.placeholder": "Choisir un formulaire…",
|
|
198
|
+
"form-picker.fallback": "Slug du formulaire",
|
|
199
|
+
"form-picker.orphan": "{slug} — formulaire inconnu",
|
|
200
|
+
"form-picker.draft": "{name} ({slug}) — brouillon, pas encore servi"
|
|
194
201
|
};
|
|
195
202
|
export {
|
|
196
203
|
fr as default
|
|
@@ -192,6 +192,13 @@ const fr = {
|
|
|
192
192
|
"forms.import-hint": "Convertit un formulaire du content type historique (toutes locales) en brouillon ici — même slug, source intacte. Ré-importer écrase le brouillon.",
|
|
193
193
|
"forms.import-source": "Formulaire à importer",
|
|
194
194
|
"forms.import": "Importer",
|
|
195
|
-
"forms.import-error": "Impossible d'importer le formulaire."
|
|
195
|
+
"forms.import-error": "Impossible d'importer le formulaire.",
|
|
196
|
+
"form-picker.label": "Formulaire HubSpot",
|
|
197
|
+
"form-picker.description": "Un formulaire construit dans le form builder HubSpot, stocké par slug",
|
|
198
|
+
"form-picker.loading": "Chargement des formulaires…",
|
|
199
|
+
"form-picker.placeholder": "Choisir un formulaire…",
|
|
200
|
+
"form-picker.fallback": "Slug du formulaire",
|
|
201
|
+
"form-picker.orphan": "{slug} — formulaire inconnu",
|
|
202
|
+
"form-picker.draft": "{name} ({slug}) — brouillon, pas encore servi"
|
|
196
203
|
};
|
|
197
204
|
exports.default = fr;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { g as getTranslation } from "./index-foVSGFWb.mjs";
|
|
3
2
|
var __assign = function() {
|
|
4
3
|
__assign = Object.assign || function __assign2(t) {
|
|
5
4
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -407,19 +406,6 @@ createFormattedComponent("formatList");
|
|
|
407
406
|
createFormattedComponent("formatDisplayName");
|
|
408
407
|
createFormattedDateTimePartsComponent("formatDate");
|
|
409
408
|
createFormattedDateTimePartsComponent("formatTime");
|
|
410
|
-
const STANDARD = /* @__PURE__ */ new Set([
|
|
411
|
-
"contact",
|
|
412
|
-
"company",
|
|
413
|
-
"deal",
|
|
414
|
-
"ticket",
|
|
415
|
-
"product",
|
|
416
|
-
"line_item",
|
|
417
|
-
"quote"
|
|
418
|
-
]);
|
|
419
|
-
function objectLabel(intl, object) {
|
|
420
|
-
return STANDARD.has(object) ? intl.formatMessage({ id: getTranslation(`objects.${object}`), defaultMessage: object }) : object;
|
|
421
|
-
}
|
|
422
409
|
export {
|
|
423
|
-
objectLabel as o,
|
|
424
410
|
useIntl as u
|
|
425
411
|
};
|
|
@@ -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-
|
|
29
|
+
Component: async () => (await Promise.resolve().then(() => require("./Forms-HMZbTk_B.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-
|
|
44
|
+
Input: async () => Promise.resolve().then(() => require("./HubspotPropertyInput-Dn1QvOcu.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,23 @@ 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-
|
|
107
|
+
Input: async () => Promise.resolve().then(() => require("./HubspotObjectInput-D-FGwsyS.js"))
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
app.customFields.register({
|
|
111
|
+
name: "form-picker",
|
|
112
|
+
pluginId: PLUGIN_ID,
|
|
113
|
+
type: "string",
|
|
114
|
+
intlLabel: {
|
|
115
|
+
id: `${PLUGIN_ID}.form-picker.label`,
|
|
116
|
+
defaultMessage: "HubSpot form"
|
|
117
|
+
},
|
|
118
|
+
intlDescription: {
|
|
119
|
+
id: `${PLUGIN_ID}.form-picker.description`,
|
|
120
|
+
defaultMessage: "A form built in the HubSpot form builder, stored by slug"
|
|
121
|
+
},
|
|
122
|
+
components: {
|
|
123
|
+
Input: async () => Promise.resolve().then(() => require("./HubspotFormInput-BequMb12.js"))
|
|
108
124
|
}
|
|
109
125
|
});
|
|
110
126
|
app.createSettingSection(
|
|
@@ -120,7 +136,7 @@ const index = {
|
|
|
120
136
|
// Mirrors the RBAC action registered server-side: a role without it
|
|
121
137
|
// doesn't see the link at all — the routes refuse it anyway.
|
|
122
138
|
permissions: [{ action: `plugin::${PLUGIN_ID}.settings`, subject: null }],
|
|
123
|
-
Component: async () => (await Promise.resolve().then(() => require("./Settings-
|
|
139
|
+
Component: async () => (await Promise.resolve().then(() => require("./Settings-Cgp7M1Cv.js"))).default
|
|
124
140
|
}
|
|
125
141
|
]
|
|
126
142
|
);
|
|
@@ -130,7 +146,7 @@ const index = {
|
|
|
130
146
|
return Promise.all(
|
|
131
147
|
locales.map(async (locale) => {
|
|
132
148
|
try {
|
|
133
|
-
const { default: data } = await __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => Promise.resolve().then(() => require("./en-
|
|
149
|
+
const { default: data } = await __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => Promise.resolve().then(() => require("./en-D5Ch9YFo.js")), "./translations/fr.json": () => Promise.resolve().then(() => require("./fr-CqlhHltZ.js")) }), `./translations/${locale}.json`, 3);
|
|
134
150
|
return { data: prefixPluginTranslations(data), locale };
|
|
135
151
|
} catch {
|
|
136
152
|
return { data: {}, locale };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const React = require("react");
|
|
3
|
-
const index = require("./index-D_CPrIHe.js");
|
|
4
3
|
function _interopNamespace(e) {
|
|
5
4
|
if (e && e.__esModule) return e;
|
|
6
5
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
@@ -426,17 +425,4 @@ createFormattedComponent("formatList");
|
|
|
426
425
|
createFormattedComponent("formatDisplayName");
|
|
427
426
|
createFormattedDateTimePartsComponent("formatDate");
|
|
428
427
|
createFormattedDateTimePartsComponent("formatTime");
|
|
429
|
-
const STANDARD = /* @__PURE__ */ new Set([
|
|
430
|
-
"contact",
|
|
431
|
-
"company",
|
|
432
|
-
"deal",
|
|
433
|
-
"ticket",
|
|
434
|
-
"product",
|
|
435
|
-
"line_item",
|
|
436
|
-
"quote"
|
|
437
|
-
]);
|
|
438
|
-
function objectLabel(intl, object) {
|
|
439
|
-
return STANDARD.has(object) ? intl.formatMessage({ id: index.getTranslation(`objects.${object}`), defaultMessage: object }) : object;
|
|
440
|
-
}
|
|
441
|
-
exports.objectLabel = objectLabel;
|
|
442
428
|
exports.useIntl = useIntl;
|
|
@@ -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-
|
|
28
|
+
Component: async () => (await import("./Forms-CKA6ukB6.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-
|
|
43
|
+
Input: async () => import("./HubspotPropertyInput-DrBsx9jQ.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,23 @@ const index = {
|
|
|
103
103
|
defaultMessage: "Picked from the portal's configured objects"
|
|
104
104
|
},
|
|
105
105
|
components: {
|
|
106
|
-
Input: async () => import("./HubspotObjectInput-
|
|
106
|
+
Input: async () => import("./HubspotObjectInput-V3uhGK8k.mjs")
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
app.customFields.register({
|
|
110
|
+
name: "form-picker",
|
|
111
|
+
pluginId: PLUGIN_ID,
|
|
112
|
+
type: "string",
|
|
113
|
+
intlLabel: {
|
|
114
|
+
id: `${PLUGIN_ID}.form-picker.label`,
|
|
115
|
+
defaultMessage: "HubSpot form"
|
|
116
|
+
},
|
|
117
|
+
intlDescription: {
|
|
118
|
+
id: `${PLUGIN_ID}.form-picker.description`,
|
|
119
|
+
defaultMessage: "A form built in the HubSpot form builder, stored by slug"
|
|
120
|
+
},
|
|
121
|
+
components: {
|
|
122
|
+
Input: async () => import("./HubspotFormInput-CKYRcNNU.mjs")
|
|
107
123
|
}
|
|
108
124
|
});
|
|
109
125
|
app.createSettingSection(
|
|
@@ -119,7 +135,7 @@ const index = {
|
|
|
119
135
|
// Mirrors the RBAC action registered server-side: a role without it
|
|
120
136
|
// doesn't see the link at all — the routes refuse it anyway.
|
|
121
137
|
permissions: [{ action: `plugin::${PLUGIN_ID}.settings`, subject: null }],
|
|
122
|
-
Component: async () => (await import("./Settings-
|
|
138
|
+
Component: async () => (await import("./Settings-BjkNbyna.mjs")).default
|
|
123
139
|
}
|
|
124
140
|
]
|
|
125
141
|
);
|
|
@@ -129,7 +145,7 @@ const index = {
|
|
|
129
145
|
return Promise.all(
|
|
130
146
|
locales.map(async (locale) => {
|
|
131
147
|
try {
|
|
132
|
-
const { default: data } = await __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => import("./en-
|
|
148
|
+
const { default: data } = await __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => import("./en-Cun5LoUP.mjs"), "./translations/fr.json": () => import("./fr-ClOWflse.mjs") }), `./translations/${locale}.json`, 3);
|
|
133
149
|
return { data: prefixPluginTranslations(data), locale };
|
|
134
150
|
} catch {
|
|
135
151
|
return { data: {}, locale };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { g as getTranslation } from "./index-FKsiOEPB.mjs";
|
|
2
|
+
const STANDARD = /* @__PURE__ */ new Set([
|
|
3
|
+
"contact",
|
|
4
|
+
"company",
|
|
5
|
+
"deal",
|
|
6
|
+
"ticket",
|
|
7
|
+
"product",
|
|
8
|
+
"line_item",
|
|
9
|
+
"quote"
|
|
10
|
+
]);
|
|
11
|
+
function objectLabel(intl, object) {
|
|
12
|
+
return STANDARD.has(object) ? intl.formatMessage({ id: getTranslation(`objects.${object}`), defaultMessage: object }) : object;
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
objectLabel as o
|
|
16
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const index = require("./index-D2Q34BuH.js");
|
|
3
|
+
const STANDARD = /* @__PURE__ */ new Set([
|
|
4
|
+
"contact",
|
|
5
|
+
"company",
|
|
6
|
+
"deal",
|
|
7
|
+
"ticket",
|
|
8
|
+
"product",
|
|
9
|
+
"line_item",
|
|
10
|
+
"quote"
|
|
11
|
+
]);
|
|
12
|
+
function objectLabel(intl, object) {
|
|
13
|
+
return STANDARD.has(object) ? intl.formatMessage({ id: index.getTranslation(`objects.${object}`), defaultMessage: object }) : object;
|
|
14
|
+
}
|
|
15
|
+
exports.objectLabel = objectLabel;
|
|
@@ -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-
|
|
3
|
+
import { P as PLUGIN_ID } from "./index-FKsiOEPB.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-
|
|
4
|
+
const index = require("./index-D2Q34BuH.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" } });
|
package/dist/admin/index.js
CHANGED
package/dist/admin/index.mjs
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
interface InputProps {
|
|
3
|
+
name: string;
|
|
4
|
+
value?: string;
|
|
5
|
+
onChange: (event: {
|
|
6
|
+
target: {
|
|
7
|
+
name: string;
|
|
8
|
+
value: string;
|
|
9
|
+
type: string;
|
|
10
|
+
};
|
|
11
|
+
}) => void;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
error?: string;
|
|
14
|
+
required?: boolean;
|
|
15
|
+
labelAction?: React.ReactNode;
|
|
16
|
+
hint?: React.ReactNode;
|
|
17
|
+
label?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Picker over the forms built in the HubSpot form builder, for host content
|
|
21
|
+
* that references one (a hero block, a landing…). Stores the form's slug as a
|
|
22
|
+
* plain string: the reference survives the plugin being uninstalled, and a
|
|
23
|
+
* fetch failure degrades to a free-text input rather than blocking the editor.
|
|
24
|
+
*
|
|
25
|
+
* An unpublished form stays selectable — an editor can wire the block before
|
|
26
|
+
* publishing — but is flagged, since the public API only serves published ones.
|
|
27
|
+
*/
|
|
28
|
+
declare const HubspotFormInput: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
|
|
29
|
+
export default HubspotFormInput;
|
package/dist/server/index.js
CHANGED
|
@@ -1094,6 +1094,31 @@ function createFormsAdminController(strapi) {
|
|
|
1094
1094
|
});
|
|
1095
1095
|
ctx.body = { ok: true };
|
|
1096
1096
|
},
|
|
1097
|
+
/**
|
|
1098
|
+
* Feeds the `hubspot.form-picker` custom field: every form of the builder
|
|
1099
|
+
* as { name, slug, published }. Open to any authenticated admin — like the
|
|
1100
|
+
* properties route — because editors pick forms from the Content Manager,
|
|
1101
|
+
* not from the builder. `name`/`slug` are shared across locales.
|
|
1102
|
+
*/
|
|
1103
|
+
async options(ctx) {
|
|
1104
|
+
const drafts = await documents().findMany({
|
|
1105
|
+
fields: ["name", "slug"],
|
|
1106
|
+
sort: "name:asc",
|
|
1107
|
+
status: "draft"
|
|
1108
|
+
});
|
|
1109
|
+
const published = await documents().findMany({
|
|
1110
|
+
fields: ["slug"],
|
|
1111
|
+
status: "published"
|
|
1112
|
+
});
|
|
1113
|
+
const publishedSlugs = new Set(published.map((e) => e.slug));
|
|
1114
|
+
ctx.body = {
|
|
1115
|
+
forms: drafts.filter((e) => e.slug).map((e) => ({
|
|
1116
|
+
name: e.name ?? e.slug,
|
|
1117
|
+
slug: e.slug,
|
|
1118
|
+
published: publishedSlugs.has(e.slug)
|
|
1119
|
+
}))
|
|
1120
|
+
};
|
|
1121
|
+
},
|
|
1097
1122
|
/** Entries of the configured legacy content type, offered for import. */
|
|
1098
1123
|
async listSources(ctx) {
|
|
1099
1124
|
const config2 = strapi.plugin("hubspot").config("forms", {}).import;
|
|
@@ -1477,6 +1502,9 @@ const routes = {
|
|
|
1477
1502
|
adminRoute("POST", "/builder/forms/:documentId/publish", "formsAdmin.publish", [FORMS_ACTION]),
|
|
1478
1503
|
adminRoute("POST", "/builder/forms/:documentId/unpublish", "formsAdmin.unpublish", [FORMS_ACTION]),
|
|
1479
1504
|
adminRoute("DELETE", "/builder/forms/:documentId", "formsAdmin.remove", [FORMS_ACTION]),
|
|
1505
|
+
// No FORMS_ACTION: editors pick forms from the Content Manager, like
|
|
1506
|
+
// they pick properties — the builder itself stays gated.
|
|
1507
|
+
adminRoute("GET", "/forms-options", "formsAdmin.options"),
|
|
1480
1508
|
adminRoute("GET", "/builder/import/sources", "formsAdmin.listSources", [FORMS_ACTION]),
|
|
1481
1509
|
adminRoute("POST", "/builder/import", "formsAdmin.runImport", [FORMS_ACTION])
|
|
1482
1510
|
]
|
|
@@ -1512,6 +1540,11 @@ const index = {
|
|
|
1512
1540
|
plugin: "hubspot",
|
|
1513
1541
|
type: "string"
|
|
1514
1542
|
});
|
|
1543
|
+
strapi.customFields.register({
|
|
1544
|
+
name: "form-picker",
|
|
1545
|
+
plugin: "hubspot",
|
|
1546
|
+
type: "string"
|
|
1547
|
+
});
|
|
1515
1548
|
},
|
|
1516
1549
|
async bootstrap({ strapi }) {
|
|
1517
1550
|
await strapi.service("admin::permission").actionProvider.registerMany([
|
package/dist/server/index.mjs
CHANGED
|
@@ -1093,6 +1093,31 @@ function createFormsAdminController(strapi) {
|
|
|
1093
1093
|
});
|
|
1094
1094
|
ctx.body = { ok: true };
|
|
1095
1095
|
},
|
|
1096
|
+
/**
|
|
1097
|
+
* Feeds the `hubspot.form-picker` custom field: every form of the builder
|
|
1098
|
+
* as { name, slug, published }. Open to any authenticated admin — like the
|
|
1099
|
+
* properties route — because editors pick forms from the Content Manager,
|
|
1100
|
+
* not from the builder. `name`/`slug` are shared across locales.
|
|
1101
|
+
*/
|
|
1102
|
+
async options(ctx) {
|
|
1103
|
+
const drafts = await documents().findMany({
|
|
1104
|
+
fields: ["name", "slug"],
|
|
1105
|
+
sort: "name:asc",
|
|
1106
|
+
status: "draft"
|
|
1107
|
+
});
|
|
1108
|
+
const published = await documents().findMany({
|
|
1109
|
+
fields: ["slug"],
|
|
1110
|
+
status: "published"
|
|
1111
|
+
});
|
|
1112
|
+
const publishedSlugs = new Set(published.map((e) => e.slug));
|
|
1113
|
+
ctx.body = {
|
|
1114
|
+
forms: drafts.filter((e) => e.slug).map((e) => ({
|
|
1115
|
+
name: e.name ?? e.slug,
|
|
1116
|
+
slug: e.slug,
|
|
1117
|
+
published: publishedSlugs.has(e.slug)
|
|
1118
|
+
}))
|
|
1119
|
+
};
|
|
1120
|
+
},
|
|
1096
1121
|
/** Entries of the configured legacy content type, offered for import. */
|
|
1097
1122
|
async listSources(ctx) {
|
|
1098
1123
|
const config2 = strapi.plugin("hubspot").config("forms", {}).import;
|
|
@@ -1476,6 +1501,9 @@ const routes = {
|
|
|
1476
1501
|
adminRoute("POST", "/builder/forms/:documentId/publish", "formsAdmin.publish", [FORMS_ACTION]),
|
|
1477
1502
|
adminRoute("POST", "/builder/forms/:documentId/unpublish", "formsAdmin.unpublish", [FORMS_ACTION]),
|
|
1478
1503
|
adminRoute("DELETE", "/builder/forms/:documentId", "formsAdmin.remove", [FORMS_ACTION]),
|
|
1504
|
+
// No FORMS_ACTION: editors pick forms from the Content Manager, like
|
|
1505
|
+
// they pick properties — the builder itself stays gated.
|
|
1506
|
+
adminRoute("GET", "/forms-options", "formsAdmin.options"),
|
|
1479
1507
|
adminRoute("GET", "/builder/import/sources", "formsAdmin.listSources", [FORMS_ACTION]),
|
|
1480
1508
|
adminRoute("POST", "/builder/import", "formsAdmin.runImport", [FORMS_ACTION])
|
|
1481
1509
|
]
|
|
@@ -1511,6 +1539,11 @@ const index = {
|
|
|
1511
1539
|
plugin: "hubspot",
|
|
1512
1540
|
type: "string"
|
|
1513
1541
|
});
|
|
1542
|
+
strapi.customFields.register({
|
|
1543
|
+
name: "form-picker",
|
|
1544
|
+
plugin: "hubspot",
|
|
1545
|
+
type: "string"
|
|
1546
|
+
});
|
|
1514
1547
|
},
|
|
1515
1548
|
async bootstrap({ strapi }) {
|
|
1516
1549
|
await strapi.service("admin::permission").actionProvider.registerMany([
|
|
@@ -27,6 +27,13 @@ export declare function createFormsAdminController(strapi: Core.Strapi): {
|
|
|
27
27
|
update(ctx: Ctx): Promise<void>;
|
|
28
28
|
publish(ctx: Ctx): Promise<void>;
|
|
29
29
|
unpublish(ctx: Ctx): Promise<void>;
|
|
30
|
+
/**
|
|
31
|
+
* Feeds the `hubspot.form-picker` custom field: every form of the builder
|
|
32
|
+
* as { name, slug, published }. Open to any authenticated admin — like the
|
|
33
|
+
* properties route — because editors pick forms from the Content Manager,
|
|
34
|
+
* not from the builder. `name`/`slug` are shared across locales.
|
|
35
|
+
*/
|
|
36
|
+
options(ctx: Ctx): Promise<void>;
|
|
30
37
|
/** Entries of the configured legacy content type, offered for import. */
|
|
31
38
|
listSources(ctx: Ctx): Promise<void>;
|
|
32
39
|
/**
|
|
@@ -250,6 +250,7 @@ declare const _default: {
|
|
|
250
250
|
update(ctx: import("./formsAdmin").Ctx): Promise<void>;
|
|
251
251
|
publish(ctx: import("./formsAdmin").Ctx): Promise<void>;
|
|
252
252
|
unpublish(ctx: import("./formsAdmin").Ctx): Promise<void>;
|
|
253
|
+
options(ctx: import("./formsAdmin").Ctx): Promise<void>;
|
|
253
254
|
listSources(ctx: import("./formsAdmin").Ctx): Promise<void>;
|
|
254
255
|
runImport(ctx: import("./formsAdmin").Ctx): Promise<void>;
|
|
255
256
|
remove(ctx: import("./formsAdmin").Ctx): Promise<void>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "strapi-plugin-hubspot",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
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",
|