strapi-plugin-hubspot 0.2.1 → 0.4.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 (44) hide show
  1. package/README.md +145 -5
  2. package/dist/_chunks/HubspotObjectInput-DAq_W1rA.js +91 -0
  3. package/dist/_chunks/HubspotObjectInput-G-A_pL2j.mjs +73 -0
  4. package/dist/_chunks/HubspotPropertyInput-B-Jg0x68.js +186 -0
  5. package/dist/_chunks/HubspotPropertyInput-Cv77QiS6.mjs +168 -0
  6. package/dist/_chunks/Settings-58edRL5D.mjs +1293 -0
  7. package/dist/_chunks/Settings-CryiUgSe.js +1311 -0
  8. package/dist/_chunks/en-CnQbjHs-.js +81 -0
  9. package/dist/_chunks/en-DHQZuRsj.mjs +81 -0
  10. package/dist/_chunks/fr-Bv8zsNX5.js +81 -0
  11. package/dist/_chunks/fr-Dxgil7RP.mjs +81 -0
  12. package/dist/_chunks/index-BudHTwSw.mjs +137 -0
  13. package/dist/_chunks/index-Tlw1p93d.js +136 -0
  14. package/dist/_chunks/objectLabels-CJTKZ4vT.mjs +425 -0
  15. package/dist/_chunks/objectLabels-GRmYGCIn.js +442 -0
  16. package/dist/admin/index.js +1 -1
  17. package/dist/admin/index.mjs +1 -1
  18. package/dist/admin/src/components/AuditSection.d.ts +5 -0
  19. package/dist/admin/src/components/FailuresSection.d.ts +11 -0
  20. package/dist/admin/src/components/HubspotObjectInput.d.ts +28 -0
  21. package/dist/admin/src/components/HubspotPropertyInput.d.ts +1 -0
  22. package/dist/admin/src/getTranslation.d.ts +3 -0
  23. package/dist/admin/src/index.d.ts +6 -0
  24. package/dist/admin/src/objectLabels.d.ts +2 -1
  25. package/dist/server/index.js +445 -69
  26. package/dist/server/index.mjs +445 -69
  27. package/dist/server/src/__tests__/audit.test.d.ts +1 -0
  28. package/dist/server/src/__tests__/checkMapping.test.d.ts +1 -0
  29. package/dist/server/src/__tests__/loadSchema.test.d.ts +1 -0
  30. package/dist/server/src/__tests__/submit.test.d.ts +1 -0
  31. package/dist/server/src/__tests__/validation.test.d.ts +1 -0
  32. package/dist/server/src/audit.d.ts +60 -0
  33. package/dist/server/src/content-types.d.ts +56 -0
  34. package/dist/server/src/index.d.ts +104 -22
  35. package/dist/server/src/properties.d.ts +41 -5
  36. package/dist/server/src/submit.d.ts +35 -0
  37. package/dist/server/src/validation.d.ts +37 -0
  38. package/package.json +5 -2
  39. package/dist/_chunks/HubspotPropertyInput-BVFRtt49.js +0 -124
  40. package/dist/_chunks/HubspotPropertyInput-C7Wcw8ee.mjs +0 -106
  41. package/dist/_chunks/Settings-B5w7LAsH.mjs +0 -140
  42. package/dist/_chunks/Settings-TGB0MOHr.js +0 -158
  43. package/dist/_chunks/index-BpZtcsPM.mjs +0 -42
  44. package/dist/_chunks/index-DgsAHPui.js +0 -41
@@ -1,140 +0,0 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import * as React from "react";
3
- import { Box, Loader, Flex, Typography, Badge, Field, Button } from "@strapi/design-system";
4
- import { useFetchClient } from "@strapi/strapi/admin";
5
- import { P as PLUGIN_ID } from "./index-BpZtcsPM.mjs";
6
- const SOURCE_LABEL = {
7
- settings: "saisie ici",
8
- config: "config/plugins.ts",
9
- env: "variable d'environnement"
10
- };
11
- const HubspotSettings = () => {
12
- const { get, put, del } = useFetchClient();
13
- const [settings, setSettings] = React.useState(null);
14
- const [apiKey, setApiKey] = React.useState("");
15
- const [busy, setBusy] = React.useState(false);
16
- const [feedback, setFeedback] = React.useState(
17
- null
18
- );
19
- const load = React.useCallback(async () => {
20
- const { data } = await get(`/${PLUGIN_ID}/settings`);
21
- setSettings(data);
22
- }, [get]);
23
- React.useEffect(() => {
24
- load().catch(() => setFeedback({ tone: "danger", text: "Réglages illisibles." }));
25
- }, [load]);
26
- const save = async () => {
27
- setBusy(true);
28
- setFeedback(null);
29
- try {
30
- const { data } = await put(`/${PLUGIN_ID}/settings`, { apiKey });
31
- setSettings(data);
32
- setApiKey("");
33
- setFeedback({ tone: "success", text: "Clé enregistrée." });
34
- } catch {
35
- setFeedback({ tone: "danger", text: "Enregistrement impossible." });
36
- } finally {
37
- setBusy(false);
38
- }
39
- };
40
- const remove = async () => {
41
- setBusy(true);
42
- setFeedback(null);
43
- try {
44
- const { data } = await del(`/${PLUGIN_ID}/settings`);
45
- setSettings(data);
46
- setApiKey("");
47
- setFeedback({ tone: "success", text: "Clé supprimée." });
48
- } catch {
49
- setFeedback({ tone: "danger", text: "Suppression impossible." });
50
- } finally {
51
- setBusy(false);
52
- }
53
- };
54
- const test = async () => {
55
- setBusy(true);
56
- setFeedback(null);
57
- try {
58
- const { data } = await get(
59
- `/${PLUGIN_ID}/properties?refresh=1`
60
- );
61
- setFeedback(
62
- data.configured ? { tone: "success", text: `Connexion établie — ${data.properties.length} propriétés lisibles.` } : { tone: "danger", text: "Aucune clé configurée." }
63
- );
64
- } catch {
65
- setFeedback({ tone: "danger", text: "HubSpot injoignable — clé invalide ou révoquée ?" });
66
- } finally {
67
- setBusy(false);
68
- }
69
- };
70
- if (!settings) {
71
- return /* @__PURE__ */ jsx(Box, { padding: 8, children: /* @__PURE__ */ jsx(Loader, { small: true, children: "Chargement…" }) });
72
- }
73
- return /* @__PURE__ */ jsx(Box, { padding: 8, children: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 6, children: [
74
- /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "flex-start", gap: 2, children: [
75
- /* @__PURE__ */ jsx(Typography, { variant: "alpha", children: "HubSpot" }),
76
- /* @__PURE__ */ jsx(Typography, { variant: "epsilon", textColor: "neutral600", children: "Le jeton d'application privée utilisé pour lire les propriétés du portail et valider les mappings de formulaires." })
77
- ] }),
78
- /* @__PURE__ */ jsxs(Flex, { gap: 2, alignItems: "center", children: [
79
- /* @__PURE__ */ jsx(Badge, { active: settings.configured, children: settings.configured ? `Configurée ${settings.hint}` : "Non configurée" }),
80
- settings.keySource ? /* @__PURE__ */ jsxs(Typography, { variant: "pi", textColor: "neutral600", children: [
81
- "source : ",
82
- SOURCE_LABEL[settings.keySource]
83
- ] }) : null
84
- ] }),
85
- /* @__PURE__ */ jsx(Box, { maxWidth: "32rem", children: /* @__PURE__ */ jsxs(
86
- Field.Root,
87
- {
88
- name: "apiKey",
89
- hint: "Saisir une clé ici remplace celles venant de config/plugins.ts et de HUBSPOT_API_KEY.",
90
- children: [
91
- /* @__PURE__ */ jsx(Field.Label, { children: "Jeton d'application privée" }),
92
- /* @__PURE__ */ jsx(
93
- Field.Input,
94
- {
95
- type: "password",
96
- value: apiKey,
97
- autoComplete: "off",
98
- placeholder: settings.configured ? "•••••••• (laisser vide pour conserver)" : "pat-eu1-…",
99
- onChange: (e) => setApiKey(e.target.value)
100
- }
101
- ),
102
- /* @__PURE__ */ jsx(Field.Hint, {})
103
- ]
104
- }
105
- ) }),
106
- /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
107
- /* @__PURE__ */ jsx(Button, { onClick: save, loading: busy, disabled: !apiKey.trim(), children: "Enregistrer" }),
108
- /* @__PURE__ */ jsx(Button, { variant: "secondary", onClick: test, loading: busy, disabled: !settings.configured, children: "Tester la connexion" }),
109
- /* @__PURE__ */ jsx(
110
- Button,
111
- {
112
- variant: "danger-light",
113
- onClick: remove,
114
- loading: busy,
115
- disabled: settings.keySource !== "settings",
116
- children: "Supprimer"
117
- }
118
- )
119
- ] }),
120
- feedback ? /* @__PURE__ */ jsx(
121
- Typography,
122
- {
123
- variant: "pi",
124
- textColor: feedback.tone === "success" ? "success600" : "danger600",
125
- children: feedback.text
126
- }
127
- ) : null,
128
- /* @__PURE__ */ jsx(Box, { paddingTop: 4, children: /* @__PURE__ */ jsxs(Typography, { variant: "pi", textColor: "neutral600", children: [
129
- "Le jeton a besoin des portées ",
130
- /* @__PURE__ */ jsx("b", { children: "crm.schemas.contacts.read" }),
131
- " et",
132
- " ",
133
- /* @__PURE__ */ jsx("b", { children: "crm.schemas.companies.read" }),
134
- " pour lister les propriétés. Il n'est jamais renvoyé au navigateur : seuls son existence, sa provenance et ses quatre derniers caractères le sont."
135
- ] }) })
136
- ] }) });
137
- };
138
- export {
139
- HubspotSettings as default
140
- };
@@ -1,158 +0,0 @@
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 designSystem = require("@strapi/design-system");
6
- const admin = require("@strapi/strapi/admin");
7
- const index = require("./index-DgsAHPui.js");
8
- function _interopNamespace(e) {
9
- if (e && e.__esModule) return e;
10
- const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
11
- if (e) {
12
- for (const k in e) {
13
- if (k !== "default") {
14
- const d = Object.getOwnPropertyDescriptor(e, k);
15
- Object.defineProperty(n, k, d.get ? d : {
16
- enumerable: true,
17
- get: () => e[k]
18
- });
19
- }
20
- }
21
- }
22
- n.default = e;
23
- return Object.freeze(n);
24
- }
25
- const React__namespace = /* @__PURE__ */ _interopNamespace(React);
26
- const SOURCE_LABEL = {
27
- settings: "saisie ici",
28
- config: "config/plugins.ts",
29
- env: "variable d'environnement"
30
- };
31
- const HubspotSettings = () => {
32
- const { get, put, del } = admin.useFetchClient();
33
- const [settings, setSettings] = React__namespace.useState(null);
34
- const [apiKey, setApiKey] = React__namespace.useState("");
35
- const [busy, setBusy] = React__namespace.useState(false);
36
- const [feedback, setFeedback] = React__namespace.useState(
37
- null
38
- );
39
- const load = React__namespace.useCallback(async () => {
40
- const { data } = await get(`/${index.PLUGIN_ID}/settings`);
41
- setSettings(data);
42
- }, [get]);
43
- React__namespace.useEffect(() => {
44
- load().catch(() => setFeedback({ tone: "danger", text: "Réglages illisibles." }));
45
- }, [load]);
46
- const save = async () => {
47
- setBusy(true);
48
- setFeedback(null);
49
- try {
50
- const { data } = await put(`/${index.PLUGIN_ID}/settings`, { apiKey });
51
- setSettings(data);
52
- setApiKey("");
53
- setFeedback({ tone: "success", text: "Clé enregistrée." });
54
- } catch {
55
- setFeedback({ tone: "danger", text: "Enregistrement impossible." });
56
- } finally {
57
- setBusy(false);
58
- }
59
- };
60
- const remove = async () => {
61
- setBusy(true);
62
- setFeedback(null);
63
- try {
64
- const { data } = await del(`/${index.PLUGIN_ID}/settings`);
65
- setSettings(data);
66
- setApiKey("");
67
- setFeedback({ tone: "success", text: "Clé supprimée." });
68
- } catch {
69
- setFeedback({ tone: "danger", text: "Suppression impossible." });
70
- } finally {
71
- setBusy(false);
72
- }
73
- };
74
- const test = async () => {
75
- setBusy(true);
76
- setFeedback(null);
77
- try {
78
- const { data } = await get(
79
- `/${index.PLUGIN_ID}/properties?refresh=1`
80
- );
81
- setFeedback(
82
- data.configured ? { tone: "success", text: `Connexion établie — ${data.properties.length} propriétés lisibles.` } : { tone: "danger", text: "Aucune clé configurée." }
83
- );
84
- } catch {
85
- setFeedback({ tone: "danger", text: "HubSpot injoignable — clé invalide ou révoquée ?" });
86
- } finally {
87
- setBusy(false);
88
- }
89
- };
90
- if (!settings) {
91
- return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 8, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Loader, { small: true, children: "Chargement…" }) });
92
- }
93
- return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 8, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 6, children: [
94
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "flex-start", gap: 2, children: [
95
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "alpha", children: "HubSpot" }),
96
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "epsilon", textColor: "neutral600", children: "Le jeton d'application privée utilisé pour lire les propriétés du portail et valider les mappings de formulaires." })
97
- ] }),
98
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, alignItems: "center", children: [
99
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { active: settings.configured, children: settings.configured ? `Configurée ${settings.hint}` : "Non configurée" }),
100
- settings.keySource ? /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: [
101
- "source : ",
102
- SOURCE_LABEL[settings.keySource]
103
- ] }) : null
104
- ] }),
105
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { maxWidth: "32rem", children: /* @__PURE__ */ jsxRuntime.jsxs(
106
- designSystem.Field.Root,
107
- {
108
- name: "apiKey",
109
- hint: "Saisir une clé ici remplace celles venant de config/plugins.ts et de HUBSPOT_API_KEY.",
110
- children: [
111
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: "Jeton d'application privée" }),
112
- /* @__PURE__ */ jsxRuntime.jsx(
113
- designSystem.Field.Input,
114
- {
115
- type: "password",
116
- value: apiKey,
117
- autoComplete: "off",
118
- placeholder: settings.configured ? "•••••••• (laisser vide pour conserver)" : "pat-eu1-…",
119
- onChange: (e) => setApiKey(e.target.value)
120
- }
121
- ),
122
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {})
123
- ]
124
- }
125
- ) }),
126
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
127
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: save, loading: busy, disabled: !apiKey.trim(), children: "Enregistrer" }),
128
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "secondary", onClick: test, loading: busy, disabled: !settings.configured, children: "Tester la connexion" }),
129
- /* @__PURE__ */ jsxRuntime.jsx(
130
- designSystem.Button,
131
- {
132
- variant: "danger-light",
133
- onClick: remove,
134
- loading: busy,
135
- disabled: settings.keySource !== "settings",
136
- children: "Supprimer"
137
- }
138
- )
139
- ] }),
140
- feedback ? /* @__PURE__ */ jsxRuntime.jsx(
141
- designSystem.Typography,
142
- {
143
- variant: "pi",
144
- textColor: feedback.tone === "success" ? "success600" : "danger600",
145
- children: feedback.text
146
- }
147
- ) : null,
148
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingTop: 4, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: [
149
- "Le jeton a besoin des portées ",
150
- /* @__PURE__ */ jsxRuntime.jsx("b", { children: "crm.schemas.contacts.read" }),
151
- " et",
152
- " ",
153
- /* @__PURE__ */ jsxRuntime.jsx("b", { children: "crm.schemas.companies.read" }),
154
- " pour lister les propriétés. Il n'est jamais renvoyé au navigateur : seuls son existence, sa provenance et ses quatre derniers caractères le sont."
155
- ] }) })
156
- ] }) });
157
- };
158
- exports.default = HubspotSettings;
@@ -1,42 +0,0 @@
1
- const PLUGIN_ID = "hubspot";
2
- const index = {
3
- register(app) {
4
- app.customFields.register({
5
- name: "property",
6
- pluginId: PLUGIN_ID,
7
- type: "string",
8
- intlLabel: {
9
- id: `${PLUGIN_ID}.property.label`,
10
- defaultMessage: "Propriété HubSpot"
11
- },
12
- intlDescription: {
13
- id: `${PLUGIN_ID}.property.description`,
14
- defaultMessage: "Choisie dans les propriétés réelles du portail"
15
- },
16
- components: {
17
- Input: async () => import("./HubspotPropertyInput-C7Wcw8ee.mjs")
18
- },
19
- options: {}
20
- });
21
- app.createSettingSection(
22
- {
23
- id: PLUGIN_ID,
24
- intlLabel: { id: `${PLUGIN_ID}.settings.section`, defaultMessage: "HubSpot" }
25
- },
26
- [
27
- {
28
- intlLabel: { id: `${PLUGIN_ID}.settings.link`, defaultMessage: "Configuration" },
29
- id: `${PLUGIN_ID}-settings`,
30
- to: `/settings/${PLUGIN_ID}`,
31
- permissions: [],
32
- Component: async () => (await import("./Settings-B5w7LAsH.mjs")).default
33
- }
34
- ]
35
- );
36
- app.registerPlugin({ id: PLUGIN_ID, name: PLUGIN_ID });
37
- }
38
- };
39
- export {
40
- PLUGIN_ID as P,
41
- index as i
42
- };
@@ -1,41 +0,0 @@
1
- "use strict";
2
- const PLUGIN_ID = "hubspot";
3
- const index = {
4
- register(app) {
5
- app.customFields.register({
6
- name: "property",
7
- pluginId: PLUGIN_ID,
8
- type: "string",
9
- intlLabel: {
10
- id: `${PLUGIN_ID}.property.label`,
11
- defaultMessage: "Propriété HubSpot"
12
- },
13
- intlDescription: {
14
- id: `${PLUGIN_ID}.property.description`,
15
- defaultMessage: "Choisie dans les propriétés réelles du portail"
16
- },
17
- components: {
18
- Input: async () => Promise.resolve().then(() => require("./HubspotPropertyInput-BVFRtt49.js"))
19
- },
20
- options: {}
21
- });
22
- app.createSettingSection(
23
- {
24
- id: PLUGIN_ID,
25
- intlLabel: { id: `${PLUGIN_ID}.settings.section`, defaultMessage: "HubSpot" }
26
- },
27
- [
28
- {
29
- intlLabel: { id: `${PLUGIN_ID}.settings.link`, defaultMessage: "Configuration" },
30
- id: `${PLUGIN_ID}-settings`,
31
- to: `/settings/${PLUGIN_ID}`,
32
- permissions: [],
33
- Component: async () => (await Promise.resolve().then(() => require("./Settings-TGB0MOHr.js"))).default
34
- }
35
- ]
36
- );
37
- app.registerPlugin({ id: PLUGIN_ID, name: PLUGIN_ID });
38
- }
39
- };
40
- exports.PLUGIN_ID = PLUGIN_ID;
41
- exports.index = index;