@nubitio/core 1.1.1 → 1.2.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/dist/index.cjs +62 -6
- package/dist/index.d.cts +32 -36
- package/dist/index.d.mts +32 -36
- package/dist/index.mjs +60 -6
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -16,7 +16,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
}
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
20
20
|
value: mod,
|
|
21
21
|
enumerable: true
|
|
22
22
|
}) : target, mod));
|
|
@@ -169,7 +169,7 @@ var DateUtils = class {
|
|
|
169
169
|
const dateStart = new Date(startDate);
|
|
170
170
|
const dateEnd = new Date(endDate);
|
|
171
171
|
const timeDiff = Math.abs(dateEnd.getTime() - dateStart.getTime());
|
|
172
|
-
return Math.ceil(timeDiff /
|
|
172
|
+
return Math.ceil(timeDiff / 864e5);
|
|
173
173
|
}
|
|
174
174
|
static monthDiff(startDate, endDate) {
|
|
175
175
|
const dateStart = new Date(startDate);
|
|
@@ -411,8 +411,9 @@ const createCrudEvents = (prefix) => ({
|
|
|
411
411
|
*/
|
|
412
412
|
function createScopedEventBus(resourceId) {
|
|
413
413
|
const scopeId = Math.random().toString(36).slice(2, 10);
|
|
414
|
+
const prefix = `${resourceId}:${scopeId}`;
|
|
414
415
|
return {
|
|
415
|
-
...createCrudEvents(
|
|
416
|
+
...createCrudEvents(prefix),
|
|
416
417
|
_scopeId: scopeId
|
|
417
418
|
};
|
|
418
419
|
}
|
|
@@ -457,6 +458,11 @@ const coreTranslationsEs = {
|
|
|
457
458
|
"form.loading": "Cargando...",
|
|
458
459
|
"form.groupOther": "Otros",
|
|
459
460
|
"grid.noRecords": "No hay registros para mostrar",
|
|
461
|
+
"grid.noMatchingRecords": "No hay resultados para estos filtros",
|
|
462
|
+
"grid.noMatchingRecordsDescription": "Prueba con otra búsqueda o limpia los filtros para ver los registros disponibles.",
|
|
463
|
+
"grid.retry": "Reintentar",
|
|
464
|
+
"grid.recordNotFoundTitle": "No se encontró el registro",
|
|
465
|
+
"grid.recordNotFoundDescription": "Puede que se haya eliminado o que el enlace ya no esté disponible.",
|
|
460
466
|
"grid.accessDeniedTitle": "Acceso denegado",
|
|
461
467
|
"grid.accessDeniedDescription": "No tienes permiso para ver esta información.",
|
|
462
468
|
"grid.loadErrorTitle": "No se pudo cargar la información",
|
|
@@ -523,6 +529,7 @@ const coreTranslationsEs = {
|
|
|
523
529
|
"grid.filterTo": "Filtrar {{column}} hasta",
|
|
524
530
|
"grid.sortColumn": "Ordenar por {{column}}",
|
|
525
531
|
"grid.filters": "Filtros",
|
|
532
|
+
"grid.activeFilters": "Filtros activos",
|
|
526
533
|
"grid.sortBy": "Ordenar por",
|
|
527
534
|
"grid.sortNone": "Sin ordenar",
|
|
528
535
|
"grid.sortAscending": "Ascendente",
|
|
@@ -531,6 +538,9 @@ const coreTranslationsEs = {
|
|
|
531
538
|
"grid.done": "Listo",
|
|
532
539
|
"grid.searchPlaceholder": "Buscar por {{column}}",
|
|
533
540
|
"grid.showMore": "Ver más",
|
|
541
|
+
"grid.presentation": "Presentación",
|
|
542
|
+
"grid.tableView": "Tabla",
|
|
543
|
+
"grid.cardsView": "Tarjetas",
|
|
534
544
|
"grid.showLess": "Ver menos",
|
|
535
545
|
"grid.filterOperator.contains": "Contiene",
|
|
536
546
|
"grid.filterOperator.notcontains": "No contiene",
|
|
@@ -561,6 +571,7 @@ const coreTranslationsEs = {
|
|
|
561
571
|
"validation.defaultError": "Valor inválido",
|
|
562
572
|
"form.searchButton": "Buscar",
|
|
563
573
|
"form.actionButton": "Acción",
|
|
574
|
+
"form.actionError": "No se pudo completar la acción. Intenta nuevamente.",
|
|
564
575
|
"form.detailTitle": "Detalle",
|
|
565
576
|
"form.lookupClear": "Limpiar {{label}}",
|
|
566
577
|
"form.lookupOpen": "Abrir {{label}}",
|
|
@@ -586,6 +597,8 @@ const coreTranslationsEs = {
|
|
|
586
597
|
"form.fileUploadInvalidResponse": "La respuesta del servidor no incluye el identificador del archivo",
|
|
587
598
|
"form.imageUploadPrompt": "Arrastra una imagen o haz clic para seleccionar",
|
|
588
599
|
"form.imageUploadHint": "PNG, JPG, WEBP o GIF. Se sube automáticamente al seleccionar.",
|
|
600
|
+
"form.imageUploadEmpty": "Sin imagen",
|
|
601
|
+
"form.fileUploadEmpty": "Sin archivo",
|
|
589
602
|
"crudPage.confirmActionTitle": "Confirmar acción"
|
|
590
603
|
};
|
|
591
604
|
const coreTranslationsEn = {
|
|
@@ -627,6 +640,11 @@ const coreTranslationsEn = {
|
|
|
627
640
|
"form.loading": "Loading...",
|
|
628
641
|
"form.groupOther": "Other",
|
|
629
642
|
"grid.noRecords": "No records to display",
|
|
643
|
+
"grid.noMatchingRecords": "No results for these filters",
|
|
644
|
+
"grid.noMatchingRecordsDescription": "Try another search or clear the filters to see available records.",
|
|
645
|
+
"grid.retry": "Retry",
|
|
646
|
+
"grid.recordNotFoundTitle": "Record not found",
|
|
647
|
+
"grid.recordNotFoundDescription": "It may have been deleted or the link may no longer be available.",
|
|
630
648
|
"grid.accessDeniedTitle": "Access denied",
|
|
631
649
|
"grid.accessDeniedDescription": "You don't have permission to view this data.",
|
|
632
650
|
"grid.loadErrorTitle": "Couldn't load data",
|
|
@@ -693,6 +711,7 @@ const coreTranslationsEn = {
|
|
|
693
711
|
"grid.filterTo": "Filter {{column}} to",
|
|
694
712
|
"grid.sortColumn": "Sort by {{column}}",
|
|
695
713
|
"grid.filters": "Filters",
|
|
714
|
+
"grid.activeFilters": "Active filters",
|
|
696
715
|
"grid.sortBy": "Sort by",
|
|
697
716
|
"grid.sortNone": "Unsorted",
|
|
698
717
|
"grid.sortAscending": "Ascending",
|
|
@@ -701,6 +720,9 @@ const coreTranslationsEn = {
|
|
|
701
720
|
"grid.done": "Done",
|
|
702
721
|
"grid.searchPlaceholder": "Search by {{column}}",
|
|
703
722
|
"grid.showMore": "Show more",
|
|
723
|
+
"grid.presentation": "Presentation",
|
|
724
|
+
"grid.tableView": "Table",
|
|
725
|
+
"grid.cardsView": "Cards",
|
|
704
726
|
"grid.showLess": "Show less",
|
|
705
727
|
"grid.filterOperator.contains": "Contains",
|
|
706
728
|
"grid.filterOperator.notcontains": "Does not contain",
|
|
@@ -731,6 +753,7 @@ const coreTranslationsEn = {
|
|
|
731
753
|
"validation.defaultError": "Invalid value",
|
|
732
754
|
"form.searchButton": "Search",
|
|
733
755
|
"form.actionButton": "Action",
|
|
756
|
+
"form.actionError": "The action could not be completed. Try again.",
|
|
734
757
|
"form.detailTitle": "Detail",
|
|
735
758
|
"form.lookupClear": "Clear {{label}}",
|
|
736
759
|
"form.lookupOpen": "Open {{label}}",
|
|
@@ -756,6 +779,8 @@ const coreTranslationsEn = {
|
|
|
756
779
|
"form.fileUploadInvalidResponse": "Server response did not include the file identifier",
|
|
757
780
|
"form.imageUploadPrompt": "Drag an image here or click to browse",
|
|
758
781
|
"form.imageUploadHint": "PNG, JPG, WEBP or GIF. Uploads automatically on selection.",
|
|
782
|
+
"form.imageUploadEmpty": "No image",
|
|
783
|
+
"form.fileUploadEmpty": "No file",
|
|
759
784
|
"crudPage.confirmActionTitle": "Confirm action"
|
|
760
785
|
};
|
|
761
786
|
//#endregion
|
|
@@ -1026,7 +1051,7 @@ const DEFAULT_CORRELATION_ID_HEADER_NAME = "X-Request-Id";
|
|
|
1026
1051
|
* "safe methods don't need CSRF protection" rule (GET/HEAD never mutate
|
|
1027
1052
|
* state), so read requests never pay the cost of a token lookup.
|
|
1028
1053
|
*/
|
|
1029
|
-
const CSRF_PROTECTED_METHODS = new Set([
|
|
1054
|
+
const CSRF_PROTECTED_METHODS = /* @__PURE__ */ new Set([
|
|
1030
1055
|
"POST",
|
|
1031
1056
|
"PUT",
|
|
1032
1057
|
"PATCH",
|
|
@@ -1231,7 +1256,8 @@ function createCoreHttpClient(config) {
|
|
|
1231
1256
|
}
|
|
1232
1257
|
//#endregion
|
|
1233
1258
|
//#region packages/core/http/CoreHttpContext.tsx
|
|
1234
|
-
const
|
|
1259
|
+
const defaultHttpClient = createCoreHttpClient();
|
|
1260
|
+
const CoreHttpContext = (0, react.createContext)(defaultHttpClient);
|
|
1235
1261
|
function CoreHttpProvider({ children, client, config }) {
|
|
1236
1262
|
const value = (0, react.useMemo)(() => {
|
|
1237
1263
|
if (client) return client;
|
|
@@ -1249,6 +1275,33 @@ function useCoreHttpClient() {
|
|
|
1249
1275
|
return (0, react.useContext)(CoreHttpContext);
|
|
1250
1276
|
}
|
|
1251
1277
|
//#endregion
|
|
1278
|
+
//#region packages/core/http/csrf.ts
|
|
1279
|
+
/** Name of the cookie the Nubit backend sets for the double-submit CSRF policy. */
|
|
1280
|
+
const CSRF_COOKIE_NAME = "CSRF_TOKEN";
|
|
1281
|
+
/**
|
|
1282
|
+
* Reads the double-submit CSRF token from `document.cookie`.
|
|
1283
|
+
*
|
|
1284
|
+
* The backend sets the cookie readable by JavaScript on purpose: a cross-site
|
|
1285
|
+
* page can make the browser attach it but cannot read it, so it cannot echo it
|
|
1286
|
+
* back in the `X-CSRF-Token` header. Returns `undefined` outside a browser or
|
|
1287
|
+
* before login has issued the cookie.
|
|
1288
|
+
*/
|
|
1289
|
+
function readCsrfToken(cookieName = CSRF_COOKIE_NAME) {
|
|
1290
|
+
if (typeof document === "undefined") return void 0;
|
|
1291
|
+
for (const part of document.cookie.split(";")) {
|
|
1292
|
+
const separator = part.indexOf("=");
|
|
1293
|
+
if (separator === -1) continue;
|
|
1294
|
+
if (part.slice(0, separator).trim() !== cookieName) continue;
|
|
1295
|
+
const value = part.slice(separator + 1).trim();
|
|
1296
|
+
if (value === "") return void 0;
|
|
1297
|
+
try {
|
|
1298
|
+
return decodeURIComponent(value);
|
|
1299
|
+
} catch {
|
|
1300
|
+
return value;
|
|
1301
|
+
}
|
|
1302
|
+
}
|
|
1303
|
+
}
|
|
1304
|
+
//#endregion
|
|
1252
1305
|
//#region packages/core/runtime/CoreRuntimeContext.tsx
|
|
1253
1306
|
const defaultRuntime = {
|
|
1254
1307
|
notify: () => void 0,
|
|
@@ -1309,7 +1362,8 @@ var StaticFeatureFlagClient = class {
|
|
|
1309
1362
|
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : defaultValue;
|
|
1310
1363
|
}
|
|
1311
1364
|
};
|
|
1312
|
-
const
|
|
1365
|
+
const defaultClient = new StaticFeatureFlagClient();
|
|
1366
|
+
const FeatureFlagsContext = (0, react.createContext)(defaultClient);
|
|
1313
1367
|
function FeatureFlagsProvider({ children, client, flags = {}, context = {} }) {
|
|
1314
1368
|
const value = (0, react.useMemo)(() => client ?? new StaticFeatureFlagClient(flags, context), [
|
|
1315
1369
|
client,
|
|
@@ -1516,6 +1570,7 @@ function useMercureSubscription(apiUrl, onUpdate, enabled = true) {
|
|
|
1516
1570
|
]);
|
|
1517
1571
|
}
|
|
1518
1572
|
//#endregion
|
|
1573
|
+
exports.CSRF_COOKIE_NAME = CSRF_COOKIE_NAME;
|
|
1519
1574
|
exports.CoreConfigProvider = CoreConfigProvider;
|
|
1520
1575
|
exports.CoreHttpClient = CoreHttpClient;
|
|
1521
1576
|
exports.CoreHttpProvider = CoreHttpProvider;
|
|
@@ -1556,6 +1611,7 @@ exports.isMoneyValue = isMoneyValue;
|
|
|
1556
1611
|
exports.parseLinkHeader = parseLinkHeader;
|
|
1557
1612
|
exports.parseMoney = parseMoney;
|
|
1558
1613
|
exports.parseMoneyInput = parseMoneyInput;
|
|
1614
|
+
exports.readCsrfToken = readCsrfToken;
|
|
1559
1615
|
exports.resolveMercureTopicOrigin = resolveMercureTopicOrigin;
|
|
1560
1616
|
exports.sumMoney = sumMoney;
|
|
1561
1617
|
exports.toMinorUnits = toMinorUnits;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React, { ReactNode } from "react";
|
|
2
|
-
|
|
3
2
|
//#region packages/core/data/DataRecord.d.ts
|
|
4
3
|
type DataRecord = Record<string, unknown>;
|
|
5
4
|
//#endregion
|
|
@@ -163,15 +162,7 @@ interface CoreConfigProviderProps {
|
|
|
163
162
|
mercureTenantId?: number | string;
|
|
164
163
|
children: React.ReactNode;
|
|
165
164
|
}
|
|
166
|
-
declare const CoreConfigProvider: ({
|
|
167
|
-
locale,
|
|
168
|
-
timezone,
|
|
169
|
-
apiBaseUrl,
|
|
170
|
-
currency,
|
|
171
|
-
mercureTopicOrigin,
|
|
172
|
-
mercureTenantId,
|
|
173
|
-
children
|
|
174
|
-
}: CoreConfigProviderProps) => React.JSX.Element;
|
|
165
|
+
declare const CoreConfigProvider: ({ locale, timezone, apiBaseUrl, currency, mercureTopicOrigin, mercureTenantId, children }: CoreConfigProviderProps) => React.JSX.Element;
|
|
175
166
|
declare function useCoreConfig(): CoreConfig;
|
|
176
167
|
//#endregion
|
|
177
168
|
//#region packages/core/event/EventHook.d.ts
|
|
@@ -316,6 +307,11 @@ interface CoreTranslationKeys {
|
|
|
316
307
|
'form.loading': string;
|
|
317
308
|
'form.groupOther': string;
|
|
318
309
|
'grid.noRecords': string;
|
|
310
|
+
'grid.noMatchingRecords': string;
|
|
311
|
+
'grid.noMatchingRecordsDescription': string;
|
|
312
|
+
'grid.retry': string;
|
|
313
|
+
'grid.recordNotFoundTitle': string;
|
|
314
|
+
'grid.recordNotFoundDescription': string;
|
|
319
315
|
'grid.accessDeniedTitle': string;
|
|
320
316
|
'grid.accessDeniedDescription': string;
|
|
321
317
|
'grid.loadErrorTitle': string;
|
|
@@ -353,6 +349,7 @@ interface CoreTranslationKeys {
|
|
|
353
349
|
'grid.filterTo': string;
|
|
354
350
|
'grid.sortColumn': string;
|
|
355
351
|
'grid.filters': string;
|
|
352
|
+
'grid.activeFilters': string;
|
|
356
353
|
'grid.sortBy': string;
|
|
357
354
|
'grid.sortNone': string;
|
|
358
355
|
'grid.sortAscending': string;
|
|
@@ -362,6 +359,9 @@ interface CoreTranslationKeys {
|
|
|
362
359
|
'grid.searchPlaceholder': string;
|
|
363
360
|
'grid.showMore': string;
|
|
364
361
|
'grid.showLess': string;
|
|
362
|
+
'grid.presentation': string;
|
|
363
|
+
'grid.tableView': string;
|
|
364
|
+
'grid.cardsView': string;
|
|
365
365
|
'grid.filterOperator.contains': string;
|
|
366
366
|
'grid.filterOperator.notcontains': string;
|
|
367
367
|
'grid.filterOperator.startswith': string;
|
|
@@ -391,6 +391,7 @@ interface CoreTranslationKeys {
|
|
|
391
391
|
'validation.defaultError': string;
|
|
392
392
|
'form.searchButton': string;
|
|
393
393
|
'form.actionButton': string;
|
|
394
|
+
'form.actionError': string;
|
|
394
395
|
'form.detailTitle': string;
|
|
395
396
|
'form.lookupClear': string;
|
|
396
397
|
'form.lookupOpen': string;
|
|
@@ -416,6 +417,8 @@ interface CoreTranslationKeys {
|
|
|
416
417
|
'form.fileUploadInvalidResponse': string;
|
|
417
418
|
'form.imageUploadPrompt': string;
|
|
418
419
|
'form.imageUploadHint': string;
|
|
420
|
+
'form.imageUploadEmpty': string;
|
|
421
|
+
'form.fileUploadEmpty': string;
|
|
419
422
|
'crudPage.confirmActionTitle': string;
|
|
420
423
|
'document.print': string;
|
|
421
424
|
'document.reissue': string;
|
|
@@ -643,11 +646,7 @@ interface CoreHttpProviderProps {
|
|
|
643
646
|
client?: CoreHttpClient;
|
|
644
647
|
config?: CoreHttpClientConfig;
|
|
645
648
|
}
|
|
646
|
-
declare function CoreHttpProvider({
|
|
647
|
-
children,
|
|
648
|
-
client,
|
|
649
|
-
config
|
|
650
|
-
}: CoreHttpProviderProps): React.JSX.Element;
|
|
649
|
+
declare function CoreHttpProvider({ children, client, config }: CoreHttpProviderProps): React.JSX.Element;
|
|
651
650
|
declare function useCoreHttpClient(): CoreHttpClient;
|
|
652
651
|
//#endregion
|
|
653
652
|
//#region packages/core/http/correlationId.d.ts
|
|
@@ -667,6 +666,19 @@ declare function useCoreHttpClient(): CoreHttpClient;
|
|
|
667
666
|
*/
|
|
668
667
|
declare function generateCorrelationId(): string;
|
|
669
668
|
//#endregion
|
|
669
|
+
//#region packages/core/http/csrf.d.ts
|
|
670
|
+
/** Name of the cookie the Nubit backend sets for the double-submit CSRF policy. */
|
|
671
|
+
declare const CSRF_COOKIE_NAME = "CSRF_TOKEN";
|
|
672
|
+
/**
|
|
673
|
+
* Reads the double-submit CSRF token from `document.cookie`.
|
|
674
|
+
*
|
|
675
|
+
* The backend sets the cookie readable by JavaScript on purpose: a cross-site
|
|
676
|
+
* page can make the browser attach it but cannot read it, so it cannot echo it
|
|
677
|
+
* back in the `X-CSRF-Token` header. Returns `undefined` outside a browser or
|
|
678
|
+
* before login has issued the cookie.
|
|
679
|
+
*/
|
|
680
|
+
declare function readCsrfToken(cookieName?: string): string | undefined;
|
|
681
|
+
//#endregion
|
|
670
682
|
//#region packages/core/runtime/CoreRuntimeContext.d.ts
|
|
671
683
|
type CoreNotificationType = 'success' | 'error' | 'warning' | 'info';
|
|
672
684
|
interface CoreRuntime {
|
|
@@ -677,10 +689,7 @@ interface CoreRuntimeProviderProps {
|
|
|
677
689
|
children: React.ReactNode;
|
|
678
690
|
runtime?: Partial<CoreRuntime>;
|
|
679
691
|
}
|
|
680
|
-
declare function CoreRuntimeProvider({
|
|
681
|
-
children,
|
|
682
|
-
runtime
|
|
683
|
-
}: CoreRuntimeProviderProps): React.JSX.Element;
|
|
692
|
+
declare function CoreRuntimeProvider({ children, runtime }: CoreRuntimeProviderProps): React.JSX.Element;
|
|
684
693
|
declare function useCoreRuntime(): CoreRuntime;
|
|
685
694
|
//#endregion
|
|
686
695
|
//#region packages/core/provider/CoreProvider.d.ts
|
|
@@ -690,12 +699,7 @@ interface CoreProviderProps {
|
|
|
690
699
|
httpClient?: CoreHttpClient;
|
|
691
700
|
runtime?: Partial<CoreRuntime>;
|
|
692
701
|
}
|
|
693
|
-
declare function CoreProvider({
|
|
694
|
-
children,
|
|
695
|
-
http,
|
|
696
|
-
httpClient,
|
|
697
|
-
runtime
|
|
698
|
-
}: CoreProviderProps): React.JSX.Element;
|
|
702
|
+
declare function CoreProvider({ children, http, httpClient, runtime }: CoreProviderProps): React.JSX.Element;
|
|
699
703
|
//#endregion
|
|
700
704
|
//#region packages/core/featureFlags/FeatureFlags.d.ts
|
|
701
705
|
interface FeatureFlagEvaluationContext {
|
|
@@ -726,12 +730,7 @@ interface FeatureFlagsProviderProps {
|
|
|
726
730
|
flags?: FeatureFlagValues;
|
|
727
731
|
context?: FeatureFlagEvaluationContext;
|
|
728
732
|
}
|
|
729
|
-
declare function FeatureFlagsProvider({
|
|
730
|
-
children,
|
|
731
|
-
client,
|
|
732
|
-
flags,
|
|
733
|
-
context
|
|
734
|
-
}: FeatureFlagsProviderProps): React.JSX.Element;
|
|
733
|
+
declare function FeatureFlagsProvider({ children, client, flags, context }: FeatureFlagsProviderProps): React.JSX.Element;
|
|
735
734
|
declare function useFeatureFlags(): FeatureFlagClient;
|
|
736
735
|
declare function useBooleanFlag(key: string, defaultValue?: boolean): boolean;
|
|
737
736
|
declare function useStringFlag(key: string, defaultValue?: string): string;
|
|
@@ -751,10 +750,7 @@ interface MercureProviderProps {
|
|
|
751
750
|
* Provides the Mercure hub URL to the React tree and keeps `MercureManager`
|
|
752
751
|
* in sync whenever the URL changes.
|
|
753
752
|
*/
|
|
754
|
-
declare function MercureProvider({
|
|
755
|
-
hubUrl: hubUrlOverride,
|
|
756
|
-
children
|
|
757
|
-
}: MercureProviderProps): React.JSX.Element;
|
|
753
|
+
declare function MercureProvider({ hubUrl: hubUrlOverride, children }: MercureProviderProps): React.JSX.Element;
|
|
758
754
|
//#endregion
|
|
759
755
|
//#region packages/core/mercure/useMercureHub.d.ts
|
|
760
756
|
/**
|
|
@@ -929,4 +925,4 @@ declare class MercureManager {
|
|
|
929
925
|
/** Singleton instance — shared across the entire application. */
|
|
930
926
|
declare const mercureManager: MercureManager;
|
|
931
927
|
//#endregion
|
|
932
|
-
export { type CoreConfig, CoreConfigProvider, type CoreConfigProviderProps, CoreHttpClient, type CoreHttpClientConfig, type CoreHttpError, type CoreHttpErrorData, CoreHttpProvider, type CoreHttpProviderProps, type CoreHttpResponse, type CoreNotificationType, CoreProvider, type CoreProviderProps, type CoreRequestConfig, type CoreResponseType, type CoreRuntime, CoreRuntimeProvider, type CoreRuntimeProviderProps, type CoreTranslationKeys, DEFAULT_CORRELATION_ID_HEADER_NAME, DEFAULT_CSRF_HEADER_NAME, DEFAULT_TIMEZONE, type DataGridEventNames, type DataRecord, DateUtils, type DialogEventNames, type EventSubscription, type FeatureFlagClient, type FeatureFlagEvaluationContext, type FeatureFlagValues, FeatureFlagsProvider, type FeatureFlagsProviderProps, type FormEventNames, type FormatMoneyOptions, type GridData, mercureManager as MercureManager, type MercureManager as MercureManagerType, MercureProvider, type MercureProviderProps, type MoneyValue, type ScopedFormEventNames, StaticFeatureFlagClient, type ToolbarButtonItem, buildMercureCollectionTopic, configureCore, configureCoreDate, coreTranslationsEn, coreTranslationsEs, createCoreHttpClient, createCrudEvents, createScopedEventBus, discoverMercureFromResponse, dispatch, extractMercureHubUrl, extractTopicOriginFromPayload, formatMinorUnits, formatMoney, fromMinorUnits, generateCorrelationId, getCoreApiBaseUrl, getCoreCurrency, getCoreLocale, getCoreTimezone, getDiscoveredMercureTopicOrigin, getMercureTopicOrigin, initCoreI18n, isMoneyValue, parseLinkHeader, parseMoney, parseMoneyInput, resolveMercureTopicOrigin, sumMoney, toMinorUnits, useBooleanFlag, useCoreConfig, useCoreHttpClient, useCoreRuntime, useCoreTranslation, useDiscoveredMercureTopicOrigin, useEvents, useFeatureFlags, useMercureHub, useMercureSubscription, useNumberFlag, useObjectFlag, useStringFlag };
|
|
928
|
+
export { CSRF_COOKIE_NAME, type CoreConfig, CoreConfigProvider, type CoreConfigProviderProps, CoreHttpClient, type CoreHttpClientConfig, type CoreHttpError, type CoreHttpErrorData, CoreHttpProvider, type CoreHttpProviderProps, type CoreHttpResponse, type CoreNotificationType, CoreProvider, type CoreProviderProps, type CoreRequestConfig, type CoreResponseType, type CoreRuntime, CoreRuntimeProvider, type CoreRuntimeProviderProps, type CoreTranslationKeys, DEFAULT_CORRELATION_ID_HEADER_NAME, DEFAULT_CSRF_HEADER_NAME, DEFAULT_TIMEZONE, type DataGridEventNames, type DataRecord, DateUtils, type DialogEventNames, type EventSubscription, type FeatureFlagClient, type FeatureFlagEvaluationContext, type FeatureFlagValues, FeatureFlagsProvider, type FeatureFlagsProviderProps, type FormEventNames, type FormatMoneyOptions, type GridData, mercureManager as MercureManager, type MercureManager as MercureManagerType, MercureProvider, type MercureProviderProps, type MoneyValue, type ScopedFormEventNames, StaticFeatureFlagClient, type ToolbarButtonItem, buildMercureCollectionTopic, configureCore, configureCoreDate, coreTranslationsEn, coreTranslationsEs, createCoreHttpClient, createCrudEvents, createScopedEventBus, discoverMercureFromResponse, dispatch, extractMercureHubUrl, extractTopicOriginFromPayload, formatMinorUnits, formatMoney, fromMinorUnits, generateCorrelationId, getCoreApiBaseUrl, getCoreCurrency, getCoreLocale, getCoreTimezone, getDiscoveredMercureTopicOrigin, getMercureTopicOrigin, initCoreI18n, isMoneyValue, parseLinkHeader, parseMoney, parseMoneyInput, readCsrfToken, resolveMercureTopicOrigin, sumMoney, toMinorUnits, useBooleanFlag, useCoreConfig, useCoreHttpClient, useCoreRuntime, useCoreTranslation, useDiscoveredMercureTopicOrigin, useEvents, useFeatureFlags, useMercureHub, useMercureSubscription, useNumberFlag, useObjectFlag, useStringFlag };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React, { ReactNode } from "react";
|
|
2
|
-
|
|
3
2
|
//#region packages/core/data/DataRecord.d.ts
|
|
4
3
|
type DataRecord = Record<string, unknown>;
|
|
5
4
|
//#endregion
|
|
@@ -163,15 +162,7 @@ interface CoreConfigProviderProps {
|
|
|
163
162
|
mercureTenantId?: number | string;
|
|
164
163
|
children: React.ReactNode;
|
|
165
164
|
}
|
|
166
|
-
declare const CoreConfigProvider: ({
|
|
167
|
-
locale,
|
|
168
|
-
timezone,
|
|
169
|
-
apiBaseUrl,
|
|
170
|
-
currency,
|
|
171
|
-
mercureTopicOrigin,
|
|
172
|
-
mercureTenantId,
|
|
173
|
-
children
|
|
174
|
-
}: CoreConfigProviderProps) => React.JSX.Element;
|
|
165
|
+
declare const CoreConfigProvider: ({ locale, timezone, apiBaseUrl, currency, mercureTopicOrigin, mercureTenantId, children }: CoreConfigProviderProps) => React.JSX.Element;
|
|
175
166
|
declare function useCoreConfig(): CoreConfig;
|
|
176
167
|
//#endregion
|
|
177
168
|
//#region packages/core/event/EventHook.d.ts
|
|
@@ -316,6 +307,11 @@ interface CoreTranslationKeys {
|
|
|
316
307
|
'form.loading': string;
|
|
317
308
|
'form.groupOther': string;
|
|
318
309
|
'grid.noRecords': string;
|
|
310
|
+
'grid.noMatchingRecords': string;
|
|
311
|
+
'grid.noMatchingRecordsDescription': string;
|
|
312
|
+
'grid.retry': string;
|
|
313
|
+
'grid.recordNotFoundTitle': string;
|
|
314
|
+
'grid.recordNotFoundDescription': string;
|
|
319
315
|
'grid.accessDeniedTitle': string;
|
|
320
316
|
'grid.accessDeniedDescription': string;
|
|
321
317
|
'grid.loadErrorTitle': string;
|
|
@@ -353,6 +349,7 @@ interface CoreTranslationKeys {
|
|
|
353
349
|
'grid.filterTo': string;
|
|
354
350
|
'grid.sortColumn': string;
|
|
355
351
|
'grid.filters': string;
|
|
352
|
+
'grid.activeFilters': string;
|
|
356
353
|
'grid.sortBy': string;
|
|
357
354
|
'grid.sortNone': string;
|
|
358
355
|
'grid.sortAscending': string;
|
|
@@ -362,6 +359,9 @@ interface CoreTranslationKeys {
|
|
|
362
359
|
'grid.searchPlaceholder': string;
|
|
363
360
|
'grid.showMore': string;
|
|
364
361
|
'grid.showLess': string;
|
|
362
|
+
'grid.presentation': string;
|
|
363
|
+
'grid.tableView': string;
|
|
364
|
+
'grid.cardsView': string;
|
|
365
365
|
'grid.filterOperator.contains': string;
|
|
366
366
|
'grid.filterOperator.notcontains': string;
|
|
367
367
|
'grid.filterOperator.startswith': string;
|
|
@@ -391,6 +391,7 @@ interface CoreTranslationKeys {
|
|
|
391
391
|
'validation.defaultError': string;
|
|
392
392
|
'form.searchButton': string;
|
|
393
393
|
'form.actionButton': string;
|
|
394
|
+
'form.actionError': string;
|
|
394
395
|
'form.detailTitle': string;
|
|
395
396
|
'form.lookupClear': string;
|
|
396
397
|
'form.lookupOpen': string;
|
|
@@ -416,6 +417,8 @@ interface CoreTranslationKeys {
|
|
|
416
417
|
'form.fileUploadInvalidResponse': string;
|
|
417
418
|
'form.imageUploadPrompt': string;
|
|
418
419
|
'form.imageUploadHint': string;
|
|
420
|
+
'form.imageUploadEmpty': string;
|
|
421
|
+
'form.fileUploadEmpty': string;
|
|
419
422
|
'crudPage.confirmActionTitle': string;
|
|
420
423
|
'document.print': string;
|
|
421
424
|
'document.reissue': string;
|
|
@@ -643,11 +646,7 @@ interface CoreHttpProviderProps {
|
|
|
643
646
|
client?: CoreHttpClient;
|
|
644
647
|
config?: CoreHttpClientConfig;
|
|
645
648
|
}
|
|
646
|
-
declare function CoreHttpProvider({
|
|
647
|
-
children,
|
|
648
|
-
client,
|
|
649
|
-
config
|
|
650
|
-
}: CoreHttpProviderProps): React.JSX.Element;
|
|
649
|
+
declare function CoreHttpProvider({ children, client, config }: CoreHttpProviderProps): React.JSX.Element;
|
|
651
650
|
declare function useCoreHttpClient(): CoreHttpClient;
|
|
652
651
|
//#endregion
|
|
653
652
|
//#region packages/core/http/correlationId.d.ts
|
|
@@ -667,6 +666,19 @@ declare function useCoreHttpClient(): CoreHttpClient;
|
|
|
667
666
|
*/
|
|
668
667
|
declare function generateCorrelationId(): string;
|
|
669
668
|
//#endregion
|
|
669
|
+
//#region packages/core/http/csrf.d.ts
|
|
670
|
+
/** Name of the cookie the Nubit backend sets for the double-submit CSRF policy. */
|
|
671
|
+
declare const CSRF_COOKIE_NAME = "CSRF_TOKEN";
|
|
672
|
+
/**
|
|
673
|
+
* Reads the double-submit CSRF token from `document.cookie`.
|
|
674
|
+
*
|
|
675
|
+
* The backend sets the cookie readable by JavaScript on purpose: a cross-site
|
|
676
|
+
* page can make the browser attach it but cannot read it, so it cannot echo it
|
|
677
|
+
* back in the `X-CSRF-Token` header. Returns `undefined` outside a browser or
|
|
678
|
+
* before login has issued the cookie.
|
|
679
|
+
*/
|
|
680
|
+
declare function readCsrfToken(cookieName?: string): string | undefined;
|
|
681
|
+
//#endregion
|
|
670
682
|
//#region packages/core/runtime/CoreRuntimeContext.d.ts
|
|
671
683
|
type CoreNotificationType = 'success' | 'error' | 'warning' | 'info';
|
|
672
684
|
interface CoreRuntime {
|
|
@@ -677,10 +689,7 @@ interface CoreRuntimeProviderProps {
|
|
|
677
689
|
children: React.ReactNode;
|
|
678
690
|
runtime?: Partial<CoreRuntime>;
|
|
679
691
|
}
|
|
680
|
-
declare function CoreRuntimeProvider({
|
|
681
|
-
children,
|
|
682
|
-
runtime
|
|
683
|
-
}: CoreRuntimeProviderProps): React.JSX.Element;
|
|
692
|
+
declare function CoreRuntimeProvider({ children, runtime }: CoreRuntimeProviderProps): React.JSX.Element;
|
|
684
693
|
declare function useCoreRuntime(): CoreRuntime;
|
|
685
694
|
//#endregion
|
|
686
695
|
//#region packages/core/provider/CoreProvider.d.ts
|
|
@@ -690,12 +699,7 @@ interface CoreProviderProps {
|
|
|
690
699
|
httpClient?: CoreHttpClient;
|
|
691
700
|
runtime?: Partial<CoreRuntime>;
|
|
692
701
|
}
|
|
693
|
-
declare function CoreProvider({
|
|
694
|
-
children,
|
|
695
|
-
http,
|
|
696
|
-
httpClient,
|
|
697
|
-
runtime
|
|
698
|
-
}: CoreProviderProps): React.JSX.Element;
|
|
702
|
+
declare function CoreProvider({ children, http, httpClient, runtime }: CoreProviderProps): React.JSX.Element;
|
|
699
703
|
//#endregion
|
|
700
704
|
//#region packages/core/featureFlags/FeatureFlags.d.ts
|
|
701
705
|
interface FeatureFlagEvaluationContext {
|
|
@@ -726,12 +730,7 @@ interface FeatureFlagsProviderProps {
|
|
|
726
730
|
flags?: FeatureFlagValues;
|
|
727
731
|
context?: FeatureFlagEvaluationContext;
|
|
728
732
|
}
|
|
729
|
-
declare function FeatureFlagsProvider({
|
|
730
|
-
children,
|
|
731
|
-
client,
|
|
732
|
-
flags,
|
|
733
|
-
context
|
|
734
|
-
}: FeatureFlagsProviderProps): React.JSX.Element;
|
|
733
|
+
declare function FeatureFlagsProvider({ children, client, flags, context }: FeatureFlagsProviderProps): React.JSX.Element;
|
|
735
734
|
declare function useFeatureFlags(): FeatureFlagClient;
|
|
736
735
|
declare function useBooleanFlag(key: string, defaultValue?: boolean): boolean;
|
|
737
736
|
declare function useStringFlag(key: string, defaultValue?: string): string;
|
|
@@ -751,10 +750,7 @@ interface MercureProviderProps {
|
|
|
751
750
|
* Provides the Mercure hub URL to the React tree and keeps `MercureManager`
|
|
752
751
|
* in sync whenever the URL changes.
|
|
753
752
|
*/
|
|
754
|
-
declare function MercureProvider({
|
|
755
|
-
hubUrl: hubUrlOverride,
|
|
756
|
-
children
|
|
757
|
-
}: MercureProviderProps): React.JSX.Element;
|
|
753
|
+
declare function MercureProvider({ hubUrl: hubUrlOverride, children }: MercureProviderProps): React.JSX.Element;
|
|
758
754
|
//#endregion
|
|
759
755
|
//#region packages/core/mercure/useMercureHub.d.ts
|
|
760
756
|
/**
|
|
@@ -929,4 +925,4 @@ declare class MercureManager {
|
|
|
929
925
|
/** Singleton instance — shared across the entire application. */
|
|
930
926
|
declare const mercureManager: MercureManager;
|
|
931
927
|
//#endregion
|
|
932
|
-
export { type CoreConfig, CoreConfigProvider, type CoreConfigProviderProps, CoreHttpClient, type CoreHttpClientConfig, type CoreHttpError, type CoreHttpErrorData, CoreHttpProvider, type CoreHttpProviderProps, type CoreHttpResponse, type CoreNotificationType, CoreProvider, type CoreProviderProps, type CoreRequestConfig, type CoreResponseType, type CoreRuntime, CoreRuntimeProvider, type CoreRuntimeProviderProps, type CoreTranslationKeys, DEFAULT_CORRELATION_ID_HEADER_NAME, DEFAULT_CSRF_HEADER_NAME, DEFAULT_TIMEZONE, type DataGridEventNames, type DataRecord, DateUtils, type DialogEventNames, type EventSubscription, type FeatureFlagClient, type FeatureFlagEvaluationContext, type FeatureFlagValues, FeatureFlagsProvider, type FeatureFlagsProviderProps, type FormEventNames, type FormatMoneyOptions, type GridData, mercureManager as MercureManager, type MercureManager as MercureManagerType, MercureProvider, type MercureProviderProps, type MoneyValue, type ScopedFormEventNames, StaticFeatureFlagClient, type ToolbarButtonItem, buildMercureCollectionTopic, configureCore, configureCoreDate, coreTranslationsEn, coreTranslationsEs, createCoreHttpClient, createCrudEvents, createScopedEventBus, discoverMercureFromResponse, dispatch, extractMercureHubUrl, extractTopicOriginFromPayload, formatMinorUnits, formatMoney, fromMinorUnits, generateCorrelationId, getCoreApiBaseUrl, getCoreCurrency, getCoreLocale, getCoreTimezone, getDiscoveredMercureTopicOrigin, getMercureTopicOrigin, initCoreI18n, isMoneyValue, parseLinkHeader, parseMoney, parseMoneyInput, resolveMercureTopicOrigin, sumMoney, toMinorUnits, useBooleanFlag, useCoreConfig, useCoreHttpClient, useCoreRuntime, useCoreTranslation, useDiscoveredMercureTopicOrigin, useEvents, useFeatureFlags, useMercureHub, useMercureSubscription, useNumberFlag, useObjectFlag, useStringFlag };
|
|
928
|
+
export { CSRF_COOKIE_NAME, type CoreConfig, CoreConfigProvider, type CoreConfigProviderProps, CoreHttpClient, type CoreHttpClientConfig, type CoreHttpError, type CoreHttpErrorData, CoreHttpProvider, type CoreHttpProviderProps, type CoreHttpResponse, type CoreNotificationType, CoreProvider, type CoreProviderProps, type CoreRequestConfig, type CoreResponseType, type CoreRuntime, CoreRuntimeProvider, type CoreRuntimeProviderProps, type CoreTranslationKeys, DEFAULT_CORRELATION_ID_HEADER_NAME, DEFAULT_CSRF_HEADER_NAME, DEFAULT_TIMEZONE, type DataGridEventNames, type DataRecord, DateUtils, type DialogEventNames, type EventSubscription, type FeatureFlagClient, type FeatureFlagEvaluationContext, type FeatureFlagValues, FeatureFlagsProvider, type FeatureFlagsProviderProps, type FormEventNames, type FormatMoneyOptions, type GridData, mercureManager as MercureManager, type MercureManager as MercureManagerType, MercureProvider, type MercureProviderProps, type MoneyValue, type ScopedFormEventNames, StaticFeatureFlagClient, type ToolbarButtonItem, buildMercureCollectionTopic, configureCore, configureCoreDate, coreTranslationsEn, coreTranslationsEs, createCoreHttpClient, createCrudEvents, createScopedEventBus, discoverMercureFromResponse, dispatch, extractMercureHubUrl, extractTopicOriginFromPayload, formatMinorUnits, formatMoney, fromMinorUnits, generateCorrelationId, getCoreApiBaseUrl, getCoreCurrency, getCoreLocale, getCoreTimezone, getDiscoveredMercureTopicOrigin, getMercureTopicOrigin, initCoreI18n, isMoneyValue, parseLinkHeader, parseMoney, parseMoneyInput, readCsrfToken, resolveMercureTopicOrigin, sumMoney, toMinorUnits, useBooleanFlag, useCoreConfig, useCoreHttpClient, useCoreRuntime, useCoreTranslation, useDiscoveredMercureTopicOrigin, useEvents, useFeatureFlags, useMercureHub, useMercureSubscription, useNumberFlag, useObjectFlag, useStringFlag };
|
package/dist/index.mjs
CHANGED
|
@@ -144,7 +144,7 @@ var DateUtils = class {
|
|
|
144
144
|
const dateStart = new Date(startDate);
|
|
145
145
|
const dateEnd = new Date(endDate);
|
|
146
146
|
const timeDiff = Math.abs(dateEnd.getTime() - dateStart.getTime());
|
|
147
|
-
return Math.ceil(timeDiff /
|
|
147
|
+
return Math.ceil(timeDiff / 864e5);
|
|
148
148
|
}
|
|
149
149
|
static monthDiff(startDate, endDate) {
|
|
150
150
|
const dateStart = new Date(startDate);
|
|
@@ -386,8 +386,9 @@ const createCrudEvents = (prefix) => ({
|
|
|
386
386
|
*/
|
|
387
387
|
function createScopedEventBus(resourceId) {
|
|
388
388
|
const scopeId = Math.random().toString(36).slice(2, 10);
|
|
389
|
+
const prefix = `${resourceId}:${scopeId}`;
|
|
389
390
|
return {
|
|
390
|
-
...createCrudEvents(
|
|
391
|
+
...createCrudEvents(prefix),
|
|
391
392
|
_scopeId: scopeId
|
|
392
393
|
};
|
|
393
394
|
}
|
|
@@ -432,6 +433,11 @@ const coreTranslationsEs = {
|
|
|
432
433
|
"form.loading": "Cargando...",
|
|
433
434
|
"form.groupOther": "Otros",
|
|
434
435
|
"grid.noRecords": "No hay registros para mostrar",
|
|
436
|
+
"grid.noMatchingRecords": "No hay resultados para estos filtros",
|
|
437
|
+
"grid.noMatchingRecordsDescription": "Prueba con otra búsqueda o limpia los filtros para ver los registros disponibles.",
|
|
438
|
+
"grid.retry": "Reintentar",
|
|
439
|
+
"grid.recordNotFoundTitle": "No se encontró el registro",
|
|
440
|
+
"grid.recordNotFoundDescription": "Puede que se haya eliminado o que el enlace ya no esté disponible.",
|
|
435
441
|
"grid.accessDeniedTitle": "Acceso denegado",
|
|
436
442
|
"grid.accessDeniedDescription": "No tienes permiso para ver esta información.",
|
|
437
443
|
"grid.loadErrorTitle": "No se pudo cargar la información",
|
|
@@ -498,6 +504,7 @@ const coreTranslationsEs = {
|
|
|
498
504
|
"grid.filterTo": "Filtrar {{column}} hasta",
|
|
499
505
|
"grid.sortColumn": "Ordenar por {{column}}",
|
|
500
506
|
"grid.filters": "Filtros",
|
|
507
|
+
"grid.activeFilters": "Filtros activos",
|
|
501
508
|
"grid.sortBy": "Ordenar por",
|
|
502
509
|
"grid.sortNone": "Sin ordenar",
|
|
503
510
|
"grid.sortAscending": "Ascendente",
|
|
@@ -506,6 +513,9 @@ const coreTranslationsEs = {
|
|
|
506
513
|
"grid.done": "Listo",
|
|
507
514
|
"grid.searchPlaceholder": "Buscar por {{column}}",
|
|
508
515
|
"grid.showMore": "Ver más",
|
|
516
|
+
"grid.presentation": "Presentación",
|
|
517
|
+
"grid.tableView": "Tabla",
|
|
518
|
+
"grid.cardsView": "Tarjetas",
|
|
509
519
|
"grid.showLess": "Ver menos",
|
|
510
520
|
"grid.filterOperator.contains": "Contiene",
|
|
511
521
|
"grid.filterOperator.notcontains": "No contiene",
|
|
@@ -536,6 +546,7 @@ const coreTranslationsEs = {
|
|
|
536
546
|
"validation.defaultError": "Valor inválido",
|
|
537
547
|
"form.searchButton": "Buscar",
|
|
538
548
|
"form.actionButton": "Acción",
|
|
549
|
+
"form.actionError": "No se pudo completar la acción. Intenta nuevamente.",
|
|
539
550
|
"form.detailTitle": "Detalle",
|
|
540
551
|
"form.lookupClear": "Limpiar {{label}}",
|
|
541
552
|
"form.lookupOpen": "Abrir {{label}}",
|
|
@@ -561,6 +572,8 @@ const coreTranslationsEs = {
|
|
|
561
572
|
"form.fileUploadInvalidResponse": "La respuesta del servidor no incluye el identificador del archivo",
|
|
562
573
|
"form.imageUploadPrompt": "Arrastra una imagen o haz clic para seleccionar",
|
|
563
574
|
"form.imageUploadHint": "PNG, JPG, WEBP o GIF. Se sube automáticamente al seleccionar.",
|
|
575
|
+
"form.imageUploadEmpty": "Sin imagen",
|
|
576
|
+
"form.fileUploadEmpty": "Sin archivo",
|
|
564
577
|
"crudPage.confirmActionTitle": "Confirmar acción"
|
|
565
578
|
};
|
|
566
579
|
const coreTranslationsEn = {
|
|
@@ -602,6 +615,11 @@ const coreTranslationsEn = {
|
|
|
602
615
|
"form.loading": "Loading...",
|
|
603
616
|
"form.groupOther": "Other",
|
|
604
617
|
"grid.noRecords": "No records to display",
|
|
618
|
+
"grid.noMatchingRecords": "No results for these filters",
|
|
619
|
+
"grid.noMatchingRecordsDescription": "Try another search or clear the filters to see available records.",
|
|
620
|
+
"grid.retry": "Retry",
|
|
621
|
+
"grid.recordNotFoundTitle": "Record not found",
|
|
622
|
+
"grid.recordNotFoundDescription": "It may have been deleted or the link may no longer be available.",
|
|
605
623
|
"grid.accessDeniedTitle": "Access denied",
|
|
606
624
|
"grid.accessDeniedDescription": "You don't have permission to view this data.",
|
|
607
625
|
"grid.loadErrorTitle": "Couldn't load data",
|
|
@@ -668,6 +686,7 @@ const coreTranslationsEn = {
|
|
|
668
686
|
"grid.filterTo": "Filter {{column}} to",
|
|
669
687
|
"grid.sortColumn": "Sort by {{column}}",
|
|
670
688
|
"grid.filters": "Filters",
|
|
689
|
+
"grid.activeFilters": "Active filters",
|
|
671
690
|
"grid.sortBy": "Sort by",
|
|
672
691
|
"grid.sortNone": "Unsorted",
|
|
673
692
|
"grid.sortAscending": "Ascending",
|
|
@@ -676,6 +695,9 @@ const coreTranslationsEn = {
|
|
|
676
695
|
"grid.done": "Done",
|
|
677
696
|
"grid.searchPlaceholder": "Search by {{column}}",
|
|
678
697
|
"grid.showMore": "Show more",
|
|
698
|
+
"grid.presentation": "Presentation",
|
|
699
|
+
"grid.tableView": "Table",
|
|
700
|
+
"grid.cardsView": "Cards",
|
|
679
701
|
"grid.showLess": "Show less",
|
|
680
702
|
"grid.filterOperator.contains": "Contains",
|
|
681
703
|
"grid.filterOperator.notcontains": "Does not contain",
|
|
@@ -706,6 +728,7 @@ const coreTranslationsEn = {
|
|
|
706
728
|
"validation.defaultError": "Invalid value",
|
|
707
729
|
"form.searchButton": "Search",
|
|
708
730
|
"form.actionButton": "Action",
|
|
731
|
+
"form.actionError": "The action could not be completed. Try again.",
|
|
709
732
|
"form.detailTitle": "Detail",
|
|
710
733
|
"form.lookupClear": "Clear {{label}}",
|
|
711
734
|
"form.lookupOpen": "Open {{label}}",
|
|
@@ -731,6 +754,8 @@ const coreTranslationsEn = {
|
|
|
731
754
|
"form.fileUploadInvalidResponse": "Server response did not include the file identifier",
|
|
732
755
|
"form.imageUploadPrompt": "Drag an image here or click to browse",
|
|
733
756
|
"form.imageUploadHint": "PNG, JPG, WEBP or GIF. Uploads automatically on selection.",
|
|
757
|
+
"form.imageUploadEmpty": "No image",
|
|
758
|
+
"form.fileUploadEmpty": "No file",
|
|
734
759
|
"crudPage.confirmActionTitle": "Confirm action"
|
|
735
760
|
};
|
|
736
761
|
//#endregion
|
|
@@ -1001,7 +1026,7 @@ const DEFAULT_CORRELATION_ID_HEADER_NAME = "X-Request-Id";
|
|
|
1001
1026
|
* "safe methods don't need CSRF protection" rule (GET/HEAD never mutate
|
|
1002
1027
|
* state), so read requests never pay the cost of a token lookup.
|
|
1003
1028
|
*/
|
|
1004
|
-
const CSRF_PROTECTED_METHODS = new Set([
|
|
1029
|
+
const CSRF_PROTECTED_METHODS = /* @__PURE__ */ new Set([
|
|
1005
1030
|
"POST",
|
|
1006
1031
|
"PUT",
|
|
1007
1032
|
"PATCH",
|
|
@@ -1206,7 +1231,8 @@ function createCoreHttpClient(config) {
|
|
|
1206
1231
|
}
|
|
1207
1232
|
//#endregion
|
|
1208
1233
|
//#region packages/core/http/CoreHttpContext.tsx
|
|
1209
|
-
const
|
|
1234
|
+
const defaultHttpClient = createCoreHttpClient();
|
|
1235
|
+
const CoreHttpContext = createContext(defaultHttpClient);
|
|
1210
1236
|
function CoreHttpProvider({ children, client, config }) {
|
|
1211
1237
|
const value = useMemo(() => {
|
|
1212
1238
|
if (client) return client;
|
|
@@ -1224,6 +1250,33 @@ function useCoreHttpClient() {
|
|
|
1224
1250
|
return useContext(CoreHttpContext);
|
|
1225
1251
|
}
|
|
1226
1252
|
//#endregion
|
|
1253
|
+
//#region packages/core/http/csrf.ts
|
|
1254
|
+
/** Name of the cookie the Nubit backend sets for the double-submit CSRF policy. */
|
|
1255
|
+
const CSRF_COOKIE_NAME = "CSRF_TOKEN";
|
|
1256
|
+
/**
|
|
1257
|
+
* Reads the double-submit CSRF token from `document.cookie`.
|
|
1258
|
+
*
|
|
1259
|
+
* The backend sets the cookie readable by JavaScript on purpose: a cross-site
|
|
1260
|
+
* page can make the browser attach it but cannot read it, so it cannot echo it
|
|
1261
|
+
* back in the `X-CSRF-Token` header. Returns `undefined` outside a browser or
|
|
1262
|
+
* before login has issued the cookie.
|
|
1263
|
+
*/
|
|
1264
|
+
function readCsrfToken(cookieName = CSRF_COOKIE_NAME) {
|
|
1265
|
+
if (typeof document === "undefined") return void 0;
|
|
1266
|
+
for (const part of document.cookie.split(";")) {
|
|
1267
|
+
const separator = part.indexOf("=");
|
|
1268
|
+
if (separator === -1) continue;
|
|
1269
|
+
if (part.slice(0, separator).trim() !== cookieName) continue;
|
|
1270
|
+
const value = part.slice(separator + 1).trim();
|
|
1271
|
+
if (value === "") return void 0;
|
|
1272
|
+
try {
|
|
1273
|
+
return decodeURIComponent(value);
|
|
1274
|
+
} catch {
|
|
1275
|
+
return value;
|
|
1276
|
+
}
|
|
1277
|
+
}
|
|
1278
|
+
}
|
|
1279
|
+
//#endregion
|
|
1227
1280
|
//#region packages/core/runtime/CoreRuntimeContext.tsx
|
|
1228
1281
|
const defaultRuntime = {
|
|
1229
1282
|
notify: () => void 0,
|
|
@@ -1284,7 +1337,8 @@ var StaticFeatureFlagClient = class {
|
|
|
1284
1337
|
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : defaultValue;
|
|
1285
1338
|
}
|
|
1286
1339
|
};
|
|
1287
|
-
const
|
|
1340
|
+
const defaultClient = new StaticFeatureFlagClient();
|
|
1341
|
+
const FeatureFlagsContext = createContext(defaultClient);
|
|
1288
1342
|
function FeatureFlagsProvider({ children, client, flags = {}, context = {} }) {
|
|
1289
1343
|
const value = useMemo(() => client ?? new StaticFeatureFlagClient(flags, context), [
|
|
1290
1344
|
client,
|
|
@@ -1491,4 +1545,4 @@ function useMercureSubscription(apiUrl, onUpdate, enabled = true) {
|
|
|
1491
1545
|
]);
|
|
1492
1546
|
}
|
|
1493
1547
|
//#endregion
|
|
1494
|
-
export { CoreConfigProvider, CoreHttpClient, CoreHttpProvider, CoreProvider, CoreRuntimeProvider, DEFAULT_CORRELATION_ID_HEADER_NAME, DEFAULT_CSRF_HEADER_NAME, DEFAULT_TIMEZONE, DateUtils, FeatureFlagsProvider, mercureManager as MercureManager, MercureProvider, StaticFeatureFlagClient, buildMercureCollectionTopic, configureCore, configureCoreDate, coreTranslationsEn, coreTranslationsEs, createCoreHttpClient, createCrudEvents, createScopedEventBus, discoverMercureFromResponse, dispatch, extractMercureHubUrl, extractTopicOriginFromPayload, formatMinorUnits, formatMoney, fromMinorUnits, generateCorrelationId, getCoreApiBaseUrl, getCoreCurrency, getCoreLocale, getCoreTimezone, getDiscoveredMercureTopicOrigin, getMercureTopicOrigin, initCoreI18n, isMoneyValue, parseLinkHeader, parseMoney, parseMoneyInput, resolveMercureTopicOrigin, sumMoney, toMinorUnits, useBooleanFlag, useCoreConfig, useCoreHttpClient, useCoreRuntime, useCoreTranslation, useDiscoveredMercureTopicOrigin, useEvents, useFeatureFlags, useMercureHub, useMercureSubscription, useNumberFlag, useObjectFlag, useStringFlag };
|
|
1548
|
+
export { CSRF_COOKIE_NAME, CoreConfigProvider, CoreHttpClient, CoreHttpProvider, CoreProvider, CoreRuntimeProvider, DEFAULT_CORRELATION_ID_HEADER_NAME, DEFAULT_CSRF_HEADER_NAME, DEFAULT_TIMEZONE, DateUtils, FeatureFlagsProvider, mercureManager as MercureManager, MercureProvider, StaticFeatureFlagClient, buildMercureCollectionTopic, configureCore, configureCoreDate, coreTranslationsEn, coreTranslationsEs, createCoreHttpClient, createCrudEvents, createScopedEventBus, discoverMercureFromResponse, dispatch, extractMercureHubUrl, extractTopicOriginFromPayload, formatMinorUnits, formatMoney, fromMinorUnits, generateCorrelationId, getCoreApiBaseUrl, getCoreCurrency, getCoreLocale, getCoreTimezone, getDiscoveredMercureTopicOrigin, getMercureTopicOrigin, initCoreI18n, isMoneyValue, parseLinkHeader, parseMoney, parseMoneyInput, readCsrfToken, resolveMercureTopicOrigin, sumMoney, toMinorUnits, useBooleanFlag, useCoreConfig, useCoreHttpClient, useCoreRuntime, useCoreTranslation, useDiscoveredMercureTopicOrigin, useEvents, useFeatureFlags, useMercureHub, useMercureSubscription, useNumberFlag, useObjectFlag, useStringFlag };
|