@nar-bus/ui-shared 1.22.0 → 2.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 (113) hide show
  1. package/dist/adapters/api-adapter.d.ts +5 -5
  2. package/dist/adapters/api-adapter.d.ts.map +1 -1
  3. package/dist/adapters/index.d.ts +1 -1
  4. package/dist/adapters/index.d.ts.map +1 -1
  5. package/dist/adapters/real-adapter.d.ts +5 -5
  6. package/dist/adapters/real-adapter.d.ts.map +1 -1
  7. package/dist/adapters/traceId.d.ts +24 -0
  8. package/dist/adapters/traceId.d.ts.map +1 -0
  9. package/dist/adapters/types.d.ts +41 -0
  10. package/dist/adapters/types.d.ts.map +1 -1
  11. package/dist/api/apiClient.d.ts +22 -5
  12. package/dist/api/apiClient.d.ts.map +1 -1
  13. package/dist/api/queryKeys.d.ts +12 -0
  14. package/dist/api/queryKeys.d.ts.map +1 -1
  15. package/dist/api/searchRequest.d.ts +1 -1
  16. package/dist/components/CronBuilder.d.ts +28 -1
  17. package/dist/components/CronBuilder.d.ts.map +1 -1
  18. package/dist/components/MeterStatusBadge.d.ts.map +1 -1
  19. package/dist/components/OrderCreateSheet.d.ts +96 -1
  20. package/dist/components/OrderCreateSheet.d.ts.map +1 -1
  21. package/dist/components/OrderDetailSheet.d.ts +15 -1
  22. package/dist/components/OrderDetailSheet.d.ts.map +1 -1
  23. package/dist/components/detail-layout/ReadingHeatmap.d.ts +20 -2
  24. package/dist/components/detail-layout/ReadingHeatmap.d.ts.map +1 -1
  25. package/dist/components/detail-layout/TriColumnSymmetric.d.ts +16 -1
  26. package/dist/components/detail-layout/TriColumnSymmetric.d.ts.map +1 -1
  27. package/dist/components/detail-layout/adapters.d.ts.map +1 -1
  28. package/dist/components/detail-layout/types.d.ts +46 -18
  29. package/dist/components/detail-layout/types.d.ts.map +1 -1
  30. package/dist/components/export/ExportButton.d.ts +47 -0
  31. package/dist/components/export/ExportButton.d.ts.map +1 -0
  32. package/dist/components/export/ExportHistoryTable.d.ts +38 -0
  33. package/dist/components/export/ExportHistoryTable.d.ts.map +1 -0
  34. package/dist/components/export/ExportJobStatusBadge.d.ts +10 -0
  35. package/dist/components/export/ExportJobStatusBadge.d.ts.map +1 -0
  36. package/dist/components/export/exportJobApi.d.ts +54 -0
  37. package/dist/components/export/exportJobApi.d.ts.map +1 -0
  38. package/dist/components/export/exportJobFormat.d.ts +19 -0
  39. package/dist/components/export/exportJobFormat.d.ts.map +1 -0
  40. package/dist/components/export/exportJobText.d.ts +26 -0
  41. package/dist/components/export/exportJobText.d.ts.map +1 -0
  42. package/dist/components/export/index.d.ts +11 -0
  43. package/dist/components/export/index.d.ts.map +1 -0
  44. package/dist/components/export/useExportJob.d.ts +71 -0
  45. package/dist/components/export/useExportJob.d.ts.map +1 -0
  46. package/dist/components/form-sheet/FormSheet.d.ts +1 -1
  47. package/dist/components/form-sheet/ReadonlySheet.d.ts +1 -1
  48. package/dist/components/hourly-month-grid/HourStrip.d.ts.map +1 -1
  49. package/dist/components/hourly-month-grid/HourlyGridLegend.d.ts +4 -2
  50. package/dist/components/hourly-month-grid/HourlyGridLegend.d.ts.map +1 -1
  51. package/dist/components/hourly-month-grid/HourlyMonthGrid.d.ts +45 -0
  52. package/dist/components/hourly-month-grid/HourlyMonthGrid.d.ts.map +1 -1
  53. package/dist/components/hourly-month-grid/index.d.ts +1 -1
  54. package/dist/components/hourly-month-grid/index.d.ts.map +1 -1
  55. package/dist/components/index.d.ts +4 -4
  56. package/dist/components/index.d.ts.map +1 -1
  57. package/dist/components/order-forms/AstroConfigForm.d.ts.map +1 -1
  58. package/dist/components/order-forms/DirectiveForms.d.ts +15 -2
  59. package/dist/components/order-forms/DirectiveForms.d.ts.map +1 -1
  60. package/dist/components/order-forms/FirmwareUpdateForm.d.ts +10 -2
  61. package/dist/components/order-forms/FirmwareUpdateForm.d.ts.map +1 -1
  62. package/dist/components/order-forms/modemDetailQuery.d.ts +17 -0
  63. package/dist/components/order-forms/modemDetailQuery.d.ts.map +1 -0
  64. package/dist/hooks/index.d.ts +1 -1
  65. package/dist/hooks/index.d.ts.map +1 -1
  66. package/dist/hooks/useEnumValues.d.ts +66 -1
  67. package/dist/hooks/useEnumValues.d.ts.map +1 -1
  68. package/dist/index.css +1 -1
  69. package/dist/index.d.ts +14 -7
  70. package/dist/index.d.ts.map +1 -1
  71. package/dist/index.js +17563 -16427
  72. package/dist/mocks/periodic-jobs.json.d.ts +5 -5
  73. package/dist/types/audit.types.d.ts +27 -0
  74. package/dist/types/audit.types.d.ts.map +1 -0
  75. package/dist/types/auth.types.d.ts +98 -9
  76. package/dist/types/auth.types.d.ts.map +1 -1
  77. package/dist/types/brand-model.types.d.ts +25 -1
  78. package/dist/types/brand-model.types.d.ts.map +1 -1
  79. package/dist/types/calendar.types.d.ts +3 -0
  80. package/dist/types/calendar.types.d.ts.map +1 -1
  81. package/dist/types/directive.types.d.ts +3 -0
  82. package/dist/types/directive.types.d.ts.map +1 -1
  83. package/dist/types/exportJob.types.d.ts +115 -0
  84. package/dist/types/exportJob.types.d.ts.map +1 -0
  85. package/dist/types/firmware.types.d.ts +16 -1
  86. package/dist/types/firmware.types.d.ts.map +1 -1
  87. package/dist/types/index.d.ts +6 -4
  88. package/dist/types/index.d.ts.map +1 -1
  89. package/dist/types/location.types.d.ts +21 -1
  90. package/dist/types/location.types.d.ts.map +1 -1
  91. package/dist/types/management.types.d.ts +165 -9
  92. package/dist/types/management.types.d.ts.map +1 -1
  93. package/dist/types/meter.types.d.ts +122 -1
  94. package/dist/types/meter.types.d.ts.map +1 -1
  95. package/dist/types/modem.types.d.ts +67 -3
  96. package/dist/types/modem.types.d.ts.map +1 -1
  97. package/dist/types/order.types.d.ts +15 -0
  98. package/dist/types/order.types.d.ts.map +1 -1
  99. package/dist/types/parser-template.types.d.ts +9 -2
  100. package/dist/types/parser-template.types.d.ts.map +1 -1
  101. package/dist/types/protocol.types.d.ts +3 -0
  102. package/dist/types/protocol.types.d.ts.map +1 -1
  103. package/dist/types/reading-setting.types.d.ts +3 -0
  104. package/dist/types/reading-setting.types.d.ts.map +1 -1
  105. package/dist/types/server-config.types.d.ts +7 -0
  106. package/dist/types/server-config.types.d.ts.map +1 -1
  107. package/dist/types/simcard.types.d.ts +3 -0
  108. package/dist/types/simcard.types.d.ts.map +1 -1
  109. package/dist/utils/activeLocale.d.ts +1 -2
  110. package/dist/utils/activeLocale.d.ts.map +1 -1
  111. package/dist/utils/orderReason.d.ts +50 -0
  112. package/dist/utils/orderReason.d.ts.map +1 -0
  113. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"AstroConfigForm.d.ts","sourceRoot":"","sources":["../../../src/components/order-forms/AstroConfigForm.tsx"],"names":[],"mappings":"AA2CA,UAAU,SAAS;IACjB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/C,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAID,wBAAgB,eAAe,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,SAAS,+BA+K/D"}
1
+ {"version":3,"file":"AstroConfigForm.d.ts","sourceRoot":"","sources":["../../../src/components/order-forms/AstroConfigForm.tsx"],"names":[],"mappings":"AAyCA,UAAU,SAAS;IACjB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/C,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAID,wBAAgB,eAAe,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,SAAS,+BAuK/D"}
@@ -1,12 +1,25 @@
1
1
  interface FormProps {
2
2
  params: Record<string, string>;
3
- onChange: (key: string, value: string) => void;
3
+ /** `undefined` removes the key from the payload (see OrderCreateSheet `handleParamChange`). */
4
+ onChange: (key: string, value: string | undefined) => void;
5
+ /**
6
+ * Directive picker options. OPTIONAL override — when omitted the form loads
7
+ * the directive catalogue itself (see `useDirectiveOptions`). `value` is the
8
+ * directive's `name` — the id the gateway knows it by.
9
+ */
4
10
  directiveOptions?: Array<{
5
11
  value: string;
6
12
  label: string;
7
13
  }>;
8
14
  }
9
- /** DirectiveQueryForm — select directive to query */
15
+ /**
16
+ * DirectiveQueryForm — list the directives on the gateway, all or one.
17
+ *
18
+ * Wire: `{operation: "list"}` for "Tümü" (no `filter` — an empty filter's
19
+ * meaning is not specified), `{operation: "list", filter: {"id": name}}` for one
20
+ * directive. `operation` is what the handler sends anyway; it is also what makes
21
+ * "Tümü" a filled form (the sheet enables submit on a non-empty param).
22
+ */
10
23
  export declare function DirectiveQueryForm({ params, onChange, directiveOptions }: FormProps): import("react").JSX.Element;
11
24
  /** DirectiveChangeForm — multi-select directives to push to modem (FIX-166/FIX-168) */
12
25
  export declare function DirectiveChangeForm({ params, onChange }: FormProps): import("react").JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"DirectiveForms.d.ts","sourceRoot":"","sources":["../../../src/components/order-forms/DirectiveForms.tsx"],"names":[],"mappings":"AAQA,UAAU,SAAS;IACjB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/C,gBAAgB,CAAC,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC5D;AAED,qDAAqD;AACrD,wBAAgB,kBAAkB,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,gBAAqB,EAAE,EAAE,SAAS,+BAexF;AAED,uFAAuF;AACvF,wBAAgB,mBAAmB,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,SAAS,+BAiFlE;AAED,0DAA0D;AAC1D,wBAAgB,oBAAoB,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,gBAAqB,EAAE,EAAE,SAAS,+BA+B1F"}
1
+ {"version":3,"file":"DirectiveForms.d.ts","sourceRoot":"","sources":["../../../src/components/order-forms/DirectiveForms.tsx"],"names":[],"mappings":"AAQA,UAAU,SAAS;IACjB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,+FAA+F;IAC/F,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;IAC3D;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC5D;AAgGD;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,gBAAgB,EAAE,EAAE,SAAS,+BAqBnF;AAED,uFAAuF;AACvF,wBAAgB,mBAAmB,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,SAAS,+BA2ElE;AAED,0DAA0D;AAC1D,wBAAgB,oBAAoB,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,gBAAgB,EAAE,EAAE,SAAS,+BAmCrF"}
@@ -1,11 +1,19 @@
1
1
  interface FormProps {
2
2
  params: Record<string, string>;
3
- onChange: (key: string, value: string) => void;
3
+ /** `undefined` removes the key from the payload (see OrderCreateSheet `handleParamChange`). */
4
+ onChange: (key: string, value: string | undefined) => void;
5
+ /**
6
+ * Firmware picker options. OPTIONAL override — when omitted the form loads the
7
+ * packages for the modem's brand/model itself (see `useFirmwareOptions`).
8
+ * `value` is the firmware's `versionName`; it becomes the `versionName` param.
9
+ */
4
10
  firmwareOptions?: Array<{
5
11
  value: string;
6
12
  label: string;
7
13
  }>;
14
+ /** Modem whose brand/model selects the packages. Ignored when `firmwareOptions` is supplied. */
15
+ modemId?: number;
8
16
  }
9
- export declare function FirmwareUpdateForm({ params, onChange, firmwareOptions }: FormProps): import("react").JSX.Element;
17
+ export declare function FirmwareUpdateForm({ params, onChange, firmwareOptions, modemId }: FormProps): import("react").JSX.Element;
10
18
  export {};
11
19
  //# sourceMappingURL=FirmwareUpdateForm.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FirmwareUpdateForm.d.ts","sourceRoot":"","sources":["../../../src/components/order-forms/FirmwareUpdateForm.tsx"],"names":[],"mappings":"AAGA,UAAU,SAAS;IACjB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/C,eAAe,CAAC,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC3D;AAED,wBAAgB,kBAAkB,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,eAAoB,EAAE,EAAE,SAAS,+BAcvF"}
1
+ {"version":3,"file":"FirmwareUpdateForm.d.ts","sourceRoot":"","sources":["../../../src/components/order-forms/FirmwareUpdateForm.tsx"],"names":[],"mappings":"AASA,UAAU,SAAS;IACjB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,+FAA+F;IAC/F,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;IAC3D;;;;OAIG;IACH,eAAe,CAAC,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC1D,gGAAgG;IAChG,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAiFD,wBAAgB,kBAAkB,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,eAAe,EAAE,OAAO,EAAE,EAAE,SAAS,+BA6C3F"}
@@ -0,0 +1,17 @@
1
+ import { ModemDetail } from '../../types/modem.types';
2
+ /**
3
+ * The modem detail query the order forms share (Astro: location + astroDefaults;
4
+ * Firmware: brand/model for the package list).
5
+ *
6
+ * ONE definition on purpose: both forms read the same cache entry
7
+ * (`queryKeys.modems.detail`), so they must agree on the cached shape — a
8
+ * second, slightly different queryFn under the same key would hand one form the
9
+ * other's data.
10
+ */
11
+ export declare function modemDetailQuery(modemId: number | undefined): {
12
+ queryKey: readonly ["modems", "detail", number];
13
+ queryFn: () => Promise<ModemDetail | null>;
14
+ staleTime: number;
15
+ enabled: boolean;
16
+ };
17
+ //# sourceMappingURL=modemDetailQuery.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"modemDetailQuery.d.ts","sourceRoot":"","sources":["../../../src/components/order-forms/modemDetailQuery.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE3D;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS;;mBAGrC,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;;;EAOjD"}
@@ -7,7 +7,7 @@ export { useSSE, setSSEDefaultMode } from './useSSE';
7
7
  export type { SSEConnectionState, SSEOptions, SSEMode, SSEModeOption } from './useSSE';
8
8
  export { useNotifications } from './useNotifications';
9
9
  export type { UseNotificationsReturn } from './useNotifications';
10
- export { useEnumValues } from './useEnumValues';
10
+ export { useEnumValues, fetchEnumValues, enumValuesQueryOptions } from './useEnumValues';
11
11
  export type { EnumOption, UseEnumValuesReturn } from './useEnumValues';
12
12
  export { useOrderDetail } from './useOrderDetail';
13
13
  export type { UseOrderDetailOptions } from './useOrderDetail';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAClD,YAAY,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACvE,YAAY,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AACrD,YAAY,EAAE,kBAAkB,EAAE,UAAU,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACvF,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,YAAY,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAClD,YAAY,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACvE,YAAY,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AACrD,YAAY,EAAE,kBAAkB,EAAE,UAAU,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACvF,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACzF,YAAY,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,YAAY,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC"}
@@ -1,6 +1,21 @@
1
1
  export interface EnumOption {
2
2
  value: string;
3
3
  label: string;
4
+ /**
5
+ * NB-ENUM-EN-01 — the English display label: the catalogue's `enumValueEn` when
6
+ * the value has one, otherwise `label` — so it is never blank. In an English UI
7
+ * show `option.labelEn` instead of `option.label`.
8
+ *
9
+ * Optional in the type only because consumers build `EnumOption`s themselves
10
+ * (tests, mocks, their own cache warm-up); `useEnumValues` always fills it.
11
+ */
12
+ labelEn?: string;
13
+ /**
14
+ * NB-ENUM-EN-01 — the English label exactly as the catalogue stores it, `null`
15
+ * when the value has no translation. Read it when an untranslated value should
16
+ * fall back to something other than the Turkish `label` (e.g. a humanized key).
17
+ */
18
+ enumValueEn?: string | null;
4
19
  /**
5
20
  * NB-ENUMOPT-RELKEY-01 — the backend `EnumValueResponse.relationKey` classifies
6
21
  * an option (e.g. `FIELD_OPERATION_TITLE` values carry `relationKey="MODEM"`).
@@ -10,15 +25,65 @@ export interface EnumOption {
10
25
  relationKey?: string | null;
11
26
  }
12
27
  export interface UseEnumValuesReturn {
28
+ /** The catalogue, sorted by `sortOrder`. `[]` while loading and after a failed fetch — see `isError`. */
13
29
  options: EnumOption[];
14
30
  isLoading: boolean;
31
+ /**
32
+ * True when the last fetch failed (server error envelope or transport error) and
33
+ * there is no catalogue to show. Lets a mandatory picker say "could not load"
34
+ * instead of looking like an empty catalogue. Cleared by the next successful fetch.
35
+ *
36
+ * Optional in the type only because consumers declare `UseEnumValuesReturn` on their
37
+ * own wrappers and mocks; `useEnumValues` always fills it.
38
+ */
39
+ isError?: boolean;
15
40
  }
41
+ /**
42
+ * Fetches one enum catalogue and maps it to `EnumOption`s, sorted by `sortOrder`.
43
+ *
44
+ * An error envelope REJECTS instead of resolving to `[]`. The API client reports a
45
+ * failed request as `{ status: "error" }` rather than throwing; resolving that to an
46
+ * empty list made TanStack cache "this catalogue has no values" as a SUCCESS for the
47
+ * full stale time, so a mandatory picker stayed empty for five minutes after a
48
+ * transient error, even once the server had recovered. Rejecting lets the query's
49
+ * retry/error semantics run and leaves nothing in the cache, so the next mount or
50
+ * refetch asks the server again. (HES fixed the same bug in its own prefetch copy,
51
+ * FIX-817 — this is the package-side root fix.)
52
+ *
53
+ * The rejection value is the envelope's `ApiError` (`{ code, … }`), or
54
+ * `{ code: "UNKNOWN_ERROR" }` when the envelope carries none.
55
+ */
56
+ export declare function fetchEnumValues(enumCode: string): Promise<EnumOption[]>;
57
+ /**
58
+ * The exact query `useEnumValues` runs — key, fetch and stale time — for a consumer
59
+ * that warms the cache ahead of time:
60
+ *
61
+ * ```ts
62
+ * void queryClient.prefetchQuery(enumValuesQueryOptions("ORDER_STATUS"));
63
+ * ```
64
+ *
65
+ * A prefetch built from this writes what the hook would write (same `EnumOption`
66
+ * shape, `labelEn` included) and follows the same error rule: a failed prefetch
67
+ * caches nothing, so the hook fetches on demand instead of serving a cached `[]`.
68
+ */
69
+ export declare function enumValuesQueryOptions(enumCode: string): {
70
+ queryKey: readonly ["enums", "values", string];
71
+ queryFn: () => Promise<EnumOption[]>;
72
+ staleTime: number;
73
+ };
16
74
  /**
17
75
  * Fetches enum values from the management API for a given enum definition code.
18
76
  * Uses TanStack Query with 5-minute stale time for caching.
19
77
  *
78
+ * Each option carries the Turkish `label` and the English `labelEn` (NB-ENUM-EN-01);
79
+ * the hook does not pick one for you — `label` stays what it always was.
80
+ *
81
+ * A failed fetch is an error, not an empty catalogue: `options` is `[]` and
82
+ * `isError` is true, and nothing is cached, so the next mount refetches (see
83
+ * `fetchEnumValues`). Retries follow the app's QueryClient defaults.
84
+ *
20
85
  * @param enumCode — The enum definition code (e.g. "LIFECYCLE_STATUS", "PHASE_TYPE")
21
- * @returns { options, isLoading } — SelectOption-compatible array
86
+ * @returns { options, isLoading, isError } — SelectOption-compatible array
22
87
  */
23
88
  export declare function useEnumValues(enumCode: string): UseEnumValuesReturn;
24
89
  //# sourceMappingURL=useEnumValues.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useEnumValues.d.ts","sourceRoot":"","sources":["../../src/hooks/useEnumValues.ts"],"names":[],"mappings":"AAeA,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,SAAS,EAAE,OAAO,CAAC;CACpB;AAMD;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,mBAAmB,CAwBnE"}
1
+ {"version":3,"file":"useEnumValues.d.ts","sourceRoot":"","sources":["../../src/hooks/useEnumValues.ts"],"names":[],"mappings":"AAiBA,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED,MAAM,WAAW,mBAAmB;IAClC,yGAAyG;IACzG,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,SAAS,EAAE,OAAO,CAAC;IACnB;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AA+CD;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAW7E;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM;;;;EAMtD;AAMD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,mBAAmB,CAanE"}