strapi-plugin-hubspot 0.6.0 → 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 +26 -0
- package/dist/_chunks/{Forms-CW1KFO9U.mjs → Forms-CKA6ukB6.mjs} +5 -4
- package/dist/_chunks/{Forms-BF4_zA-m.js → Forms-HMZbTk_B.js} +30 -29
- package/dist/_chunks/HubspotFormInput-BequMb12.js +79 -0
- package/dist/_chunks/HubspotFormInput-CKYRcNNU.mjs +61 -0
- package/dist/_chunks/{HubspotObjectInput-hjAYWtaU.js → HubspotObjectInput-D-FGwsyS.js} +8 -7
- package/dist/_chunks/{HubspotObjectInput-CpxeM2J0.mjs → HubspotObjectInput-V3uhGK8k.mjs} +4 -3
- package/dist/_chunks/{HubspotPropertyInput-OSeIBaRC.js → HubspotPropertyInput-Dn1QvOcu.js} +18 -17
- package/dist/_chunks/{HubspotPropertyInput-C-52Lu24.mjs → HubspotPropertyInput-DrBsx9jQ.mjs} +4 -3
- package/dist/_chunks/{Settings-2V7TH5CX.mjs → Settings-BjkNbyna.mjs} +4 -3
- package/dist/_chunks/{Settings-DcA9M5Tw.js → Settings-Cgp7M1Cv.js} +8 -7
- 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-D9UEuOGr.mjs → index-CEh8vkxY.mjs} +0 -14
- package/dist/_chunks/{index-CMzg-x5i.js → index-D2Q34BuH.js} +21 -5
- package/dist/_chunks/{objectLabels-Th7aYW-B.js → index-DkTxsEqL.js} +0 -14
- package/dist/_chunks/{index-DkGOTp8p.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-DQkQcA_V.mjs → useHubspotSchema-BC0Od-Wl.mjs} +1 -1
- package/dist/_chunks/{useHubspotSchema-Bgrgg8Mt.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 +3 -2
- package/dist/_chunks/index-C1UJXE_o.mjs +0 -1552
- package/dist/_chunks/index-Dgbid2LK.js +0 -1569
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
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
|
+
|
|
18
|
+
## 0.6.1 — 2026-08-28
|
|
19
|
+
|
|
20
|
+
### Fixed
|
|
21
|
+
- **Admin crash on the HubSpot Forms page** ("Error" with no message, from a
|
|
22
|
+
react-router invariant): `react-router-dom` was missing from
|
|
23
|
+
`peerDependencies`, so 0.6.0 shipped its own inlined copy — a second Router
|
|
24
|
+
context the plugin's `<Routes>` could not reach. It is now externalized to
|
|
25
|
+
the host admin's copy, like every other shared library.
|
|
26
|
+
- A `check-externals` step now runs on every build and fails when a
|
|
27
|
+
must-be-external library gets inlined, so this class of bug can't ship again.
|
|
28
|
+
|
|
3
29
|
## 0.6.0 — 2026-08-28
|
|
4
30
|
|
|
5
31
|
The plugin becomes **the form builder for HubSpot**.
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useParams, useSearchParams, Link, useNavigate, Routes, Route } from "react-router-dom";
|
|
2
3
|
import * as React from "react";
|
|
3
|
-
import { u as useIntl
|
|
4
|
-
import { u as useParams, a as useSearchParams, L as Link, b as useNavigate, R as Routes, c as Route } from "./index-C1UJXE_o.mjs";
|
|
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 }) => {
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const reactRouterDom = require("react-router-dom");
|
|
4
5
|
const React = require("react");
|
|
5
|
-
const
|
|
6
|
-
const index$1 = require("./index-Dgbid2LK.js");
|
|
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,10 +374,10 @@ 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
|
-
const { documentId } =
|
|
379
|
-
const [searchParams, setSearchParams] =
|
|
379
|
+
const { documentId } = reactRouterDom.useParams();
|
|
380
|
+
const [searchParams, setSearchParams] = reactRouterDom.useSearchParams();
|
|
380
381
|
const locale = searchParams.get("locale") ?? void 0;
|
|
381
382
|
const [entry, setEntry] = React__namespace.useState(null);
|
|
382
383
|
const [published, setPublished] = React__namespace.useState(false);
|
|
@@ -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(
|
|
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,24 +849,24 @@ 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
|
-
const navigate =
|
|
854
|
+
const navigate = reactRouterDom.useNavigate();
|
|
854
855
|
const [rows, setRows] = React__namespace.useState(null);
|
|
855
856
|
const [name, setName] = React__namespace.useState("");
|
|
856
857
|
const [busy, setBusy] = React__namespace.useState(false);
|
|
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."));
|
|
@@ -1000,8 +1001,8 @@ const FormsList = () => {
|
|
|
1000
1001
|
] })
|
|
1001
1002
|
] });
|
|
1002
1003
|
};
|
|
1003
|
-
const Forms = () => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1004
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1005
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1004
|
+
const Forms = () => /* @__PURE__ */ jsxRuntime.jsxs(reactRouterDom.Routes, { children: [
|
|
1005
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { index: true, element: /* @__PURE__ */ jsxRuntime.jsx(FormsList, {}) }),
|
|
1006
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path: ":documentId", element: /* @__PURE__ */ jsxRuntime.jsx(FormEditor, {}) })
|
|
1006
1007
|
] });
|
|
1007
1008
|
exports.default = Forms;
|
|
@@ -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-C-52Lu24.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-
|
|
7
|
-
import {
|
|
6
|
+
import { g as getTranslation, P as PLUGIN_ID } from "./index-FKsiOEPB.mjs";
|
|
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;
|