strapi-plugin-hubspot 0.3.0 → 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.
- package/README.md +121 -2
- package/dist/_chunks/HubspotObjectInput-DAq_W1rA.js +91 -0
- package/dist/_chunks/HubspotObjectInput-G-A_pL2j.mjs +73 -0
- package/dist/_chunks/HubspotPropertyInput-B-Jg0x68.js +186 -0
- package/dist/_chunks/HubspotPropertyInput-Cv77QiS6.mjs +168 -0
- package/dist/_chunks/Settings-58edRL5D.mjs +1293 -0
- package/dist/_chunks/Settings-CryiUgSe.js +1311 -0
- package/dist/_chunks/en-CnQbjHs-.js +81 -0
- package/dist/_chunks/en-DHQZuRsj.mjs +81 -0
- package/dist/_chunks/fr-Bv8zsNX5.js +81 -0
- package/dist/_chunks/fr-Dxgil7RP.mjs +81 -0
- package/dist/_chunks/index-BudHTwSw.mjs +137 -0
- package/dist/_chunks/index-Tlw1p93d.js +136 -0
- package/dist/_chunks/objectLabels-CJTKZ4vT.mjs +425 -0
- package/dist/_chunks/objectLabels-GRmYGCIn.js +442 -0
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/src/components/AuditSection.d.ts +5 -0
- package/dist/admin/src/components/FailuresSection.d.ts +11 -0
- package/dist/admin/src/components/HubspotObjectInput.d.ts +28 -0
- package/dist/admin/src/components/HubspotPropertyInput.d.ts +1 -0
- package/dist/admin/src/getTranslation.d.ts +3 -0
- package/dist/admin/src/index.d.ts +6 -0
- package/dist/admin/src/objectLabels.d.ts +2 -1
- package/dist/server/index.js +417 -69
- package/dist/server/index.mjs +417 -69
- package/dist/server/src/__tests__/audit.test.d.ts +1 -0
- package/dist/server/src/__tests__/checkMapping.test.d.ts +1 -0
- package/dist/server/src/__tests__/loadSchema.test.d.ts +1 -0
- package/dist/server/src/__tests__/submit.test.d.ts +1 -0
- package/dist/server/src/__tests__/validation.test.d.ts +1 -0
- package/dist/server/src/audit.d.ts +60 -0
- package/dist/server/src/content-types.d.ts +56 -0
- package/dist/server/src/index.d.ts +104 -28
- package/dist/server/src/properties.d.ts +7 -2
- package/dist/server/src/submit.d.ts +35 -0
- package/dist/server/src/validation.d.ts +37 -0
- package/package.json +5 -2
- package/dist/_chunks/HubspotPropertyInput-C3KbDHYP.mjs +0 -106
- package/dist/_chunks/HubspotPropertyInput-C9PpYYgj.js +0 -124
- package/dist/_chunks/Settings-DGJ_mmlw.mjs +0 -140
- package/dist/_chunks/Settings-Lj49S5fO.js +0 -158
- package/dist/_chunks/index-Bq1tS5h6.js +0 -71
- package/dist/_chunks/index-lx7um1Yx.mjs +0 -72
|
@@ -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-Bq1tS5h6.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,71 +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-C9PpYYgj.js"))
|
|
19
|
-
},
|
|
20
|
-
// Exposed in the Content-Type Builder. Without this, `objectField` could
|
|
21
|
-
// only be set by hand-editing schema.json — which is not how anyone
|
|
22
|
-
// installing from npm adds a field, so the filtering would be unreachable.
|
|
23
|
-
options: {
|
|
24
|
-
base: [
|
|
25
|
-
{
|
|
26
|
-
sectionTitle: {
|
|
27
|
-
id: `${PLUGIN_ID}.options.section`,
|
|
28
|
-
defaultMessage: "HubSpot"
|
|
29
|
-
},
|
|
30
|
-
items: [
|
|
31
|
-
{
|
|
32
|
-
name: "options.objectField",
|
|
33
|
-
type: "text",
|
|
34
|
-
intlLabel: {
|
|
35
|
-
id: `${PLUGIN_ID}.options.objectField.label`,
|
|
36
|
-
defaultMessage: "Object field"
|
|
37
|
-
},
|
|
38
|
-
description: {
|
|
39
|
-
id: `${PLUGIN_ID}.options.objectField.description`,
|
|
40
|
-
defaultMessage: "Name of the sibling field holding the HubSpot object (e.g. hsObject). Leave empty to list every object's properties."
|
|
41
|
-
},
|
|
42
|
-
placeholder: {
|
|
43
|
-
id: `${PLUGIN_ID}.options.objectField.placeholder`,
|
|
44
|
-
defaultMessage: "hsObject"
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
]
|
|
48
|
-
}
|
|
49
|
-
]
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
app.createSettingSection(
|
|
53
|
-
{
|
|
54
|
-
id: PLUGIN_ID,
|
|
55
|
-
intlLabel: { id: `${PLUGIN_ID}.settings.section`, defaultMessage: "HubSpot" }
|
|
56
|
-
},
|
|
57
|
-
[
|
|
58
|
-
{
|
|
59
|
-
intlLabel: { id: `${PLUGIN_ID}.settings.link`, defaultMessage: "Configuration" },
|
|
60
|
-
id: `${PLUGIN_ID}-settings`,
|
|
61
|
-
to: `/settings/${PLUGIN_ID}`,
|
|
62
|
-
permissions: [],
|
|
63
|
-
Component: async () => (await Promise.resolve().then(() => require("./Settings-Lj49S5fO.js"))).default
|
|
64
|
-
}
|
|
65
|
-
]
|
|
66
|
-
);
|
|
67
|
-
app.registerPlugin({ id: PLUGIN_ID, name: PLUGIN_ID });
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
exports.PLUGIN_ID = PLUGIN_ID;
|
|
71
|
-
exports.index = index;
|
|
@@ -1,72 +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-C3KbDHYP.mjs")
|
|
18
|
-
},
|
|
19
|
-
// Exposed in the Content-Type Builder. Without this, `objectField` could
|
|
20
|
-
// only be set by hand-editing schema.json — which is not how anyone
|
|
21
|
-
// installing from npm adds a field, so the filtering would be unreachable.
|
|
22
|
-
options: {
|
|
23
|
-
base: [
|
|
24
|
-
{
|
|
25
|
-
sectionTitle: {
|
|
26
|
-
id: `${PLUGIN_ID}.options.section`,
|
|
27
|
-
defaultMessage: "HubSpot"
|
|
28
|
-
},
|
|
29
|
-
items: [
|
|
30
|
-
{
|
|
31
|
-
name: "options.objectField",
|
|
32
|
-
type: "text",
|
|
33
|
-
intlLabel: {
|
|
34
|
-
id: `${PLUGIN_ID}.options.objectField.label`,
|
|
35
|
-
defaultMessage: "Object field"
|
|
36
|
-
},
|
|
37
|
-
description: {
|
|
38
|
-
id: `${PLUGIN_ID}.options.objectField.description`,
|
|
39
|
-
defaultMessage: "Name of the sibling field holding the HubSpot object (e.g. hsObject). Leave empty to list every object's properties."
|
|
40
|
-
},
|
|
41
|
-
placeholder: {
|
|
42
|
-
id: `${PLUGIN_ID}.options.objectField.placeholder`,
|
|
43
|
-
defaultMessage: "hsObject"
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
]
|
|
47
|
-
}
|
|
48
|
-
]
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
app.createSettingSection(
|
|
52
|
-
{
|
|
53
|
-
id: PLUGIN_ID,
|
|
54
|
-
intlLabel: { id: `${PLUGIN_ID}.settings.section`, defaultMessage: "HubSpot" }
|
|
55
|
-
},
|
|
56
|
-
[
|
|
57
|
-
{
|
|
58
|
-
intlLabel: { id: `${PLUGIN_ID}.settings.link`, defaultMessage: "Configuration" },
|
|
59
|
-
id: `${PLUGIN_ID}-settings`,
|
|
60
|
-
to: `/settings/${PLUGIN_ID}`,
|
|
61
|
-
permissions: [],
|
|
62
|
-
Component: async () => (await import("./Settings-DGJ_mmlw.mjs")).default
|
|
63
|
-
}
|
|
64
|
-
]
|
|
65
|
-
);
|
|
66
|
-
app.registerPlugin({ id: PLUGIN_ID, name: PLUGIN_ID });
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
export {
|
|
70
|
-
PLUGIN_ID as P,
|
|
71
|
-
index as i
|
|
72
|
-
};
|