@localazy/strapi-plugin 1.0.8 → 1.0.9
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/dist/_chunks/{set-CmcBsVOP.js → FetchIdentity-4kkW9N7Y.js} +141 -51
- package/dist/_chunks/{set-BRyy4Ra6.mjs → FetchIdentity-BWSQAXt-.mjs} +97 -7
- package/dist/_chunks/{LanguagesSelector-u9iDsQqB.mjs → LanguagesSelector-DwAGgpcR.mjs} +3 -3
- package/dist/_chunks/{LanguagesSelector-Bfrsr3-P.js → LanguagesSelector-yWC_Yb_S.js} +10 -10
- package/dist/_chunks/{App-Dl58PZKy.js → LocalazyApp-DnaA768k.js} +49 -34
- package/dist/_chunks/{App-C0ogWaOz.mjs → LocalazyApp-zySanVTu.mjs} +29 -14
- package/dist/_chunks/{ContentTransferSetup-ClR8Nwv2.mjs → LocalazyContentTransferSetup-C7qVIeix.mjs} +12 -8
- package/dist/_chunks/{ContentTransferSetup-DWQg9zDj.js → LocalazyContentTransferSetup-CeOM6bYA.js} +26 -22
- package/dist/_chunks/{GlobalSettings-B_h5sPwa.mjs → LocalazyGlobalSettings-QvuLdsLe.mjs} +15 -9
- package/dist/_chunks/{GlobalSettings-BpY7BoXu.js → LocalazyGlobalSettings-ewETL3oG.js} +58 -52
- package/dist/_chunks/{LocalazyPanel-BedTxk3C.js → LocalazyPanel-BXVLvFgD.js} +1 -1
- package/dist/_chunks/{LocalazyPanel-CuvdSJYx.mjs → LocalazyPanel-BotUsX-y.mjs} +2 -2
- package/dist/_chunks/{LocalazyStatusColumn-955GpXAv.mjs → LocalazyStatusColumn-C81HewMg.mjs} +1 -1
- package/dist/_chunks/{LocalazyStatusColumn-Bf1ntoc7.js → LocalazyStatusColumn-Dt96YcGQ.js} +1 -1
- package/dist/_chunks/{isEqual-BazjlHGf.mjs → RequireLocalazyAuth-CDuyGCrT.mjs} +22 -1
- package/dist/_chunks/{isEqual-CrlZhAtq.js → RequireLocalazyAuth-CWBWETzC.js} +50 -29
- package/dist/_chunks/{entry-exclusion-service-BlyFqyBY.mjs → entry-exclusion-service-BVPICve2.mjs} +1 -1
- package/dist/_chunks/{entry-exclusion-service-bm-lp4za.js → entry-exclusion-service-CGV6iOkB.js} +2 -2
- package/dist/_chunks/{has-model-changed-B5SSh8XW.js → has-model-changed-DVYRxVhM.js} +31 -31
- package/dist/_chunks/{has-model-changed-DIHY9LBA.mjs → has-model-changed-DZL36gWh.mjs} +2 -2
- package/dist/_chunks/index-CCxXsn7Z.js +254 -0
- package/dist/_chunks/{index-DOCSzcPH.mjs → index-CgI_aKe_.mjs} +6 -6
- package/dist/_chunks/index-DsrYI6aB.mjs +231 -0
- package/dist/_chunks/{index-C15Goe6p.mjs → strapi-api-base-BE8VMlaA.js} +7 -350
- package/dist/_chunks/{index-Q3-srfXc.js → strapi-api-base-DjeKGUw7.mjs} +15 -380
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/src/components/RequireLocalazyAuth.d.ts +6 -0
- package/dist/admin/src/pages/LocalazyApp.d.ts +2 -0
- package/dist/admin/src/pages/LocalazyContentTransferSetup.d.ts +2 -0
- package/dist/admin/src/pages/LocalazyGlobalSettings.d.ts +2 -0
- package/dist/server/index.js +1 -1
- package/dist/server/index.mjs +1 -1
- package/package.json +1 -1
|
@@ -1,11 +1,47 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const
|
|
2
|
+
const strapiApiBase = require("./strapi-api-base-BE8VMlaA.js");
|
|
3
|
+
const React = require("react");
|
|
4
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
5
|
+
const emptyIdentity = {
|
|
6
|
+
accessToken: "",
|
|
7
|
+
project: {
|
|
8
|
+
id: "",
|
|
9
|
+
image: "",
|
|
10
|
+
name: "",
|
|
11
|
+
url: ""
|
|
12
|
+
},
|
|
13
|
+
scope: "",
|
|
14
|
+
user: {
|
|
15
|
+
id: "",
|
|
16
|
+
name: ""
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
const LocalazyIdentityContextType = React.createContext(void 0);
|
|
20
|
+
const LocalazyIdentityProvider = ({ children }) => {
|
|
21
|
+
const [identity, setIdentity] = React.useState(emptyIdentity);
|
|
22
|
+
const [isFetchingIdentity, setIsFetchingIdentity] = React.useState(true);
|
|
23
|
+
const isLoggedIn = React.useMemo(() => !!identity.accessToken, [identity.accessToken]);
|
|
24
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
25
|
+
LocalazyIdentityContextType.Provider,
|
|
26
|
+
{
|
|
27
|
+
value: { identity, setIdentity, isLoggedIn, isFetchingIdentity, setIsFetchingIdentity },
|
|
28
|
+
children
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
const useLocalazyIdentity = () => {
|
|
33
|
+
const context = React.useContext(LocalazyIdentityContextType);
|
|
34
|
+
if (context === void 0) {
|
|
35
|
+
throw new Error("useLocalazyIdentity must be used within a LocalazyIdentityProvider");
|
|
36
|
+
}
|
|
37
|
+
return context;
|
|
38
|
+
};
|
|
39
|
+
const BASE_PATH$1 = "/plugin-settings";
|
|
40
|
+
const axiosInstance = strapiApiBase.createStrapiApiAxiosInstance();
|
|
5
41
|
class PluginSettingsService {
|
|
6
42
|
static async getContentTransferSetup() {
|
|
7
43
|
try {
|
|
8
|
-
const result = await axiosInstance.get(`${BASE_PATH}/content-transfer-setup`);
|
|
44
|
+
const result = await axiosInstance.get(`${BASE_PATH$1}/content-transfer-setup`);
|
|
9
45
|
return result.data;
|
|
10
46
|
} catch (e) {
|
|
11
47
|
throw e;
|
|
@@ -13,7 +49,7 @@ class PluginSettingsService {
|
|
|
13
49
|
}
|
|
14
50
|
static async updateContentTransferSetup(data) {
|
|
15
51
|
try {
|
|
16
|
-
const result = await axiosInstance.put(`${BASE_PATH}/content-transfer-setup`, data);
|
|
52
|
+
const result = await axiosInstance.put(`${BASE_PATH$1}/content-transfer-setup`, data);
|
|
17
53
|
return result.data;
|
|
18
54
|
} catch (e) {
|
|
19
55
|
throw e;
|
|
@@ -21,7 +57,7 @@ class PluginSettingsService {
|
|
|
21
57
|
}
|
|
22
58
|
static async getPluginSettings() {
|
|
23
59
|
try {
|
|
24
|
-
const result = await axiosInstance.get(`${BASE_PATH}/plugin-settings`);
|
|
60
|
+
const result = await axiosInstance.get(`${BASE_PATH$1}/plugin-settings`);
|
|
25
61
|
return result.data;
|
|
26
62
|
} catch (e) {
|
|
27
63
|
throw e;
|
|
@@ -29,7 +65,35 @@ class PluginSettingsService {
|
|
|
29
65
|
}
|
|
30
66
|
static async updatePluginSettings(data) {
|
|
31
67
|
try {
|
|
32
|
-
const result = await axiosInstance.put(`${BASE_PATH}/plugin-settings`, data);
|
|
68
|
+
const result = await axiosInstance.put(`${BASE_PATH$1}/plugin-settings`, data);
|
|
69
|
+
return result.data;
|
|
70
|
+
} catch (e) {
|
|
71
|
+
throw e;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
const BASE_PATH = "/user";
|
|
76
|
+
const strapiApiInstance = strapiApiBase.createStrapiApiAxiosInstance();
|
|
77
|
+
class LocalazyUserService {
|
|
78
|
+
static async getIdentity() {
|
|
79
|
+
try {
|
|
80
|
+
const result = await strapiApiInstance.get(`${BASE_PATH}`);
|
|
81
|
+
return result.data;
|
|
82
|
+
} catch (e) {
|
|
83
|
+
throw e;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
static async updateIdentity(localazyIdentity) {
|
|
87
|
+
try {
|
|
88
|
+
const result = await strapiApiInstance.put(`${BASE_PATH}`, localazyIdentity);
|
|
89
|
+
return result.data;
|
|
90
|
+
} catch (e) {
|
|
91
|
+
throw e;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
static async deleteIdentity() {
|
|
95
|
+
try {
|
|
96
|
+
const result = await strapiApiInstance.delete(`${BASE_PATH}`);
|
|
33
97
|
return result.data;
|
|
34
98
|
} catch (e) {
|
|
35
99
|
throw e;
|
|
@@ -185,10 +249,10 @@ function hashSet(key, value) {
|
|
|
185
249
|
return this;
|
|
186
250
|
}
|
|
187
251
|
function Hash(entries) {
|
|
188
|
-
var
|
|
252
|
+
var index = -1, length = entries == null ? 0 : entries.length;
|
|
189
253
|
this.clear();
|
|
190
|
-
while (++
|
|
191
|
-
var entry = entries[
|
|
254
|
+
while (++index < length) {
|
|
255
|
+
var entry = entries[index];
|
|
192
256
|
this.set(entry[0], entry[1]);
|
|
193
257
|
}
|
|
194
258
|
}
|
|
@@ -216,41 +280,41 @@ function assocIndexOf(array, key) {
|
|
|
216
280
|
var arrayProto = Array.prototype;
|
|
217
281
|
var splice = arrayProto.splice;
|
|
218
282
|
function listCacheDelete(key) {
|
|
219
|
-
var data = this.__data__,
|
|
220
|
-
if (
|
|
283
|
+
var data = this.__data__, index = assocIndexOf(data, key);
|
|
284
|
+
if (index < 0) {
|
|
221
285
|
return false;
|
|
222
286
|
}
|
|
223
287
|
var lastIndex = data.length - 1;
|
|
224
|
-
if (
|
|
288
|
+
if (index == lastIndex) {
|
|
225
289
|
data.pop();
|
|
226
290
|
} else {
|
|
227
|
-
splice.call(data,
|
|
291
|
+
splice.call(data, index, 1);
|
|
228
292
|
}
|
|
229
293
|
--this.size;
|
|
230
294
|
return true;
|
|
231
295
|
}
|
|
232
296
|
function listCacheGet(key) {
|
|
233
|
-
var data = this.__data__,
|
|
234
|
-
return
|
|
297
|
+
var data = this.__data__, index = assocIndexOf(data, key);
|
|
298
|
+
return index < 0 ? void 0 : data[index][1];
|
|
235
299
|
}
|
|
236
300
|
function listCacheHas(key) {
|
|
237
301
|
return assocIndexOf(this.__data__, key) > -1;
|
|
238
302
|
}
|
|
239
303
|
function listCacheSet(key, value) {
|
|
240
|
-
var data = this.__data__,
|
|
241
|
-
if (
|
|
304
|
+
var data = this.__data__, index = assocIndexOf(data, key);
|
|
305
|
+
if (index < 0) {
|
|
242
306
|
++this.size;
|
|
243
307
|
data.push([key, value]);
|
|
244
308
|
} else {
|
|
245
|
-
data[
|
|
309
|
+
data[index][1] = value;
|
|
246
310
|
}
|
|
247
311
|
return this;
|
|
248
312
|
}
|
|
249
313
|
function ListCache(entries) {
|
|
250
|
-
var
|
|
314
|
+
var index = -1, length = entries == null ? 0 : entries.length;
|
|
251
315
|
this.clear();
|
|
252
|
-
while (++
|
|
253
|
-
var entry = entries[
|
|
316
|
+
while (++index < length) {
|
|
317
|
+
var entry = entries[index];
|
|
254
318
|
this.set(entry[0], entry[1]);
|
|
255
319
|
}
|
|
256
320
|
}
|
|
@@ -294,10 +358,10 @@ function mapCacheSet(key, value) {
|
|
|
294
358
|
return this;
|
|
295
359
|
}
|
|
296
360
|
function MapCache(entries) {
|
|
297
|
-
var
|
|
361
|
+
var index = -1, length = entries == null ? 0 : entries.length;
|
|
298
362
|
this.clear();
|
|
299
|
-
while (++
|
|
300
|
-
var entry = entries[
|
|
363
|
+
while (++index < length) {
|
|
364
|
+
var entry = entries[index];
|
|
301
365
|
this.set(entry[0], entry[1]);
|
|
302
366
|
}
|
|
303
367
|
}
|
|
@@ -348,9 +412,9 @@ var stringToPath = memoizeCapped(function(string) {
|
|
|
348
412
|
return result;
|
|
349
413
|
});
|
|
350
414
|
function arrayMap(array, iteratee) {
|
|
351
|
-
var
|
|
352
|
-
while (++
|
|
353
|
-
result[
|
|
415
|
+
var index = -1, length = array == null ? 0 : array.length, result = Array(length);
|
|
416
|
+
while (++index < length) {
|
|
417
|
+
result[index] = iteratee(array[index], index, array);
|
|
354
418
|
}
|
|
355
419
|
return result;
|
|
356
420
|
}
|
|
@@ -393,10 +457,10 @@ function setCacheHas(value) {
|
|
|
393
457
|
return this.__data__.has(value);
|
|
394
458
|
}
|
|
395
459
|
function SetCache(values) {
|
|
396
|
-
var
|
|
460
|
+
var index = -1, length = values == null ? 0 : values.length;
|
|
397
461
|
this.__data__ = new MapCache();
|
|
398
|
-
while (++
|
|
399
|
-
this.add(values[
|
|
462
|
+
while (++index < length) {
|
|
463
|
+
this.add(values[index]);
|
|
400
464
|
}
|
|
401
465
|
}
|
|
402
466
|
SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
|
|
@@ -406,9 +470,9 @@ function cacheHas(cache, key) {
|
|
|
406
470
|
}
|
|
407
471
|
var Set = getNative(root, "Set");
|
|
408
472
|
function setToArray(set2) {
|
|
409
|
-
var
|
|
473
|
+
var index = -1, result = Array(set2.size);
|
|
410
474
|
set2.forEach(function(value) {
|
|
411
|
-
result[++
|
|
475
|
+
result[++index] = value;
|
|
412
476
|
});
|
|
413
477
|
return result;
|
|
414
478
|
}
|
|
@@ -453,9 +517,9 @@ Stack.prototype.get = stackGet;
|
|
|
453
517
|
Stack.prototype.has = stackHas;
|
|
454
518
|
Stack.prototype.set = stackSet;
|
|
455
519
|
function arrayEach(array, iteratee) {
|
|
456
|
-
var
|
|
457
|
-
while (++
|
|
458
|
-
if (iteratee(array[
|
|
520
|
+
var index = -1, length = array == null ? 0 : array.length;
|
|
521
|
+
while (++index < length) {
|
|
522
|
+
if (iteratee(array[index], index, array) === false) {
|
|
459
523
|
break;
|
|
460
524
|
}
|
|
461
525
|
}
|
|
@@ -490,9 +554,9 @@ function assignValue(object, key, value) {
|
|
|
490
554
|
}
|
|
491
555
|
}
|
|
492
556
|
function baseTimes(n, iteratee) {
|
|
493
|
-
var
|
|
494
|
-
while (++
|
|
495
|
-
result[
|
|
557
|
+
var index = -1, result = Array(n);
|
|
558
|
+
while (++index < n) {
|
|
559
|
+
result[index] = iteratee(index);
|
|
496
560
|
}
|
|
497
561
|
return result;
|
|
498
562
|
}
|
|
@@ -614,10 +678,10 @@ function cloneBuffer(buffer, isDeep) {
|
|
|
614
678
|
}
|
|
615
679
|
}
|
|
616
680
|
function arrayFilter(array, predicate) {
|
|
617
|
-
var
|
|
618
|
-
while (++
|
|
619
|
-
var value = array[
|
|
620
|
-
if (predicate(value,
|
|
681
|
+
var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
|
|
682
|
+
while (++index < length) {
|
|
683
|
+
var value = array[index];
|
|
684
|
+
if (predicate(value, index, array)) {
|
|
621
685
|
result[resIndex++] = value;
|
|
622
686
|
}
|
|
623
687
|
}
|
|
@@ -639,9 +703,9 @@ var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
|
|
|
639
703
|
});
|
|
640
704
|
};
|
|
641
705
|
function arrayPush(array, values) {
|
|
642
|
-
var
|
|
643
|
-
while (++
|
|
644
|
-
array[offset +
|
|
706
|
+
var index = -1, length = values.length, offset = array.length;
|
|
707
|
+
while (++index < length) {
|
|
708
|
+
array[offset + index] = values[index];
|
|
645
709
|
}
|
|
646
710
|
return array;
|
|
647
711
|
}
|
|
@@ -846,17 +910,17 @@ function baseSet(object, path, value, customizer) {
|
|
|
846
910
|
return object;
|
|
847
911
|
}
|
|
848
912
|
path = castPath(path, object);
|
|
849
|
-
var
|
|
850
|
-
while (nested != null && ++
|
|
851
|
-
var key = toKey(path[
|
|
913
|
+
var index = -1, length = path.length, lastIndex = length - 1, nested = object;
|
|
914
|
+
while (nested != null && ++index < length) {
|
|
915
|
+
var key = toKey(path[index]), newValue = value;
|
|
852
916
|
if (key === "__proto__" || key === "constructor" || key === "prototype") {
|
|
853
917
|
return object;
|
|
854
918
|
}
|
|
855
|
-
if (
|
|
919
|
+
if (index != lastIndex) {
|
|
856
920
|
var objValue = nested[key];
|
|
857
921
|
newValue = void 0;
|
|
858
922
|
if (newValue === void 0) {
|
|
859
|
-
newValue = isObject(objValue) ? objValue : isIndex(path[
|
|
923
|
+
newValue = isObject(objValue) ? objValue : isIndex(path[index + 1]) ? [] : {};
|
|
860
924
|
}
|
|
861
925
|
}
|
|
862
926
|
assignValue(nested, key, newValue);
|
|
@@ -867,6 +931,30 @@ function baseSet(object, path, value, customizer) {
|
|
|
867
931
|
function set(object, path, value) {
|
|
868
932
|
return object == null ? object : baseSet(object, path, value);
|
|
869
933
|
}
|
|
934
|
+
const FetchIdentity = () => {
|
|
935
|
+
const { setIdentity, setIsFetchingIdentity } = useLocalazyIdentity();
|
|
936
|
+
React.useEffect(() => {
|
|
937
|
+
const fetchIdentity = async () => {
|
|
938
|
+
try {
|
|
939
|
+
setIsFetchingIdentity(true);
|
|
940
|
+
const fetchedIdentity = await LocalazyUserService.getIdentity();
|
|
941
|
+
setIdentity(fetchedIdentity || emptyIdentity);
|
|
942
|
+
} catch (error) {
|
|
943
|
+
if (error?.status !== 401 && error?.response?.status !== 401) {
|
|
944
|
+
console.error("Error fetching identity:", error);
|
|
945
|
+
}
|
|
946
|
+
setIdentity(emptyIdentity);
|
|
947
|
+
} finally {
|
|
948
|
+
setIsFetchingIdentity(false);
|
|
949
|
+
}
|
|
950
|
+
};
|
|
951
|
+
fetchIdentity();
|
|
952
|
+
}, [setIdentity, setIsFetchingIdentity]);
|
|
953
|
+
return null;
|
|
954
|
+
};
|
|
955
|
+
exports.FetchIdentity = FetchIdentity;
|
|
956
|
+
exports.LocalazyIdentityProvider = LocalazyIdentityProvider;
|
|
957
|
+
exports.LocalazyUserService = LocalazyUserService;
|
|
870
958
|
exports.PluginSettingsService = PluginSettingsService;
|
|
871
959
|
exports.Set = Set;
|
|
872
960
|
exports.SetCache = SetCache;
|
|
@@ -877,6 +965,7 @@ exports.arrayEach = arrayEach;
|
|
|
877
965
|
exports.cacheHas = cacheHas;
|
|
878
966
|
exports.castPath = castPath;
|
|
879
967
|
exports.cloneDeep = cloneDeep;
|
|
968
|
+
exports.emptyIdentity = emptyIdentity;
|
|
880
969
|
exports.eq = eq;
|
|
881
970
|
exports.getAllKeys = getAllKeys;
|
|
882
971
|
exports.isArray = isArray;
|
|
@@ -889,3 +978,4 @@ exports.keys = keys;
|
|
|
889
978
|
exports.set = set;
|
|
890
979
|
exports.setToArray = setToArray;
|
|
891
980
|
exports.toKey = toKey;
|
|
981
|
+
exports.useLocalazyIdentity = useLocalazyIdentity;
|
|
@@ -1,10 +1,46 @@
|
|
|
1
|
-
import { c as createStrapiApiAxiosInstance } from "./
|
|
2
|
-
|
|
1
|
+
import { c as createStrapiApiAxiosInstance } from "./strapi-api-base-DjeKGUw7.mjs";
|
|
2
|
+
import { useState, useMemo, createContext, useContext, useEffect } from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
const emptyIdentity = {
|
|
5
|
+
accessToken: "",
|
|
6
|
+
project: {
|
|
7
|
+
id: "",
|
|
8
|
+
image: "",
|
|
9
|
+
name: "",
|
|
10
|
+
url: ""
|
|
11
|
+
},
|
|
12
|
+
scope: "",
|
|
13
|
+
user: {
|
|
14
|
+
id: "",
|
|
15
|
+
name: ""
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
const LocalazyIdentityContextType = createContext(void 0);
|
|
19
|
+
const LocalazyIdentityProvider = ({ children }) => {
|
|
20
|
+
const [identity, setIdentity] = useState(emptyIdentity);
|
|
21
|
+
const [isFetchingIdentity, setIsFetchingIdentity] = useState(true);
|
|
22
|
+
const isLoggedIn = useMemo(() => !!identity.accessToken, [identity.accessToken]);
|
|
23
|
+
return /* @__PURE__ */ jsx(
|
|
24
|
+
LocalazyIdentityContextType.Provider,
|
|
25
|
+
{
|
|
26
|
+
value: { identity, setIdentity, isLoggedIn, isFetchingIdentity, setIsFetchingIdentity },
|
|
27
|
+
children
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
};
|
|
31
|
+
const useLocalazyIdentity = () => {
|
|
32
|
+
const context = useContext(LocalazyIdentityContextType);
|
|
33
|
+
if (context === void 0) {
|
|
34
|
+
throw new Error("useLocalazyIdentity must be used within a LocalazyIdentityProvider");
|
|
35
|
+
}
|
|
36
|
+
return context;
|
|
37
|
+
};
|
|
38
|
+
const BASE_PATH$1 = "/plugin-settings";
|
|
3
39
|
const axiosInstance = createStrapiApiAxiosInstance();
|
|
4
40
|
class PluginSettingsService {
|
|
5
41
|
static async getContentTransferSetup() {
|
|
6
42
|
try {
|
|
7
|
-
const result = await axiosInstance.get(`${BASE_PATH}/content-transfer-setup`);
|
|
43
|
+
const result = await axiosInstance.get(`${BASE_PATH$1}/content-transfer-setup`);
|
|
8
44
|
return result.data;
|
|
9
45
|
} catch (e) {
|
|
10
46
|
throw e;
|
|
@@ -12,7 +48,7 @@ class PluginSettingsService {
|
|
|
12
48
|
}
|
|
13
49
|
static async updateContentTransferSetup(data) {
|
|
14
50
|
try {
|
|
15
|
-
const result = await axiosInstance.put(`${BASE_PATH}/content-transfer-setup`, data);
|
|
51
|
+
const result = await axiosInstance.put(`${BASE_PATH$1}/content-transfer-setup`, data);
|
|
16
52
|
return result.data;
|
|
17
53
|
} catch (e) {
|
|
18
54
|
throw e;
|
|
@@ -20,7 +56,7 @@ class PluginSettingsService {
|
|
|
20
56
|
}
|
|
21
57
|
static async getPluginSettings() {
|
|
22
58
|
try {
|
|
23
|
-
const result = await axiosInstance.get(`${BASE_PATH}/plugin-settings`);
|
|
59
|
+
const result = await axiosInstance.get(`${BASE_PATH$1}/plugin-settings`);
|
|
24
60
|
return result.data;
|
|
25
61
|
} catch (e) {
|
|
26
62
|
throw e;
|
|
@@ -28,7 +64,35 @@ class PluginSettingsService {
|
|
|
28
64
|
}
|
|
29
65
|
static async updatePluginSettings(data) {
|
|
30
66
|
try {
|
|
31
|
-
const result = await axiosInstance.put(`${BASE_PATH}/plugin-settings`, data);
|
|
67
|
+
const result = await axiosInstance.put(`${BASE_PATH$1}/plugin-settings`, data);
|
|
68
|
+
return result.data;
|
|
69
|
+
} catch (e) {
|
|
70
|
+
throw e;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
const BASE_PATH = "/user";
|
|
75
|
+
const strapiApiInstance = createStrapiApiAxiosInstance();
|
|
76
|
+
class LocalazyUserService {
|
|
77
|
+
static async getIdentity() {
|
|
78
|
+
try {
|
|
79
|
+
const result = await strapiApiInstance.get(`${BASE_PATH}`);
|
|
80
|
+
return result.data;
|
|
81
|
+
} catch (e) {
|
|
82
|
+
throw e;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
static async updateIdentity(localazyIdentity) {
|
|
86
|
+
try {
|
|
87
|
+
const result = await strapiApiInstance.put(`${BASE_PATH}`, localazyIdentity);
|
|
88
|
+
return result.data;
|
|
89
|
+
} catch (e) {
|
|
90
|
+
throw e;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
static async deleteIdentity() {
|
|
94
|
+
try {
|
|
95
|
+
const result = await strapiApiInstance.delete(`${BASE_PATH}`);
|
|
32
96
|
return result.data;
|
|
33
97
|
} catch (e) {
|
|
34
98
|
throw e;
|
|
@@ -866,7 +930,30 @@ function baseSet(object, path, value, customizer) {
|
|
|
866
930
|
function set(object, path, value) {
|
|
867
931
|
return object == null ? object : baseSet(object, path, value);
|
|
868
932
|
}
|
|
933
|
+
const FetchIdentity = () => {
|
|
934
|
+
const { setIdentity, setIsFetchingIdentity } = useLocalazyIdentity();
|
|
935
|
+
useEffect(() => {
|
|
936
|
+
const fetchIdentity = async () => {
|
|
937
|
+
try {
|
|
938
|
+
setIsFetchingIdentity(true);
|
|
939
|
+
const fetchedIdentity = await LocalazyUserService.getIdentity();
|
|
940
|
+
setIdentity(fetchedIdentity || emptyIdentity);
|
|
941
|
+
} catch (error) {
|
|
942
|
+
if (error?.status !== 401 && error?.response?.status !== 401) {
|
|
943
|
+
console.error("Error fetching identity:", error);
|
|
944
|
+
}
|
|
945
|
+
setIdentity(emptyIdentity);
|
|
946
|
+
} finally {
|
|
947
|
+
setIsFetchingIdentity(false);
|
|
948
|
+
}
|
|
949
|
+
};
|
|
950
|
+
fetchIdentity();
|
|
951
|
+
}, [setIdentity, setIsFetchingIdentity]);
|
|
952
|
+
return null;
|
|
953
|
+
};
|
|
869
954
|
export {
|
|
955
|
+
FetchIdentity as F,
|
|
956
|
+
LocalazyIdentityProvider as L,
|
|
870
957
|
PluginSettingsService as P,
|
|
871
958
|
SetCache as S,
|
|
872
959
|
Uint8Array as U,
|
|
@@ -889,5 +976,8 @@ export {
|
|
|
889
976
|
castPath as q,
|
|
890
977
|
Set as r,
|
|
891
978
|
set as s,
|
|
892
|
-
toKey as t
|
|
979
|
+
toKey as t,
|
|
980
|
+
useLocalazyIdentity as u,
|
|
981
|
+
LocalazyUserService as v,
|
|
982
|
+
emptyIdentity as w
|
|
893
983
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { c as createStrapiApiAxiosInstance } from "./
|
|
1
|
+
import { c as createStrapiApiAxiosInstance } from "./strapi-api-base-DjeKGUw7.mjs";
|
|
2
2
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
3
|
import { useState, useEffect } from "react";
|
|
4
|
-
import { c as cloneDeep } from "./
|
|
5
|
-
import {
|
|
4
|
+
import { c as cloneDeep } from "./FetchIdentity-BWSQAXt-.mjs";
|
|
5
|
+
import { F as Field, M as MultiSelect, b as MultiSelectOption } from "./index-CgI_aKe_.mjs";
|
|
6
6
|
import { u as useTranslation } from "./useTranslation-CZQ4lU1m.mjs";
|
|
7
7
|
const strapiApiInstance = createStrapiApiAxiosInstance();
|
|
8
8
|
class ProjectService {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const
|
|
2
|
+
const strapiApiBase = require("./strapi-api-base-BE8VMlaA.js");
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const React = require("react");
|
|
5
|
-
const
|
|
6
|
-
const index
|
|
5
|
+
const FetchIdentity = require("./FetchIdentity-4kkW9N7Y.js");
|
|
6
|
+
const index = require("./index-CaY3BYnQ.js");
|
|
7
7
|
const useTranslation = require("./useTranslation-BdIl-aLe.js");
|
|
8
|
-
const strapiApiInstance =
|
|
8
|
+
const strapiApiInstance = strapiApiBase.createStrapiApiAxiosInstance();
|
|
9
9
|
class ProjectService {
|
|
10
10
|
static async getConnectedProject() {
|
|
11
11
|
try {
|
|
@@ -21,16 +21,16 @@ const LanguagesSelector = (props) => {
|
|
|
21
21
|
const [selectedLanguages, setSelectedLanguages] = React.useState([]);
|
|
22
22
|
const onChange = (values) => {
|
|
23
23
|
setSelectedLanguages(values);
|
|
24
|
-
props.onChange(
|
|
24
|
+
props.onChange(FetchIdentity.cloneDeep(values));
|
|
25
25
|
};
|
|
26
26
|
React.useEffect(() => {
|
|
27
27
|
const existingPreselectedLanguages = props.projectLanguages.filter((lang) => props.preselectedLanguages.includes(lang.code)).map((lang) => lang.code);
|
|
28
28
|
setSelectedLanguages(existingPreselectedLanguages);
|
|
29
29
|
}, [props.projectLanguages, props.preselectedLanguages]);
|
|
30
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(index
|
|
31
|
-
/* @__PURE__ */ jsxRuntime.jsx(index
|
|
30
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(index.Field.Root, { hint: props.hint || t("common.select_languages"), children: [
|
|
31
|
+
/* @__PURE__ */ jsxRuntime.jsx(index.Field.Label, { children: props.label || t("common.select_languages") }),
|
|
32
32
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
33
|
-
index
|
|
33
|
+
index.MultiSelect,
|
|
34
34
|
{
|
|
35
35
|
clearLabel: t("plugin_settings.clear"),
|
|
36
36
|
placeholder: props.placeholder || t("common.select_languages"),
|
|
@@ -39,10 +39,10 @@ const LanguagesSelector = (props) => {
|
|
|
39
39
|
onChange: (values) => onChange(values),
|
|
40
40
|
multi: true,
|
|
41
41
|
withTags: true,
|
|
42
|
-
children: props.projectLanguages.map((lang) => /* @__PURE__ */ jsxRuntime.jsx(index
|
|
42
|
+
children: props.projectLanguages.map((lang) => /* @__PURE__ */ jsxRuntime.jsx(index.MultiSelectOption, { value: lang.code, children: `${lang.name} (${lang.code})` }, lang.id))
|
|
43
43
|
}
|
|
44
44
|
),
|
|
45
|
-
/* @__PURE__ */ jsxRuntime.jsx(index
|
|
45
|
+
/* @__PURE__ */ jsxRuntime.jsx(index.Field.Hint, {})
|
|
46
46
|
] });
|
|
47
47
|
};
|
|
48
48
|
exports.LanguagesSelector = LanguagesSelector;
|