@frameless/strapi-plugin-flo-legal-embed 2.0.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/LICENSE.md +288 -0
- package/README.md +34 -0
- package/dist/_chunks/en-DA9_CZNh.js +9 -0
- package/dist/_chunks/en-DL8lkwfI.mjs +9 -0
- package/dist/_chunks/index-BsjCjaop.mjs +421 -0
- package/dist/_chunks/index-Doljqns2.js +141 -0
- package/dist/_chunks/index-DuaW1Ojp.mjs +142 -0
- package/dist/_chunks/index-IrSgMm3Q.js +438 -0
- package/dist/_chunks/nl--quOP7M_.mjs +9 -0
- package/dist/_chunks/nl-WRqysNLk.js +9 -0
- package/dist/admin/index.js +3 -0
- package/dist/admin/index.mjs +4 -0
- package/dist/server/index.js +86 -0
- package/dist/server/index.mjs +87 -0
- package/package.json +102 -0
|
@@ -0,0 +1,438 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const designSystem = require("@strapi/design-system");
|
|
5
|
+
const reactIntl = require("react-intl");
|
|
6
|
+
const admin = require("@strapi/strapi/admin");
|
|
7
|
+
const React = require("react");
|
|
8
|
+
const index = require("./index-Doljqns2.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
|
+
var withSelector = { exports: {} };
|
|
28
|
+
var useSyncExternalStoreWithSelector_production = {};
|
|
29
|
+
/**
|
|
30
|
+
* @license React
|
|
31
|
+
* use-sync-external-store-with-selector.production.js
|
|
32
|
+
*
|
|
33
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
34
|
+
*
|
|
35
|
+
* This source code is licensed under the MIT license found in the
|
|
36
|
+
* LICENSE file in the root directory of this source tree.
|
|
37
|
+
*/
|
|
38
|
+
var hasRequiredUseSyncExternalStoreWithSelector_production;
|
|
39
|
+
function requireUseSyncExternalStoreWithSelector_production() {
|
|
40
|
+
if (hasRequiredUseSyncExternalStoreWithSelector_production) return useSyncExternalStoreWithSelector_production;
|
|
41
|
+
hasRequiredUseSyncExternalStoreWithSelector_production = 1;
|
|
42
|
+
var React2 = React__namespace.default;
|
|
43
|
+
function is(x, y) {
|
|
44
|
+
return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
|
|
45
|
+
}
|
|
46
|
+
var objectIs = "function" === typeof Object.is ? Object.is : is, useSyncExternalStore = React2.useSyncExternalStore, useRef = React2.useRef, useEffect = React2.useEffect, useMemo = React2.useMemo, useDebugValue = React2.useDebugValue;
|
|
47
|
+
useSyncExternalStoreWithSelector_production.useSyncExternalStoreWithSelector = function(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
|
|
48
|
+
var instRef = useRef(null);
|
|
49
|
+
if (null === instRef.current) {
|
|
50
|
+
var inst = { hasValue: false, value: null };
|
|
51
|
+
instRef.current = inst;
|
|
52
|
+
} else inst = instRef.current;
|
|
53
|
+
instRef = useMemo(
|
|
54
|
+
function() {
|
|
55
|
+
function memoizedSelector(nextSnapshot) {
|
|
56
|
+
if (!hasMemo) {
|
|
57
|
+
hasMemo = true;
|
|
58
|
+
memoizedSnapshot = nextSnapshot;
|
|
59
|
+
nextSnapshot = selector(nextSnapshot);
|
|
60
|
+
if (void 0 !== isEqual && inst.hasValue) {
|
|
61
|
+
var currentSelection = inst.value;
|
|
62
|
+
if (isEqual(currentSelection, nextSnapshot))
|
|
63
|
+
return memoizedSelection = currentSelection;
|
|
64
|
+
}
|
|
65
|
+
return memoizedSelection = nextSnapshot;
|
|
66
|
+
}
|
|
67
|
+
currentSelection = memoizedSelection;
|
|
68
|
+
if (objectIs(memoizedSnapshot, nextSnapshot)) return currentSelection;
|
|
69
|
+
var nextSelection = selector(nextSnapshot);
|
|
70
|
+
if (void 0 !== isEqual && isEqual(currentSelection, nextSelection))
|
|
71
|
+
return memoizedSnapshot = nextSnapshot, currentSelection;
|
|
72
|
+
memoizedSnapshot = nextSnapshot;
|
|
73
|
+
return memoizedSelection = nextSelection;
|
|
74
|
+
}
|
|
75
|
+
var hasMemo = false, memoizedSnapshot, memoizedSelection, maybeGetServerSnapshot = void 0 === getServerSnapshot ? null : getServerSnapshot;
|
|
76
|
+
return [
|
|
77
|
+
function() {
|
|
78
|
+
return memoizedSelector(getSnapshot());
|
|
79
|
+
},
|
|
80
|
+
null === maybeGetServerSnapshot ? void 0 : function() {
|
|
81
|
+
return memoizedSelector(maybeGetServerSnapshot());
|
|
82
|
+
}
|
|
83
|
+
];
|
|
84
|
+
},
|
|
85
|
+
[getSnapshot, getServerSnapshot, selector, isEqual]
|
|
86
|
+
);
|
|
87
|
+
var value = useSyncExternalStore(subscribe, instRef[0], instRef[1]);
|
|
88
|
+
useEffect(
|
|
89
|
+
function() {
|
|
90
|
+
inst.hasValue = true;
|
|
91
|
+
inst.value = value;
|
|
92
|
+
},
|
|
93
|
+
[value]
|
|
94
|
+
);
|
|
95
|
+
useDebugValue(value);
|
|
96
|
+
return value;
|
|
97
|
+
};
|
|
98
|
+
return useSyncExternalStoreWithSelector_production;
|
|
99
|
+
}
|
|
100
|
+
var useSyncExternalStoreWithSelector_development = {};
|
|
101
|
+
/**
|
|
102
|
+
* @license React
|
|
103
|
+
* use-sync-external-store-with-selector.development.js
|
|
104
|
+
*
|
|
105
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
106
|
+
*
|
|
107
|
+
* This source code is licensed under the MIT license found in the
|
|
108
|
+
* LICENSE file in the root directory of this source tree.
|
|
109
|
+
*/
|
|
110
|
+
var hasRequiredUseSyncExternalStoreWithSelector_development;
|
|
111
|
+
function requireUseSyncExternalStoreWithSelector_development() {
|
|
112
|
+
if (hasRequiredUseSyncExternalStoreWithSelector_development) return useSyncExternalStoreWithSelector_development;
|
|
113
|
+
hasRequiredUseSyncExternalStoreWithSelector_development = 1;
|
|
114
|
+
"production" !== process.env.NODE_ENV && function() {
|
|
115
|
+
function is(x, y) {
|
|
116
|
+
return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
|
|
117
|
+
}
|
|
118
|
+
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
119
|
+
var React2 = React__namespace.default, objectIs = "function" === typeof Object.is ? Object.is : is, useSyncExternalStore = React2.useSyncExternalStore, useRef = React2.useRef, useEffect = React2.useEffect, useMemo = React2.useMemo, useDebugValue = React2.useDebugValue;
|
|
120
|
+
useSyncExternalStoreWithSelector_development.useSyncExternalStoreWithSelector = function(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
|
|
121
|
+
var instRef = useRef(null);
|
|
122
|
+
if (null === instRef.current) {
|
|
123
|
+
var inst = { hasValue: false, value: null };
|
|
124
|
+
instRef.current = inst;
|
|
125
|
+
} else inst = instRef.current;
|
|
126
|
+
instRef = useMemo(
|
|
127
|
+
function() {
|
|
128
|
+
function memoizedSelector(nextSnapshot) {
|
|
129
|
+
if (!hasMemo) {
|
|
130
|
+
hasMemo = true;
|
|
131
|
+
memoizedSnapshot = nextSnapshot;
|
|
132
|
+
nextSnapshot = selector(nextSnapshot);
|
|
133
|
+
if (void 0 !== isEqual && inst.hasValue) {
|
|
134
|
+
var currentSelection = inst.value;
|
|
135
|
+
if (isEqual(currentSelection, nextSnapshot))
|
|
136
|
+
return memoizedSelection = currentSelection;
|
|
137
|
+
}
|
|
138
|
+
return memoizedSelection = nextSnapshot;
|
|
139
|
+
}
|
|
140
|
+
currentSelection = memoizedSelection;
|
|
141
|
+
if (objectIs(memoizedSnapshot, nextSnapshot))
|
|
142
|
+
return currentSelection;
|
|
143
|
+
var nextSelection = selector(nextSnapshot);
|
|
144
|
+
if (void 0 !== isEqual && isEqual(currentSelection, nextSelection))
|
|
145
|
+
return memoizedSnapshot = nextSnapshot, currentSelection;
|
|
146
|
+
memoizedSnapshot = nextSnapshot;
|
|
147
|
+
return memoizedSelection = nextSelection;
|
|
148
|
+
}
|
|
149
|
+
var hasMemo = false, memoizedSnapshot, memoizedSelection, maybeGetServerSnapshot = void 0 === getServerSnapshot ? null : getServerSnapshot;
|
|
150
|
+
return [
|
|
151
|
+
function() {
|
|
152
|
+
return memoizedSelector(getSnapshot());
|
|
153
|
+
},
|
|
154
|
+
null === maybeGetServerSnapshot ? void 0 : function() {
|
|
155
|
+
return memoizedSelector(maybeGetServerSnapshot());
|
|
156
|
+
}
|
|
157
|
+
];
|
|
158
|
+
},
|
|
159
|
+
[getSnapshot, getServerSnapshot, selector, isEqual]
|
|
160
|
+
);
|
|
161
|
+
var value = useSyncExternalStore(subscribe, instRef[0], instRef[1]);
|
|
162
|
+
useEffect(
|
|
163
|
+
function() {
|
|
164
|
+
inst.hasValue = true;
|
|
165
|
+
inst.value = value;
|
|
166
|
+
},
|
|
167
|
+
[value]
|
|
168
|
+
);
|
|
169
|
+
useDebugValue(value);
|
|
170
|
+
return value;
|
|
171
|
+
};
|
|
172
|
+
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
173
|
+
}();
|
|
174
|
+
return useSyncExternalStoreWithSelector_development;
|
|
175
|
+
}
|
|
176
|
+
if (process.env.NODE_ENV === "production") {
|
|
177
|
+
withSelector.exports = requireUseSyncExternalStoreWithSelector_production();
|
|
178
|
+
} else {
|
|
179
|
+
withSelector.exports = requireUseSyncExternalStoreWithSelector_development();
|
|
180
|
+
}
|
|
181
|
+
var withSelectorExports = withSelector.exports;
|
|
182
|
+
var ContextKey = /* @__PURE__ */ Symbol.for(`react-redux-context`);
|
|
183
|
+
var gT = typeof globalThis !== "undefined" ? globalThis : (
|
|
184
|
+
/* fall back to a per-module scope (pre-8.1 behaviour) if `globalThis` is not available */
|
|
185
|
+
{}
|
|
186
|
+
);
|
|
187
|
+
function getContext() {
|
|
188
|
+
if (!React__namespace.createContext) return {};
|
|
189
|
+
const contextMap = gT[ContextKey] ??= /* @__PURE__ */ new Map();
|
|
190
|
+
let realContext = contextMap.get(React__namespace.createContext);
|
|
191
|
+
if (!realContext) {
|
|
192
|
+
realContext = React__namespace.createContext(
|
|
193
|
+
null
|
|
194
|
+
);
|
|
195
|
+
if (process.env.NODE_ENV !== "production") {
|
|
196
|
+
realContext.displayName = "ReactRedux";
|
|
197
|
+
}
|
|
198
|
+
contextMap.set(React__namespace.createContext, realContext);
|
|
199
|
+
}
|
|
200
|
+
return realContext;
|
|
201
|
+
}
|
|
202
|
+
var ReactReduxContext = /* @__PURE__ */ getContext();
|
|
203
|
+
function createReduxContextHook(context = ReactReduxContext) {
|
|
204
|
+
return function useReduxContext2() {
|
|
205
|
+
const contextValue = React__namespace.useContext(context);
|
|
206
|
+
if (process.env.NODE_ENV !== "production" && !contextValue) {
|
|
207
|
+
throw new Error(
|
|
208
|
+
"could not find react-redux context value; please ensure the component is wrapped in a <Provider>"
|
|
209
|
+
);
|
|
210
|
+
}
|
|
211
|
+
return contextValue;
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
var useReduxContext = /* @__PURE__ */ createReduxContextHook();
|
|
215
|
+
function createStoreHook(context = ReactReduxContext) {
|
|
216
|
+
const useReduxContext2 = context === ReactReduxContext ? useReduxContext : (
|
|
217
|
+
// @ts-ignore
|
|
218
|
+
createReduxContextHook(context)
|
|
219
|
+
);
|
|
220
|
+
const useStore2 = () => {
|
|
221
|
+
const { store } = useReduxContext2();
|
|
222
|
+
return store;
|
|
223
|
+
};
|
|
224
|
+
Object.assign(useStore2, {
|
|
225
|
+
withTypes: () => useStore2
|
|
226
|
+
});
|
|
227
|
+
return useStore2;
|
|
228
|
+
}
|
|
229
|
+
var useStore = /* @__PURE__ */ createStoreHook();
|
|
230
|
+
function createDispatchHook(context = ReactReduxContext) {
|
|
231
|
+
const useStore2 = context === ReactReduxContext ? useStore : createStoreHook(context);
|
|
232
|
+
const useDispatch2 = () => {
|
|
233
|
+
const store = useStore2();
|
|
234
|
+
return store.dispatch;
|
|
235
|
+
};
|
|
236
|
+
Object.assign(useDispatch2, {
|
|
237
|
+
withTypes: () => useDispatch2
|
|
238
|
+
});
|
|
239
|
+
return useDispatch2;
|
|
240
|
+
}
|
|
241
|
+
var useDispatch = /* @__PURE__ */ createDispatchHook();
|
|
242
|
+
var refEquality = (a, b) => a === b;
|
|
243
|
+
function createSelectorHook(context = ReactReduxContext) {
|
|
244
|
+
const useReduxContext2 = context === ReactReduxContext ? useReduxContext : createReduxContextHook(context);
|
|
245
|
+
const useSelector2 = (selector, equalityFnOrOptions = {}) => {
|
|
246
|
+
const { equalityFn = refEquality } = typeof equalityFnOrOptions === "function" ? { equalityFn: equalityFnOrOptions } : equalityFnOrOptions;
|
|
247
|
+
if (process.env.NODE_ENV !== "production") {
|
|
248
|
+
if (!selector) {
|
|
249
|
+
throw new Error(`You must pass a selector to useSelector`);
|
|
250
|
+
}
|
|
251
|
+
if (typeof selector !== "function") {
|
|
252
|
+
throw new Error(`You must pass a function as a selector to useSelector`);
|
|
253
|
+
}
|
|
254
|
+
if (typeof equalityFn !== "function") {
|
|
255
|
+
throw new Error(
|
|
256
|
+
`You must pass a function as an equality function to useSelector`
|
|
257
|
+
);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
const reduxContext = useReduxContext2();
|
|
261
|
+
const { store, subscription, getServerState } = reduxContext;
|
|
262
|
+
const firstRun = React__namespace.useRef(true);
|
|
263
|
+
const wrappedSelector = React__namespace.useCallback(
|
|
264
|
+
{
|
|
265
|
+
[selector.name](state) {
|
|
266
|
+
const selected = selector(state);
|
|
267
|
+
if (process.env.NODE_ENV !== "production") {
|
|
268
|
+
const { devModeChecks = {} } = typeof equalityFnOrOptions === "function" ? {} : equalityFnOrOptions;
|
|
269
|
+
const { identityFunctionCheck, stabilityCheck } = reduxContext;
|
|
270
|
+
const {
|
|
271
|
+
identityFunctionCheck: finalIdentityFunctionCheck,
|
|
272
|
+
stabilityCheck: finalStabilityCheck
|
|
273
|
+
} = {
|
|
274
|
+
stabilityCheck,
|
|
275
|
+
identityFunctionCheck,
|
|
276
|
+
...devModeChecks
|
|
277
|
+
};
|
|
278
|
+
if (finalStabilityCheck === "always" || finalStabilityCheck === "once" && firstRun.current) {
|
|
279
|
+
const toCompare = selector(state);
|
|
280
|
+
if (!equalityFn(selected, toCompare)) {
|
|
281
|
+
let stack = void 0;
|
|
282
|
+
try {
|
|
283
|
+
throw new Error();
|
|
284
|
+
} catch (e) {
|
|
285
|
+
({ stack } = e);
|
|
286
|
+
}
|
|
287
|
+
console.warn(
|
|
288
|
+
"Selector " + (selector.name || "unknown") + " returned a different result when called with the same parameters. This can lead to unnecessary rerenders.\nSelectors that return a new reference (such as an object or an array) should be memoized: https://redux.js.org/usage/deriving-data-selectors#optimizing-selectors-with-memoization",
|
|
289
|
+
{
|
|
290
|
+
state,
|
|
291
|
+
selected,
|
|
292
|
+
selected2: toCompare,
|
|
293
|
+
stack
|
|
294
|
+
}
|
|
295
|
+
);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
if (finalIdentityFunctionCheck === "always" || finalIdentityFunctionCheck === "once" && firstRun.current) {
|
|
299
|
+
if (selected === state) {
|
|
300
|
+
let stack = void 0;
|
|
301
|
+
try {
|
|
302
|
+
throw new Error();
|
|
303
|
+
} catch (e) {
|
|
304
|
+
({ stack } = e);
|
|
305
|
+
}
|
|
306
|
+
console.warn(
|
|
307
|
+
"Selector " + (selector.name || "unknown") + " returned the root state when called. This can lead to unnecessary rerenders.\nSelectors that return the entire state are almost certainly a mistake, as they will cause a rerender whenever *anything* in state changes.",
|
|
308
|
+
{ stack }
|
|
309
|
+
);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
if (firstRun.current) firstRun.current = false;
|
|
313
|
+
}
|
|
314
|
+
return selected;
|
|
315
|
+
}
|
|
316
|
+
}[selector.name],
|
|
317
|
+
[selector]
|
|
318
|
+
);
|
|
319
|
+
const selectedState = withSelectorExports.useSyncExternalStoreWithSelector(
|
|
320
|
+
subscription.addNestedSub,
|
|
321
|
+
store.getState,
|
|
322
|
+
getServerState || store.getState,
|
|
323
|
+
wrappedSelector,
|
|
324
|
+
equalityFn
|
|
325
|
+
);
|
|
326
|
+
React__namespace.useDebugValue(selectedState);
|
|
327
|
+
return selectedState;
|
|
328
|
+
};
|
|
329
|
+
Object.assign(useSelector2, {
|
|
330
|
+
withTypes: () => useSelector2
|
|
331
|
+
});
|
|
332
|
+
return useSelector2;
|
|
333
|
+
}
|
|
334
|
+
var useSelector = /* @__PURE__ */ createSelectorHook();
|
|
335
|
+
const usePluginConfig = () => {
|
|
336
|
+
const dispatch = useDispatch();
|
|
337
|
+
const { toggleNotification } = admin.useNotification();
|
|
338
|
+
const { formatMessage } = reactIntl.useIntl();
|
|
339
|
+
const { isLoading, config, checks } = useSelector(
|
|
340
|
+
(state) => state[`${index.PLUGIN_ID}_config`]
|
|
341
|
+
);
|
|
342
|
+
const client = admin.useFetchClient();
|
|
343
|
+
React.useEffect(() => {
|
|
344
|
+
if (!isLoading && config !== null) {
|
|
345
|
+
return;
|
|
346
|
+
}
|
|
347
|
+
const abortController = new AbortController();
|
|
348
|
+
const fetchData = async () => {
|
|
349
|
+
try {
|
|
350
|
+
const endpoint = `/${index.PLUGIN_ID}/config`;
|
|
351
|
+
const { data } = await client.get(endpoint, {
|
|
352
|
+
signal: abortController.signal
|
|
353
|
+
});
|
|
354
|
+
return data ?? null;
|
|
355
|
+
} catch (err) {
|
|
356
|
+
console.error(err);
|
|
357
|
+
if (!abortController.signal.aborted) {
|
|
358
|
+
toggleNotification({
|
|
359
|
+
type: "warning",
|
|
360
|
+
message: formatMessage({
|
|
361
|
+
id: index.getTranslation("notification.error"),
|
|
362
|
+
defaultMessage: "An error occurred while fetching data"
|
|
363
|
+
})
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
return null;
|
|
367
|
+
}
|
|
368
|
+
};
|
|
369
|
+
fetchData().then((data) => dispatch({ type: index.RESOLVE_CONFIG, data }));
|
|
370
|
+
return () => abortController.abort();
|
|
371
|
+
}, [client, config, dispatch, isLoading, toggleNotification, formatMessage]);
|
|
372
|
+
return { config, checks, isLoading };
|
|
373
|
+
};
|
|
374
|
+
const FloLegalCombobox = ({
|
|
375
|
+
value,
|
|
376
|
+
onChange,
|
|
377
|
+
name,
|
|
378
|
+
required,
|
|
379
|
+
type,
|
|
380
|
+
placeholder,
|
|
381
|
+
disabled,
|
|
382
|
+
error,
|
|
383
|
+
label,
|
|
384
|
+
hint
|
|
385
|
+
}) => {
|
|
386
|
+
const { config, checks, isLoading } = usePluginConfig();
|
|
387
|
+
const { formatMessage } = reactIntl.useIntl();
|
|
388
|
+
const generateFloLegalData = (params) => new URLSearchParams({ ...params }).toString();
|
|
389
|
+
if (!config?.api_url || !config?.token) {
|
|
390
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
391
|
+
designSystem.Field.Root,
|
|
392
|
+
{
|
|
393
|
+
name,
|
|
394
|
+
error,
|
|
395
|
+
hint: formatMessage({
|
|
396
|
+
id: index.getTranslation("flo-legal-embed.disabled.hint"),
|
|
397
|
+
defaultMessage: "Ensure FLO_LEGAL_API_URL and FLO_LEGAL_API_TOKEN are configured to enable this field."
|
|
398
|
+
}),
|
|
399
|
+
children: [
|
|
400
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: label }),
|
|
401
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
402
|
+
designSystem.TextInput,
|
|
403
|
+
{
|
|
404
|
+
name,
|
|
405
|
+
value: "",
|
|
406
|
+
placeholder: formatMessage({
|
|
407
|
+
id: index.getTranslation("flo-legal-embed.disabled.placeholder"),
|
|
408
|
+
defaultMessage: "This field is disabled until necessary settings are configured."
|
|
409
|
+
}),
|
|
410
|
+
disabled: true
|
|
411
|
+
}
|
|
412
|
+
),
|
|
413
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {}),
|
|
414
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
|
|
415
|
+
]
|
|
416
|
+
}
|
|
417
|
+
);
|
|
418
|
+
}
|
|
419
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { name, error, hint, required, children: [
|
|
420
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: label }),
|
|
421
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
422
|
+
designSystem.Combobox,
|
|
423
|
+
{
|
|
424
|
+
placeholder,
|
|
425
|
+
"aria-label": label,
|
|
426
|
+
disabled,
|
|
427
|
+
required,
|
|
428
|
+
value: value ?? "",
|
|
429
|
+
loading: isLoading,
|
|
430
|
+
onChange: (val) => onChange({ target: { name, value: val, type } }),
|
|
431
|
+
children: checks.map(({ identifier, name: name2 }) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.ComboboxOption, { value: generateFloLegalData({ identifier }), children: name2 }, identifier))
|
|
432
|
+
}
|
|
433
|
+
),
|
|
434
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {}),
|
|
435
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
|
|
436
|
+
] });
|
|
437
|
+
};
|
|
438
|
+
exports.FloLegalCombobox = FloLegalCombobox;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const nl = {
|
|
2
|
+
"flo-legal-embed.label": "Kies een ingebed Flo Legal formulier",
|
|
3
|
+
"flo-legal-embed.description": "Slaat de unieke identificatie van het geselecteerde formulier op in de database.",
|
|
4
|
+
"flo-legal-embed.disabled.placeholder": "Dit veld is uitgeschakeld totdat de vereiste instellingen zijn geconfigureerd.",
|
|
5
|
+
"flo-legal-embed.disabled.hint": "Zorg ervoor dat FLO_LEGAL_API_URL en FLO_LEGAL_API_TOKEN correct zijn geconfigureerd om dit veld in te schakelen."
|
|
6
|
+
};
|
|
7
|
+
export {
|
|
8
|
+
nl as default
|
|
9
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const nl = {
|
|
4
|
+
"flo-legal-embed.label": "Kies een ingebed Flo Legal formulier",
|
|
5
|
+
"flo-legal-embed.description": "Slaat de unieke identificatie van het geselecteerde formulier op in de database.",
|
|
6
|
+
"flo-legal-embed.disabled.placeholder": "Dit veld is uitgeschakeld totdat de vereiste instellingen zijn geconfigureerd.",
|
|
7
|
+
"flo-legal-embed.disabled.hint": "Zorg ervoor dat FLO_LEGAL_API_URL en FLO_LEGAL_API_TOKEN correct zijn geconfigureerd om dit veld in te schakelen."
|
|
8
|
+
};
|
|
9
|
+
exports.default = nl;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const config = {
|
|
3
|
+
default: {}
|
|
4
|
+
// export default {
|
|
5
|
+
// default: {},
|
|
6
|
+
// validator: (config: Config) => {
|
|
7
|
+
// if (!config) {
|
|
8
|
+
// return;
|
|
9
|
+
// }
|
|
10
|
+
// if (!config?.api_url) {
|
|
11
|
+
// console.warn('strapi-plugin-flo-legal-embed: Warning: Missing api_url prop.');
|
|
12
|
+
// }
|
|
13
|
+
// if (!config?.token) {
|
|
14
|
+
// console.warn('strapi-plugin-flo-legal-embed: Warning: Missing token prop.');
|
|
15
|
+
// }
|
|
16
|
+
// },
|
|
17
|
+
// };
|
|
18
|
+
};
|
|
19
|
+
const PLUGIN_ID = "flo-legal-embed";
|
|
20
|
+
const floLegalEmbed = ({ strapi }) => ({
|
|
21
|
+
async config(ctx) {
|
|
22
|
+
try {
|
|
23
|
+
const config2 = await strapi.plugin(PLUGIN_ID).service("plugin").getConfig();
|
|
24
|
+
if (!config2?.api_url || !config2?.token) {
|
|
25
|
+
ctx.body = { config: config2 };
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const response = await fetch(`${config2.api_url}/block-publications?type=CHECK`, {
|
|
29
|
+
headers: {
|
|
30
|
+
"x-api-key": config2.token
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
if (!response.ok) {
|
|
34
|
+
throw new Error(`API request failed with status ${response.status}`);
|
|
35
|
+
}
|
|
36
|
+
const checks = await response.json();
|
|
37
|
+
ctx.body = { config: config2, checks };
|
|
38
|
+
} catch (error) {
|
|
39
|
+
console.error(error);
|
|
40
|
+
ctx.badRequest(`Failed to load ${PLUGIN_ID} config: ${error.message}`);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
const controllers = {
|
|
45
|
+
"flo-legal-embed": floLegalEmbed
|
|
46
|
+
};
|
|
47
|
+
const register = ({ strapi }) => {
|
|
48
|
+
strapi.customFields.register({
|
|
49
|
+
name: PLUGIN_ID,
|
|
50
|
+
plugin: PLUGIN_ID,
|
|
51
|
+
type: "string"
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
const admin = {
|
|
55
|
+
type: "admin",
|
|
56
|
+
routes: [
|
|
57
|
+
{
|
|
58
|
+
method: "GET",
|
|
59
|
+
path: "/config",
|
|
60
|
+
handler: `${PLUGIN_ID}.config`,
|
|
61
|
+
config: {
|
|
62
|
+
policies: ["admin::isAuthenticatedAdmin"]
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
};
|
|
67
|
+
const routes = {
|
|
68
|
+
"admin-api": admin
|
|
69
|
+
};
|
|
70
|
+
const plugin = ({ strapi }) => ({
|
|
71
|
+
getConfig() {
|
|
72
|
+
const data = strapi.config.get(`plugin::${PLUGIN_ID}`);
|
|
73
|
+
return data;
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
const services = {
|
|
77
|
+
plugin
|
|
78
|
+
};
|
|
79
|
+
const index = {
|
|
80
|
+
config,
|
|
81
|
+
controllers,
|
|
82
|
+
routes,
|
|
83
|
+
services,
|
|
84
|
+
register
|
|
85
|
+
};
|
|
86
|
+
module.exports = index;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
const config = {
|
|
2
|
+
default: {}
|
|
3
|
+
// export default {
|
|
4
|
+
// default: {},
|
|
5
|
+
// validator: (config: Config) => {
|
|
6
|
+
// if (!config) {
|
|
7
|
+
// return;
|
|
8
|
+
// }
|
|
9
|
+
// if (!config?.api_url) {
|
|
10
|
+
// console.warn('strapi-plugin-flo-legal-embed: Warning: Missing api_url prop.');
|
|
11
|
+
// }
|
|
12
|
+
// if (!config?.token) {
|
|
13
|
+
// console.warn('strapi-plugin-flo-legal-embed: Warning: Missing token prop.');
|
|
14
|
+
// }
|
|
15
|
+
// },
|
|
16
|
+
// };
|
|
17
|
+
};
|
|
18
|
+
const PLUGIN_ID = "flo-legal-embed";
|
|
19
|
+
const floLegalEmbed = ({ strapi }) => ({
|
|
20
|
+
async config(ctx) {
|
|
21
|
+
try {
|
|
22
|
+
const config2 = await strapi.plugin(PLUGIN_ID).service("plugin").getConfig();
|
|
23
|
+
if (!config2?.api_url || !config2?.token) {
|
|
24
|
+
ctx.body = { config: config2 };
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const response = await fetch(`${config2.api_url}/block-publications?type=CHECK`, {
|
|
28
|
+
headers: {
|
|
29
|
+
"x-api-key": config2.token
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
if (!response.ok) {
|
|
33
|
+
throw new Error(`API request failed with status ${response.status}`);
|
|
34
|
+
}
|
|
35
|
+
const checks = await response.json();
|
|
36
|
+
ctx.body = { config: config2, checks };
|
|
37
|
+
} catch (error) {
|
|
38
|
+
console.error(error);
|
|
39
|
+
ctx.badRequest(`Failed to load ${PLUGIN_ID} config: ${error.message}`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
const controllers = {
|
|
44
|
+
"flo-legal-embed": floLegalEmbed
|
|
45
|
+
};
|
|
46
|
+
const register = ({ strapi }) => {
|
|
47
|
+
strapi.customFields.register({
|
|
48
|
+
name: PLUGIN_ID,
|
|
49
|
+
plugin: PLUGIN_ID,
|
|
50
|
+
type: "string"
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
const admin = {
|
|
54
|
+
type: "admin",
|
|
55
|
+
routes: [
|
|
56
|
+
{
|
|
57
|
+
method: "GET",
|
|
58
|
+
path: "/config",
|
|
59
|
+
handler: `${PLUGIN_ID}.config`,
|
|
60
|
+
config: {
|
|
61
|
+
policies: ["admin::isAuthenticatedAdmin"]
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
};
|
|
66
|
+
const routes = {
|
|
67
|
+
"admin-api": admin
|
|
68
|
+
};
|
|
69
|
+
const plugin = ({ strapi }) => ({
|
|
70
|
+
getConfig() {
|
|
71
|
+
const data = strapi.config.get(`plugin::${PLUGIN_ID}`);
|
|
72
|
+
return data;
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
const services = {
|
|
76
|
+
plugin
|
|
77
|
+
};
|
|
78
|
+
const index = {
|
|
79
|
+
config,
|
|
80
|
+
controllers,
|
|
81
|
+
routes,
|
|
82
|
+
services,
|
|
83
|
+
register
|
|
84
|
+
};
|
|
85
|
+
export {
|
|
86
|
+
index as default
|
|
87
|
+
};
|