strapi-plugin-hubspot 0.14.0 → 0.15.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 (30) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +16 -7
  3. package/dist/_chunks/{Forms-ws6d8rdC.mjs → Forms-B7eIm0Fi.mjs} +3 -3
  4. package/dist/_chunks/{Forms-Cch-7zei.js → Forms-ClyI4MJ1.js} +3 -3
  5. package/dist/_chunks/{HubspotFormInput-M2l_8w_e.js → HubspotFormInput-Do7F83V6.js} +1 -1
  6. package/dist/_chunks/{HubspotFormInput-18pWTITT.mjs → HubspotFormInput-cZAiaAaq.mjs} +1 -1
  7. package/dist/_chunks/{HubspotObjectInput-BDO99qXs.js → HubspotObjectInput-DWqk2C26.js} +3 -3
  8. package/dist/_chunks/{HubspotObjectInput-DshusXZP.mjs → HubspotObjectInput-ZZk_7hWq.mjs} +3 -3
  9. package/dist/_chunks/{HubspotPropertyInput-C-kHDgwx.mjs → HubspotPropertyInput-5bkDGmGo.mjs} +3 -3
  10. package/dist/_chunks/{HubspotPropertyInput-XGnH2tHn.js → HubspotPropertyInput-v9B3wb1a.js} +3 -3
  11. package/dist/_chunks/{Settings-Bm7WkzK1.mjs → Settings-QcFbm3s5.mjs} +132 -36
  12. package/dist/_chunks/{Settings-CRnsu6ob.js → Settings-X3EHnTaO.js} +131 -35
  13. package/dist/_chunks/{en-DKV-8FWP.mjs → en-DMJeF7EN.mjs} +15 -6
  14. package/dist/_chunks/{en-BXMU5CjT.js → en-ZHvaZLi7.js} +15 -6
  15. package/dist/_chunks/{fr-GB6T3ZyU.mjs → fr-CVAntLmc.mjs} +14 -5
  16. package/dist/_chunks/{fr-Dx4XmZ4X.js → fr-Ds_2EAzZ.js} +14 -5
  17. package/dist/_chunks/{index-CPVfElYB.mjs → index-BSJAhj8r.mjs} +6 -6
  18. package/dist/_chunks/{index-BlaG8oIq.js → index-BpcilDy1.js} +6 -6
  19. package/dist/_chunks/{objectLabels-CPc21Tdd.js → objectLabels-CYXXFpNB.js} +1 -1
  20. package/dist/_chunks/{objectLabels-6OUnIDB5.mjs → objectLabels-CrYRzsqe.mjs} +1 -1
  21. package/dist/_chunks/{useHubspotSchema-0MvCM1AC.js → useHubspotSchema-Ba6xZUCL.js} +1 -1
  22. package/dist/_chunks/{useHubspotSchema-qCUs2gIX.mjs → useHubspotSchema-CBF4GkmK.mjs} +1 -1
  23. package/dist/admin/index.js +1 -1
  24. package/dist/admin/index.mjs +1 -1
  25. package/dist/server/index.js +88 -11
  26. package/dist/server/index.mjs +88 -11
  27. package/dist/server/src/__tests__/settings.test.d.ts +1 -0
  28. package/dist/server/src/index.d.ts +5 -1
  29. package/dist/server/src/settings.d.ts +36 -5
  30. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.15.0 — 2026-09-21
6
+
7
+ ### Added — account settings in the admin
8
+ - **Settings → HubSpot** now holds the portal id, region (`eu1` / `na1`) and
9
+ the default marketing form (picked from the connected portal), not just the
10
+ private app token. Values saved here override `config/plugins.ts` and env.
11
+ Switching test → production is an admin change, not a deploy.
12
+
5
13
  ## 0.14.0 — 2026-09-21
6
14
 
7
15
  ### Changed — native HubSpot form conversions
package/README.md CHANGED
@@ -365,10 +365,17 @@ its equivalent per object you send to).
365
365
 
366
366
  ### A settings screen
367
367
 
368
- **Settings → HubSpot** holds the private app token. It is stored server-side and
369
- never returned to the browser: the UI only receives whether a key exists, where
370
- it comes from, and its last four characters. A "Test connection" button
371
- round-trips to HubSpot and reports how many properties it can read.
368
+ **Settings → HubSpot** holds the private app token **and** the HubSpot account
369
+ that receives conversions: portal id, region (`eu1` / `na1`), and the default
370
+ marketing form (picked from the connected portal). Values saved here override
371
+ `config/plugins.ts` and env — switching test → production is an admin change,
372
+ not a deploy.
373
+
374
+ The token is stored server-side and never returned to the browser: the UI only
375
+ receives whether a key exists, where it comes from, and its last four
376
+ characters. Portal id / region / form GUID are not secrets and round-trip so
377
+ they can be edited. A "Test connection" button round-trips to HubSpot and
378
+ reports how many properties it can read.
372
379
 
373
380
  Access is gated by a dedicated RBAC permission — **Settings →
374
381
  Roles → Plugins → Hubspot**. A role without it neither sees the settings link
@@ -479,11 +486,13 @@ lives on `app-eu1.hubspot.com` and submits to `api-eu1.hsforms.com`. Set
479
486
  `config.region` (`eu1`, `na1`, …) to match. Deep links are built from the
480
487
  `uiDomain` HubSpot reports for your portal rather than a hardcoded host.
481
488
 
482
- The key is resolved in this order, first match wins:
489
+ The key, portal id, region and default form GUID are resolved in this order,
490
+ first match wins:
483
491
 
484
492
  1. saved from **Settings → HubSpot**
485
- 2. `config.apiKey` in `config/plugins.ts`
486
- 3. the `HUBSPOT_API_KEY` environment variable
493
+ 2. `config/plugins.ts` (`apiKey`, `portalId`, `region`, `forms.defaultFormId`)
494
+ 3. environment variables (`HUBSPOT_API_KEY`, `HUBSPOT_PORTAL_ID`,
495
+ `HUBSPOT_REGION`, `HUBSPOT_DEFAULT_FORM_ID`)
487
496
 
488
497
  ## Migrating an existing field
489
498
 
@@ -5,12 +5,12 @@ import { u as useIntl } from "./index-CEh8vkxY.mjs";
5
5
  import { Typography, Flex, Box, SingleSelect, SingleSelectOption, MultiSelect, MultiSelectOption, TextInput, IconButton, Button, Combobox, ComboboxOption, Field, Textarea, Checkbox, Divider, Loader, Badge, Table, Thead, Tr, Th, Tbody, Td, Modal } from "@strapi/design-system";
6
6
  import { Trash, Plus, ArrowClockwise, ArrowLeft, Drag, ArrowUp, ArrowDown, List, Duplicate, Download } from "@strapi/icons";
7
7
  import { useFetchClient } from "@strapi/strapi/admin";
8
- import { g as getTranslation, P as PLUGIN_ID } from "./index-CPVfElYB.mjs";
8
+ import { g as getTranslation, P as PLUGIN_ID } from "./index-BSJAhj8r.mjs";
9
9
  import { useSensors, useSensor, PointerSensor, KeyboardSensor, DndContext, closestCenter } from "@dnd-kit/core";
10
10
  import { sortableKeyboardCoordinates, SortableContext, verticalListSortingStrategy, useSortable, arrayMove } from "@dnd-kit/sortable";
11
11
  import { CSS } from "@dnd-kit/utilities";
12
- import { o as objectLabel } from "./objectLabels-6OUnIDB5.mjs";
13
- import { u as useHubspotSchema } from "./useHubspotSchema-qCUs2gIX.mjs";
12
+ import { o as objectLabel } from "./objectLabels-CrYRzsqe.mjs";
13
+ import { u as useHubspotSchema } from "./useHubspotSchema-CBF4GkmK.mjs";
14
14
  const OPERATORS = [
15
15
  "eq",
16
16
  "neq",
@@ -7,12 +7,12 @@ const index = require("./index-DkTxsEqL.js");
7
7
  const designSystem = require("@strapi/design-system");
8
8
  const icons = require("@strapi/icons");
9
9
  const admin = require("@strapi/strapi/admin");
10
- const index$1 = require("./index-BlaG8oIq.js");
10
+ const index$1 = require("./index-BpcilDy1.js");
11
11
  const core = require("@dnd-kit/core");
12
12
  const sortable = require("@dnd-kit/sortable");
13
13
  const utilities = require("@dnd-kit/utilities");
14
- const objectLabels = require("./objectLabels-CPc21Tdd.js");
15
- const useHubspotSchema = require("./useHubspotSchema-0MvCM1AC.js");
14
+ const objectLabels = require("./objectLabels-CYXXFpNB.js");
15
+ const useHubspotSchema = require("./useHubspotSchema-Ba6xZUCL.js");
16
16
  function _interopNamespace(e) {
17
17
  if (e && e.__esModule) return e;
18
18
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
@@ -5,7 +5,7 @@ const React = require("react");
5
5
  const index = require("./index-DkTxsEqL.js");
6
6
  const designSystem = require("@strapi/design-system");
7
7
  const admin = require("@strapi/strapi/admin");
8
- const index$1 = require("./index-BlaG8oIq.js");
8
+ const index$1 = require("./index-BpcilDy1.js");
9
9
  function _interopNamespace(e) {
10
10
  if (e && e.__esModule) return e;
11
11
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
@@ -3,7 +3,7 @@ import * as React from "react";
3
3
  import { u as useIntl } from "./index-CEh8vkxY.mjs";
4
4
  import { Field, Flex, Loader, Combobox, ComboboxOption } from "@strapi/design-system";
5
5
  import { useFetchClient } from "@strapi/strapi/admin";
6
- import { P as PLUGIN_ID, g as getTranslation } from "./index-CPVfElYB.mjs";
6
+ import { P as PLUGIN_ID, g as getTranslation } from "./index-BSJAhj8r.mjs";
7
7
  const HubspotFormInput = React.forwardRef(
8
8
  ({ name, value, onChange, disabled, error, required, label, hint, labelAction }, ref) => {
9
9
  const { formatMessage } = useIntl();
@@ -4,9 +4,9 @@ const jsxRuntime = require("react/jsx-runtime");
4
4
  const React = require("react");
5
5
  const index = require("./index-DkTxsEqL.js");
6
6
  const designSystem = require("@strapi/design-system");
7
- const index$1 = require("./index-BlaG8oIq.js");
8
- const objectLabels = require("./objectLabels-CPc21Tdd.js");
9
- const useHubspotSchema = require("./useHubspotSchema-0MvCM1AC.js");
7
+ const index$1 = require("./index-BpcilDy1.js");
8
+ const objectLabels = require("./objectLabels-CYXXFpNB.js");
9
+ const useHubspotSchema = require("./useHubspotSchema-Ba6xZUCL.js");
10
10
  function _interopNamespace(e) {
11
11
  if (e && e.__esModule) return e;
12
12
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
@@ -2,9 +2,9 @@ import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import * as React from "react";
3
3
  import { u as useIntl } from "./index-CEh8vkxY.mjs";
4
4
  import { Field, Flex, Loader, SingleSelect, SingleSelectOption } from "@strapi/design-system";
5
- import { g as getTranslation } from "./index-CPVfElYB.mjs";
6
- import { o as objectLabel } from "./objectLabels-6OUnIDB5.mjs";
7
- import { u as useHubspotSchema } from "./useHubspotSchema-qCUs2gIX.mjs";
5
+ import { g as getTranslation } from "./index-BSJAhj8r.mjs";
6
+ import { o as objectLabel } from "./objectLabels-CrYRzsqe.mjs";
7
+ import { u as useHubspotSchema } from "./useHubspotSchema-CBF4GkmK.mjs";
8
8
  const HubspotObjectInput = React.forwardRef(
9
9
  ({ name, value, onChange, disabled, error, required, label, hint, labelAction }, ref) => {
10
10
  const intl = useIntl();
@@ -4,9 +4,9 @@ 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-CPVfElYB.mjs";
8
- import { o as objectLabel } from "./objectLabels-6OUnIDB5.mjs";
9
- import { u as useHubspotSchema } from "./useHubspotSchema-qCUs2gIX.mjs";
7
+ import { g as getTranslation } from "./index-BSJAhj8r.mjs";
8
+ import { o as objectLabel } from "./objectLabels-CrYRzsqe.mjs";
9
+ import { u as useHubspotSchema } from "./useHubspotSchema-CBF4GkmK.mjs";
10
10
  const oneLine = {
11
11
  display: "block",
12
12
  whiteSpace: "nowrap",
@@ -6,9 +6,9 @@ const index = require("./index-DkTxsEqL.js");
6
6
  const designSystem = require("@strapi/design-system");
7
7
  const icons = require("@strapi/icons");
8
8
  const admin = require("@strapi/strapi/admin");
9
- const index$1 = require("./index-BlaG8oIq.js");
10
- const objectLabels = require("./objectLabels-CPc21Tdd.js");
11
- const useHubspotSchema = require("./useHubspotSchema-0MvCM1AC.js");
9
+ const index$1 = require("./index-BpcilDy1.js");
10
+ const objectLabels = require("./objectLabels-CYXXFpNB.js");
11
+ const useHubspotSchema = require("./useHubspotSchema-Ba6xZUCL.js");
12
12
  function _interopNamespace(e) {
13
13
  if (e && e.__esModule) return e;
14
14
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
@@ -1,11 +1,11 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import * as React from "react";
3
3
  import { u as useIntl } from "./index-CEh8vkxY.mjs";
4
- import { Flex, Divider, Typography, Button, Box, Link, Badge, Loader, Field } from "@strapi/design-system";
4
+ import { Flex, Divider, Typography, Button, Box, Link, Badge, Loader, Field, SingleSelect, SingleSelectOption } from "@strapi/design-system";
5
5
  import { useFetchClient } from "@strapi/strapi/admin";
6
- import { g as getTranslation, P as PLUGIN_ID } from "./index-CPVfElYB.mjs";
6
+ import { g as getTranslation, P as PLUGIN_ID } from "./index-BSJAhj8r.mjs";
7
7
  import { Link as Link$1 } from "react-router-dom";
8
- import { o as objectLabel } from "./objectLabels-6OUnIDB5.mjs";
8
+ import { o as objectLabel } from "./objectLabels-CrYRzsqe.mjs";
9
9
  const AuditSection = ({ configured }) => {
10
10
  const intl = useIntl();
11
11
  const { formatMessage } = intl;
@@ -172,19 +172,31 @@ const FailuresSection = ({ configured }) => {
172
172
  ) : null
173
173
  ] });
174
174
  };
175
+ const REGIONS = ["eu1", "na1"];
175
176
  const HubspotSettings = () => {
176
177
  const { formatMessage } = useIntl();
177
178
  const { get, put, del } = useFetchClient();
178
179
  const [settings, setSettings] = React.useState(null);
179
180
  const [apiKey, setApiKey] = React.useState("");
181
+ const [portalId, setPortalId] = React.useState("");
182
+ const [region, setRegion] = React.useState("eu1");
183
+ const [defaultFormId, setDefaultFormId] = React.useState("");
184
+ const [forms, setForms] = React.useState([]);
180
185
  const [busy, setBusy] = React.useState(false);
181
186
  const [feedback, setFeedback] = React.useState(
182
187
  null
183
188
  );
184
189
  const t = (id, defaultMessage, values) => formatMessage({ id: getTranslation(id), defaultMessage }, values);
190
+ const apply = (data) => {
191
+ setSettings(data);
192
+ setPortalId(data.portalId ?? "");
193
+ setRegion(data.region || "eu1");
194
+ setDefaultFormId(data.defaultFormId ?? "");
195
+ setForms(Array.isArray(data.forms) ? data.forms : []);
196
+ };
185
197
  const load = React.useCallback(async () => {
186
198
  const { data } = await get(`/${PLUGIN_ID}/settings`);
187
- setSettings(data);
199
+ apply(data);
188
200
  }, [get]);
189
201
  React.useEffect(() => {
190
202
  load().catch(
@@ -195,12 +207,17 @@ const HubspotSettings = () => {
195
207
  setBusy(true);
196
208
  setFeedback(null);
197
209
  try {
198
- const { data } = await put(`/${PLUGIN_ID}/settings`, { apiKey });
199
- setSettings(data);
210
+ await put(`/${PLUGIN_ID}/settings`, {
211
+ ...apiKey.trim() ? { apiKey: apiKey.trim() } : {},
212
+ portalId,
213
+ region,
214
+ defaultFormId
215
+ });
200
216
  setApiKey("");
201
- setFeedback({ tone: "success", text: t("settings.saved", "Key saved.") });
217
+ await load();
218
+ setFeedback({ tone: "success", text: t("settings.saved", "Settings saved.") });
202
219
  } catch {
203
- setFeedback({ tone: "danger", text: t("settings.save-error", "Could not save the key.") });
220
+ setFeedback({ tone: "danger", text: t("settings.save-error", "Could not save settings.") });
204
221
  } finally {
205
222
  setBusy(false);
206
223
  }
@@ -209,9 +226,9 @@ const HubspotSettings = () => {
209
226
  setBusy(true);
210
227
  setFeedback(null);
211
228
  try {
212
- const { data } = await del(`/${PLUGIN_ID}/settings`);
213
- setSettings(data);
229
+ await del(`/${PLUGIN_ID}/settings`);
214
230
  setApiKey("");
231
+ await load();
215
232
  setFeedback({ tone: "success", text: t("settings.removed", "Key removed.") });
216
233
  } catch {
217
234
  setFeedback({ tone: "danger", text: t("settings.remove-error", "Could not remove the key.") });
@@ -234,6 +251,7 @@ const HubspotSettings = () => {
234
251
  })
235
252
  } : { tone: "danger", text: t("settings.test-no-key", "No key configured.") }
236
253
  );
254
+ if (data.configured) await load();
237
255
  } catch {
238
256
  setFeedback({
239
257
  tone: "danger",
@@ -251,44 +269,122 @@ const HubspotSettings = () => {
251
269
  config: t("settings.source.config", "config/plugins.ts"),
252
270
  env: t("settings.source.env", "environment variable")
253
271
  };
272
+ const sourceHint = (source) => source && source !== "settings" ? /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral600", children: t("settings.source", "source: {source}", { source: sourceLabel[source] }) }) : null;
273
+ const regionOptions = REGIONS.includes(region) ? [...REGIONS] : [region, ...REGIONS];
254
274
  return /* @__PURE__ */ jsx(Box, { padding: 8, children: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 6, children: [
255
275
  /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "flex-start", gap: 2, children: [
256
276
  /* @__PURE__ */ jsx(Typography, { variant: "alpha", children: "HubSpot" }),
257
277
  /* @__PURE__ */ jsx(Typography, { variant: "epsilon", textColor: "neutral600", children: t(
258
278
  "settings.subtitle",
259
- "The private app token used to read the portal's properties and validate form mappings."
279
+ "Private app token and the HubSpot account that receives form conversions. Switch test → production here — nothing is hardcoded."
260
280
  ) })
261
281
  ] }),
262
282
  /* @__PURE__ */ jsxs(Flex, { gap: 2, alignItems: "center", children: [
263
283
  /* @__PURE__ */ jsx(Badge, { active: settings.configured, children: settings.configured ? t("settings.configured", "Configured {hint}", { hint: settings.hint }) : t("settings.not-configured", "Not configured") }),
264
284
  settings.keySource ? /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral600", children: t("settings.source", "source: {source}", { source: sourceLabel[settings.keySource] }) }) : null
265
285
  ] }),
266
- /* @__PURE__ */ jsx(Box, { maxWidth: "32rem", children: /* @__PURE__ */ jsxs(
267
- Field.Root,
268
- {
269
- name: "apiKey",
270
- hint: t(
271
- "settings.key.hint",
272
- "A key entered here overrides the ones from config/plugins.ts and HUBSPOT_API_KEY."
286
+ /* @__PURE__ */ jsx(Box, { maxWidth: "32rem", children: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 4, children: [
287
+ /* @__PURE__ */ jsxs(
288
+ Field.Root,
289
+ {
290
+ name: "apiKey",
291
+ hint: t(
292
+ "settings.key.hint",
293
+ "A key entered here overrides config/plugins.ts and HUBSPOT_API_KEY."
294
+ ),
295
+ children: [
296
+ /* @__PURE__ */ jsx(Field.Label, { children: t("settings.key.label", "Private app token") }),
297
+ /* @__PURE__ */ jsx(
298
+ Field.Input,
299
+ {
300
+ type: "password",
301
+ value: apiKey,
302
+ autoComplete: "off",
303
+ placeholder: settings.configured ? t("settings.key.placeholder.set", "•••••••• (leave empty to keep)") : t("settings.key.placeholder.empty", "pat-eu1-…"),
304
+ onChange: (e) => setApiKey(e.target.value)
305
+ }
306
+ ),
307
+ /* @__PURE__ */ jsx(Field.Hint, {})
308
+ ]
309
+ }
310
+ ),
311
+ /* @__PURE__ */ jsxs(
312
+ Field.Root,
313
+ {
314
+ name: "portalId",
315
+ hint: t(
316
+ "settings.portal.hint",
317
+ "HubSpot account id (Settings → Account → Account setup). Test portal today, production later."
318
+ ),
319
+ children: [
320
+ /* @__PURE__ */ jsx(Field.Label, { children: t("settings.portal.label", "Portal ID") }),
321
+ /* @__PURE__ */ jsx(
322
+ Field.Input,
323
+ {
324
+ type: "text",
325
+ value: portalId,
326
+ autoComplete: "off",
327
+ placeholder: "148991818",
328
+ onChange: (e) => setPortalId(e.target.value)
329
+ }
330
+ ),
331
+ /* @__PURE__ */ jsx(Field.Hint, {}),
332
+ sourceHint(settings.portalSource)
333
+ ]
334
+ }
335
+ ),
336
+ /* @__PURE__ */ jsxs(Field.Root, { name: "region", children: [
337
+ /* @__PURE__ */ jsx(Field.Label, { children: t("settings.region.label", "Region") }),
338
+ /* @__PURE__ */ jsx(
339
+ SingleSelect,
340
+ {
341
+ value: region,
342
+ onChange: (value) => setRegion(String(value)),
343
+ children: regionOptions.map((r) => /* @__PURE__ */ jsx(SingleSelectOption, { value: r, children: r === "eu1" ? t("settings.region.eu1", "Europe (eu1)") : r === "na1" ? t("settings.region.na1", "North America (na1)") : r }, r))
344
+ }
273
345
  ),
274
- children: [
275
- /* @__PURE__ */ jsx(Field.Label, { children: t("settings.key.label", "Private app token") }),
276
- /* @__PURE__ */ jsx(
277
- Field.Input,
278
- {
279
- type: "password",
280
- value: apiKey,
281
- autoComplete: "off",
282
- placeholder: settings.configured ? t("settings.key.placeholder.set", "•••••••• (leave empty to keep)") : t("settings.key.placeholder.empty", "pat-eu1-…"),
283
- onChange: (e) => setApiKey(e.target.value)
284
- }
346
+ sourceHint(settings.regionSource)
347
+ ] }),
348
+ /* @__PURE__ */ jsxs(
349
+ Field.Root,
350
+ {
351
+ name: "defaultFormId",
352
+ hint: t(
353
+ "settings.form.hint",
354
+ "Marketing form that receives submissions when a builder form doesn't pick its own. Create the form in HubSpot, then pick it here."
285
355
  ),
286
- /* @__PURE__ */ jsx(Field.Hint, {})
287
- ]
288
- }
289
- ) }),
356
+ children: [
357
+ /* @__PURE__ */ jsx(Field.Label, { children: t("settings.form.label", "Default marketing form") }),
358
+ forms.length ? /* @__PURE__ */ jsxs(
359
+ SingleSelect,
360
+ {
361
+ value: defaultFormId,
362
+ placeholder: t("settings.form.placeholder", "Pick a form of the connected portal"),
363
+ onChange: (value) => setDefaultFormId(String(value)),
364
+ children: [
365
+ /* @__PURE__ */ jsx(SingleSelectOption, { value: "", children: t("settings.form.none", "None — CRM upsert only") }),
366
+ defaultFormId && !forms.some((f) => f.id === defaultFormId) && /* @__PURE__ */ jsx(SingleSelectOption, { value: defaultFormId, children: defaultFormId }),
367
+ forms.map((f) => /* @__PURE__ */ jsx(SingleSelectOption, { value: f.id, children: f.name }, f.id))
368
+ ]
369
+ }
370
+ ) : /* @__PURE__ */ jsx(
371
+ Field.Input,
372
+ {
373
+ type: "text",
374
+ value: defaultFormId,
375
+ autoComplete: "off",
376
+ placeholder: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
377
+ onChange: (e) => setDefaultFormId(e.target.value.trim())
378
+ }
379
+ ),
380
+ /* @__PURE__ */ jsx(Field.Hint, {}),
381
+ sourceHint(settings.formSource)
382
+ ]
383
+ }
384
+ )
385
+ ] }) }),
290
386
  /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
291
- /* @__PURE__ */ jsx(Button, { onClick: save, loading: busy, disabled: !apiKey.trim(), children: t("settings.save", "Save") }),
387
+ /* @__PURE__ */ jsx(Button, { onClick: save, loading: busy, children: t("settings.save", "Save") }),
292
388
  /* @__PURE__ */ jsx(Button, { variant: "secondary", onClick: test, loading: busy, disabled: !settings.configured, children: t("settings.test", "Test connection") }),
293
389
  /* @__PURE__ */ jsx(
294
390
  Button,
@@ -297,7 +393,7 @@ const HubspotSettings = () => {
297
393
  onClick: remove,
298
394
  loading: busy,
299
395
  disabled: settings.keySource !== "settings",
300
- children: t("settings.remove", "Remove")
396
+ children: t("settings.remove", "Remove key")
301
397
  }
302
398
  )
303
399
  ] }),
@@ -311,7 +407,7 @@ const HubspotSettings = () => {
311
407
  ) : null,
312
408
  /* @__PURE__ */ jsx(Box, { paddingTop: 4, children: /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral600", children: t(
313
409
  "settings.scopes",
314
- "The token needs the crm.schemas.contacts.read and crm.schemas.companies.read scopes to list properties. It is never returned to the browser: only its existence, its source and its last four characters are."
410
+ "The token needs crm.schemas.contacts.read, crm.schemas.companies.read and forms (to list and submit marketing forms). The token is never returned to the browser."
315
411
  ) }) }),
316
412
  /* @__PURE__ */ jsx(AuditSection, { configured: settings.configured }),
317
413
  /* @__PURE__ */ jsx(FailuresSection, { configured: settings.configured })