@intlayer/design-system 4.0.4 → 4.1.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 (137) hide show
  1. package/dist/.vite/manifest.json +10 -10
  2. package/dist/components/Auth/ExternalsLoginButtons/ExternalsLoginButtons.cjs +1 -1
  3. package/dist/components/Auth/ExternalsLoginButtons/ExternalsLoginButtons.mjs +1 -1
  4. package/dist/components/Button/Button.cjs +9 -9
  5. package/dist/components/Button/Button.cjs.map +1 -1
  6. package/dist/components/Button/Button.mjs +9 -9
  7. package/dist/components/Button/Button.mjs.map +1 -1
  8. package/dist/components/DictionaryEditor/DictionaryEditor.cjs +4 -3
  9. package/dist/components/DictionaryEditor/DictionaryEditor.cjs.map +1 -1
  10. package/dist/components/DictionaryEditor/DictionaryEditor.d.ts +1 -0
  11. package/dist/components/DictionaryEditor/DictionaryEditor.d.ts.map +1 -1
  12. package/dist/components/DictionaryEditor/DictionaryEditor.mjs +4 -3
  13. package/dist/components/DictionaryEditor/DictionaryEditor.mjs.map +1 -1
  14. package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.cjs +29 -11
  15. package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.cjs.map +1 -1
  16. package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.d.ts +1 -0
  17. package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.d.ts.map +1 -1
  18. package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.mjs +31 -13
  19. package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.mjs.map +1 -1
  20. package/dist/components/DictionaryEditor/validDictionaryChangeButtons.content.cjs +32 -0
  21. package/dist/components/DictionaryEditor/validDictionaryChangeButtons.content.cjs.map +1 -1
  22. package/dist/components/DictionaryEditor/validDictionaryChangeButtons.content.d.ts +4 -0
  23. package/dist/components/DictionaryEditor/validDictionaryChangeButtons.content.d.ts.map +1 -1
  24. package/dist/components/DictionaryEditor/validDictionaryChangeButtons.content.mjs +32 -0
  25. package/dist/components/DictionaryEditor/validDictionaryChangeButtons.content.mjs.map +1 -1
  26. package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.cjs +4 -2
  27. package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.cjs.map +1 -1
  28. package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.d.ts +1 -0
  29. package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.d.ts.map +1 -1
  30. package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.mjs +4 -2
  31. package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.mjs.map +1 -1
  32. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.cjs +1 -1
  33. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.mjs +1 -1
  34. package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.cjs +43 -14
  35. package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.cjs.map +1 -1
  36. package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.d.ts +1 -0
  37. package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.d.ts.map +1 -1
  38. package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs +46 -17
  39. package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs.map +1 -1
  40. package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.cjs +32 -0
  41. package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.cjs.map +1 -1
  42. package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.d.ts +4 -0
  43. package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.d.ts.map +1 -1
  44. package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.mjs +32 -0
  45. package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.mjs.map +1 -1
  46. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.cjs +5 -4
  47. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.cjs.map +1 -1
  48. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.d.ts +1 -0
  49. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.d.ts.map +1 -1
  50. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs +5 -4
  51. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs.map +1 -1
  52. package/dist/components/DictionaryFieldEditor/EditorView/EditorView.cjs +4 -1
  53. package/dist/components/DictionaryFieldEditor/EditorView/EditorView.cjs.map +1 -1
  54. package/dist/components/DictionaryFieldEditor/EditorView/EditorView.d.ts.map +1 -1
  55. package/dist/components/DictionaryFieldEditor/EditorView/EditorView.mjs +4 -1
  56. package/dist/components/DictionaryFieldEditor/EditorView/EditorView.mjs.map +1 -1
  57. package/dist/components/DictionaryFieldEditor/JSONEditor.cjs +1 -1
  58. package/dist/components/DictionaryFieldEditor/JSONEditor.cjs.map +1 -1
  59. package/dist/components/DictionaryFieldEditor/JSONEditor.mjs +1 -1
  60. package/dist/components/DictionaryFieldEditor/JSONEditor.mjs.map +1 -1
  61. package/dist/components/DictionaryFieldEditor/NodeEditor.cjs +1 -1
  62. package/dist/components/DictionaryFieldEditor/NodeEditor.cjs.map +1 -1
  63. package/dist/components/DictionaryFieldEditor/NodeEditor.mjs +1 -1
  64. package/dist/components/DictionaryFieldEditor/NodeEditor.mjs.map +1 -1
  65. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs +45 -18
  66. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs.map +1 -1
  67. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.d.ts +1 -0
  68. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.d.ts.map +1 -1
  69. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs +47 -20
  70. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs.map +1 -1
  71. package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.cjs +32 -0
  72. package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.cjs.map +1 -1
  73. package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.d.ts +4 -0
  74. package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.d.ts.map +1 -1
  75. package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.mjs +32 -0
  76. package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.mjs.map +1 -1
  77. package/dist/components/EditableField/EditableFieldLayout.cjs +1 -1
  78. package/dist/components/EditableField/EditableFieldLayout.cjs.map +1 -1
  79. package/dist/components/EditableField/EditableFieldLayout.mjs +1 -1
  80. package/dist/components/EditableField/EditableFieldLayout.mjs.map +1 -1
  81. package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.cjs +2 -2
  82. package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.cjs.map +1 -1
  83. package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.mjs +2 -2
  84. package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.mjs.map +1 -1
  85. package/dist/components/RightDrawer/RightDrawer.cjs +2 -2
  86. package/dist/components/RightDrawer/RightDrawer.cjs.map +1 -1
  87. package/dist/components/RightDrawer/RightDrawer.d.ts.map +1 -1
  88. package/dist/components/RightDrawer/RightDrawer.mjs +2 -2
  89. package/dist/components/RightDrawer/RightDrawer.mjs.map +1 -1
  90. package/dist/hooks/index.cjs +1 -0
  91. package/dist/hooks/index.cjs.map +1 -1
  92. package/dist/hooks/index.mjs +3 -2
  93. package/dist/hooks/intlayerAPIHooks.cjs +11 -1
  94. package/dist/hooks/intlayerAPIHooks.cjs.map +1 -1
  95. package/dist/hooks/intlayerAPIHooks.d.ts +4 -0
  96. package/dist/hooks/intlayerAPIHooks.d.ts.map +1 -1
  97. package/dist/hooks/intlayerAPIHooks.mjs +12 -2
  98. package/dist/hooks/intlayerAPIHooks.mjs.map +1 -1
  99. package/dist/hooks/useGetAllDictionaries.d.ts.map +1 -1
  100. package/dist/hooks/useIntlayerAPI.d.ts +4 -0
  101. package/dist/hooks/useIntlayerAPI.d.ts.map +1 -1
  102. package/dist/index-Ai6eeqZH.js +702 -0
  103. package/dist/index-Ai6eeqZH.js.map +1 -0
  104. package/dist/index-B1nU1-65.cjs +690 -0
  105. package/dist/index-B1nU1-65.cjs.map +1 -0
  106. package/dist/index-BIyA5LAs.js +691 -0
  107. package/dist/index-BIyA5LAs.js.map +1 -0
  108. package/dist/index-BbqOa6BU.cjs +701 -0
  109. package/dist/index-BbqOa6BU.cjs.map +1 -0
  110. package/dist/index-BqZwP4Lr.js +691 -0
  111. package/dist/index-BqZwP4Lr.js.map +1 -0
  112. package/dist/index-Buecpjbh.cjs +690 -0
  113. package/dist/index-Buecpjbh.cjs.map +1 -0
  114. package/dist/index-CDEJjmId.js +694 -0
  115. package/dist/index-CDEJjmId.js.map +1 -0
  116. package/dist/index-CTAyk6RY.cjs +693 -0
  117. package/dist/index-CTAyk6RY.cjs.map +1 -0
  118. package/dist/index-CVC2sfEj.js +693 -0
  119. package/dist/index-CVC2sfEj.js.map +1 -0
  120. package/dist/index-CVz0RdK6.js +691 -0
  121. package/dist/index-CVz0RdK6.js.map +1 -0
  122. package/dist/index-CjF2ksU7.cjs +693 -0
  123. package/dist/index-CjF2ksU7.cjs.map +1 -0
  124. package/dist/index-CuQs5759.cjs +692 -0
  125. package/dist/index-CuQs5759.cjs.map +1 -0
  126. package/dist/index-D_MDocy7.cjs +690 -0
  127. package/dist/index-D_MDocy7.cjs.map +1 -0
  128. package/dist/index-Djo2Jnua.cjs +693 -0
  129. package/dist/index-Djo2Jnua.cjs.map +1 -0
  130. package/dist/index-LFTthFne.js +694 -0
  131. package/dist/index-LFTthFne.js.map +1 -0
  132. package/dist/index-xZoGTokf.js +694 -0
  133. package/dist/index-xZoGTokf.js.map +1 -0
  134. package/dist/tailwind.config.cjs.map +1 -1
  135. package/dist/tailwind.config.mjs.map +1 -1
  136. package/dist/tailwind.css +1 -1
  137. package/package.json +18 -18
@@ -0,0 +1,691 @@
1
+ import { getConfiguration } from "@intlayer/config/client";
2
+ const fetcherOptions = {
3
+ method: "GET",
4
+ // Default HTTP method
5
+ headers: {
6
+ "Content-Type": "application/json"
7
+ // Default content type
8
+ },
9
+ credentials: "include"
10
+ // Include cookies in the request
11
+ };
12
+ const removeUndefined = (obj) => {
13
+ Object.keys(obj).forEach((key) => {
14
+ if (obj[key] === void 0) {
15
+ delete obj[key];
16
+ }
17
+ });
18
+ return obj;
19
+ };
20
+ const deepMerge = (objects) => objects.reduce((acc, obj) => {
21
+ const acc1 = acc ?? {};
22
+ const obj1 = removeUndefined(obj ?? {});
23
+ if (typeof acc1 === "object" && typeof obj1 === "object") {
24
+ return { ...acc1, ...obj1 };
25
+ }
26
+ return obj1 ?? acc1;
27
+ }, {});
28
+ const fetcher = async (url, ...options) => {
29
+ const { signal } = new AbortController();
30
+ let paramsString = "";
31
+ let bodyString = void 0;
32
+ const otherOptions = options.map(
33
+ ({ body, params: params2, headers, ...otherOptions2 }) => otherOptions2
34
+ );
35
+ const mergedOptions = deepMerge([fetcherOptions, ...otherOptions]);
36
+ const mergedHeaders = deepMerge([
37
+ fetcherOptions.headers,
38
+ ...options.map((option) => option.headers)
39
+ ]);
40
+ const params = deepMerge(options.map((option) => option.params));
41
+ const method = mergedOptions.method;
42
+ if (method !== "GET" && method !== "HEAD") {
43
+ const body = deepMerge(options.map((option) => option.body));
44
+ if (mergedHeaders?.["Content-Type"] === "application/x-www-form-urlencoded") {
45
+ bodyString = new URLSearchParams(
46
+ body
47
+ ).toString();
48
+ } else {
49
+ bodyString = JSON.stringify(body);
50
+ }
51
+ }
52
+ if (Object.entries(params).length > 0) {
53
+ paramsString = `?${new URLSearchParams(
54
+ params
55
+ ).toString()}`;
56
+ }
57
+ const formattedOptions = {
58
+ ...mergedOptions,
59
+ headers: mergedHeaders,
60
+ body: bodyString,
61
+ signal
62
+ };
63
+ const urlResult = `${url}${paramsString}`;
64
+ const response = await fetch(urlResult, formattedOptions);
65
+ if (!response.ok) {
66
+ const result = await response.json();
67
+ console.error(result);
68
+ throw new Error(JSON.stringify(result.error) ?? "An error occurred");
69
+ }
70
+ return await response.json();
71
+ };
72
+ const getAiAPI = (authAPIOptions = {}, intlayerConfig) => {
73
+ const { backendURL } = getConfiguration().editor;
74
+ const AI_API_ROUTE = `${backendURL}/api/ai`;
75
+ const auditContentDeclaration = async (body, otherOptions = {}) => await fetcher(
76
+ `${AI_API_ROUTE}/audit/content-declaration`,
77
+ authAPIOptions,
78
+ otherOptions,
79
+ {
80
+ method: "POST",
81
+ body
82
+ }
83
+ );
84
+ const auditContentDeclarationField = async (body, otherOptions = {}) => await fetcher(
85
+ `${AI_API_ROUTE}/audit/content-declaration/field`,
86
+ authAPIOptions,
87
+ otherOptions,
88
+ {
89
+ method: "POST",
90
+ body
91
+ }
92
+ );
93
+ const auditContentDeclarationMetadata = async (body, otherOptions = {}) => await fetcher(
94
+ `${AI_API_ROUTE}/audit/content-declaration/metadata`,
95
+ authAPIOptions,
96
+ otherOptions,
97
+ {
98
+ method: "POST",
99
+ body
100
+ }
101
+ );
102
+ const auditTag = async (body, otherOptions = {}) => await fetcher(
103
+ `${AI_API_ROUTE}/audit/tag`,
104
+ authAPIOptions,
105
+ otherOptions,
106
+ {
107
+ method: "POST",
108
+ body
109
+ }
110
+ );
111
+ const askDocQuestion = async (body, otherOptions = {}) => await fetcher(
112
+ `${AI_API_ROUTE}/ask`,
113
+ authAPIOptions,
114
+ otherOptions,
115
+ {
116
+ method: "POST",
117
+ body
118
+ }
119
+ );
120
+ return {
121
+ auditContentDeclaration,
122
+ auditContentDeclarationField,
123
+ auditContentDeclarationMetadata,
124
+ auditTag,
125
+ askDocQuestion
126
+ };
127
+ };
128
+ getAiAPI();
129
+ const getAuthAPI = (authAPIOptions = {}, intlayerConfig) => {
130
+ const { backendURL, clientId, clientSecret } = getConfiguration().editor;
131
+ const AUTH_API_ROUTE = `${backendURL}/api/auth`;
132
+ const login = async (user, otherOptions = {}) => await fetcher(
133
+ `${AUTH_API_ROUTE}/login`,
134
+ authAPIOptions,
135
+ otherOptions,
136
+ {
137
+ method: "POST",
138
+ body: user
139
+ }
140
+ );
141
+ const getLoginWithGitHubURL = (params) => {
142
+ const searchParams = new URLSearchParams(params);
143
+ return `${AUTH_API_ROUTE}/login/github?${searchParams.toString()}`;
144
+ };
145
+ const getLoginWithGoogleURL = (params) => {
146
+ const searchParams = new URLSearchParams(params);
147
+ return `${AUTH_API_ROUTE}/login/google?${searchParams.toString()}`;
148
+ };
149
+ const register = async (user, query = {}, otherOptions = {}) => await fetcher(
150
+ `${AUTH_API_ROUTE}/register`,
151
+ authAPIOptions,
152
+ otherOptions,
153
+ {
154
+ method: "POST",
155
+ body: user,
156
+ params: query
157
+ }
158
+ );
159
+ const logout = async (otherOptions = {}) => await fetcher(
160
+ `${AUTH_API_ROUTE}/logout`,
161
+ authAPIOptions,
162
+ otherOptions,
163
+ {
164
+ method: "POST"
165
+ }
166
+ );
167
+ const askResetPassword = async (email, otherOptions = {}) => await fetcher(
168
+ `${AUTH_API_ROUTE}/password/reset`,
169
+ authAPIOptions,
170
+ otherOptions,
171
+ {
172
+ method: "POST",
173
+ body: { email }
174
+ }
175
+ );
176
+ const resetPassword = async (params, otherOptions = {}) => await fetcher(
177
+ `${AUTH_API_ROUTE}/password/reset`,
178
+ authAPIOptions,
179
+ otherOptions,
180
+ { params, method: "POST" }
181
+ );
182
+ const changePassword = async (data, otherOptions = {}) => await fetcher(
183
+ `${AUTH_API_ROUTE}/password`,
184
+ authAPIOptions,
185
+ otherOptions,
186
+ {
187
+ method: "PUT",
188
+ body: data
189
+ }
190
+ );
191
+ const checkIfUserHasPassword = async (otherOptions = {}) => await fetcher(
192
+ `${AUTH_API_ROUTE}/password/has`,
193
+ authAPIOptions,
194
+ otherOptions,
195
+ {
196
+ method: "GET"
197
+ }
198
+ );
199
+ const verifyEmail = async ({ userId, secret }, otherOptions = {}) => await fetcher(
200
+ `${AUTH_API_ROUTE}/active/${userId}/${secret}`,
201
+ authAPIOptions,
202
+ otherOptions,
203
+ {
204
+ method: "PUT"
205
+ }
206
+ );
207
+ const getVerifyEmailStatusURL = (userId) => `${AUTH_API_ROUTE}/verify-email-status/${String(userId)}`;
208
+ const createSession = async (data, otherOptions = {}) => await fetcher(
209
+ `${AUTH_API_ROUTE}/session`,
210
+ authAPIOptions,
211
+ otherOptions,
212
+ {
213
+ method: "POST",
214
+ body: data
215
+ }
216
+ );
217
+ const getSession = async (sessionToken, otherOptions = {}) => await fetcher(
218
+ `${backendURL}/session`,
219
+ authAPIOptions,
220
+ otherOptions,
221
+ { params: { session_token: sessionToken } }
222
+ );
223
+ const getCSRFToken = async (otherOptions = {}) => await fetcher(
224
+ `${backendURL}/csrf-token`,
225
+ authAPIOptions,
226
+ otherOptions
227
+ );
228
+ const getOAuth2AccessToken = async (otherOptions = {}) => await fetcher(
229
+ `${backendURL}/oauth2/token`,
230
+ authAPIOptions,
231
+ otherOptions,
232
+ {
233
+ method: "POST",
234
+ headers: {
235
+ "Content-Type": "application/x-www-form-urlencoded"
236
+ },
237
+ body: {
238
+ grant_type: "client_credentials",
239
+ client_id: clientId,
240
+ client_secret: clientSecret
241
+ }
242
+ }
243
+ );
244
+ return {
245
+ login,
246
+ getLoginWithGitHubURL,
247
+ getLoginWithGoogleURL,
248
+ register,
249
+ logout,
250
+ resetPassword,
251
+ askResetPassword,
252
+ checkIfUserHasPassword,
253
+ verifyEmail,
254
+ getVerifyEmailStatusURL,
255
+ changePassword,
256
+ createSession,
257
+ getSession,
258
+ getCSRFToken,
259
+ getOAuth2AccessToken
260
+ };
261
+ };
262
+ getAuthAPI();
263
+ const getDictionaryAPI = (authAPIOptions = {}, intlayerConfig) => {
264
+ const { backendURL } = getConfiguration().editor;
265
+ const PROJECT_API_ROUTE = `${backendURL}/api/dictionary`;
266
+ const getDictionaries = async (filters, otherOptions = {}) => await fetcher(
267
+ PROJECT_API_ROUTE,
268
+ authAPIOptions,
269
+ otherOptions,
270
+ {
271
+ params: filters
272
+ }
273
+ );
274
+ const getDictionariesKeys = async (otherOptions = {}) => await fetcher(
275
+ `${PROJECT_API_ROUTE}/keys`,
276
+ authAPIOptions,
277
+ otherOptions
278
+ );
279
+ const getDictionary = async (dictionaryKey, version, otherOptions = {}) => await fetcher(
280
+ `${PROJECT_API_ROUTE}/${dictionaryKey}`,
281
+ authAPIOptions,
282
+ otherOptions,
283
+ {
284
+ params: version ? { version: version.toString() } : void 0
285
+ }
286
+ );
287
+ const addDictionary = async (dictionary, otherOptions = {}) => await fetcher(
288
+ `${PROJECT_API_ROUTE}`,
289
+ authAPIOptions,
290
+ otherOptions,
291
+ {
292
+ method: "POST",
293
+ body: dictionary
294
+ }
295
+ );
296
+ const pushDictionaries = async (dictionaries, otherOptions = {}) => await fetcher(
297
+ `${PROJECT_API_ROUTE}`,
298
+ authAPIOptions,
299
+ otherOptions,
300
+ {
301
+ method: "PATCH",
302
+ body: { dictionaries }
303
+ }
304
+ );
305
+ const updateDictionary = async (dictionaryId, dictionary, otherOptions = {}) => await fetcher(
306
+ `${PROJECT_API_ROUTE}/${dictionaryId}`,
307
+ authAPIOptions,
308
+ otherOptions,
309
+ {
310
+ method: "PUT",
311
+ body: dictionary
312
+ }
313
+ );
314
+ const deleteDictionary = async (id, otherOptions = {}) => await fetcher(
315
+ `${PROJECT_API_ROUTE}`,
316
+ authAPIOptions,
317
+ otherOptions,
318
+ {
319
+ method: "DELETE",
320
+ body: { id }
321
+ }
322
+ );
323
+ return {
324
+ getDictionaries,
325
+ getDictionariesKeys,
326
+ getDictionary,
327
+ pushDictionaries,
328
+ addDictionary,
329
+ updateDictionary,
330
+ deleteDictionary
331
+ };
332
+ };
333
+ getDictionaryAPI();
334
+ const getEditorAPI = (authAPIOptions = {}, intlayerConfig) => {
335
+ const { editorURL } = getConfiguration().editor;
336
+ const PROJECT_API_ROUTE = `${editorURL}/api/dictionary`;
337
+ const writeDictionary = async (dictionary, otherOptions = {}) => await fetcher(
338
+ `${PROJECT_API_ROUTE}`,
339
+ authAPIOptions,
340
+ otherOptions,
341
+ {
342
+ method: "POST",
343
+ body: dictionary
344
+ }
345
+ );
346
+ return {
347
+ writeDictionary
348
+ };
349
+ };
350
+ getEditorAPI();
351
+ const getOrganizationAPI = (authAPIOptions = {}, intlayerConfig) => {
352
+ const { backendURL } = getConfiguration().editor;
353
+ const ORGANIZATION_API_ROUTE = `${backendURL}/api/organization`;
354
+ const getOrganizations = async (filters, otherOptions = {}) => await fetcher(
355
+ ORGANIZATION_API_ROUTE,
356
+ authAPIOptions,
357
+ otherOptions,
358
+ {
359
+ params: filters
360
+ }
361
+ );
362
+ const getOrganization = async (organizationId, otherOptions = {}) => await fetcher(
363
+ `${ORGANIZATION_API_ROUTE}/${String(organizationId)}`,
364
+ authAPIOptions,
365
+ otherOptions
366
+ );
367
+ const addOrganization = async (organization, otherOptions = {}) => await fetcher(
368
+ ORGANIZATION_API_ROUTE,
369
+ authAPIOptions,
370
+ otherOptions,
371
+ {
372
+ method: "POST",
373
+ body: organization
374
+ }
375
+ );
376
+ const updateOrganization = async (organization, otherOptions = {}) => fetcher(
377
+ ORGANIZATION_API_ROUTE,
378
+ authAPIOptions,
379
+ otherOptions,
380
+ {
381
+ method: "PUT",
382
+ body: organization
383
+ }
384
+ );
385
+ const updateOrganizationMembers = async (body, otherOptions = {}) => fetcher(
386
+ `${ORGANIZATION_API_ROUTE}/members`,
387
+ authAPIOptions,
388
+ otherOptions,
389
+ {
390
+ method: "PUT",
391
+ body
392
+ }
393
+ );
394
+ const addOrganizationMember = async (body, otherOptions = {}) => fetcher(
395
+ `${ORGANIZATION_API_ROUTE}/member`,
396
+ authAPIOptions,
397
+ otherOptions,
398
+ {
399
+ method: "POST",
400
+ body
401
+ }
402
+ );
403
+ const deleteOrganization = async (otherOptions = {}) => await fetcher(
404
+ ORGANIZATION_API_ROUTE,
405
+ authAPIOptions,
406
+ otherOptions,
407
+ {
408
+ method: "DELETE"
409
+ }
410
+ );
411
+ const selectOrganization = async (organizationId, otherOptions = {}) => await fetcher(
412
+ `${ORGANIZATION_API_ROUTE}/${String(organizationId)}`,
413
+ authAPIOptions,
414
+ otherOptions,
415
+ {
416
+ method: "PUT"
417
+ }
418
+ );
419
+ const unselectOrganization = async (otherOptions = {}) => await fetcher(
420
+ `${ORGANIZATION_API_ROUTE}/logout`,
421
+ authAPIOptions,
422
+ otherOptions,
423
+ {
424
+ method: "POST"
425
+ }
426
+ );
427
+ return {
428
+ getOrganizations,
429
+ getOrganization,
430
+ addOrganization,
431
+ addOrganizationMember,
432
+ updateOrganization,
433
+ updateOrganizationMembers,
434
+ deleteOrganization,
435
+ selectOrganization,
436
+ unselectOrganization
437
+ };
438
+ };
439
+ getOrganizationAPI();
440
+ const getProjectAPI = (authAPIOptions = {}, intlayerConfig) => {
441
+ const { backendURL } = getConfiguration().editor;
442
+ const PROJECT_API_ROUTE = `${backendURL}/api/project`;
443
+ const getProjects = async (filters, otherOptions = {}) => await fetcher(
444
+ PROJECT_API_ROUTE,
445
+ authAPIOptions,
446
+ otherOptions,
447
+ {
448
+ params: filters
449
+ }
450
+ );
451
+ const addProject = async (project, otherOptions = {}) => await fetcher(
452
+ `${PROJECT_API_ROUTE}`,
453
+ authAPIOptions,
454
+ otherOptions,
455
+ {
456
+ method: "POST",
457
+ body: project
458
+ }
459
+ );
460
+ const updateProject = async (project, otherOptions = {}) => await fetcher(
461
+ `${PROJECT_API_ROUTE}`,
462
+ authAPIOptions,
463
+ otherOptions,
464
+ {
465
+ method: "PUT",
466
+ body: project
467
+ }
468
+ );
469
+ const updateProjectMembers = async (body, otherOptions = {}) => await fetcher(
470
+ `${PROJECT_API_ROUTE}/members`,
471
+ authAPIOptions,
472
+ otherOptions,
473
+ {
474
+ method: "PUT",
475
+ body
476
+ }
477
+ );
478
+ const deleteProject = async (otherOptions = {}) => await fetcher(
479
+ `${PROJECT_API_ROUTE}`,
480
+ authAPIOptions,
481
+ otherOptions,
482
+ {
483
+ method: "DELETE"
484
+ }
485
+ );
486
+ const selectProject = async (projectId, otherOptions = {}) => await fetcher(
487
+ `${PROJECT_API_ROUTE}/${String(projectId)}`,
488
+ authAPIOptions,
489
+ otherOptions,
490
+ {
491
+ method: "PUT"
492
+ }
493
+ );
494
+ const unselectProject = async (otherOptions = {}) => await fetcher(
495
+ `${PROJECT_API_ROUTE}/logout`,
496
+ authAPIOptions,
497
+ otherOptions,
498
+ {
499
+ method: "POST"
500
+ }
501
+ );
502
+ const addNewAccessKey = async (accessKey, otherOptions = {}) => await fetcher(
503
+ `${PROJECT_API_ROUTE}/access_key`,
504
+ authAPIOptions,
505
+ otherOptions,
506
+ {
507
+ method: "POST",
508
+ body: accessKey
509
+ }
510
+ );
511
+ const deleteAccessKey = async (clientId, otherOptions = {}) => await fetcher(
512
+ `${PROJECT_API_ROUTE}/access_key`,
513
+ authAPIOptions,
514
+ otherOptions,
515
+ {
516
+ method: "DELETE",
517
+ body: { clientId }
518
+ }
519
+ );
520
+ const refreshAccessKey = async (clientId, otherOptions = {}) => await fetcher(
521
+ `${PROJECT_API_ROUTE}/access_key`,
522
+ authAPIOptions,
523
+ otherOptions,
524
+ {
525
+ method: "PATCH",
526
+ body: { clientId }
527
+ }
528
+ );
529
+ return {
530
+ getProjects,
531
+ addProject,
532
+ updateProject,
533
+ updateProjectMembers,
534
+ deleteProject,
535
+ selectProject,
536
+ unselectProject,
537
+ addNewAccessKey,
538
+ deleteAccessKey,
539
+ refreshAccessKey
540
+ };
541
+ };
542
+ getProjectAPI();
543
+ const getStripeAPI = (authAPIOptions = {}, intlayerConfig) => {
544
+ const backendURL = getConfiguration().editor.backendURL;
545
+ const STRIPE_API_ROUTE = `${backendURL}/api/stripe`;
546
+ const getSubscription = async (body, otherOptions = {}) => await fetcher(
547
+ `${STRIPE_API_ROUTE}/create-subscription`,
548
+ authAPIOptions,
549
+ otherOptions,
550
+ {
551
+ method: "POST",
552
+ body
553
+ }
554
+ );
555
+ const cancelSubscription = async (otherOptions = {}) => await fetcher(
556
+ `${STRIPE_API_ROUTE}/cancel-subscription`,
557
+ authAPIOptions,
558
+ otherOptions,
559
+ {
560
+ method: "POST"
561
+ }
562
+ );
563
+ return {
564
+ getSubscription,
565
+ cancelSubscription
566
+ };
567
+ };
568
+ const getTagAPI = (authAPIOptions = {}, intlayerConfig) => {
569
+ const { backendURL } = getConfiguration().editor;
570
+ const PROJECT_API_ROUTE = `${backendURL}/api/tag`;
571
+ const getTags = async (filters, otherOptions = {}) => await fetcher(
572
+ PROJECT_API_ROUTE,
573
+ authAPIOptions,
574
+ otherOptions,
575
+ {
576
+ params: filters
577
+ }
578
+ );
579
+ const addTag = async (tag, otherOptions = {}) => await fetcher(
580
+ `${PROJECT_API_ROUTE}`,
581
+ authAPIOptions,
582
+ otherOptions,
583
+ {
584
+ method: "POST",
585
+ body: tag
586
+ }
587
+ );
588
+ const updateTag = async (tagId, tag, otherOptions = {}) => await fetcher(
589
+ `${PROJECT_API_ROUTE}/${tagId}`,
590
+ authAPIOptions,
591
+ otherOptions,
592
+ {
593
+ method: "PUT",
594
+ body: tag
595
+ }
596
+ );
597
+ const deleteTag = async (tagId, otherOptions = {}) => await fetcher(
598
+ `${PROJECT_API_ROUTE}/${tagId}`,
599
+ authAPIOptions,
600
+ otherOptions,
601
+ {
602
+ method: "DELETE"
603
+ }
604
+ );
605
+ return {
606
+ getTags,
607
+ addTag,
608
+ updateTag,
609
+ deleteTag
610
+ };
611
+ };
612
+ getTagAPI();
613
+ const getUserAPI = (authAPIOptions = {}, intlayerConfig) => {
614
+ const { backendURL } = getConfiguration().editor;
615
+ const USER_API_ROUTE = `${backendURL}/api/user`;
616
+ const getUsers = async (filters, otherOptions = {}) => await fetcher(
617
+ USER_API_ROUTE,
618
+ authAPIOptions,
619
+ otherOptions,
620
+ {
621
+ params: filters
622
+ }
623
+ );
624
+ const getUserById = async (userId, otherOptions = {}) => await fetcher(
625
+ `${USER_API_ROUTE}/${userId}`,
626
+ authAPIOptions,
627
+ otherOptions
628
+ );
629
+ const getUserByEmail = async (email, otherOptions = {}) => await fetcher(
630
+ `${USER_API_ROUTE}/email/${email}`,
631
+ authAPIOptions,
632
+ otherOptions
633
+ );
634
+ const getUserByAccount = async (providerAccountId, provider, otherOptions = {}) => await fetcher(
635
+ `${USER_API_ROUTE}/account/${provider}/${providerAccountId}`,
636
+ authAPIOptions,
637
+ otherOptions
638
+ );
639
+ const createUser = async (user, otherOptions = {}) => await fetcher(
640
+ `${USER_API_ROUTE}/`,
641
+ authAPIOptions,
642
+ otherOptions,
643
+ {
644
+ method: "POST",
645
+ body: user
646
+ }
647
+ );
648
+ const updateUser = async (user, otherOptions = {}) => await fetcher(
649
+ `${USER_API_ROUTE}`,
650
+ authAPIOptions,
651
+ otherOptions,
652
+ {
653
+ method: "PUT",
654
+ body: user
655
+ }
656
+ );
657
+ const deleteUser = async (userId, otherOptions = {}) => await fetcher(
658
+ `${USER_API_ROUTE}/${userId}`,
659
+ authAPIOptions,
660
+ otherOptions,
661
+ {
662
+ method: "DELETE"
663
+ }
664
+ );
665
+ return {
666
+ createUser,
667
+ getUsers,
668
+ getUserById,
669
+ getUserByAccount,
670
+ getUserByEmail,
671
+ updateUser,
672
+ deleteUser
673
+ };
674
+ };
675
+ getUserAPI();
676
+ const getIntlayerAPI = (authAPIOptions = {}, intlayerConfig) => ({
677
+ organization: getOrganizationAPI(authAPIOptions),
678
+ project: getProjectAPI(authAPIOptions),
679
+ user: getUserAPI(authAPIOptions),
680
+ auth: getAuthAPI(authAPIOptions),
681
+ dictionary: getDictionaryAPI(authAPIOptions),
682
+ stripe: getStripeAPI(authAPIOptions),
683
+ ai: getAiAPI(authAPIOptions),
684
+ tag: getTagAPI(authAPIOptions),
685
+ editor: getEditorAPI(authAPIOptions)
686
+ });
687
+ const intlayerAPI = getIntlayerAPI();
688
+ export {
689
+ intlayerAPI as i
690
+ };
691
+ //# sourceMappingURL=index-BIyA5LAs.js.map