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.
Files changed (33) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/_chunks/{Forms-CW1KFO9U.mjs → Forms-CKA6ukB6.mjs} +5 -4
  3. package/dist/_chunks/{Forms-BF4_zA-m.js → Forms-HMZbTk_B.js} +30 -29
  4. package/dist/_chunks/HubspotFormInput-BequMb12.js +79 -0
  5. package/dist/_chunks/HubspotFormInput-CKYRcNNU.mjs +61 -0
  6. package/dist/_chunks/{HubspotObjectInput-hjAYWtaU.js → HubspotObjectInput-D-FGwsyS.js} +8 -7
  7. package/dist/_chunks/{HubspotObjectInput-CpxeM2J0.mjs → HubspotObjectInput-V3uhGK8k.mjs} +4 -3
  8. package/dist/_chunks/{HubspotPropertyInput-OSeIBaRC.js → HubspotPropertyInput-Dn1QvOcu.js} +18 -17
  9. package/dist/_chunks/{HubspotPropertyInput-C-52Lu24.mjs → HubspotPropertyInput-DrBsx9jQ.mjs} +4 -3
  10. package/dist/_chunks/{Settings-2V7TH5CX.mjs → Settings-BjkNbyna.mjs} +4 -3
  11. package/dist/_chunks/{Settings-DcA9M5Tw.js → Settings-Cgp7M1Cv.js} +8 -7
  12. package/dist/_chunks/{en-CJ9wYHgN.mjs → en-Cun5LoUP.mjs} +8 -1
  13. package/dist/_chunks/{en-C_-N8cjv.js → en-D5Ch9YFo.js} +8 -1
  14. package/dist/_chunks/{fr-DttDn-2Y.mjs → fr-ClOWflse.mjs} +8 -1
  15. package/dist/_chunks/{fr-BHObPoUp.js → fr-CqlhHltZ.js} +8 -1
  16. package/dist/_chunks/{objectLabels-D9UEuOGr.mjs → index-CEh8vkxY.mjs} +0 -14
  17. package/dist/_chunks/{index-CMzg-x5i.js → index-D2Q34BuH.js} +21 -5
  18. package/dist/_chunks/{objectLabels-Th7aYW-B.js → index-DkTxsEqL.js} +0 -14
  19. package/dist/_chunks/{index-DkGOTp8p.mjs → index-FKsiOEPB.mjs} +21 -5
  20. package/dist/_chunks/objectLabels-DBKevJle.mjs +16 -0
  21. package/dist/_chunks/objectLabels-LAQ0M6-a.js +15 -0
  22. package/dist/_chunks/{useHubspotSchema-DQkQcA_V.mjs → useHubspotSchema-BC0Od-Wl.mjs} +1 -1
  23. package/dist/_chunks/{useHubspotSchema-Bgrgg8Mt.js → useHubspotSchema-C08qBAyy.js} +1 -1
  24. package/dist/admin/index.js +1 -1
  25. package/dist/admin/index.mjs +1 -1
  26. package/dist/admin/src/components/HubspotFormInput.d.ts +29 -0
  27. package/dist/server/index.js +33 -0
  28. package/dist/server/index.mjs +33 -0
  29. package/dist/server/src/formsAdmin.d.ts +7 -0
  30. package/dist/server/src/index.d.ts +1 -0
  31. package/package.json +3 -2
  32. package/dist/_chunks/index-C1UJXE_o.mjs +0 -1552
  33. package/dist/_chunks/index-Dgbid2LK.js +0 -1569
@@ -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 objectLabels = require("./objectLabels-Th7aYW-B.js");
5
+ const index = require("./index-DkTxsEqL.js");
6
6
  const designSystem = require("@strapi/design-system");
7
7
  const admin = require("@strapi/strapi/admin");
8
- const index$1 = require("./index-CMzg-x5i.js");
9
- const index = require("./index-Dgbid2LK.js");
8
+ const index$1 = require("./index-D2Q34BuH.js");
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,7 +27,7 @@ function _interopNamespace(e) {
26
27
  }
27
28
  const React__namespace = /* @__PURE__ */ _interopNamespace(React);
28
29
  const AuditSection = ({ configured }) => {
29
- const intl = objectLabels.useIntl();
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);
@@ -106,7 +107,7 @@ const AuditSection = ({ configured }) => {
106
107
  hasRadius: true,
107
108
  children: [
108
109
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, alignItems: "center", children: [
109
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Link, { tag: index.Link, to: entryLink(report.uid, entry), children: entry.label }),
110
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Link, { tag: reactRouterDom.Link, to: entryLink(report.uid, entry), children: entry.label }),
110
111
  entry.locale ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { children: entry.locale }) : null
111
112
  ] }),
112
113
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingTop: 1, children: entry.problems.map((p, i) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "danger600", tag: "p", children: problemText(p) }, i)) })
@@ -119,7 +120,7 @@ const AuditSection = ({ configured }) => {
119
120
  ] });
120
121
  };
121
122
  const FailuresSection = ({ configured }) => {
122
- const { formatMessage } = objectLabels.useIntl();
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);
@@ -192,7 +193,7 @@ const FailuresSection = ({ configured }) => {
192
193
  ] });
193
194
  };
194
195
  const HubspotSettings = () => {
195
- const { formatMessage } = objectLabels.useIntl();
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("");
@@ -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-DkGOTp8p.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-BF4_zA-m.js"))).default
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-OSeIBaRC.js"))
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-hjAYWtaU.js"))
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-DcA9M5Tw.js"))).default
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-C_-N8cjv.js")), "./translations/fr.json": () => Promise.resolve().then(() => require("./fr-BHObPoUp.js")) }), `./translations/${locale}.json`, 3);
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-CMzg-x5i.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-CW1KFO9U.mjs")).default
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-C-52Lu24.mjs")
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-CpxeM2J0.mjs")
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-2V7TH5CX.mjs")).default
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-CJ9wYHgN.mjs"), "./translations/fr.json": () => import("./fr-DttDn-2Y.mjs") }), `./translations/${locale}.json`, 3);
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-DkGOTp8p.mjs";
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-CMzg-x5i.js");
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" } });
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
- const index = require("../_chunks/index-CMzg-x5i.js");
2
+ const index = require("../_chunks/index-D2Q34BuH.js");
3
3
  require("@strapi/icons");
4
4
  module.exports = index.index;
@@ -1,4 +1,4 @@
1
- import { i } from "../_chunks/index-DkGOTp8p.mjs";
1
+ import { i } from "../_chunks/index-FKsiOEPB.mjs";
2
2
  import "@strapi/icons";
3
3
  export {
4
4
  i as default
@@ -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;
@@ -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([
@@ -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.6.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",
@@ -53,7 +53,7 @@
53
53
  "CHANGELOG.md"
54
54
  ],
55
55
  "scripts": {
56
- "build": "strapi-plugin build && node scripts/build-types.mjs",
56
+ "build": "strapi-plugin build && node scripts/build-types.mjs && node scripts/check-externals.mjs",
57
57
  "watch": "strapi-plugin watch",
58
58
  "verify": "strapi-plugin verify",
59
59
  "test": "vitest run",
@@ -88,6 +88,7 @@
88
88
  "@strapi/utils": "^5.0.0",
89
89
  "react": "^17.0.0 || ^18.0.0",
90
90
  "react-dom": "^17.0.0 || ^18.0.0",
91
+ "react-router-dom": "^6.0.0",
91
92
  "styled-components": "^6.0.0"
92
93
  },
93
94
  "strapi": {