codicent-app-sdk 0.7.10 → 0.8.6

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 (268) hide show
  1. package/dist/cjs/_virtual/scheduler.production.js +1 -0
  2. package/dist/cjs/components/DataMessagePicker.d.ts +7 -1
  3. package/dist/cjs/components/DataMessagePicker.d.ts.map +1 -1
  4. package/dist/cjs/components/DataMessagePicker.js +1 -1
  5. package/dist/cjs/components/ErrorBoundary.d.ts.map +1 -1
  6. package/dist/cjs/components/ErrorBoundary.js +1 -1
  7. package/dist/cjs/components/ListView.d.ts +54 -1
  8. package/dist/cjs/components/ListView.d.ts.map +1 -1
  9. package/dist/cjs/components/ListView.js +1 -1
  10. package/dist/cjs/components/MessageItem.js +1 -1
  11. package/dist/cjs/components/RecordModal.d.ts +6 -1
  12. package/dist/cjs/components/RecordModal.d.ts.map +1 -1
  13. package/dist/cjs/components/RecordModal.js +1 -1
  14. package/dist/cjs/config/index.d.ts +1 -0
  15. package/dist/cjs/config/index.d.ts.map +1 -1
  16. package/dist/cjs/config/index.js +1 -1
  17. package/dist/cjs/hooks/useChat.d.ts +4 -1
  18. package/dist/cjs/hooks/useChat.d.ts.map +1 -1
  19. package/dist/cjs/hooks/useChat.js +1 -1
  20. package/dist/cjs/hooks/useCodicentApp.js +1 -1
  21. package/dist/cjs/hooks/useRealtimeVoiceAI.d.ts.map +1 -1
  22. package/dist/cjs/hooks/useRealtimeVoiceAI.js +1 -1
  23. package/dist/cjs/hooks/useToaster.d.ts +1 -1
  24. package/dist/cjs/hooks/useToaster.d.ts.map +1 -1
  25. package/dist/cjs/hooks/useToaster.js +1 -1
  26. package/dist/cjs/hooks/useUserRoles.js +1 -1
  27. package/dist/cjs/index.js +1 -1
  28. package/dist/cjs/node_modules/@floating-ui/core/dist/floating-ui.core.js +1 -1
  29. package/dist/cjs/node_modules/@floating-ui/devtools/dist/floating-ui.devtools.js +1 -1
  30. package/dist/cjs/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +1 -1
  31. package/dist/cjs/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +1 -1
  32. package/dist/cjs/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +1 -1
  33. package/dist/cjs/node_modules/@fluentui/react-aria/lib/activedescendant/useOptionWalker.js +1 -1
  34. package/dist/cjs/node_modules/@fluentui/react-calendar-compat/lib/components/Calendar/useCalendarStyles.styles.js +1 -1
  35. package/dist/cjs/node_modules/@fluentui/react-calendar-compat/lib/components/CalendarDay/CalendarDay.js +1 -1
  36. package/dist/cjs/node_modules/@fluentui/react-calendar-compat/lib/components/CalendarDay/useCalendarDayStyles.styles.js +1 -1
  37. package/dist/cjs/node_modules/@fluentui/react-calendar-compat/lib/components/CalendarDayGrid/CalendarDayGrid.js +1 -1
  38. package/dist/cjs/node_modules/@fluentui/react-calendar-compat/lib/components/CalendarDayGrid/CalendarGridDayCell.js +1 -1
  39. package/dist/cjs/node_modules/@fluentui/react-calendar-compat/lib/components/CalendarDayGrid/CalendarMonthHeaderRow.js +1 -1
  40. package/dist/cjs/node_modules/@fluentui/react-calendar-compat/lib/components/CalendarDayGrid/useCalendarDayGridStyles.styles.js +1 -1
  41. package/dist/cjs/node_modules/@fluentui/react-calendar-compat/lib/components/CalendarDayGrid/useWeekCornerStyles.styles.js +1 -1
  42. package/dist/cjs/node_modules/@fluentui/react-calendar-compat/lib/components/CalendarMonth/CalendarMonth.js +1 -1
  43. package/dist/cjs/node_modules/@fluentui/react-calendar-compat/lib/components/CalendarPicker/useCalendarPickerStyles.styles.js +1 -1
  44. package/dist/cjs/node_modules/@fluentui/react-calendar-compat/lib/components/CalendarYear/CalendarYear.js +1 -1
  45. package/dist/cjs/node_modules/@fluentui/react-combobox/lib/components/Combobox/useCombobox.js +1 -1
  46. package/dist/cjs/node_modules/@fluentui/react-combobox/lib/components/Combobox/useComboboxStyles.styles.js +1 -1
  47. package/dist/cjs/node_modules/@fluentui/react-combobox/lib/components/Listbox/useListboxStyles.styles.js +1 -1
  48. package/dist/cjs/node_modules/@fluentui/react-combobox/lib/components/Option/useOption.js +1 -1
  49. package/dist/cjs/node_modules/@fluentui/react-combobox/lib/components/Option/useOptionStyles.styles.js +1 -1
  50. package/dist/cjs/node_modules/@fluentui/react-combobox/lib/contexts/ListboxContext.js +1 -1
  51. package/dist/cjs/node_modules/@fluentui/react-combobox/lib/utils/dropdownKeyActions.js +1 -1
  52. package/dist/cjs/node_modules/@fluentui/react-combobox/lib/utils/useComboboxPositioning.js +1 -1
  53. package/dist/cjs/node_modules/@fluentui/react-combobox/lib/utils/useListboxSlot.js +1 -1
  54. package/dist/cjs/node_modules/@fluentui/react-context-selector/lib/createContext.js +1 -1
  55. package/dist/cjs/node_modules/@fluentui/react-context-selector/lib/useContextSelector.js +1 -1
  56. package/dist/cjs/node_modules/@fluentui/react-context-selector/lib/useHasParentContext.js +1 -1
  57. package/dist/cjs/node_modules/@fluentui/react-datepicker-compat/lib/components/DatePicker/useDatePickerStyles.styles.js +1 -1
  58. package/dist/cjs/node_modules/@fluentui/react-input/lib/components/Input/useInput.js +1 -1
  59. package/dist/cjs/node_modules/@fluentui/react-input/lib/components/Input/useInputStyles.styles.js +1 -1
  60. package/dist/cjs/node_modules/@fluentui/react-jsx-runtime/lib/jsx/createJSX.js +1 -1
  61. package/dist/cjs/node_modules/@fluentui/react-jsx-runtime/lib/utils/createCompatSlotComponent.js +1 -1
  62. package/dist/cjs/node_modules/@fluentui/react-jsx-runtime/lib/utils/warnIfElementTypeIsInvalid.js +1 -1
  63. package/dist/cjs/node_modules/@fluentui/react-portal/lib/components/Portal/Portal.js +1 -1
  64. package/dist/cjs/node_modules/@fluentui/react-portal/lib/components/Portal/renderPortal.js +1 -1
  65. package/dist/cjs/node_modules/@fluentui/react-portal/lib/components/Portal/usePortal.js +1 -1
  66. package/dist/cjs/node_modules/@fluentui/react-portal/lib/components/Portal/usePortalMountNode.js +1 -1
  67. package/dist/cjs/node_modules/@fluentui/react-portal/lib/components/Portal/usePortalMountNodeStyles.js +1 -0
  68. package/dist/cjs/node_modules/@fluentui/react-positioning/lib/createPositionManager.js +1 -1
  69. package/dist/cjs/node_modules/@fluentui/react-positioning/lib/usePositioning.js +1 -1
  70. package/dist/cjs/node_modules/@fluentui/react-positioning/lib/utils/getReactFiberFromNode.js +1 -1
  71. package/dist/cjs/node_modules/@fluentui/react-tabster/lib/focus/focusVisiblePolyfill.js +1 -1
  72. package/dist/cjs/node_modules/@fluentui/react-tabster/lib/hooks/useDangerousNeverHidden.js +1 -0
  73. package/dist/cjs/node_modules/@fluentui/react-tabster/lib/hooks/useModalAttributes.js +1 -1
  74. package/dist/cjs/node_modules/@fluentui/react-tabster/lib/hooks/useTabster.js +1 -1
  75. package/dist/cjs/node_modules/@fluentui/react-timepicker-compat/lib/components/TimePicker/useTimePickerStyles.styles.js +1 -1
  76. package/dist/cjs/node_modules/@fluentui/react-utilities/lib/compose/assertSlots.js +1 -1
  77. package/dist/cjs/node_modules/@fluentui/react-utilities/lib/compose/getIntrinsicElementProps.js +1 -1
  78. package/dist/cjs/node_modules/@fluentui/react-utilities/lib/compose/slot.js +1 -1
  79. package/dist/cjs/node_modules/@fluentui/react-utilities/lib/hooks/useFirstMount.js +1 -1
  80. package/dist/cjs/node_modules/@fluentui/react-utilities/lib/hooks/useOnClickOutside.js +1 -1
  81. package/dist/cjs/node_modules/@fluentui/react-utilities/lib/utils/getNativeElementProps.js +1 -1
  82. package/dist/cjs/node_modules/@fluentui/react-utilities/lib/utils/properties.js +1 -1
  83. package/dist/cjs/node_modules/@fluentui/react-utilities/lib/virtualParent/getParent.js +1 -1
  84. package/dist/cjs/node_modules/@fluentui/react-utilities/lib/virtualParent/setVirtualParent.js +1 -1
  85. package/dist/cjs/node_modules/@griffel/core/src/__resetStyles.js +1 -0
  86. package/dist/cjs/node_modules/@griffel/core/src/__styles.js +1 -0
  87. package/dist/cjs/node_modules/@griffel/core/src/constants.js +1 -0
  88. package/dist/cjs/node_modules/@griffel/core/src/devtools/getAtomicDebugSequenceTree.js +1 -0
  89. package/dist/cjs/node_modules/@griffel/core/src/devtools/getResetDebugSequence.js +1 -0
  90. package/dist/cjs/node_modules/@griffel/core/src/devtools/getSourceURLfromError.js +1 -0
  91. package/dist/cjs/node_modules/@griffel/core/src/devtools/injectDevTools.js +1 -0
  92. package/dist/cjs/node_modules/@griffel/core/src/devtools/isDevToolsEnabled.js +1 -0
  93. package/dist/cjs/node_modules/@griffel/core/src/devtools/mergeDebugSequence.js +1 -0
  94. package/dist/cjs/node_modules/@griffel/core/src/devtools/react-render-tracker/stackTrace.js +1 -0
  95. package/dist/cjs/node_modules/@griffel/core/src/devtools/store.js +1 -0
  96. package/dist/cjs/node_modules/@griffel/core/src/devtools/utils.js +1 -0
  97. package/dist/cjs/node_modules/@griffel/core/src/insertionFactory.js +1 -0
  98. package/dist/cjs/node_modules/@griffel/core/src/mergeClasses.js +1 -0
  99. package/dist/cjs/node_modules/@griffel/core/src/renderer/createDOMRenderer.js +1 -0
  100. package/dist/cjs/node_modules/@griffel/core/src/renderer/createIsomorphicStyleSheet.js +1 -0
  101. package/dist/cjs/node_modules/@griffel/core/src/renderer/getStyleSheetForBucket.js +1 -0
  102. package/dist/cjs/node_modules/@griffel/core/src/renderer/safeInsertRule.js +1 -0
  103. package/dist/cjs/node_modules/@griffel/core/src/runtime/reduceToClassNameForSlots.js +1 -0
  104. package/dist/cjs/node_modules/@griffel/core/src/runtime/utils/hashSequence.js +1 -0
  105. package/dist/cjs/node_modules/@griffel/core/src/runtime/utils/normalizeCSSBucketEntry.js +1 -0
  106. package/dist/cjs/node_modules/@griffel/react/src/RendererContext.js +1 -0
  107. package/dist/cjs/node_modules/@griffel/react/src/TextDirectionContext.js +1 -0
  108. package/dist/cjs/node_modules/@griffel/react/src/__resetStyles.js +1 -0
  109. package/dist/cjs/node_modules/@griffel/react/src/__styles.js +1 -0
  110. package/dist/cjs/node_modules/@griffel/react/src/insertionFactory.js +1 -0
  111. package/dist/cjs/node_modules/@griffel/react/src/useInsertionEffect.js +1 -0
  112. package/dist/cjs/node_modules/@griffel/react/src/utils/canUseDOM.js +1 -0
  113. package/dist/cjs/node_modules/scheduler/cjs/scheduler.development.js +3 -3
  114. package/dist/cjs/node_modules/scheduler/cjs/scheduler.production.js +10 -0
  115. package/dist/cjs/node_modules/scheduler/index.js +1 -1
  116. package/dist/cjs/pages/Chat.d.ts.map +1 -1
  117. package/dist/cjs/pages/Chat.js +1 -1
  118. package/dist/cjs/pages/ListPage.d.ts +6 -1
  119. package/dist/cjs/pages/ListPage.d.ts.map +1 -1
  120. package/dist/cjs/pages/ListPage.js +1 -1
  121. package/dist/cjs/services/codicent.d.ts +23 -2
  122. package/dist/cjs/services/codicent.d.ts.map +1 -1
  123. package/dist/cjs/services/codicent.js +1 -1
  124. package/dist/cjs/types/index.d.ts +28 -0
  125. package/dist/cjs/types/index.d.ts.map +1 -1
  126. package/dist/cjs/utils/index.d.ts +3 -0
  127. package/dist/cjs/utils/index.d.ts.map +1 -1
  128. package/dist/cjs/utils/reference.d.ts +15 -0
  129. package/dist/cjs/utils/reference.d.ts.map +1 -0
  130. package/dist/cjs/utils/reference.js +1 -0
  131. package/dist/cjs/utils/telemetry.d.ts +27 -0
  132. package/dist/cjs/utils/telemetry.d.ts.map +1 -0
  133. package/dist/cjs/utils/telemetry.js +1 -0
  134. package/dist/esm/_virtual/scheduler.production.js +1 -0
  135. package/dist/esm/components/DataMessagePicker.d.ts +7 -1
  136. package/dist/esm/components/DataMessagePicker.d.ts.map +1 -1
  137. package/dist/esm/components/DataMessagePicker.js +1 -1
  138. package/dist/esm/components/ErrorBoundary.d.ts.map +1 -1
  139. package/dist/esm/components/ErrorBoundary.js +1 -1
  140. package/dist/esm/components/ListView.d.ts +54 -1
  141. package/dist/esm/components/ListView.d.ts.map +1 -1
  142. package/dist/esm/components/ListView.js +1 -1
  143. package/dist/esm/components/MessageItem.js +1 -1
  144. package/dist/esm/components/RecordModal.d.ts +6 -1
  145. package/dist/esm/components/RecordModal.d.ts.map +1 -1
  146. package/dist/esm/components/RecordModal.js +1 -1
  147. package/dist/esm/config/index.d.ts +1 -0
  148. package/dist/esm/config/index.d.ts.map +1 -1
  149. package/dist/esm/config/index.js +1 -1
  150. package/dist/esm/hooks/useChat.d.ts +4 -1
  151. package/dist/esm/hooks/useChat.d.ts.map +1 -1
  152. package/dist/esm/hooks/useChat.js +1 -1
  153. package/dist/esm/hooks/useCodicentApp.js +1 -1
  154. package/dist/esm/hooks/useRealtimeVoiceAI.d.ts.map +1 -1
  155. package/dist/esm/hooks/useRealtimeVoiceAI.js +1 -1
  156. package/dist/esm/hooks/useToaster.d.ts +1 -1
  157. package/dist/esm/hooks/useToaster.d.ts.map +1 -1
  158. package/dist/esm/hooks/useToaster.js +1 -1
  159. package/dist/esm/hooks/useUserRoles.js +1 -1
  160. package/dist/esm/index.js +1 -1
  161. package/dist/esm/node_modules/@floating-ui/core/dist/floating-ui.core.js +1 -1
  162. package/dist/esm/node_modules/@floating-ui/devtools/dist/floating-ui.devtools.js +1 -1
  163. package/dist/esm/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +1 -1
  164. package/dist/esm/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +1 -1
  165. package/dist/esm/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +1 -1
  166. package/dist/esm/node_modules/@fluentui/react-aria/lib/activedescendant/useOptionWalker.js +1 -1
  167. package/dist/esm/node_modules/@fluentui/react-calendar-compat/lib/components/Calendar/useCalendarStyles.styles.js +1 -1
  168. package/dist/esm/node_modules/@fluentui/react-calendar-compat/lib/components/CalendarDay/CalendarDay.js +1 -1
  169. package/dist/esm/node_modules/@fluentui/react-calendar-compat/lib/components/CalendarDay/useCalendarDayStyles.styles.js +1 -1
  170. package/dist/esm/node_modules/@fluentui/react-calendar-compat/lib/components/CalendarDayGrid/CalendarDayGrid.js +1 -1
  171. package/dist/esm/node_modules/@fluentui/react-calendar-compat/lib/components/CalendarDayGrid/CalendarGridDayCell.js +1 -1
  172. package/dist/esm/node_modules/@fluentui/react-calendar-compat/lib/components/CalendarDayGrid/CalendarMonthHeaderRow.js +1 -1
  173. package/dist/esm/node_modules/@fluentui/react-calendar-compat/lib/components/CalendarDayGrid/useCalendarDayGridStyles.styles.js +1 -1
  174. package/dist/esm/node_modules/@fluentui/react-calendar-compat/lib/components/CalendarDayGrid/useWeekCornerStyles.styles.js +1 -1
  175. package/dist/esm/node_modules/@fluentui/react-calendar-compat/lib/components/CalendarMonth/CalendarMonth.js +1 -1
  176. package/dist/esm/node_modules/@fluentui/react-calendar-compat/lib/components/CalendarPicker/useCalendarPickerStyles.styles.js +1 -1
  177. package/dist/esm/node_modules/@fluentui/react-calendar-compat/lib/components/CalendarYear/CalendarYear.js +1 -1
  178. package/dist/esm/node_modules/@fluentui/react-combobox/lib/components/Combobox/useCombobox.js +1 -1
  179. package/dist/esm/node_modules/@fluentui/react-combobox/lib/components/Combobox/useComboboxStyles.styles.js +1 -1
  180. package/dist/esm/node_modules/@fluentui/react-combobox/lib/components/Listbox/useListboxStyles.styles.js +1 -1
  181. package/dist/esm/node_modules/@fluentui/react-combobox/lib/components/Option/useOption.js +1 -1
  182. package/dist/esm/node_modules/@fluentui/react-combobox/lib/components/Option/useOptionStyles.styles.js +1 -1
  183. package/dist/esm/node_modules/@fluentui/react-combobox/lib/contexts/ListboxContext.js +1 -1
  184. package/dist/esm/node_modules/@fluentui/react-combobox/lib/utils/dropdownKeyActions.js +1 -1
  185. package/dist/esm/node_modules/@fluentui/react-combobox/lib/utils/useComboboxPositioning.js +1 -1
  186. package/dist/esm/node_modules/@fluentui/react-combobox/lib/utils/useListboxSlot.js +1 -1
  187. package/dist/esm/node_modules/@fluentui/react-context-selector/lib/createContext.js +1 -1
  188. package/dist/esm/node_modules/@fluentui/react-context-selector/lib/useContextSelector.js +1 -1
  189. package/dist/esm/node_modules/@fluentui/react-context-selector/lib/useHasParentContext.js +1 -1
  190. package/dist/esm/node_modules/@fluentui/react-datepicker-compat/lib/components/DatePicker/useDatePickerStyles.styles.js +1 -1
  191. package/dist/esm/node_modules/@fluentui/react-input/lib/components/Input/useInput.js +1 -1
  192. package/dist/esm/node_modules/@fluentui/react-input/lib/components/Input/useInputStyles.styles.js +1 -1
  193. package/dist/esm/node_modules/@fluentui/react-jsx-runtime/lib/jsx/createJSX.js +1 -1
  194. package/dist/esm/node_modules/@fluentui/react-jsx-runtime/lib/utils/createCompatSlotComponent.js +1 -1
  195. package/dist/esm/node_modules/@fluentui/react-jsx-runtime/lib/utils/warnIfElementTypeIsInvalid.js +1 -1
  196. package/dist/esm/node_modules/@fluentui/react-portal/lib/components/Portal/Portal.js +1 -1
  197. package/dist/esm/node_modules/@fluentui/react-portal/lib/components/Portal/renderPortal.js +1 -1
  198. package/dist/esm/node_modules/@fluentui/react-portal/lib/components/Portal/usePortal.js +1 -1
  199. package/dist/esm/node_modules/@fluentui/react-portal/lib/components/Portal/usePortalMountNode.js +1 -1
  200. package/dist/esm/node_modules/@fluentui/react-portal/lib/components/Portal/usePortalMountNodeStyles.js +1 -0
  201. package/dist/esm/node_modules/@fluentui/react-positioning/lib/createPositionManager.js +1 -1
  202. package/dist/esm/node_modules/@fluentui/react-positioning/lib/usePositioning.js +1 -1
  203. package/dist/esm/node_modules/@fluentui/react-positioning/lib/utils/getReactFiberFromNode.js +1 -1
  204. package/dist/esm/node_modules/@fluentui/react-tabster/lib/focus/focusVisiblePolyfill.js +1 -1
  205. package/dist/esm/node_modules/@fluentui/react-tabster/lib/hooks/useDangerousNeverHidden.js +1 -0
  206. package/dist/esm/node_modules/@fluentui/react-tabster/lib/hooks/useModalAttributes.js +1 -1
  207. package/dist/esm/node_modules/@fluentui/react-tabster/lib/hooks/useTabster.js +1 -1
  208. package/dist/esm/node_modules/@fluentui/react-timepicker-compat/lib/components/TimePicker/useTimePickerStyles.styles.js +1 -1
  209. package/dist/esm/node_modules/@fluentui/react-utilities/lib/compose/assertSlots.js +1 -1
  210. package/dist/esm/node_modules/@fluentui/react-utilities/lib/compose/getIntrinsicElementProps.js +1 -1
  211. package/dist/esm/node_modules/@fluentui/react-utilities/lib/compose/slot.js +1 -1
  212. package/dist/esm/node_modules/@fluentui/react-utilities/lib/hooks/useFirstMount.js +1 -1
  213. package/dist/esm/node_modules/@fluentui/react-utilities/lib/hooks/useOnClickOutside.js +1 -1
  214. package/dist/esm/node_modules/@fluentui/react-utilities/lib/utils/getNativeElementProps.js +1 -1
  215. package/dist/esm/node_modules/@fluentui/react-utilities/lib/utils/properties.js +1 -1
  216. package/dist/esm/node_modules/@fluentui/react-utilities/lib/virtualParent/getParent.js +1 -1
  217. package/dist/esm/node_modules/@fluentui/react-utilities/lib/virtualParent/setVirtualParent.js +1 -1
  218. package/dist/esm/node_modules/@griffel/core/src/__resetStyles.js +1 -0
  219. package/dist/esm/node_modules/@griffel/core/src/__styles.js +1 -0
  220. package/dist/esm/node_modules/@griffel/core/src/constants.js +1 -0
  221. package/dist/esm/node_modules/@griffel/core/src/devtools/getAtomicDebugSequenceTree.js +1 -0
  222. package/dist/esm/node_modules/@griffel/core/src/devtools/getResetDebugSequence.js +1 -0
  223. package/dist/esm/node_modules/@griffel/core/src/devtools/getSourceURLfromError.js +1 -0
  224. package/dist/esm/node_modules/@griffel/core/src/devtools/injectDevTools.js +1 -0
  225. package/dist/esm/node_modules/@griffel/core/src/devtools/isDevToolsEnabled.js +1 -0
  226. package/dist/esm/node_modules/@griffel/core/src/devtools/mergeDebugSequence.js +1 -0
  227. package/dist/esm/node_modules/@griffel/core/src/devtools/react-render-tracker/stackTrace.js +1 -0
  228. package/dist/esm/node_modules/@griffel/core/src/devtools/store.js +1 -0
  229. package/dist/esm/node_modules/@griffel/core/src/devtools/utils.js +1 -0
  230. package/dist/esm/node_modules/@griffel/core/src/insertionFactory.js +1 -0
  231. package/dist/esm/node_modules/@griffel/core/src/mergeClasses.js +1 -0
  232. package/dist/esm/node_modules/@griffel/core/src/renderer/createDOMRenderer.js +1 -0
  233. package/dist/esm/node_modules/@griffel/core/src/renderer/createIsomorphicStyleSheet.js +1 -0
  234. package/dist/esm/node_modules/@griffel/core/src/renderer/getStyleSheetForBucket.js +1 -0
  235. package/dist/esm/node_modules/@griffel/core/src/renderer/safeInsertRule.js +1 -0
  236. package/dist/esm/node_modules/@griffel/core/src/runtime/reduceToClassNameForSlots.js +1 -0
  237. package/dist/esm/node_modules/@griffel/core/src/runtime/utils/hashSequence.js +1 -0
  238. package/dist/esm/node_modules/@griffel/core/src/runtime/utils/normalizeCSSBucketEntry.js +1 -0
  239. package/dist/esm/node_modules/@griffel/react/src/RendererContext.js +1 -0
  240. package/dist/esm/node_modules/@griffel/react/src/TextDirectionContext.js +1 -0
  241. package/dist/esm/node_modules/@griffel/react/src/__resetStyles.js +1 -0
  242. package/dist/esm/node_modules/@griffel/react/src/__styles.js +1 -0
  243. package/dist/esm/node_modules/@griffel/react/src/insertionFactory.js +1 -0
  244. package/dist/esm/node_modules/@griffel/react/src/useInsertionEffect.js +1 -0
  245. package/dist/esm/node_modules/@griffel/react/src/utils/canUseDOM.js +1 -0
  246. package/dist/esm/node_modules/scheduler/cjs/scheduler.development.js +3 -3
  247. package/dist/esm/node_modules/scheduler/cjs/scheduler.production.js +10 -0
  248. package/dist/esm/node_modules/scheduler/index.js +1 -1
  249. package/dist/esm/pages/Chat.d.ts.map +1 -1
  250. package/dist/esm/pages/Chat.js +1 -1
  251. package/dist/esm/pages/ListPage.d.ts +6 -1
  252. package/dist/esm/pages/ListPage.d.ts.map +1 -1
  253. package/dist/esm/pages/ListPage.js +1 -1
  254. package/dist/esm/services/codicent.d.ts +23 -2
  255. package/dist/esm/services/codicent.d.ts.map +1 -1
  256. package/dist/esm/services/codicent.js +1 -1
  257. package/dist/esm/types/index.d.ts +28 -0
  258. package/dist/esm/types/index.d.ts.map +1 -1
  259. package/dist/esm/utils/index.d.ts +3 -0
  260. package/dist/esm/utils/index.d.ts.map +1 -1
  261. package/dist/esm/utils/reference.d.ts +15 -0
  262. package/dist/esm/utils/reference.d.ts.map +1 -0
  263. package/dist/esm/utils/reference.js +1 -0
  264. package/dist/esm/utils/telemetry.d.ts +27 -0
  265. package/dist/esm/utils/telemetry.d.ts.map +1 -0
  266. package/dist/esm/utils/telemetry.js +1 -0
  267. package/dist/index.d.ts +165 -9
  268. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"DataMessagePicker.d.ts","sourceRoot":"","sources":["../../../src/components/DataMessagePicker.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAiF5C,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,WAAW,CAAC;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,eAAe,CAAC;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,WAAW,CAAC,EAAE,M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E,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,QAAQ,CAAC,EAAE,CAAC,SAAS,EAAE,0BAA0B,KAAK,IAAI,CAAC;CAC5D;AAuGD,QAAA,MAAM,iBAAiB,oOAmBpB,sBAAsB,4CA+TxB,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
@@ -1 +1 @@
1
- import{jsxs as e,jsx as o}from"react/jsx-runtime";import{makeStyles as t,SearchBox as n,Spinner as r}from"@fluentui/react-components";import{useState as l,useRef as a,useMemo as i,useEffect as s}from"react";const c=[],d=["name","title","label","companyName","Company Name","customerName","description"],u=["originalMessageId","OriginalMessageId","originalmessageid"],p=t({root:{position:"relative",width:"100%"},searchBox:{width:"100%"},panel:{position:"absolute",top:"calc(100% + 4px)",left:0,right:0,zIndex:10,backgroundColor:"#ffffff",border:"1px solid #d1d1d1",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.12)",overflow:"hidden"},statusRow:{display:"flex",alignItems:"center",gap:"8px",padding:"12px",color:"#616161",fontSize:"14px"},errorRow:{padding:"12px",color:"#c50f1f",fontSize:"14px"},resultsList:{maxHeight:"320px",overflowY:"auto"},option:{width:"100%",textAlign:"left",padding:"12px",border:"none",backgroundColor:"#ffffff",borderBottom:"1px solid #f0f0f0",cursor:"pointer",display:"flex",flexDirection:"column",gap:"4px",":hover":{backgroundColor:"#f5f5f5"}},optionActive:{backgroundColor:"#f3f9fd"},optionLabel:{fontSize:"14px",fontWeight:600,color:"#242424",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},optionMeta:{fontSize:"12px",color:"#616161",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}),f=e=>null==e?"":"string"==typeof e?e.trim():Array.isArray(e)?e.map((e=>f(e))).filter(Boolean).join(", "):String(e).trim(),h=e=>{const o=new Set;return e.filter((e=>!(!e||o.has(e))&&(o.add(e),!0)))},m=(e,o)=>f(e[o]),g=(e,o)=>{for(const t of o){const o=m(e,t);if(o)return o}return""},w=e=>g(e,u)||void 0,v=(e,o,t,n=c,r=c,l=c)=>{const a=e.data||{},i=g(a,h([t||"",...n,...r,...d]))||e.id,s=l.map((e=>m(a,e))).filter(Boolean).join(" • "),u=((e,o)=>0===o.length?Object.values(e).map((e=>f(e))).filter(Boolean).join(" "):o.map((o=>m(e,o))).filter(Boolean).join(" "))(a,h([...r,...n]));return{selection:{message:e,id:e.id,tag:o,label:i,searchText:u,data:a,originalMessageId:w(a)},secondaryText:s}},x=({service:t,tag:d,codicent:u,placeholder:f="Search",value:m,disabled:g=!1,debounceMs:w=300,minSearchLength:x=2,resultLimit:y=8,displayKeys:b=c,searchKeys:N=c,primaryKey:S,secondaryKeys:D=c,dataFilters:T,noResultsText:k="No matches found",onValueChange:C,onSelect:L})=>{const M=p(),[A,B]=l(m||""),[z,R]=l([]),[j,I]=l(!1),[K,O]=l(!1),[E,F]=l(-1),[$,H]=l(null),[J,U]=l(!1),V=a(null),W=i((()=>h(b)),[b]),Y=i((()=>h(N)),[N]),q=i((()=>h(D)),[D]),G=i((()=>JSON.stringify(T||{})),[T]);s((()=>{B(m||"")}),[m]),s((()=>{const e=A.trim();if(!e||e.length<x||g)return I(!1),R([]),O(!1),F(-1),H(null),void U(!1);let o=!1;const n=window.setTimeout((async()=>{I(!0),H(null),U(!0);try{const n=await t.readDataMessages(d,e,u,0,Math.max(3*y,y),void 0,void 0,T);if(o)return;const r=n.map((e=>v(e,d,S,W,Y,q))).filter((o=>0===Y.length||o.selection.searchText.toLocaleLowerCase().includes(e.toLocaleLowerCase()))).slice(0,y);R(r),F(r.length>0?0:-1),O(!0)}catch(e){o||(H(e instanceof Error?e.message:"Search failed"),R([]),F(-1),O(!0))}finally{o||I(!1)}}),w);return()=>{o=!0,window.clearTimeout(n)}}),[u,w,g,A,x,W,Y,q,S,y,G,t,d]),s((()=>()=>{null!==V.current&&window.clearTimeout(V.current)}),[]);const P=e=>{B(e.selection.label),O(!1),F(-1),C?.(e.selection.label),L?.(e.selection)},Q=K&&(j||!!$||z.length>0||J&&A.trim().length>=x);return e("div",{className:M.root,children:[o(n,{size:"large",className:M.searchBox,placeholder:f,value:A,disabled:g,onChange:(e,o)=>{return t=o.value,B(t),void C?.(t);var t},onFocus:()=>{null!==V.current&&(window.clearTimeout(V.current),V.current=null),A.trim().length>=x&&(z.length>0||j||$||J)&&O(!0)},onBlur:()=>{V.current=window.setTimeout((()=>{O(!1)}),120)},onKeyDown:e=>{if(K&&0!==z.length)return"ArrowDown"===e.key?(e.preventDefault(),void F((e=>(e+1)%z.length))):"ArrowUp"===e.key?(e.preventDefault(),void F((e=>e<=0?z.length-1:e-1))):"Enter"===e.key&&E>=0?(e.preventDefault(),void P(z[E])):void("Escape"===e.key&&(e.preventDefault(),O(!1),F(-1)));"ArrowDown"===e.key&&A.trim().length>=x&&O(!0)}}),Q?e("div",{className:M.panel,children:[j?e("div",{className:M.statusRow,children:[o(r,{size:"tiny"}),"Searching..."]}):null,!j&&$?o("div",{className:M.errorRow,children:$}):null,j||$||0!==z.length?null:o("div",{className:M.statusRow,children:k}),!j&&!$&&z.length>0?o("div",{className:M.resultsList,children:z.map(((t,n)=>e("button",{type:"button",className:`${M.option} ${n===E?M.optionActive:""}`,onMouseDown:e=>e.preventDefault(),onClick:()=>P(t),children:[o("span",{className:M.optionLabel,children:t.selection.label}),t.secondaryText?o("span",{className:M.optionMeta,children:t.secondaryText}):null]},t.selection.id)))}):null]}):null]})};export{x as default};
1
+ import{jsxs as e,jsx as t}from"react/jsx-runtime";import{makeStyles as n,Spinner as o,SearchBox as r}from"@fluentui/react-components";import{useState as l,useRef as i,useMemo as a,useEffect as s,useCallback as c}from"react";import{createPortal as d}from"react-dom";const u=[],f=["name","title","label","companyName","Company Name","customerName","description"],p=["originalMessageId","OriginalMessageId","originalmessageid"],m=n({root:{position:"relative",width:"100%"},searchBox:{width:"100%"},panel:{position:"fixed",zIndex:9999,backgroundColor:"#ffffff",border:"1px solid #d1d1d1",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.12)",overflow:"hidden"},statusRow:{display:"flex",alignItems:"center",gap:"8px",padding:"12px",color:"#616161",fontSize:"14px"},errorRow:{padding:"12px",color:"#c50f1f",fontSize:"14px"},resultsList:{maxHeight:"320px",overflowY:"auto"},option:{width:"100%",textAlign:"left",padding:"12px",border:"none",backgroundColor:"#ffffff",borderBottom:"1px solid #f0f0f0",cursor:"pointer",display:"flex",flexDirection:"column",gap:"4px",":hover":{backgroundColor:"#f5f5f5"}},optionActive:{backgroundColor:"#f3f9fd"},optionLabel:{fontSize:"14px",fontWeight:600,color:"#242424",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},optionMeta:{fontSize:"12px",color:"#616161",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}),h=e=>null==e?"":"string"==typeof e?e.trim():Array.isArray(e)?e.map((e=>h(e))).filter(Boolean).join(", "):String(e).trim(),g=e=>{const t=new Set;return e.filter((e=>!(!e||t.has(e))&&(t.add(e),!0)))},w=(e,t)=>h(e[t]),v=(e,t)=>{for(const n of t){const t=w(e,n);if(t)return t}return""},y=e=>v(e,p)||void 0,x=(e,t,n,o=u,r=u,l=u)=>{const i=e.data||{},a=v(i,g([n||"",...o,...r,...f]))||e.id,s=l.map((e=>w(i,e))).filter(Boolean).join(" • "),c=((e,t)=>0===t.length?Object.values(e).map((e=>h(e))).filter(Boolean).join(" "):t.map((t=>w(e,t))).filter(Boolean).join(" "))(i,g([...r,...o]));return{selection:{message:e,id:e.id,tag:t,label:a,searchText:c,data:i,originalMessageId:y(i)},secondaryText:s}},b=({service:n,tag:f,codicent:p,placeholder:h="Search",value:w,disabled:v=!1,debounceMs:y=300,minSearchLength:b=2,resultLimit:S=8,displayKeys:N=u,searchKeys:D=u,primaryKey:C,secondaryKeys:M=u,dataFilters:T,noResultsText:k="No matches found",showRecentOnFocus:L=!1,onValueChange:B,onSelect:R})=>{const A=m(),[z,j]=l(w||""),[O,I]=l([]),[K,E]=l(!1),[F,$]=l(!1),[H,J]=l(-1),[U,V]=l(null),[W,Y]=l(!1),[q,G]=l({}),P=i(null),Q=i(null),X=i(null),Z=a((()=>g(N)),[N]),_=a((()=>g(D)),[D]),ee=a((()=>g(M)),[M]),te=a((()=>JSON.stringify(T||{})),[T]);s((()=>{j(w||"")}),[w]);const ne=c((async(e,t)=>(await n.readDataMessages(f,e,p,0,Math.max(3*t,t),void 0,void 0,T)).map((e=>x(e,f,C,Z,_,ee))).filter((t=>!e||0===_.length||t.selection.searchText.toLocaleLowerCase().includes(e.toLocaleLowerCase()))).slice(0,t)),[p,T,Z,_,ee,C,n,f]);s((()=>{const e=z.trim();if(v)return;if(!e)return E(!1),I([]),J(-1),V(null),void Y(!1);if(e.length<b)return E(!1),I([]),$(!1),J(-1),V(null),void Y(!1);if(null!==Q.current&&Q.current===z)return E(!1),$(!1),void J(-1);let t=!1;const n=window.setTimeout((async()=>{E(!0),V(null),Y(!0);try{const n=await ne(e,S);if(t)return;I(n),J(n.length>0?0:-1),$(!0)}catch(e){t||(V(e instanceof Error?e.message:"Search failed"),I([]),J(-1),$(!0))}finally{t||E(!1)}}),y);return()=>{t=!0,window.clearTimeout(n)}}),[p,y,v,ne,z,b,S,te,f]),s((()=>()=>{null!==P.current&&window.clearTimeout(P.current)}),[]);const oe=e=>{Q.current=e.selection.label,j(e.selection.label),$(!1),J(-1),B?.(e.selection.label),R?.(e.selection)},re=F&&(K||!!U||O.length>0||W)?e("div",{className:A.panel,style:q,onMouseDown:e=>e.preventDefault(),children:[K?e("div",{className:A.statusRow,children:[t(o,{size:"tiny"}),"Searching..."]}):null,!K&&U?t("div",{className:A.errorRow,children:U}):null,K||U||0!==O.length?null:t("div",{className:A.statusRow,children:k}),!K&&!U&&O.length>0?t("div",{className:A.resultsList,children:O.map(((n,o)=>e("button",{type:"button",className:`${A.option} ${o===H?A.optionActive:""}`,onMouseDown:e=>e.preventDefault(),onClick:()=>oe(n),children:[t("span",{className:A.optionLabel,children:n.selection.label}),n.secondaryText?t("span",{className:A.optionMeta,children:n.secondaryText}):null]},n.selection.id)))}):null]}):null;return e("div",{className:A.root,ref:X,children:[t(r,{size:"large",className:A.searchBox,placeholder:h,value:z,disabled:v,onChange:(e,t)=>{return n=t.value,null!==Q.current&&n!==Q.current&&(Q.current=null),j(n),void B?.(n);var n},onFocus:()=>{if(null!==P.current&&(window.clearTimeout(P.current),P.current=null),X.current){const e=X.current.getBoundingClientRect();G({top:e.bottom+4,left:e.left,width:e.width})}const e=z.trim();if(e.length>=b)(O.length>0||K||U||W)&&$(!0);else{if(!(e||W||v)){let e=!1;return E(!0),$(!0),ne("",10).then((t=>{e||(I(t),J(-1),Y(!0))})).catch((()=>{e||I([])})).finally((()=>{e||E(!1)})),()=>{e=!0}}if(!e&&W)return void $(!0)}!L||z.trim()||v||(async()=>{E(!0),V(null),Y(!0),$(!0);try{const e=(await n.readDataMessages(f,"",p,0,S,void 0,void 0,T)).map((e=>x(e,f,C,Z,_,ee))).slice(0,S);I(e),J(e.length>0?0:-1)}catch(e){V(e instanceof Error?e.message:"Search failed"),I([]),J(-1)}finally{E(!1)}})()},onBlur:()=>{P.current=window.setTimeout((()=>{$(!1)}),120)},onKeyDown:e=>{if(F&&0!==O.length)return"ArrowDown"===e.key?(e.preventDefault(),void J((e=>(e+1)%O.length))):"ArrowUp"===e.key?(e.preventDefault(),void J((e=>e<=0?O.length-1:e-1))):"Enter"===e.key&&H>=0?(e.preventDefault(),void oe(O[H])):void("Escape"===e.key&&(e.preventDefault(),$(!1),J(-1)));"ArrowDown"===e.key&&z.trim().length>=b&&$(!0)}}),re&&"undefined"!=typeof document?d(re,document.body):null]})};export{b as default};
@@ -1 +1 @@
1
- {"version":3,"file":"ErrorBoundary.d.ts","sourceRoot":"","sources":["../../../src/components/ErrorBoundary.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAExD,UAAU,KAAK;IACZ,QAAQ,EAAE,SAAS,CAAC;IACpB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACvB;AAED,UAAU,KAAK;IACZ,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CACtB;AAED,cAAM,aAAc,SAAQ,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC;gBACpC,KAAK,EAAE,KAAK;IAQxB,MAAM,CAAC,wBAAwB,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK;IAKpD,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,GAAG,IAAI;IAM3D,MAAM,IAAI,SAAS;CAqCrB;AAED,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"ErrorBoundary.d.ts","sourceRoot":"","sources":["../../../src/components/ErrorBoundary.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGxD,UAAU,KAAK;IACZ,QAAQ,EAAE,SAAS,CAAC;IACpB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACvB;AAED,UAAU,KAAK;IACZ,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CACtB;AAED,cAAM,aAAc,SAAQ,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC;gBACpC,KAAK,EAAE,KAAK;IAQxB,MAAM,CAAC,wBAAwB,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK;IAKpD,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,GAAG,IAAI;IAoB3D,MAAM,IAAI,SAAS;CAqCrB;AAED,eAAe,aAAa,CAAC"}
@@ -1 +1 @@
1
- import{jsxs as r,jsx as e}from"react/jsx-runtime";import{Component as o}from"react";class t extends o{constructor(r){super(r),this.state={hasError:!1,error:null}}static getDerivedStateFromError(r){return{hasError:!0,error:r}}componentDidCatch(r,e){console.error("Error caught by ErrorBoundary:",r),console.error("Component stack:",e.componentStack)}render(){return this.state.hasError?this.props.fallback||r("div",{style:{padding:"20px",margin:"20px",border:"1px solid #f5c2c7",borderRadius:"5px",backgroundColor:"#f8d7da",color:"#842029"},children:[e("h2",{children:"Something went wrong"}),e("p",{children:"The application encountered an error. Please try refreshing the page."}),r("details",{style:{whiteSpace:"pre-wrap",margin:"10px 0"},children:[e("summary",{children:"Error Details"}),this.state.error?.toString()]}),e("button",{onClick:()=>window.location.reload(),style:{padding:"8px 16px",backgroundColor:"#0d6efd",color:"white",border:"none",borderRadius:"4px",cursor:"pointer"},children:"Refresh Page"})]}):this.props.children}}export{t as default};
1
+ import{jsxs as r,jsx as e}from"react/jsx-runtime";import{Component as o}from"react";import{track as t}from"../utils/telemetry.js";class n extends o{constructor(r){super(r),this.state={hasError:!1,error:null}}static getDerivedStateFromError(r){return{hasError:!0,error:r}}componentDidCatch(r,e){console.error("Error caught by ErrorBoundary:",r),console.error("Component stack:",e.componentStack);try{t({type:"error",name:"react_error_boundary",ok:!1,error:`${r.name}: ${r.message}`,page:"undefined"!=typeof window?window.location.hash.replace(/^#/,"").split("?")[0]:void 0})}catch{}}render(){return this.state.hasError?this.props.fallback||r("div",{style:{padding:"20px",margin:"20px",border:"1px solid #f5c2c7",borderRadius:"5px",backgroundColor:"#f8d7da",color:"#842029"},children:[e("h2",{children:"Something went wrong"}),e("p",{children:"The application encountered an error. Please try refreshing the page."}),r("details",{style:{whiteSpace:"pre-wrap",margin:"10px 0"},children:[e("summary",{children:"Error Details"}),this.state.error?.toString()]}),e("button",{onClick:()=>window.location.reload(),style:{padding:"8px 16px",backgroundColor:"#0d6efd",color:"white",border:"none",borderRadius:"4px",cursor:"pointer"},children:"Refresh Page"})]}):this.props.children}}export{n as default};
@@ -1,4 +1,6 @@
1
1
  import React from "react";
2
+ import { CodicentService } from "../services/codicent";
3
+ import { DataMessagePickerSelection } from "./DataMessagePicker";
2
4
  /** Action configuration for a column, similar to app button actions */
3
5
  export interface ColumnAction {
4
6
  /** Icon component to display (e.g., from @fluentui/react-icons). Pass the component itself, not a string name. */
@@ -16,9 +18,34 @@ export interface ColumnDefinition {
16
18
  hidden?: boolean;
17
19
  hideOnMobile?: boolean;
18
20
  maxWidth?: number;
19
- type?: "file" | "checkbox" | "textarea" | "enum" | "combobox" | "thumbnail" | undefined;
21
+ type?: "file" | "checkbox" | "textarea" | "enum" | "combobox" | "reference" | "thumbnail" | undefined;
20
22
  /** Number of rows for textarea type (default: 3) */
21
23
  rows?: number;
24
+ /**
25
+ * For `type: "reference"` — the data-message tag of the list this column links to (e.g. "sunhero-project").
26
+ * Renders a {@link DataMessagePicker} that searches that list and stores a stable reference to the
27
+ * picked entity. Requires the ListView/ListPage to be given a `service`.
28
+ */
29
+ referenceTag?: string;
30
+ /** Fields on the referenced entity used to build its display label (e.g. ["project_name", "name"]). */
31
+ referenceDisplayKeys?: string[];
32
+ /** Fields on the referenced entity to search against (defaults to referenceDisplayKeys). */
33
+ referenceSearchKeys?: string[];
34
+ /** Static server-side dataFilters always applied when searching the referenced list. */
35
+ referenceFilters?: Record<string, string>;
36
+ /**
37
+ * Cascading: the key of another column on the SAME row whose stored value filters this picker.
38
+ * Combined with {@link referenceCascadeFilterField} to build a dataFilter (e.g. Projekt cascades
39
+ * from the row's `installer` reference so only that installer's projects are offered).
40
+ */
41
+ referenceCascadeFromKey?: string;
42
+ /** The field on the referenced (target) list to match the cascade value against. */
43
+ referenceCascadeFilterField?: string;
44
+ /**
45
+ * Companion field that caches the picked entity's display label so the grid renders without an
46
+ * async id→name lookup. Defaults to `"{key}_label"`. The reference id itself is stored in `key`.
47
+ */
48
+ referenceLabelKey?: string;
22
49
  /** Options for enum type columns (static, small lists) */
23
50
  enumOptions?: string[];
24
51
  /** Async loader for combobox options (e.g. 15k+ customers). Receives the current search text, returns matching options. */
@@ -52,11 +79,37 @@ export interface ListViewProps {
52
79
  onDelete?: (item: Record<string, unknown>, index: number) => void;
53
80
  onToggleCheckbox?: (item: Record<string, unknown>, key: string | string[], newValue: boolean, index: number) => void;
54
81
  onEnumChange?: (item: Record<string, unknown>, key: string | string[], newValue: string, index: number) => void;
82
+ onValueChange?: (item: Record<string, unknown>, key: string | string[], newValue: string, index: number) => void;
83
+ /** Fired when a `type: "reference"` cell picks an entity. Receives the full picker selection. */
84
+ onReferenceChange?: (item: Record<string, unknown>, key: string | string[], selection: DataMessagePickerSelection, index: number) => void;
85
+ /** Required to render `type: "reference"` columns (used by the embedded DataMessagePicker to search). */
86
+ service?: CodicentService;
55
87
  onFilteredDataChange?: (filteredData: Record<string, unknown>[]) => void;
88
+ /** Fired when column filters become active/inactive. Lets the parent load the full dataset so client-side filters cover all rows. */
89
+ onActiveFiltersChange?: (hasActiveFilters: boolean) => void;
56
90
  /** Callback to compute a CSS background color for an entire row. Takes precedence over column colorScope:"row". */
57
91
  rowColor?: (row: Record<string, unknown>) => string | undefined;
58
92
  /** Reduces row height to 36px and cell padding for a denser, Excel-like view. Activated via ?compact in the URL. */
59
93
  compact?: boolean;
94
+ /**
95
+ * Optional callback invoked when the user picks files for an empty `type: "file"` cell.
96
+ * When provided, the empty-file placeholder turns into a small "Bifoga" button (with a
97
+ * hidden `<input type="file" />`) instead of a static em-dash. The parent decides what
98
+ * "attach" means for the entity (upload + post child message, etc.). The Promise lets
99
+ * callers show their own progress UI before resolving.
100
+ */
101
+ onAttachFile?: (rowData: Record<string, unknown>, files: File[]) => void | Promise<void>;
102
+ /** When true, shows a leading checkbox column and emits selection changes via onSelectionChange. */
103
+ selectable?: boolean;
104
+ /** Currently selected row keys (originalMessageId / _id). Set externally; ListView is uncontrolled-ish — just renders. */
105
+ selectedRowKeys?: Set<string>;
106
+ /** Fired when the user toggles a single row. */
107
+ onToggleRow?: (rowKey: string, row: Record<string, unknown>) => void;
108
+ /** Fired when the user toggles the header checkbox; receives the currently visible (post-filter) rows. */
109
+ onToggleAll?: (rows: Record<string, unknown>[]) => void;
110
+ /** Raw-data indices (matching `_index` / actualIndex) of rows with an in-flight inline-cell save.
111
+ * Editable controls on these rows are disabled and show a spinner; values revert on failure. */
112
+ savingRows?: Set<number>;
60
113
  }
61
114
  export declare const ListView: React.FC<ListViewProps>;
62
115
  declare const _default: React.NamedExoticComponent<ListViewProps>;
@@ -1 +1 @@
1
- {"version":3,"file":"ListView.d.ts","sourceRoot":"","sources":["../../../src/components/ListView.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAmB5D,uEAAuE;AACvE,MAAM,WAAW,YAAY;IAC3B,kHAAkH;IAClH,IAAI,EAAE,KAAK,CAAC,aAAa,CAAC;IAC1B,uCAAuC;IACvC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iFAAiF;IACjF,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IACpD,oFAAoF;IACpF,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AA4OD,MAAM,WAAW,gBAAgB;IAC/B,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,UAAU,GAAG,MAAM,GAAG,UAAU,GAAG,WAAW,GAAG,SAAS,CAAC;IACxF,oDAAoD;IACpD,IAAI,CAAC,EAAE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CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC9B,gDAAgD;IAChD,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IACrE,0GAA0G;IAC1G,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,KAAK,IAAI,CAAC;IACxD;oGACgG;IAChG,UAAU,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CAC1B;AAmOD,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAwwB5C,CAAC;;AAGF,wBAAoC"}
@@ -1 +1 @@
1
- import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import r,{useMemo as o,useState as i,useEffect as l}from"react";import{makeStyles as a,Select as c,Button as s,Checkbox as d,Dialog as p,DialogSurface as u,DialogBody as h,DialogTitle as m,DialogContent as f,Combobox as g,Option as x,Tooltip as y}from"@fluentui/react-components";import{Edit24Regular as b,Delete24Regular as w,Attach24Regular as C}from"@fluentui/react-icons";import{CodicentService as k}from"../services/codicent.js";import v from"../hooks/useLocalization.js";const S=a({container:{width:"100%",overflowX:"auto",userSelect:"text"},table:{width:"100%",borderCollapse:"collapse",backgroundColor:"#ffffff",fontSize:"14px",tableLayout:"fixed",userSelect:"text"},th:{textAlign:"left",padding:"12px 8px",borderBottom:"2px solid #e0e0e0",fontWeight:"600",backgroundColor:"#f5f5f5",position:"sticky",top:0,zIndex:1,cursor:"pointer",userSelect:"none","&:hover":{backgroundColor:"#e8e8e8"}},td:{padding:"12px 8px",borderBottom:"1px solid #e0e0e0",verticalAlign:"top",wordWrap:"break-word",overflow:"hidden",userSelect:"text"},tdTruncated:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap","@media (hover: none)":{cursor:"pointer"}},tr:{height:"57px","&:hover":{backgroundColor:"#f9f9f9"}},emptyState:{padding:"20px",textAlign:"center",color:"#666"},sortIndicator:{marginLeft:"4px",fontSize:"10px"},hideOnMobile:{"@media (max-width: 768px)":{display:"none"}},dialogContent:{wordWrap:"break-word",whiteSpace:"pre-wrap",maxHeight:"60vh",overflowY:"auto"},thumbnail:{maxWidth:"50px",maxHeight:"50px",objectFit:"cover"},tooltip:{maxWidth:"600px",whiteSpace:"normal",wordWrap:"break-word"},editButton:{minWidth:"auto",padding:"4px 8px"},actionsColumn:{width:"100px",textAlign:"center"},filterInput:{width:"100%",padding:"4px 8px",fontSize:"14px",border:"1px solid #e0e0e0",borderRadius:"4px",paddingRight:"28px"},filterWrapper:{position:"relative"},clearFilterButton:{position:"absolute",right:"6px",top:"50%",transform:"translateY(-50%)",minWidth:"auto",height:"20px",padding:"0 6px",lineHeight:"18px"},filterToolbar:{display:"flex",justifyContent:"flex-end",padding:"8px",gap:"8px"},cellWithAction:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"4px"},actionIcon:{minWidth:"auto",padding:"2px",marginLeft:"4px",flexShrink:0,cursor:"pointer",opacity:.7,"&:hover":{opacity:1}},thumbnailRow:{display:"flex",gap:"4px",flexWrap:"wrap"},cellText:{flex:1,overflow:"hidden",textOverflow:"ellipsis"},badge:{borderRadius:"12px",padding:"2px 8px",fontSize:"12px",fontWeight:"600",display:"inline-block",whiteSpace:"nowrap"},tdCompact:{paddingTop:"4px",paddingBottom:"4px"}}),N=e=>{if(/^\d{4}-\d{2}-\d{2}/.test(e)){const t=new Date(e);if(!isNaN(t.getTime()))return t.getTime()}const t=e.match(/^(\d{1,2})\.(\d{1,2})\.(\d{4})/);if(t){const e=parseInt(t[1],10),n=parseInt(t[2],10)-1,r=parseInt(t[3],10),o=new Date(r,n,e);if(o.getFullYear()===r&&o.getMonth()===n&&o.getDate()===e)return o.getTime()}return null},W=e=>{const t=e.trim().replace(/[\s\u00a0]/g,"");if(""===t||"-"===t)return null;const n=(t.match(/,/g)||[]).length,r=(t.match(/\./g)||[]).length;let o;o=1===n&&0===r?/,\d{1,2}$/.test(t)?t.replace(/,\d+$/,"").replace(/[^0-9-]/g,""):t.replace(/,/g,""):1===r&&0===n?/\.\d{1,2}$/.test(t)?t.replace(/\.\d+$/,"").replace(/[^0-9-]/g,""):t.replace(/\./g,""):t.replace(/[,.]/g,"");const i=Number(o);return""!==o&&isFinite(i)?i:null},$=(e,t)=>{if("string"==typeof t)return e[t];for(const n of t)if(void 0!==e[n])return e[n]},I=new Set,A=a({img:{maxWidth:"40px",maxHeight:"40px",objectFit:"cover",borderRadius:"3px",display:"block"},fileIcon:{width:"24px",height:"24px",verticalAlign:"middle"}}),O=({fileId:t})=>{const[n,r]=i((()=>!I.has(t))),o=A();return e("a",{href:k.getFileUrl(t),target:"_blank",rel:"noopener noreferrer",children:n?e("img",{src:k.getImageUrl(t,40),alt:"",className:o.img,onError:()=>{I.add(t),r(!1)}}):e(C,{className:o.fileIcon})})},M=({value:t,options:n,optionsLoader:a,minChars:c=2,maxResults:s=50,columnKey:d,item:p,actualIndex:u,onEnumChange:h,label:m,t:f})=>{const[y,b]=i(t),[w,C]=i([]),[k,v]=i(!1),S=r.useRef(null);l((()=>{b(t)}),[t]),l((()=>{if(a){if(!(y.length<c))return S.current&&clearTimeout(S.current),S.current=setTimeout((async()=>{v(!0);try{const e=await a(y);C(e.slice(0,s))}finally{v(!1)}}),250),()=>{S.current&&clearTimeout(S.current)};C([])}}),[y,a,c,s]);const N=o((()=>(n??[]).filter((e=>e.toLowerCase().includes(y.toLowerCase()))).slice(0,s)),[n,y,s]),W=a?w:N;return e(g,{value:y,freeform:!0,"aria-label":m,placeholder:k?f("Loading..."):a&&y.length<c?f(`Type ${c}+ characters to search...`):void 0,onChange:e=>b(e.target.value),onOptionSelect:(e,t)=>{t.optionValue&&(b(t.optionValue),h&&h(p,d,t.optionValue,u))},onBlur:()=>{h&&h(p,d,y,u)},style:{width:"100%"},children:W.map((t=>e(x,{value:t,children:t},t)))})},L=({data:a,columns:g,canEdit:x,onEdit:C,onDelete:I,onToggleCheckbox:A,onEnumChange:L,onFilteredDataChange:T,rowColor:F,compact:j})=>{const R=S(),{visibleColumns:B,defaultSortIndex:D,defaultSortDirection:E}=o((()=>{const e=a&&a.length>0?Array.from(new Set(a.flatMap((e=>Object.keys(e))))):[],t=(g||e.map((e=>({key:e})))).filter((e=>!e.hidden)),n=t.findIndex((e=>e.defaultSort));return{visibleColumns:t,defaultSortIndex:n,defaultSortDirection:n>=0&&t[n].defaultSort||null}}),[a,g]),[z,H]=i(D>=0?D:null),[_,P]=i(E),[Y,U]=i(!1),[V,K]=i({title:"",text:""}),[q,J]=i({}),[X,G]=i(0),Q=r.useRef(null),{t:Z}=v(),ee=j?36:57;r.useEffect((()=>()=>{null!==Q.current&&cancelAnimationFrame(Q.current)}),[]);const te=e=>e.title?Z(e.title):Array.isArray(e.key)?e.key[0]:e.key,ne=e=>{const t=[];return e.hideOnMobile&&t.push(R.hideOnMobile),t.join(" ")},re=(e,t)=>{J((n=>{const r={...n};return""===t.trim()?delete r[e]:r[e]=t,r}))},oe=e=>null==e||"string"==typeof e&&e.startsWith("[")&&e.endsWith("]")?"":"object"==typeof e?JSON.stringify(e):String(e),ie=o((()=>{const e=[...a];if(null!==z&&_){const t=B[z];e.sort(((e,n)=>{const r=$(e,t.key),o=$(n,t.key);if(null==r)return 1;if(null==o)return-1;let i=0;if("string"==typeof r&&"string"==typeof o){const e=N(r),t=N(o);if(null!==e&&null!==t)i=e-t;else{const e=W(r),t=W(o);i=null!==e&&null!==t?e-t:r.localeCompare(o)}}else if("number"==typeof r&&"number"==typeof o)i=r-o;else{const e=W(String(r)),t=W(String(o));i=null!==e&&null!==t?e-t:String(r).localeCompare(String(o))}return"asc"===_?i:-i}))}return e}),[a,z,_,B]),le=o((()=>ie.filter((e=>{for(const[t,n]of Object.entries(q)){const r=parseInt(t),o=B[r],i=$(e,o.key),l=oe(i).toLowerCase(),a=n.toLowerCase();if(!("enum"===o.type&&o.enumOptions?l===a:l.includes(a)))return!1}return!0}))),[ie,q,B]);l((()=>{T&&T(le)}),[le,T]);const ae="undefined"!=typeof window?window.innerHeight-250:600,ce=Math.max(0,Math.floor(X/ee)-5),se=Math.min(le.length,Math.ceil((X+ae)/ee)+5),de=le.slice(ce,se),pe=le.length*ee,ue=ce*ee,he=(e,t)=>{if(void 0!==e.id)return String(e.id);if(void 0!==e._id)return String(e._id);if(void 0!==e.originalMessageId)return String(e.originalMessageId);return`row-${t}-${(e=>{let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return Math.abs(t)})(B.slice(0,3).map((t=>String($(e,t.key)??""))).join("-"))}`};return a&&0!==a.length?t(n,{children:[e("div",{className:R.container,onScroll:e=>{const t=e.currentTarget.scrollTop;null!==Q.current&&cancelAnimationFrame(Q.current),Q.current=requestAnimationFrame((()=>{G(t),Q.current=null}))},style:{maxHeight:"calc(100vh - 200px)",overflowY:"auto"},children:t("table",{className:R.table,children:[t("thead",{children:[t("tr",{children:[B.map(((n,r)=>{const o=n.maxWidth?{width:`${n.maxWidth}px`,maxWidth:`${n.maxWidth}px`}:{};return t("th",{className:`${R.th} ${ne(n)}`.trim(),style:o,onClick:()=>(e=>{z===e?"asc"===_?P("desc"):"desc"===_&&(H(null),P(null)):(H(e),P("asc"))})(r),children:[te(n),z===r&&e("span",{className:R.sortIndicator,children:"asc"===_?"▲":"▼"})]},r)})),x&&e("th",{className:`${R.th} ${R.actionsColumn}`,style:{width:"100px"},children:Z("Actions")})]}),t("tr",{children:[B.map(((r,o)=>{const i=r.maxWidth?{width:`${r.maxWidth}px`,maxWidth:`${r.maxWidth}px`}:{};return e("th",{className:ne(r),style:i,children:r.filterable&&e("div",{className:R.filterWrapper,children:"enum"===r.type&&r.enumOptions?t(c,{className:R.filterInput,value:q[o]||"",onChange:(e,t)=>re(o,t.value),onClick:e=>e.stopPropagation(),children:[e("option",{value:"",children:Z("All")}),r.enumOptions.filter((e=>""!==e)).map((t=>e("option",{value:t,children:Z(t)},t)))]}):t(n,{children:[e("input",{type:"text",className:R.filterInput,placeholder:Z("Filter")+"...",value:q[o]||"",onChange:e=>re(o,e.target.value),onClick:e=>e.stopPropagation()}),(q[o]||"").length>0&&e(s,{appearance:"subtle",className:R.clearFilterButton,onClick:e=>{e.stopPropagation(),(e=>{J((t=>{const n={...t};return delete n[e],n}))})(o)},children:"×"})]})})},o)})),x&&e("th",{className:R.actionsColumn})]})]}),t("tbody",{children:[ce>0&&e("tr",{style:{height:`${ue}px`},children:e("td",{colSpan:B.length+(x?1:0),style:{padding:0,border:"none"}})}),de.map(((n,r)=>{const o=n._index,i="number"==typeof o?o:ce+r;let l;if(F&&(l=F(n)),!l)for(const e of B)if("row"===e.colorScope&&e.colorMap){const t=e.format?e.format($(n,e.key)):oe($(n,e.key));if(l=e.colorMap[t],l)break}return t("tr",{className:R.tr,style:{height:`${ee}px`,...l?{backgroundColor:l}:{}},children:[B.map(((r,o)=>{const l=$(n,r.key),a=r.format?r.format(l):oe(l),p=r.maxWidth?`${R.td} ${R.tdTruncated} ${j?R.tdCompact:""} ${ne(r)}`.trim():`${R.td} ${j?R.tdCompact:""} ${ne(r)}`.trim(),u=r.colorFn?r.colorFn(l,n):r.colorMap&&"row"!==r.colorScope?r.colorMap[a]:void 0,h=()=>{window.matchMedia("(hover: hover)").matches||r.maxWidth&&a.length>0&&(K({title:te(r),text:a}),U(!0))};if("thumbnail"===r.type){const t=Array.isArray(l)?l:[];return e("td",{className:p,children:e("div",{className:R.thumbnailRow,children:t.map((t=>e(O,{fileId:t},t)))})},o)}if("file"===r.type&&a)return e("td",{className:p,onClick:h,children:e("a",{href:k.getFileUrl(a),target:"_blank",rel:"noopener noreferrer",children:Z("Download")})},o);if("checkbox"===r.type){return e("td",{className:p,children:e(d,{checked:!0===l||"true"===l||"yes"===l||"1"===l,onChange:(e,t)=>{A&&A(n,r.key,!0===t.checked,i)}})},o)}if("enum"===r.type&&r.enumOptions&&r.editable)return e("td",{className:p,children:t(c,{value:a,"aria-label":r.title?Z(r.title):Array.isArray(r.key)?r.key[0]:r.key,onChange:(e,t)=>{L&&L(n,r.key,t.value,i)},style:{width:"100%"},children:[!r.enumOptions.includes(a)&&a&&e("option",{value:a,children:a}),r.enumOptions.map((t=>e("option",{value:t,children:Z(t)},t)))]})},o);if("combobox"===r.type&&r.editable&&(r.enumOptions||r.enumOptionsLoader))return e("td",{className:p,children:e(M,{value:a,options:r.enumOptions,optionsLoader:r.enumOptionsLoader,minChars:r.enumOptionsLoaderMinChars,maxResults:r.enumOptionsLoaderMaxResults,columnKey:r.key,item:n,actualIndex:i,onEnumChange:L,label:r.title?Z(r.title):Array.isArray(r.key)?r.key[0]:r.key,t:Z})},o);const m=()=>{if(r.badge&&r.colorMap){const t=r.colorMap[a];return e("span",{className:R.badge,style:t?{backgroundColor:t}:{backgroundColor:"#e0e0e0"},children:a})}return r.maxWidth&&a.length>0?e(y,{content:{children:a,style:{maxWidth:"600px",whiteSpace:"normal"}},relationship:"description",children:e("span",{children:a})}):a},f=()=>{if(!r.action)return null;const t=r.action,o=r.action.icon,i=e(s,{appearance:"subtle",icon:e(o,{}),className:R.actionIcon,onClick:e=>{e.stopPropagation(),t.onClick(n)},size:"small"});return t.tooltip?e(y,{content:Z(t.tooltip),relationship:"label",children:i}):i};return e("td",{className:p,style:u?{backgroundColor:u}:void 0,onClick:h,children:r.action?t("div",{className:R.cellWithAction,children:[r.action.iconLeft&&f(),e("span",{className:R.cellText,children:m()}),!r.action.iconLeft&&f()]}):m()},o)})),x&&(C||I)&&e("td",{className:`${R.td} ${R.actionsColumn}`,children:t("div",{style:{display:"flex",gap:"4px",justifyContent:"center"},children:[C&&e(s,{appearance:"subtle",icon:e(b,{}),className:R.editButton,onClick:()=>C(n,i),title:Z("Edit")}),I&&e(s,{appearance:"subtle",icon:e(w,{}),className:R.editButton,onClick:()=>I(n,i),title:Z("Delete")})]})})]},he(n,i))})),se<le.length&&e("tr",{style:{height:pe-ue-de.length*ee+"px"},children:e("td",{colSpan:B.length+(x?1:0),style:{padding:0,border:"none"}})})]})]})}),e(p,{open:Y,onOpenChange:(e,t)=>U(t.open),children:e(u,{children:t(h,{children:[e(m,{children:V.title}),e(f,{className:R.dialogContent,children:V.text})]})})})]}):e("div",{className:R.emptyState,children:Z("No data to display")})};var T=r.memo(L);export{L as ListView,T as default};
1
+ import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import r,{useMemo as i,useState as l,useEffect as a}from"react";import{makeStyles as o,Checkbox as c,Select as s,Button as d,Dialog as p,DialogSurface as u,DialogBody as h,DialogTitle as m,DialogContent as f,Combobox as g,Option as x,Textarea as y,Input as b,Spinner as C,Tooltip as v}from"@fluentui/react-components";import{Edit24Regular as k,Delete24Regular as w,Attach24Regular as S}from"@fluentui/react-icons";import{CodicentService as N}from"../services/codicent.js";import I from"../hooks/useLocalization.js";import W from"./DataMessagePicker.js";const A=o({container:{width:"100%",overflowX:"auto",userSelect:"text"},table:{width:"100%",borderCollapse:"collapse",backgroundColor:"#ffffff",fontSize:"14px",tableLayout:"fixed",userSelect:"text"},th:{textAlign:"left",padding:"12px 8px",borderBottom:"2px solid #e0e0e0",fontWeight:"600",backgroundColor:"#f5f5f5",position:"sticky",top:0,zIndex:1,cursor:"pointer",userSelect:"none","&:hover":{backgroundColor:"#e8e8e8"}},td:{padding:"12px 8px",borderBottom:"1px solid #e0e0e0",verticalAlign:"top",wordWrap:"break-word",overflow:"hidden",userSelect:"text"},tdTruncated:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap","@media (hover: none)":{cursor:"pointer"}},tdWrap:{whiteSpace:"pre-wrap",wordBreak:"break-word",overflow:"hidden",maxHeight:"6.5em",lineHeight:"1.4"},tr:{height:"57px","&:hover":{backgroundColor:"#f9f9f9"}},emptyState:{padding:"20px",textAlign:"center",color:"#666"},sortIndicator:{marginLeft:"4px",fontSize:"10px"},hideOnMobile:{"@media (max-width: 768px)":{display:"none"}},dialogContent:{wordWrap:"break-word",whiteSpace:"pre-wrap",maxHeight:"60vh",overflowY:"auto"},thumbnail:{maxWidth:"50px",maxHeight:"50px",objectFit:"cover"},tooltip:{maxWidth:"600px",whiteSpace:"normal",wordWrap:"break-word"},editButton:{minWidth:"auto",padding:"4px 8px"},actionsColumn:{width:"100px",textAlign:"center"},filterInput:{width:"100%",padding:"4px 8px",fontSize:"14px",border:"1px solid #e0e0e0",borderRadius:"4px",paddingRight:"28px"},filterSelect:{width:"100%",padding:"4px 8px",paddingRight:"8px",fontSize:"14px",border:"1px solid #c8c6c4",borderRadius:"4px",backgroundColor:"#fff",cursor:"pointer"},filterWrapper:{position:"relative"},clearFilterButton:{position:"absolute",right:"6px",top:"50%",transform:"translateY(-50%)",minWidth:"auto",height:"20px",padding:"0 6px",lineHeight:"18px"},filterToolbar:{display:"flex",justifyContent:"flex-end",padding:"8px",gap:"8px"},cellWithAction:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"4px"},actionIcon:{minWidth:"auto",padding:"2px",marginLeft:"4px",flexShrink:0,cursor:"pointer",opacity:.7,"&:hover":{opacity:1}},thumbnailRow:{display:"flex",gap:"4px",flexWrap:"wrap"},cellText:{flex:1,overflow:"hidden",textOverflow:"ellipsis"},badge:{borderRadius:"12px",padding:"2px 8px",fontSize:"12px",fontWeight:"600",display:"inline-block",whiteSpace:"nowrap"},tdCompact:{paddingTop:"4px",paddingBottom:"4px"}}),$=(e,t,n)=>{if(t<1||t>12||n<1||n>31)return null;const r=new Date(e,t-1,n);return r.getFullYear()===e&&r.getMonth()===t-1&&r.getDate()===n?r.getTime():null},F=e=>{const t=e.trim();if(!t)return null;if(/^\d{4}-\d{2}-\d{2}/.test(t)){const e=new Date(t);if(!isNaN(e.getTime()))return e.getTime()}let n=t.match(/^(\d{4})[/.](\d{1,2})[/.](\d{1,2})/);if(n){const e=$(parseInt(n[1],10),parseInt(n[2],10),parseInt(n[3],10));if(null!==e)return e}if(n=t.match(/^(\d{1,2})[/.-](\d{1,2})[/.-](\d{4})/),n){const e=$(parseInt(n[3],10),parseInt(n[2],10),parseInt(n[1],10));if(null!==e)return e}if(n=t.match(/^(\d{4})(\d{2})(\d{2})$/),n){const e=$(parseInt(n[1],10),parseInt(n[2],10),parseInt(n[3],10));if(null!==e)return e}return null},O=e=>{const t=e.trim().replace(/[\s\u00a0]/g,"");if(""===t||"-"===t)return null;const n=(t.match(/,/g)||[]).length,r=(t.match(/\./g)||[]).length;let i;i=1===n&&0===r?/,\d{1,2}$/.test(t)?t.replace(/,\d+$/,"").replace(/[^0-9-]/g,""):t.replace(/,/g,""):1===r&&0===n?/\.\d{1,2}$/.test(t)?t.replace(/\.\d+$/,"").replace(/[^0-9-]/g,""):t.replace(/\./g,""):t.replace(/[,.]/g,"");const l=Number(i);return""!==i&&isFinite(l)?l:null},M=(e,t)=>{if("string"==typeof t)return e[t];for(const n of t)if(void 0!==e[n])return e[n]},T=e=>e.referenceLabelKey??`${Array.isArray(e.key)?e.key[0]:e.key}_label`,L=(e,t)=>{if("reference"===t.type){const n=M(e,T(t));if(null!=n&&""!==String(n))return n}return M(e,t.key)},R=new Set,j=o({img:{maxWidth:"40px",maxHeight:"40px",objectFit:"cover",borderRadius:"3px",display:"block"},fileIcon:{width:"24px",height:"24px",verticalAlign:"middle"}}),D=({fileId:t})=>{const[n,r]=l((()=>!R.has(t))),i=j();return e("a",{href:N.getFileUrl(t),target:"_blank",rel:"noopener noreferrer",children:n?e("img",{src:N.getImageUrl(t,40),alt:"",className:i.img,onError:()=>{R.add(t),r(!1)}}):e(S,{className:i.fileIcon})})},K=({value:t,options:n,optionsLoader:o,minChars:c=2,maxResults:s=50,columnKey:d,item:p,actualIndex:u,onEnumChange:h,label:m,t:f,isSaving:y})=>{const[b,C]=l(t),[v,k]=l([]),[w,S]=l(!1),N=r.useRef(null);a((()=>{C(t)}),[t]),a((()=>{y||C(t)}),[y,t]),a((()=>{if(o){if(!(b.length<c))return N.current&&clearTimeout(N.current),N.current=setTimeout((async()=>{S(!0);try{const e=await o(b);k(e.slice(0,s))}finally{S(!1)}}),250),()=>{N.current&&clearTimeout(N.current)};k([])}}),[b,o,c,s]);const I=i((()=>(n??[]).filter((e=>e.toLowerCase().includes(b.toLowerCase()))).slice(0,s)),[n,b,s]),W=o?v:I;return e(g,{value:b,freeform:!0,disabled:y,"aria-label":m,placeholder:y?f("Sparar..."):w?f("Loading..."):o&&b.length<c?f(`Type ${c}+ characters to search...`):void 0,onChange:e=>C(e.target.value),onOptionSelect:(e,t)=>{t.optionValue&&(C(t.optionValue),h&&h(p,d,t.optionValue,u))},onBlur:()=>{h&&h(p,d,b,u)},style:{width:"100%"},children:W.map((t=>e(x,{value:t,children:t},t)))})},B=({value:t,columnKey:n,item:r,actualIndex:i,multiline:o,rows:c,onValueChange:s,isSaving:d})=>{const[p,u]=l(t);a((()=>{u(t)}),[t]),a((()=>{d||u(t)}),[d,t]);const h=()=>{s&&p!==t&&s(r,n,p,i)};return o?e(y,{value:p,rows:c??3,resize:"vertical",disabled:d,onChange:e=>u(e.target.value),onBlur:h}):e(b,{value:p,disabled:d,contentAfter:d?e(C,{size:"tiny"}):void 0,onChange:e=>u(e.target.value),onBlur:h,onKeyDown:e=>{"Enter"===e.key&&e.currentTarget.blur()}})},z=({data:o,columns:g,canEdit:x,onEdit:y,onDelete:b,onToggleCheckbox:C,onEnumChange:S,onValueChange:$,onReferenceChange:R,service:j,onFilteredDataChange:z,onActiveFiltersChange:E,rowColor:H,compact:P,onAttachFile:_,selectable:V,selectedRowKeys:Y,onToggleRow:U,onToggleAll:q,savingRows:J})=>{const X=A(),{visibleColumns:G,defaultSortIndex:Q,defaultSortDirection:Z}=i((()=>{const e=o&&o.length>0?Array.from(new Set(o.flatMap((e=>Object.keys(e))))):[],t=(g||e.map((e=>({key:e})))).filter((e=>!e.hidden)),n=t.findIndex((e=>e.defaultSort));return{visibleColumns:t,defaultSortIndex:n,defaultSortDirection:n>=0&&t[n].defaultSort||null}}),[o,g]),[ee,te]=l(Q>=0?Q:null),[ne,re]=l(Z),[ie,le]=l(!1),[ae,oe]=l({title:"",text:""}),[ce,se]=l({}),[de,pe]=l(0),ue=r.useRef(null),{t:he}=I(),me=P?36:57;r.useEffect((()=>()=>{null!==ue.current&&cancelAnimationFrame(ue.current)}),[]);const fe=e=>e.title?he(e.title):Array.isArray(e.key)?e.key[0]:e.key,ge=e=>{const t=[];return e.hideOnMobile&&t.push(X.hideOnMobile),t.join(" ")},xe=(e,t)=>{se((n=>{const r={...n};return""===t.trim()?delete r[e]:r[e]=t,r}))},ye=e=>null==e||"string"==typeof e&&e.startsWith("[")&&e.endsWith("]")?"":"object"==typeof e?JSON.stringify(e):String(e),be=i((()=>{const e=[...o];if(null!==ee&&ne){const t=G[ee];e.sort(((e,n)=>{const r=M(e,t.key),i=M(n,t.key);if(null==r)return 1;if(null==i)return-1;let l=0;if("string"==typeof r&&"string"==typeof i){const e=F(r),t=F(i);if(null!==e&&null!==t)l=e-t;else{const e=O(r),t=O(i);l=null!==e&&null!==t?e-t:r.localeCompare(i)}}else if("number"==typeof r&&"number"==typeof i)l=r-i;else{const e=O(String(r)),t=O(String(i));l=null!==e&&null!==t?e-t:String(r).localeCompare(String(i))}return"asc"===ne?l:-l}))}return e}),[o,ee,ne,G]),Ce=i((()=>be.filter((e=>{for(const[t,n]of Object.entries(ce)){const r=parseInt(t),i=G[r],l=L(e,i),a=ye(l).toLowerCase(),o=n.toLowerCase();if(!("enum"===i.type&&i.enumOptions?a===o:a.includes(o)))return!1}return!0}))),[be,ce,G]);a((()=>{z&&z(Ce)}),[Ce,z]),a((()=>{E&&E(Object.keys(ce).length>0)}),[ce,E]);const ve="undefined"!=typeof window?window.innerHeight-250:600,ke=Math.max(0,Math.floor(de/me)-5),we=Math.min(Ce.length,Math.ceil((de+ve)/me)+5),Se=Ce.slice(ke,we),Ne=Ce.length*me,Ie=ke*me,We=(e,t)=>{if(void 0!==e.id)return String(e.id);if(void 0!==e._id)return String(e._id);if(void 0!==e.originalMessageId)return String(e.originalMessageId);return`row-${t}-${(e=>{let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return Math.abs(t)})(G.slice(0,3).map((t=>String(M(e,t.key)??""))).join("-"))}`};if(!o||0===o.length)return e("div",{className:X.emptyState,children:he("No data to display")});const Ae=e=>String(e.originalMessageId??e._id??e.id??""),$e=V&&o.length>0&&o.every((e=>Y?.has(Ae(e)))),Fe=V&&!$e&&o.some((e=>Y?.has(Ae(e))));return t(n,{children:[e("div",{className:X.container,onScroll:e=>{const t=e.currentTarget.scrollTop;null!==ue.current&&cancelAnimationFrame(ue.current),ue.current=requestAnimationFrame((()=>{pe(t),ue.current=null}))},style:{maxHeight:"calc(100vh - 200px)",overflowY:"auto"},children:t("table",{className:X.table,children:[t("thead",{children:[t("tr",{children:[V&&e("th",{className:X.th,style:{width:"36px"},onClick:e=>e.stopPropagation(),children:e(c,{checked:!!$e||!!Fe&&"mixed",onChange:()=>q?.(o)})}),G.map(((n,r)=>{const i=n.maxWidth?{width:`${n.maxWidth}px`,maxWidth:`${n.maxWidth}px`}:{};return t("th",{className:`${X.th} ${ge(n)}`.trim(),style:i,onClick:()=>(e=>{ee===e?"asc"===ne?re("desc"):"desc"===ne&&(te(null),re(null)):(te(e),re("asc"))})(r),children:[fe(n),ee===r&&e("span",{className:X.sortIndicator,children:"asc"===ne?"▲":"▼"})]},r)})),x&&e("th",{className:`${X.th} ${X.actionsColumn}`,style:{width:"100px"},children:he("Actions")})]}),t("tr",{children:[V&&e("th",{style:{width:"36px"}}),G.map(((r,i)=>{const l=r.maxWidth?{width:`${r.maxWidth}px`,maxWidth:`${r.maxWidth}px`}:{};return e("th",{className:ge(r),style:l,children:r.filterable&&e("div",{className:X.filterWrapper,children:"enum"===r.type&&r.enumOptions?t(s,{className:X.filterSelect,value:ce[i]||"",onChange:(e,t)=>xe(i,t.value),onClick:e=>e.stopPropagation(),children:[e("option",{value:"",children:he("All")}),r.enumOptions.filter((e=>""!==e)).map((t=>e("option",{value:t,children:he(t)},t)))]}):t(n,{children:[e("input",{type:"text",className:X.filterInput,placeholder:he("Filter")+"...",value:ce[i]||"",onChange:e=>xe(i,e.target.value),onClick:e=>e.stopPropagation()}),(ce[i]||"").length>0&&e(d,{appearance:"subtle",className:X.clearFilterButton,onClick:e=>{e.stopPropagation(),(e=>{se((t=>{const n={...t};return delete n[e],n}))})(i)},children:"×"})]})})},i)})),x&&e("th",{className:X.actionsColumn})]})]}),t("tbody",{children:[ke>0&&e("tr",{style:{height:`${Ie}px`},children:e("td",{colSpan:G.length+(x?1:0)+(V?1:0),style:{padding:0,border:"none"}})}),Se.map(((n,r)=>{const i=n._index,l="number"==typeof i?i:ke+r,a=J?.has(l)??!1;let o;if(H&&(o=H(n)),!o)for(const e of G)if("row"===e.colorScope&&e.colorMap){const t=e.format?e.format(M(n,e.key)):ye(M(n,e.key));if(o=e.colorMap[t],o)break}return t("tr",{className:X.tr,style:{height:`${me}px`,...o?{backgroundColor:o}:{}},children:[V&&e("td",{className:`${X.td} ${P?X.tdCompact:""}`.trim(),style:{width:"36px"},onClick:e=>e.stopPropagation(),children:e(c,{checked:Y?.has(Ae(n))??!1,onChange:()=>U?.(Ae(n),n)})}),G.map(((r,i)=>{const o=M(n,r.key),p=ye(o);let u=r.format?r.format(o):p;"reference"===r.type&&(u=ye(M(n,T(r)))||u);const h="textarea"===r.type,m=r.maxWidth?`${X.td} ${h?X.tdWrap:X.tdTruncated} ${P?X.tdCompact:""} ${ge(r)}`.trim():`${X.td} ${h?X.tdWrap:""} ${P?X.tdCompact:""} ${ge(r)}`.trim(),f=r.colorFn?r.colorFn(o,n):r.colorMap&&"row"!==r.colorScope?r.colorMap[u]:void 0,g=()=>{window.matchMedia("(hover: hover)").matches||r.maxWidth&&u.length>0&&(oe({title:fe(r),text:u}),le(!0))};if("thumbnail"===r.type){const t=Array.isArray(o)?o:[];return e("td",{className:m,children:e("div",{className:X.thumbnailRow,children:t.map((t=>e(D,{fileId:t},t)))})},i)}if("file"===r.type)return e("td",u?{className:m,onClick:g,children:e("a",{href:N.getFileUrl(u),target:"_blank",rel:"noopener noreferrer",children:he("Download")})}:_?{className:m,onClick:e=>e.stopPropagation(),children:t("label",{style:{color:"#0078d4",cursor:"pointer",textDecoration:"underline",fontSize:"13px"},title:he("Attach file"),children:[he("Attach"),e("input",{type:"file",style:{display:"none"},onChange:e=>{const t=Array.from(e.target.files||[]);t.length>0&&_(n,t),e.target.value=""}})]})}:{className:m,onClick:g,children:e("span",{style:{color:"#888"},title:he("No file attached"),children:"—"})},i);if("checkbox"===r.type){return e("td",{className:m,children:e(c,{checked:!0===o||"true"===o||"yes"===o||"1"===o,disabled:a,onChange:(e,t)=>{C&&C(n,r.key,!0===t.checked,l)}})},i)}if("enum"===r.type&&r.enumOptions&&r.editable)return e("td",{className:m,style:f?{backgroundColor:f}:void 0,children:t(s,{value:u,disabled:a,"aria-label":r.title?he(r.title):Array.isArray(r.key)?r.key[0]:r.key,onChange:(e,t)=>{S&&S(n,r.key,t.value,l)},style:{width:"100%",...f?{backgroundColor:f}:{}},children:[!r.enumOptions.includes(u)&&u&&e("option",{value:u,children:u}),r.enumOptions.map((t=>e("option",{value:t,children:he(t)},t)))]})},i);if("reference"===r.type&&r.editable&&r.referenceTag&&j){const t=u,o=r.referenceDisplayKeys??[],c=r.referenceCascadeFromKey?ye(M(n,r.referenceCascadeFromKey)):"",s={...r.referenceFilters??{}};return r.referenceCascadeFilterField&&c&&(s[r.referenceCascadeFilterField]=c),e("td",{className:m,children:e(W,{service:j,tag:r.referenceTag,value:t,placeholder:r.title?he(r.title):void 0,displayKeys:o,searchKeys:r.referenceSearchKeys??o,dataFilters:Object.keys(s).length>0?s:void 0,disabled:a,onSelect:e=>R?.(n,r.key,e,l)})},i)}if("combobox"===r.type&&r.editable&&(r.enumOptions||r.enumOptionsLoader))return e("td",{className:m,children:e(K,{value:u,options:r.enumOptions,optionsLoader:r.enumOptionsLoader,minChars:r.enumOptionsLoaderMinChars,maxResults:r.enumOptionsLoaderMaxResults,columnKey:r.key,item:n,actualIndex:l,onEnumChange:S,label:r.title?he(r.title):Array.isArray(r.key)?r.key[0]:r.key,t:he,isSaving:a})},i);if(r.editable)return e("td",{className:m,children:e(B,{value:p,columnKey:r.key,item:n,actualIndex:l,multiline:"textarea"===r.type,rows:r.rows,onValueChange:$,isSaving:a})},i);const x=()=>{if(r.badge&&r.colorMap){const t=r.colorMap[u];return e("span",{className:X.badge,style:t?{backgroundColor:t}:{backgroundColor:"#e0e0e0"},children:u})}return r.maxWidth&&u.length>0?e(v,{content:{children:u,style:{maxWidth:"600px",whiteSpace:"normal"}},relationship:"description",children:e("span",{children:u})}):u},y=()=>{if(!r.action)return null;const t=r.action,i=r.action.icon,l=e(d,{appearance:"subtle",icon:e(i,{}),className:X.actionIcon,onClick:e=>{e.stopPropagation(),t.onClick(n)},size:"small"});return t.tooltip?e(v,{content:he(t.tooltip),relationship:"label",children:l}):l};return e("td",{className:m,style:f?{backgroundColor:f}:void 0,onClick:g,children:r.action?t("div",{className:X.cellWithAction,children:[r.action.iconLeft&&y(),e("span",{className:X.cellText,children:x()}),!r.action.iconLeft&&y()]}):x()},i)})),x&&(y||b)&&e("td",{className:`${X.td} ${X.actionsColumn}`,children:t("div",{style:{display:"flex",gap:"4px",justifyContent:"center"},children:[y&&e(d,{appearance:"subtle",icon:e(k,{}),className:X.editButton,onClick:()=>y(n,l),title:he("Edit")}),b&&e(d,{appearance:"subtle",icon:e(w,{}),className:X.editButton,onClick:()=>b(n,l),title:he("Delete")})]})})]},We(n,l))})),we<Ce.length&&e("tr",{style:{height:Ne-Ie-Se.length*me+"px"},children:e("td",{colSpan:G.length+(x?1:0)+(V?1:0),style:{padding:0,border:"none"}})})]})]})}),e(p,{open:ie,onOpenChange:(e,t)=>le(t.open),children:e(u,{children:t(h,{children:[e(m,{children:ae.title}),e(f,{className:X.dialogContent,children:ae.text})]})})})]})};var E=r.memo(z);export{z as ListView,E as default};
@@ -1 +1 @@
1
- import{jsxs as t,jsx as e}from"react/jsx-runtime";import{useState as i,useRef as o,useEffect as r}from"react";import{makeStyles as a,tokens as s,Card as n,Switch as l,CardHeader as m,Skeleton as d,SkeletonItem as p,Caption1 as c}from"@fluentui/react-components";import{useNavigate as u}from"react-router-dom";import{Edit20Regular as g,FullScreenMaximizeRegular as h,ArrowCollapseAllRegular as j,ArrowExpandAllRegular as f}from"@fluentui/react-icons";import{CodicentService as x}from"../services/codicent.js";import S from"./Markdown.js";import"./Textarea.js";import"./Button.js";import"./CompoundButton.js";import{Text as w}from"./Text.js";import"./Spinner.js";import"./TextHeader.js";import"./TypingIndicator.js";import"./Dialog.js";import"./ChatInput.js";import"./CombinedPlaceholderDialog.js";import"./ChatMessage.js";import"./Header.js";import b from"../utils/MessageContent.js";import"../node_modules/tinycolor2/esm/tinycolor.js";import"../_virtual/index.js";import{getConfigValue as O}from"../config/index.js";import"../utils/cacheManager.js";import"../lib/wavtools/lib/wav_packer.js";import"../lib/wavtools/lib/analysis/audio_analysis.js";import"../lib/wavtools/lib/wav_stream_player.js";import"../lib/wavtools/lib/wav_recorder.js";import"exceljs";import"../pages/AppFrame.js";import"../pages/Canvas.js";import"../pages/Chat.js";import"../pages/Compose.js";import"../pages/Snap.js";import"../pages/Search.js";import"../pages/Menu.js";import"../pages/Log.js";import"../pages/Login.js";import"../pages/Home.js";import"../pages/ListPage.js";import"../pages/CrmPage.js";import"../pages/CrmPagePersistent.js";import"../pages/ImageView.js";import"../pages/FormInvite.js";import"../pages/FormAccept.js";import"../pages/Sales.js";import"../pages/Purchase.js";import"./Content.js";import"./Page.js";import"../pages/QrScan.js";import A from"../hooks/useLocalization.js";import{FileThumbnail as _}from"./FileThumbnail.js";import"react-dom/client";import"../node_modules/@auth0/auth0-react/dist/auth0-react.esm.js";import"../hooks/useAppStyles.js";import"./MessageInput.js";import"./UploadFile.js";import"./SnapFooter.js";import"./Profile.js";import"./AiInput.js";import"./SearchBox.js";import"./DataMessagePicker.js";import"./HtmlView.js";import"./Footer.js";import"./QrCodeDialog.js";import"./QrScanner.js";import"./OfflineMessage.js";import"./LanguageSelector.js";import"./ListView.js";import"./RecordModal.js";import"./BulkUploadDialog.js";import"./CookieBanner.js";import"./audit/AuditCircularProgress.js";import"./audit/AuditHorizontalProgress.js";import"./audit/AuditRoleIndicator.js";import"./audit/AuditUnitSwitcher.js";import"./audit/AuditAnswerCell.js";import"./audit/AuditSearchBar.js";import"./audit/AuditFilterChips.js";import"./audit/AuditFilterBar.js";import"./audit/AuditGroupsProgress.js";import"./audit/AuditSummaryDashboard.js";import"./audit/AuditRequirementDialog.js";import"./audit/AuditUnitExportDialog.js";import"./audit/AuditUnitImportDialog.js";import"./audit/AuditBulkExportDialog.js";import"./audit/AuditBulkUploadDialog.js";import"./audit/AuditSortPresets.js";const I=a({iframe:{border:"none",width:"100%",height:"100%"},main:{gap:"36px",display:"flex",flexDirection:"column",flexWrap:"wrap"},card:{minWidth:"300px",maxWidth:"100%",height:"fit-content",marginBottom:"1em",paddingLeft:"1em",maxHeight:"11em",borderRadius:"10px",position:"relative"},expandedCard:{minWidth:"320px",maxWidth:"100%",height:"fit-content",marginBottom:"1em",paddingLeft:"1em",borderRadius:"10px",position:"relative"},text:{margin:"0.5em",whiteSpace:"normal",fontSize:"larger"},caption:{color:s.colorNeutralForeground3},headerImage:{borderRadius:"4px",maxWidth:"44px",maxHeight:"44px"},rectangle:{margin:0,top:"-5px",left:"-2px",width:"5px",position:"absolute",height:"100%"},fileList:{display:"flex",overflowX:"auto",overflowY:"hidden",scrollbarWidth:"thin",msOverflowStyle:"none",padding:"4px",margin:"0 -4px",maxWidth:"100%",boxSizing:"border-box","&::-webkit-scrollbar":{height:"6px"},"&::-webkit-scrollbar-track":{background:"transparent"},"&::-webkit-scrollbar-thumb":{backgroundColor:s.colorNeutralStroke1,borderRadius:"3px"}},htmlButton:{fontSize:"1.5em",cursor:"pointer",marginLeft:"0.5em"},headerButton:{fontSize:"1.5em",cursor:"pointer",marginLeft:"0.5em"},iconButtonRow:{position:"absolute",top:"0.5em",right:"0.5em",display:"flex",alignItems:"center",gap:"0.5em",zIndex:2},content:{overflow:"hidden",transition:"max-height 0.3s ease-out",userSelect:"text"},truncated:{maxHeight:"10em"},header:{display:"flex",flexDirection:"row",gap:"0.5em",alignItems:"center"},todoSwitch:{transform:"scale(0.8)","& .fui-Switch__label":{fontSize:"0.75rem"}}}),k=({header:a,description:s,timestamp:k,timestampTitle:v,text:C,image:E,tags:T,id:N,fileIds:y,codicentService:B,busy:P,onEdit:L,onShowHtmlPreview:D,maxHeightPx:F})=>{const R=I(),H=u(),[G,M]=i(!1),[z,U]=i(!1),[K,W]=i("unknown"),[$,Q]=i(!1),V=o(null),Y=Object.keys(O("LOGBOOK_TAG_DEFINITIONS")),q=Y.find((t=>T.includes(t)))||(y.length>0?Y.find((t=>"file"===t)):void 0),[X,J]=i([]),Z=T.includes("todo"),{t:tt}=A(),et=["TYPE","CUSTOMER","CONTACT","SALESPERSON","MESSAGE","COMPANY","PHONE","EMAIL","WEBSITE","INFO","FÖRETAG","ROLE","KONTAKT"],it=[tt("Typ"),tt("Kund"),tt("Kontakt"),tt("Säljare"),tt("Meddelande"),tt("Företag"),tt("Telefon"),tt("E-post"),tt("Hemsida"),tt("Info"),tt("Företag"),tt("Roll"),tt("Kontakt")];r((()=>{Promise.all(y.map((t=>B.getFileInfo(t)))).then((t=>{J(t)}))}),[B,J,y]),r((()=>{const t=()=>{if(V.current){const t=F??100,e=V.current.scrollHeight>t+(X.length>0?-72:0);U(e)}};return t(),window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)}),[C,X,F]),r((()=>{if(Z){(async()=>{try{const t=await B.getTodoStatus(N);W(t)}catch(t){console.error("Error loading todo status:",t),W("unknown")}})()}}),[Z,N,B]);const ot=()=>M(!G),rt=T.includes("chat")&&(C.includes("#function_result")||C.includes("#finish_reason_function_call")||C.includes("#function_results_batch")||C.includes("#finish_reason_tool_calls_batch")),at=t=>{const e=t.indexOf("```html");if(-1===e)return t;const i=t.indexOf("```",e+7);if(-1===i)return t.substring(e+7);return t.substring(e+7,i)},st=new b(C),nt=st.data,lt=O("LOGBOOK_STRIP_TAGS")?st.content:C,mt=q&&O("LOGBOOK_TAG_DEFINITIONS")[q].editable,dt=q&&O("LOGBOOK_TAG_DEFINITIONS")[q].imageSize||void 0;return t(n,{className:G?R.expandedCard:R.card,style:{backgroundColor:O("MESSAGE_HIDE_BAR")?q?O("LOGBOOK_TAG_DEFINITIONS")[q].color:O("APP_HEADER_COLOR")||"#eee":"#eee",maxHeight:!G&&F?`${F}px`:void 0},onClick:T.includes("chat")?t=>{T.includes("chat")&&(t&&t.stopPropagation(),H("/chat?id="+N))}:void 0,children:[!O("MESSAGE_HIDE_BAR")&&e("div",{className:R.rectangle,style:{backgroundColor:q?O("LOGBOOK_TAG_DEFINITIONS")[q].color:O("APP_HEADER_COLOR")||void 0}}),t("div",{className:R.iconButtonRow,children:[Z&&e(l,{className:R.todoSwitch,checked:"done"===K,onChange:(t,e)=>(async t=>{if(!$){Q(!0);try{const e=t?"done":"undone";await B.updateTodoStatus(N,e)&&W(e)}catch(t){console.error("Error updating todo status:",t)}finally{Q(!1)}}})(e.checked),disabled:$||"unknown"===K,label:tt("done"===K?"Done":"Todo")}),mt&&L&&e(g,{className:R.htmlButton,onClick:()=>L()}),D&&!mt&&T.includes("html")&&e(h,{className:R.htmlButton,onClick:t=>{t.stopPropagation(),D(at(C))}}),z&&!T.includes("chat")&&G&&e(j,{className:R.headerButton,onClick:ot}),z&&!T.includes("chat")&&!G&&e(f,{className:R.headerButton,onClick:ot})]}),e(m,{image:E?e("img",{className:R.headerImage,src:"app_logo.svg",alt:"User"}):null,header:P?e(d,{style:{width:"50%"},children:e(p,{})}):t("div",{className:R.header,children:[e(w,{weight:"semibold",children:a}),k&&e("span",{title:v||void 0,children:e(w,{weight:"regular",children:k})})]}),description:e(c,{className:R.caption,children:s})}),t("div",{ref:V,className:`${R.content} ${G?"":R.truncated}`,style:{maxHeight:!G&&F?`${F}px`:void 0},children:[X.length>0&&e("div",{className:R.fileList,children:X.map((t=>e(_,{file:t,thumbnailSize:dt,getImageUrl:x.getImageUrl,onClick:()=>{t.contentType.startsWith("image")?H(`/image?id=${N}&file=${t.id}`):x.downloadFile(t)}},t.id)))}),P?t(d,{style:{width:"100%"},children:[e(p,{}),e(p,{}),e(p,{}),e(p,{}),e(p,{})]}):e("div",{className:R.text,children:T.includes("html")?e("iframe",{className:R.iframe,title:"html",srcDoc:at(C),sandbox:"allow-same-origin allow-scripts"}):T.includes("crm")&&0===Object.keys(nt).length?e(S,{content:rt?"*"+tt("Tänker")+"...*":nt?(()=>{const t=new RegExp(`(${et.join("|")})\\s*:\\s*`,"gi");return lt.replace(t,((t,e)=>{const i=et.indexOf(e.toUpperCase());-1===i&&console.log("Field not found:",e);return`\n**${-1!==i?it[i]:e}:** `})).trim()})():C}):e(S,{content:rt?"*"+tt("Tänker")+"...*":nt?nt&&Object.keys(nt).length>0?Object.keys(nt).map((t=>{const e=et.indexOf(t.toUpperCase());return`**${-1!==e?it[e]:t}:** ${nt[t]}\n`})).join("\n"):lt:C})})]})]})};export{k as default};
1
+ import{jsxs as t,jsx as e}from"react/jsx-runtime";import{useState as i,useRef as o,useEffect as r}from"react";import{makeStyles as a,tokens as s,Card as n,Switch as l,CardHeader as m,Skeleton as d,SkeletonItem as p,Caption1 as c}from"@fluentui/react-components";import{useNavigate as u}from"react-router-dom";import{Edit20Regular as g,FullScreenMaximizeRegular as h,ArrowCollapseAllRegular as j,ArrowExpandAllRegular as f}from"@fluentui/react-icons";import{CodicentService as x}from"../services/codicent.js";import S from"./Markdown.js";import"./Textarea.js";import"./Button.js";import"./CompoundButton.js";import{Text as w}from"./Text.js";import"./Spinner.js";import"./TextHeader.js";import"./TypingIndicator.js";import"./Dialog.js";import"./ChatInput.js";import"./CombinedPlaceholderDialog.js";import"./ChatMessage.js";import"./Header.js";import b from"../utils/MessageContent.js";import"../node_modules/tinycolor2/esm/tinycolor.js";import"../_virtual/index.js";import{getConfigValue as O}from"../config/index.js";import"../utils/cacheManager.js";import"../lib/wavtools/lib/wav_packer.js";import"../lib/wavtools/lib/analysis/audio_analysis.js";import"../lib/wavtools/lib/wav_stream_player.js";import"../lib/wavtools/lib/wav_recorder.js";import"exceljs";import"../pages/AppFrame.js";import"../pages/Canvas.js";import"../pages/Chat.js";import"../pages/Compose.js";import"../pages/Snap.js";import"../pages/Search.js";import"../pages/Menu.js";import"../pages/Log.js";import"../pages/Login.js";import"../pages/Home.js";import"../pages/ListPage.js";import"../pages/CrmPage.js";import"../pages/CrmPagePersistent.js";import"../pages/ImageView.js";import"../pages/FormInvite.js";import"../pages/FormAccept.js";import"../pages/Sales.js";import"../pages/Purchase.js";import"./Content.js";import"./Page.js";import"../pages/QrScan.js";import A from"../hooks/useLocalization.js";import{FileThumbnail as _}from"./FileThumbnail.js";import"react-dom/client";import"../node_modules/@auth0/auth0-react/dist/auth0-react.esm.js";import"../hooks/useAppStyles.js";import"./MessageInput.js";import"./UploadFile.js";import"./SnapFooter.js";import"./Profile.js";import"./AiInput.js";import"./SearchBox.js";import"./DataMessagePicker.js";import"./HtmlView.js";import"./Footer.js";import"./QrCodeDialog.js";import"./QrScanner.js";import"./OfflineMessage.js";import"./LanguageSelector.js";import"./ListView.js";import"./RecordModal.js";import"./BulkUploadDialog.js";import"./CookieBanner.js";import"./audit/AuditCircularProgress.js";import"./audit/AuditHorizontalProgress.js";import"./audit/AuditRoleIndicator.js";import"./audit/AuditUnitSwitcher.js";import"./audit/AuditAnswerCell.js";import"./audit/AuditSearchBar.js";import"./audit/AuditFilterChips.js";import"./audit/AuditFilterBar.js";import"./audit/AuditGroupsProgress.js";import"./audit/AuditSummaryDashboard.js";import"./audit/AuditRequirementDialog.js";import"./audit/AuditUnitExportDialog.js";import"./audit/AuditUnitImportDialog.js";import"./audit/AuditBulkExportDialog.js";import"./audit/AuditBulkUploadDialog.js";import"./audit/AuditSortPresets.js";const I=a({iframe:{border:"none",width:"100%",height:"100%"},main:{gap:"36px",display:"flex",flexDirection:"column",flexWrap:"wrap"},card:{minWidth:"300px",maxWidth:"100%",height:"fit-content",marginBottom:"1em",paddingLeft:"1em",maxHeight:"11em",borderRadius:"10px",position:"relative"},expandedCard:{minWidth:"320px",maxWidth:"100%",height:"fit-content",marginBottom:"1em",paddingLeft:"1em",borderRadius:"10px",position:"relative"},text:{margin:"0.5em",whiteSpace:"normal",fontSize:"larger"},caption:{color:s.colorNeutralForeground3},headerImage:{borderRadius:"4px",maxWidth:"44px",maxHeight:"44px"},rectangle:{margin:0,top:"-5px",left:"-2px",width:"5px",position:"absolute",height:"100%"},fileList:{display:"flex",overflowX:"auto",overflowY:"hidden",scrollbarWidth:"thin",msOverflowStyle:"none",padding:"4px",margin:"0 -4px",maxWidth:"100%",boxSizing:"border-box","&::-webkit-scrollbar":{height:"6px"},"&::-webkit-scrollbar-track":{background:"transparent"},"&::-webkit-scrollbar-thumb":{backgroundColor:s.colorNeutralStroke1,borderRadius:"3px"}},htmlButton:{fontSize:"1.5em",cursor:"pointer",marginLeft:"0.5em"},headerButton:{fontSize:"1.5em",cursor:"pointer",marginLeft:"0.5em"},iconButtonRow:{position:"absolute",top:"0.5em",right:"0.5em",display:"flex",alignItems:"center",gap:"0.5em",zIndex:2},content:{overflow:"hidden",transition:"max-height 0.3s ease-out",userSelect:"text"},truncated:{maxHeight:"10em"},header:{display:"flex",flexDirection:"row",gap:"0.5em",alignItems:"center"},todoSwitch:{transform:"scale(0.8)","& .fui-Switch__label":{fontSize:"0.75rem"}}}),k=({header:a,description:s,timestamp:k,timestampTitle:v,text:C,image:E,tags:T,id:N,fileIds:y,codicentService:B,busy:P,onEdit:L,onShowHtmlPreview:D,maxHeightPx:F})=>{const R=I(),H=u(),[G,M]=i(!1),[z,U]=i(!1),[K,W]=i("unknown"),[$,Q]=i(!1),V=o(null),Y=Object.keys(O("LOGBOOK_TAG_DEFINITIONS")),q=Y.find((t=>T.includes(t)))||(y.length>0?Y.find((t=>"file"===t)):void 0),[X,J]=i([]),Z=T.includes("todo"),{t:tt}=A(),et=["TYPE","CUSTOMER","CONTACT","SALESPERSON","MESSAGE","COMPANY","PHONE","EMAIL","WEBSITE","INFO","FÖRETAG","ROLE","KONTAKT"],it=[tt("Typ"),tt("Kund"),tt("Kontakt"),tt("Säljare"),tt("Meddelande"),tt("Företag"),tt("Telefon"),tt("E-post"),tt("Hemsida"),tt("Info"),tt("Företag"),tt("Roll"),tt("Kontakt")];r((()=>{Promise.all(y.map((t=>B.getFileInfo(t)))).then((t=>{J(t)}))}),[B,J,y]),r((()=>{const t=()=>{if(V.current){const t=F??100,e=V.current.scrollHeight>t+(X.length>0?-72:0);U(e)}};return t(),window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)}),[C,X,F]),r((()=>{if(Z){(async()=>{try{const t=await B.getTodoStatus(N);W(t)}catch(t){console.error("Error loading todo status:",t),W("unknown")}})()}}),[Z,N,B]);const ot=()=>M(!G),rt=T.includes("chat")&&(C.includes("#function_result")||C.includes("#finish_reason_function_call")||C.includes("#function_results_batch")||C.includes("#finish_reason_tool_calls_batch")),at=t=>{const e=t.indexOf("```html");if(-1===e)return t;const i=t.indexOf("```",e+7);if(-1===i)return t.substring(e+7);return t.substring(e+7,i)},st=new b(C),nt=st.data,lt=O("LOGBOOK_STRIP_TAGS")?st.content:C,mt=q&&O("LOGBOOK_TAG_DEFINITIONS")[q].editable,dt=q&&O("LOGBOOK_TAG_DEFINITIONS")[q].imageSize||void 0;return t(n,{className:G?R.expandedCard:R.card,style:{backgroundColor:O("MESSAGE_HIDE_BAR")?q?O("LOGBOOK_TAG_DEFINITIONS")[q].color:O("APP_HEADER_COLOR")||"#eee":"#eee",maxHeight:!G&&F?`${F}px`:void 0},onClick:T.includes("chat")?t=>{T.includes("chat")&&(t&&t.stopPropagation(),H("/chat?id="+N))}:void 0,children:[!O("MESSAGE_HIDE_BAR")&&e("div",{className:R.rectangle,style:{backgroundColor:q?O("LOGBOOK_TAG_DEFINITIONS")[q].color:O("APP_HEADER_COLOR")||void 0}}),t("div",{className:R.iconButtonRow,children:[Z&&e(l,{className:R.todoSwitch,checked:"done"===K,onChange:(t,e)=>(async t=>{if(!$){Q(!0);try{const e=t?"done":"undone";await B.updateTodoStatus(N,e)&&W(e)}catch(t){console.error("Error updating todo status:",t)}finally{Q(!1)}}})(e.checked),disabled:$||"unknown"===K,label:tt("done"===K?"Done":"Todo")}),mt&&L&&e(g,{className:R.htmlButton,onClick:()=>L()}),D&&!mt&&T.includes("html")&&e(h,{className:R.htmlButton,onClick:t=>{t.stopPropagation(),D(at(C))}}),z&&!T.includes("chat")&&G&&e(j,{className:R.headerButton,onClick:ot}),z&&!T.includes("chat")&&!G&&e(f,{className:R.headerButton,onClick:ot})]}),e(m,{image:E?e("img",{className:R.headerImage,src:"app_logo.svg",alt:"User"}):null,header:P?e(d,{style:{width:"50%"},children:e(p,{})}):t("div",{className:R.header,children:[e(w,{weight:"semibold",children:a}),k&&e("span",{title:v||void 0,children:e(w,{weight:"regular",children:k})})]}),description:e(c,{className:R.caption,children:s})}),t("div",{ref:V,className:`${R.content} ${G?"":R.truncated}`,style:{maxHeight:!G&&F?`${F}px`:void 0},children:[X.length>0&&e("div",{className:R.fileList,children:X.map((t=>e(_,{file:t,thumbnailSize:dt,getImageUrl:x.getImageUrl,onClick:()=>{t.contentType.startsWith("image")?H(`/image?id=${N}&file=${t.id}`):x.downloadFile(t)}},t.id)))}),P?t(d,{style:{width:"100%"},children:[e(p,{}),e(p,{}),e(p,{}),e(p,{}),e(p,{})]}):e("div",{className:R.text,children:T.includes("html")?e("iframe",{className:R.iframe,title:"html",srcDoc:at(C),sandbox:"allow-same-origin allow-scripts"}):T.includes("crm")&&0===Object.keys(nt).length?e(S,{content:rt?"*"+tt("Tänker")+"...*":nt?(()=>{const t=new RegExp(`(${et.join("|")})\\s*:\\s*`,"gi");return lt.replace(t,((t,e)=>{const i=et.indexOf(e.toUpperCase());-1===i&&console.log("Field not found:",e);return`\n**${-1!==i?it[i]:e}:** `})).trim()})():C}):e(S,{content:rt?"*"+tt("Tänker")+"...*":nt?nt&&Object.keys(nt).length>0?Object.keys(nt).map((t=>{const e=et.indexOf(t.toUpperCase());return`**${-1!==e?it[e]:t}:** ${nt[t]??""}\n`})).join("\n"):lt:C})})]})]})};export{k as default};
@@ -1,12 +1,17 @@
1
1
  import React from "react";
2
2
  import { ColumnDefinition } from "./ListView";
3
+ import { CodicentService } from "../services/codicent";
3
4
  export interface RecordModalProps {
4
5
  open: boolean;
5
6
  onClose: () => void;
6
- onSave: (data: Record<string, unknown>) => Promise<void>;
7
+ onSave: (data: Record<string, unknown>, fileIds?: string[]) => Promise<void>;
7
8
  columns: ColumnDefinition[];
8
9
  initialData?: Record<string, unknown>;
9
10
  title?: string;
11
+ /** Service used to upload attachments. Required for the attach control to work. */
12
+ codicentService?: CodicentService;
13
+ /** When true, shows a file-attach control (only while adding a new record). Default off. */
14
+ allowAttachments?: boolean;
10
15
  }
11
16
  export declare const RecordModal: React.FC<RecordModalProps>;
12
17
  export default RecordModal;
@@ -1 +1 @@
1
- {"version":3,"file":"RecordModal.d.ts","sourceRoot":"","sources":["../../../src/components/RecordModal.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAqB5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAwJ9C,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACzD,OAAO,EAAE,gBAAgB,EAAE,CAAC;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CA+KlD,CAAC;AAEF,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"RecordModal.d.ts","sourceRoot":"","sources":["../../../src/components/RecordModal.tsx"],"names":[],"mappings":"AAWA,OAAO,KAA+C,MAAM,OAAO,CAAC;AAwBpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AA0JvD,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7E,OAAO,EAAE,gBAAgB,EAAE,CAAC;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mFAAmF;IACnF,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,4FAA4F;IAC5F,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CA8QlD,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -1 +1 @@
1
- import{jsx as e,jsxs as a}from"react/jsx-runtime";import r,{useState as n,useEffect as l,useMemo as t}from"react";import{makeStyles as o,tokens as i,Dialog as c,DialogSurface as s,DialogBody as d,DialogTitle as m,DialogContent as u,Field as p,Checkbox as h,Textarea as f,Select as g,Input as y,DialogActions as b,Button as x,Combobox as v,Option as C}from"@fluentui/react-components";import{Attach24Regular as k}from"@fluentui/react-icons";import w from"../hooks/useLocalization.js";import{CodicentService as N}from"../services/codicent.js";const L=o({surface:{backgroundColor:i.colorNeutralBackground1,width:"min(calc(100vw - 32px), 560px)",maxWidth:"calc(100vw - 32px)"},content:{display:"flex",flexDirection:"column",gap:"16px",minWidth:"0",maxHeight:"60vh",overflowY:"auto"},field:{display:"flex",flexDirection:"column"},thumbnailRow:{display:"flex",flexWrap:"wrap",gap:"6px",marginTop:"4px"},thumbnailImg:{maxWidth:"60px",maxHeight:"60px",objectFit:"cover",borderRadius:"4px",display:"block"},thumbnailIcon:{width:"32px",height:"32px",verticalAlign:"middle"}}),O=({fileId:a,imgClassName:r,iconClassName:l})=>{const[t,o]=n(!0);return e("a",{href:N.getFileUrl(a),target:"_blank",rel:"noopener noreferrer",children:t?e("img",{src:N.getImageUrl(a,60),alt:`File attachment ${a}`,className:r,onError:()=>o(!1)}):e(k,{className:l})})},A=({value:a,options:o,optionsLoader:i,minChars:c=2,maxResults:s=50,label:d,onChange:m,t:u})=>{const[p,h]=n(a),[f,g]=n([]),[y,b]=n(!1),x=r.useRef(null);l((()=>{h(a)}),[a]),l((()=>{if(i){if(!(p.length<c))return x.current&&clearTimeout(x.current),x.current=setTimeout((async()=>{b(!0);try{const e=await i(p);g(e.slice(0,s))}finally{b(!1)}}),250),()=>{x.current&&clearTimeout(x.current)};g([])}}),[p,i,c,s]);const k=t((()=>(o??[]).filter((e=>e.toLowerCase().includes(p.toLowerCase()))).slice(0,s)),[o,p,s]),w=i?f:k;return e(v,{value:p,freeform:!0,"aria-label":d,placeholder:y?u("Loading..."):i&&p.length<c?u(`Type ${c}+ characters to search...`):void 0,onChange:e=>h(e.target.value),onOptionSelect:(e,a)=>{a.optionValue&&(h(a.optionValue),m(a.optionValue))},onBlur:()=>m(p),style:{width:"100%"},children:w.map((a=>e(C,{value:a,children:a},a)))})},R=({open:r,onClose:t,onSave:o,columns:i,initialData:v,title:C})=>{const k=L(),{t:N}=w(),[R,S]=n({}),[I,T]=n(!1);l((()=>{r&&S(v||{})}),[r,v]);const j=e=>Array.isArray(e.key)?e.key[0]:e.key,E=e=>{if(Array.isArray(e.key))for(const a of e.key)if(void 0!==R[a])return a;return j(e)},F=(e,a)=>{const r=E(e);S((e=>({...e,[r]:a})))},W=i.filter((e=>!e.hidden&&"file"!==e.type&&"thumbnail"!==e.type&&"createdAt"!==j(e))),D=i.filter((e=>!e.hidden&&"thumbnail"===e.type));return e(c,{open:r,onOpenChange:(e,a)=>!I&&!1===a.open&&t(),children:e(s,{className:k.surface,backdrop:{style:{backgroundColor:"rgba(0, 0, 0, 0.4)"}},children:a(d,{children:[e(m,{children:C||N(v?"Edit Record":"Add Record")}),a(u,{className:k.content,children:[D.map(((a,r)=>{const n=j(a),l=a.title||n,t=v?.[n],o=Array.isArray(t)?t:[];return 0===o.length?null:e(p,{label:l,className:k.field,children:e("div",{className:k.thumbnailRow,children:o.map((a=>e(O,{fileId:a,imgClassName:k.thumbnailImg,iconClassName:k.thumbnailIcon},a)))})},`thumb-${r}`)})),W.map(((a,r)=>{const n=j(a),l=(e=>{const a=E(e);return R[a]})(a),t=a.title||n;return"checkbox"===a.type?e(p,{label:t,className:k.field,children:e(h,{checked:!0===l||"true"===l||"yes"===l||"1"===l,onChange:(e,r)=>F(a,r.checked)})},r):"textarea"===a.type?e(p,{label:t,className:k.field,children:e(f,{value:String(l??""),rows:a.rows??3,onChange:(e,r)=>F(a,r.value),placeholder:N("Enter")+" "+t.toLowerCase(),resize:"vertical"})},r):"enum"===a.type&&a.enumOptions?e(p,{label:t,className:k.field,children:e(g,{value:String(l??""),onChange:(e,r)=>F(a,r.value),children:a.enumOptions.map((a=>e("option",{value:a,children:a||N("(None)")},a)))})},r):"combobox"===a.type&&(a.enumOptions||a.enumOptionsLoader)?e(p,{label:t,className:k.field,children:e(A,{value:String(l??""),options:a.enumOptions,optionsLoader:a.enumOptionsLoader,minChars:a.enumOptionsLoaderMinChars,maxResults:a.enumOptionsLoaderMaxResults,label:t,onChange:e=>F(a,e),t:N})},r):e(p,{label:t,className:k.field,children:e(y,{value:String(l??""),onChange:(e,r)=>F(a,r.value),placeholder:N("Enter")+" "+t.toLowerCase()})},r)}))]}),a(b,{children:[e(x,{appearance:"secondary",onClick:t,disabled:I,children:N("Cancel")}),e(x,{appearance:"primary",onClick:async()=>{T(!0);try{await o(R),t()}catch(e){console.error("Failed to save record:",e)}finally{T(!1)}},disabled:I,children:N(I?"Saving...":"Save")})]})]})})})};export{R as RecordModal,R as default};
1
+ import{jsx as e,jsxs as r}from"react/jsx-runtime";import a,{useState as l,useRef as n,useEffect as i,useMemo as t}from"react";import{makeStyles as o,tokens as c,Dialog as s,DialogSurface as d,DialogBody as m,DialogTitle as u,DialogContent as p,MessageBar as h,MessageBarBody as f,Field as g,Checkbox as y,Textarea as b,Select as v,Input as C,Button as x,DialogActions as N,Spinner as k,Combobox as w,Option as S}from"@fluentui/react-components";import{Attach24Regular as L}from"@fluentui/react-icons";import F from"../hooks/useLocalization.js";import{CodicentService as I}from"../services/codicent.js";import O from"./UploadFile.js";import A from"./DataMessagePicker.js";import{formatReference as R}from"../utils/reference.js";const j=o({surface:{backgroundColor:c.colorNeutralBackground1,width:"min(calc(100vw - 32px), 560px)",maxWidth:"calc(100vw - 32px)"},content:{display:"flex",flexDirection:"column",gap:"16px",minWidth:"0",maxHeight:"60vh",overflowY:"auto"},field:{display:"flex",flexDirection:"column"},thumbnailRow:{display:"flex",flexWrap:"wrap",gap:"6px",marginTop:"4px"},thumbnailImg:{maxWidth:"60px",maxHeight:"60px",objectFit:"cover",borderRadius:"4px",display:"block"},thumbnailIcon:{width:"32px",height:"32px",verticalAlign:"middle"}}),K=({fileId:r,imgClassName:a,iconClassName:n})=>{const[i,t]=l(!0);return e("a",{href:I.getFileUrl(r),target:"_blank",rel:"noopener noreferrer",children:i?e("img",{src:I.getImageUrl(r,60),alt:`File attachment ${r}`,className:a,onError:()=>t(!1)}):e(L,{className:n})})},T=({value:r,options:n,optionsLoader:o,minChars:c=2,maxResults:s=50,label:d,onChange:m,t:u})=>{const[p,h]=l(r),[f,g]=l([]),[y,b]=l(!1),v=a.useRef(null);i((()=>{h(r)}),[r]),i((()=>{if(o){if(!(p.length<c))return v.current&&clearTimeout(v.current),v.current=setTimeout((async()=>{b(!0);try{const e=await o(p);g(e.slice(0,s))}finally{b(!1)}}),250),()=>{v.current&&clearTimeout(v.current)};g([])}}),[p,o,c,s]);const C=t((()=>(n??[]).filter((e=>e.toLowerCase().includes(p.toLowerCase()))).slice(0,s)),[n,p,s]),x=o?f:C;return e(w,{value:p,freeform:!0,"aria-label":d,placeholder:y?u("Loading..."):o&&p.length<c?u(`Type ${c}+ characters to search...`):void 0,onChange:e=>h(e.target.value),onOptionSelect:(e,r)=>{r.optionValue&&(h(r.optionValue),m(r.optionValue))},onBlur:()=>m(p),style:{width:"100%"},children:x.map((r=>e(S,{value:r,children:r},r)))})},U=({open:a,onClose:t,onSave:o,columns:c,initialData:w,title:S,codicentService:I,allowAttachments:U})=>{const D=j(),{t:E}=F(),[B,M]=l({}),[W,$]=l(!1),[z,V]=l(null),[H,_]=l([]),[P,Y]=l(!1),q=n(null),G=!!U&&!w&&!!I;i((()=>{a&&(M(w||{}),_([]),Y(!1),V(null))}),[a,w]);const J=e=>Array.isArray(e.key)?e.key[0]:e.key,Q=e=>{if(Array.isArray(e.key))for(const r of e.key)if(void 0!==B[r])return r;return J(e)},X=(e,r)=>{const a=Q(e);M((e=>({...e,[a]:r})))},Z=c.filter((e=>!e.hidden&&"file"!==e.type&&"thumbnail"!==e.type&&"createdAt"!==J(e))),ee=c.filter((e=>!e.hidden&&"thumbnail"===e.type));return e(s,{open:a,onOpenChange:(e,r)=>!W&&!1===r.open&&t(),children:e(d,{className:D.surface,backdrop:{style:{backgroundColor:"rgba(0, 0, 0, 0.4)"}},children:r(m,{children:[e(u,{children:S||E(w?"Edit Record":"Add Record")}),r(p,{className:D.content,children:[z&&e(h,{intent:"error",children:e(f,{children:E("Kunde inte spara")+": "+z})}),ee.map(((r,a)=>{const l=J(r),n=r.title||l,i=w?.[l],t=Array.isArray(i)?i:[];return 0===t.length?null:e(g,{label:n,className:D.field,children:e("div",{className:D.thumbnailRow,children:t.map((r=>e(K,{fileId:r,imgClassName:D.thumbnailImg,iconClassName:D.thumbnailIcon},r)))})},`thumb-${a}`)})),Z.map(((r,a)=>{const l=J(r),n=(e=>{const r=Q(e);return B[r]})(r),i=r.title||l;if("checkbox"===r.type)return e(g,{label:i,className:D.field,children:e(y,{checked:!0===n||"true"===n||"yes"===n||"1"===n,onChange:(e,a)=>X(r,a.checked)})},a);if("textarea"===r.type)return e(g,{label:i,className:D.field,children:e(b,{value:String(n??""),rows:r.rows??3,onChange:(e,a)=>X(r,a.value),placeholder:E("Enter")+" "+i.toLowerCase(),resize:"vertical"})},a);if("enum"===r.type&&r.enumOptions)return e(g,{label:i,className:D.field,children:e(v,{value:String(n??""),onChange:(e,a)=>X(r,a.value),children:r.enumOptions.map((r=>e("option",{value:r,children:E(r||"(None)")},r)))})},a);if("reference"===r.type&&r.referenceTag&&I){const l=J(r),t=r.referenceLabelKey??`${l}_label`,o=r.referenceDisplayKeys??[],c=r.referenceCascadeFromKey?String(B[r.referenceCascadeFromKey]??""):"",s={...r.referenceFilters??{}};return r.referenceCascadeFilterField&&c&&(s[r.referenceCascadeFilterField]=c),e(g,{label:i,className:D.field,children:e(A,{service:I,tag:r.referenceTag,value:String(B[t]??n??""),placeholder:E("Search"),displayKeys:o,searchKeys:r.referenceSearchKeys??o,dataFilters:Object.keys(s).length>0?s:void 0,onSelect:e=>M((a=>({...a,[l]:R(r.referenceTag,e.originalMessageId||e.id),[t]:e.label})))})},a)}return"combobox"===r.type&&(r.enumOptions||r.enumOptionsLoader)?e(g,{label:i,className:D.field,children:e(T,{value:String(n??""),options:r.enumOptions,optionsLoader:r.enumOptionsLoader,minChars:r.enumOptionsLoaderMinChars,maxResults:r.enumOptionsLoaderMaxResults,label:i,onChange:e=>X(r,e),t:E})},a):e(g,{label:i,className:D.field,children:e(C,{value:String(n??""),onChange:(e,a)=>X(r,a.value),placeholder:E("Enter")+" "+i.toLowerCase()})},a)})),G&&r(g,{label:E("Bilagor"),className:D.field,children:[e(x,{appearance:"secondary",icon:e(L,{}),onClick:()=>q.current?.triggerUpload(),disabled:P||W,children:E(P?"Laddar...":"Bifoga fil")}),H.length>0&&e("div",{className:D.thumbnailRow,children:H.map((r=>e(K,{fileId:r,imgClassName:D.thumbnailImg,iconClassName:D.thumbnailIcon},r)))}),e(O,{ref:q,codicentService:I,multiple:!0,onFileUploaded:e=>_((r=>[...r,...e])),onUploading:Y})]})]}),r(N,{children:[e(x,{appearance:"secondary",onClick:t,disabled:W,children:E("Cancel")}),e(x,{appearance:"primary",onClick:async()=>{$(!0),V(null);try{await o(B,H),t()}catch(e){V(e instanceof Error?e.message:String(e))}finally{$(!1)}},disabled:W||P,icon:W?e(k,{size:"tiny"}):void 0,children:E(W?"Saving...":"Save")})]})]})})})};export{U as RecordModal,U as default};
@@ -103,6 +103,7 @@ export interface AppConfigOptions {
103
103
  REALTIME_CONFIG_ENDPOINT: string;
104
104
  SEND_BUTTON_ROUND_BACKGROUND: boolean;
105
105
  SHOW_CANVAS_BUTTON: boolean;
106
+ ENABLE_CHAT_GPS: boolean;
106
107
  SHOW_CHAT_PROMPTS: boolean;
107
108
  SHOW_HELP_BUTTON: boolean;
108
109
  SHOW_LOGBOOK_BUTTON: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/config/index.ts"],"names":[],"mappings":"AACA,qBAAa,SAAS;;IAKpB,iBAAiB,EAAE,MAAM,CAAM;IAC/B,2BAA2B,EAAE,MAAM,CAAM;IACzC,IAAI,EAAE;QACJ,CAAC,GAAG,EAAE,MAAM,GAAG;YACb,OAAO,EAAE;gBAAE,KAAK,EAAE,MAAM,CAAC;gBAAC,GAAG,EAAE,MAAM,CAAA;aAAE,EAAE,CAAC;YAC1C,KAAK,EAAE;gBAAE,EAAE,EAAE,MAAM,CAAC;gBAAC,KAAK,EAAE,MAAM,CAAC;gBAAC,OAAO,EAAE,MAA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AE,OAAO,CAAC;IAC5B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,cAAc,EAAE,MAAM,CAAC;IACvB,qBAAqB,EAAE,OAAO,CAAC;IAC/B,4BAA4B,EAAE,OAAO,CAAC;IACtC,yBAAyB,EAAE,OAAO,CAAC;IACnC,kBAAkB,EAAE,QAAQ,GAAG,SAAS,CAAC;CAC1C;AA2ID,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,gBAAgB,EAAE,GAAG,EAAE,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAG5F;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,GAAE,OAAO,CAAC,gBAAgB,CAAM,QActE"}
@@ -1 +1 @@
1
- class _{constructor(){this.CHAT_INSTRUCTIONS="",this.REALTIME_VOICE_INSTRUCTIONS="",this.apps={}}}const T={LOGIN_REDIRECT:!1,ABOUT_TEXT:"Codicent APP SDK",ANONYMOUS_CODICENT:void 0,ANONYMOUS_TOKEN:void 0,API_BASE_URL:"https://codicent.com/",PUBSUB_URL:"https://pubsub.codicent.com/hub",APP_BUTTONS:void 0,APP_CHAT_TEXT_PLACEHOLDER:void 0,APP_CHAT_TITLE:void 0,APP_CONFIG:new _,APP_FOOTER_COLOR:void 0,APP_FOOTER_SELECTED_COLOR:void 0,APP_FOOTER_TEXT_COLOR:void 0,APP_HEADER_COLOR:void 0,APP_HEADER_ICON_URL:void 0,APP_HEADER_TEXT_COLOR:void 0,APP_ICON_URL:void 0,APP_LOG_CODICENT:"",APP_LOG_TOKEN:"",APP_LOGBOOK_TITLE:void 0,APP_MENU_TITLE:void 0,APP_NAME:void 0,APP_PREFIX:void 0,APP_SAVE_TITLE:void 0,APP_SEARCH_TITLE:void 0,APP_SLOGAN:void 0,APP_SPLASH_TEXT:void 0,APP_SPLASH_URL:void 0,APP_TEMPLATE:"",APP_TITLE:void 0,AUTH_REDIRECT_URL:void 0,AUTH0_AUDIENCE:"https://codicent.com/api",AUTH0_CLIENT_ID:"80STzWmmzN3Tgf76HgFRyv54keYmvnaw",AUTH0_DOMAIN:"auth.codicent.com",AUTH0_PASSWORDLESS_ENABLED:!1,AUTH0_PROVIDER_SCOPE:"read:current_user update:current_user_metadata openid profile email",AUTH0_SCOPE:"read:current_user",AUTH0_USER_DOMAIN:void 0,BUTTON_ACTIVE_COLOR:void 0,BUTTON_BACKGROUND_COLOR:void 0,BUTTON_BORDER_RADIUS:void 0,BUTTON_HOVER_COLOR:void 0,BUTTON_TAG:"app-button",BUTTON_TEXT_COLOR:void 0,CHAT_BACKGROUND_IMAGE_URL:void 0,CHAT_BOT_BACKGROUND_COLOR:void 0,CHAT_BOT_TEXT_COLOR:void 0,CHAT_INSTRUCTIONS:void 0,CHAT_USER_BACKGROUND_COLOR:void 0,CHAT_USER_TEXT_COLOR:void 0,CHAT_WELCOME:"Welcome",COMPOSE_BACKGROUND_IMAGE_URL:void 0,COMPOSE_AUTO_LOCATION:void 0,COMPOSE_HIDE_LOCATION:void 0,COMPOSE_SIMPLE_ATTACH_FILE:void 0,DEFAULT_LANGUAGE:"en",HIDE_CHAT_BUTTON:!1,HIDE_MENU_BUTTON:!1,HIDE_REGISTER_BUTTON:!1,HIDE_SAVE_BUTTON:!1,HOME_BACKGROUND_IMAGE_URL:void 0,INDEX_TITLE:void 0,LOGBOOK_TAG_DEFINITIONS:{},LOGBOOK_STRIP_TAGS:!1,LOGBOOK_TAGS:"[]",MENU_BACKGROUND_IMAGE_URL:void 0,MESSAGE_HIDE_BAR:!1,MODULE_VOICE:!1,PUBLIC_FLOW_CODICENT:void 0,REALTIME_VOICE_MODEL:"alloy",REALTIME_VOICE_PROVIDER:"openai",USE_REALTIME_SESSION_ENDPOINT:!0,REALTIME_SESSION_ENDPOINT:"/realtime/session",REALTIME_CONFIG_ENDPOINT:"/realtime/config",SEND_BUTTON_ROUND_BACKGROUND:!1,SHOW_CANVAS_BUTTON:!1,SHOW_CHAT_PROMPTS:!1,SHOW_HELP_BUTTON:!1,SHOW_LOGBOOK_BUTTON:!1,SHOW_MICROPHONE_BUTTON:!1,SHOW_SETTINGS_BUTTON:!1,SHOW_SNAP_BUTTON:!1,SHOW_VOICE_BUTTON:!1,STRIPE_CUSTOMER_PORTAL:"",STRIPE_PRICE_ID:"",STRIPE_PUBLIC_KEY:"",STRIPE_SOURCE:"",STRIPE_TRIAL_PERIOD_DAYS:0,SUBSCRIPTION_NEEDED:!1,THEME_WELCOME:void 0,USER_PREFIX:void 0,WELCOME_STATUS_PROMPT:"",SHOW_SEND_BUTTON_TEXT:!1,SHOW_SAVE_BUTTON_TEXT:!1,FORM_BACKGROUND_IMAGE_URL:void 0,AUTO_TRANSLATE:!0,FORCE_LANGUAGE:void 0,TRANSLATIONS:void 0,LOGIN_WELCOME_TEXT:void 0,LOGIN_HIDE_WELCOME:!1,LOGIN_LOGO_URL:void 0,HIDE_CHAT_ADD_FILE_BUTTON:!1,FORM_ACCEPT_MARKDOWN:void 0,RESTART_AUDIO_ON_TAKE_PHOTO:!1,ENABLE_STATE_CACHE:!1,SESSION_CACHE_TTL:864e5,USER_INFO_CACHE_TTL:36e5,APPS_CACHE_TTL:3e5,OPTIMISTIC_CACHE_LOAD:!0,VALIDATE_CACHE_IN_BACKGROUND:!0,SHOW_VALIDATION_INDICATOR:!1,CACHE_FAILURE_MODE:"lenient"};const O=function(_){return new Proxy(_,{get:(_,T,O)=>Reflect.get(_,T,O)})}(T);function E(_){return O[_]}function A(_={}){for(const[O,E]of Object.entries(_))void 0!==E&&(T[O]=E);void 0!==_.TRANSLATIONS&&(globalThis.__CODICENT_REINIT_I18N__=!0)}export{_ as AppConfig,E as getConfigValue,A as initCodicentApp};
1
+ class _{constructor(){this.CHAT_INSTRUCTIONS="",this.REALTIME_VOICE_INSTRUCTIONS="",this.apps={}}}const T={LOGIN_REDIRECT:!1,ABOUT_TEXT:"Codicent APP SDK",ANONYMOUS_CODICENT:void 0,ANONYMOUS_TOKEN:void 0,API_BASE_URL:"https://codicent.com/",PUBSUB_URL:"https://pubsub.codicent.com/hub",APP_BUTTONS:void 0,APP_CHAT_TEXT_PLACEHOLDER:void 0,APP_CHAT_TITLE:void 0,APP_CONFIG:new _,APP_FOOTER_COLOR:void 0,APP_FOOTER_SELECTED_COLOR:void 0,APP_FOOTER_TEXT_COLOR:void 0,APP_HEADER_COLOR:void 0,APP_HEADER_ICON_URL:void 0,APP_HEADER_TEXT_COLOR:void 0,APP_ICON_URL:void 0,APP_LOG_CODICENT:"",APP_LOG_TOKEN:"",APP_LOGBOOK_TITLE:void 0,APP_MENU_TITLE:void 0,APP_NAME:void 0,APP_PREFIX:void 0,APP_SAVE_TITLE:void 0,APP_SEARCH_TITLE:void 0,APP_SLOGAN:void 0,APP_SPLASH_TEXT:void 0,APP_SPLASH_URL:void 0,APP_TEMPLATE:"",APP_TITLE:void 0,AUTH_REDIRECT_URL:void 0,AUTH0_AUDIENCE:"https://codicent.com/api",AUTH0_CLIENT_ID:"80STzWmmzN3Tgf76HgFRyv54keYmvnaw",AUTH0_DOMAIN:"auth.codicent.com",AUTH0_PASSWORDLESS_ENABLED:!1,AUTH0_PROVIDER_SCOPE:"read:current_user update:current_user_metadata openid profile email",AUTH0_SCOPE:"read:current_user",AUTH0_USER_DOMAIN:void 0,BUTTON_ACTIVE_COLOR:void 0,BUTTON_BACKGROUND_COLOR:void 0,BUTTON_BORDER_RADIUS:void 0,BUTTON_HOVER_COLOR:void 0,BUTTON_TAG:"app-button",BUTTON_TEXT_COLOR:void 0,CHAT_BACKGROUND_IMAGE_URL:void 0,CHAT_BOT_BACKGROUND_COLOR:void 0,CHAT_BOT_TEXT_COLOR:void 0,CHAT_INSTRUCTIONS:void 0,CHAT_USER_BACKGROUND_COLOR:void 0,CHAT_USER_TEXT_COLOR:void 0,CHAT_WELCOME:"Welcome",COMPOSE_BACKGROUND_IMAGE_URL:void 0,COMPOSE_AUTO_LOCATION:void 0,COMPOSE_HIDE_LOCATION:void 0,COMPOSE_SIMPLE_ATTACH_FILE:void 0,DEFAULT_LANGUAGE:"en",HIDE_CHAT_BUTTON:!1,HIDE_MENU_BUTTON:!1,HIDE_REGISTER_BUTTON:!1,HIDE_SAVE_BUTTON:!1,HOME_BACKGROUND_IMAGE_URL:void 0,INDEX_TITLE:void 0,LOGBOOK_TAG_DEFINITIONS:{},LOGBOOK_STRIP_TAGS:!1,LOGBOOK_TAGS:"[]",MENU_BACKGROUND_IMAGE_URL:void 0,MESSAGE_HIDE_BAR:!1,MODULE_VOICE:!1,PUBLIC_FLOW_CODICENT:void 0,REALTIME_VOICE_MODEL:"alloy",REALTIME_VOICE_PROVIDER:"openai",USE_REALTIME_SESSION_ENDPOINT:!0,REALTIME_SESSION_ENDPOINT:"/realtime/session",REALTIME_CONFIG_ENDPOINT:"/realtime/config",SEND_BUTTON_ROUND_BACKGROUND:!1,SHOW_CANVAS_BUTTON:!1,ENABLE_CHAT_GPS:!1,SHOW_CHAT_PROMPTS:!1,SHOW_HELP_BUTTON:!1,SHOW_LOGBOOK_BUTTON:!1,SHOW_MICROPHONE_BUTTON:!1,SHOW_SETTINGS_BUTTON:!1,SHOW_SNAP_BUTTON:!1,SHOW_VOICE_BUTTON:!1,STRIPE_CUSTOMER_PORTAL:"",STRIPE_PRICE_ID:"",STRIPE_PUBLIC_KEY:"",STRIPE_SOURCE:"",STRIPE_TRIAL_PERIOD_DAYS:0,SUBSCRIPTION_NEEDED:!1,THEME_WELCOME:void 0,USER_PREFIX:void 0,WELCOME_STATUS_PROMPT:"",SHOW_SEND_BUTTON_TEXT:!1,SHOW_SAVE_BUTTON_TEXT:!1,FORM_BACKGROUND_IMAGE_URL:void 0,AUTO_TRANSLATE:!0,FORCE_LANGUAGE:void 0,TRANSLATIONS:void 0,LOGIN_WELCOME_TEXT:void 0,LOGIN_HIDE_WELCOME:!1,LOGIN_LOGO_URL:void 0,HIDE_CHAT_ADD_FILE_BUTTON:!1,FORM_ACCEPT_MARKDOWN:void 0,RESTART_AUDIO_ON_TAKE_PHOTO:!1,ENABLE_STATE_CACHE:!1,SESSION_CACHE_TTL:864e5,USER_INFO_CACHE_TTL:36e5,APPS_CACHE_TTL:3e5,OPTIMISTIC_CACHE_LOAD:!0,VALIDATE_CACHE_IN_BACKGROUND:!0,SHOW_VALIDATION_INDICATOR:!1,CACHE_FAILURE_MODE:"lenient"};const O=function(_){return new Proxy(_,{get:(_,T,O)=>Reflect.get(_,T,O)})}(T);function E(_){return O[_]}function A(_={}){for(const[O,E]of Object.entries(_))void 0!==E&&(T[O]=E);void 0!==_.TRANSLATIONS&&(globalThis.__CODICENT_REINIT_I18N__=!0)}export{_ as AppConfig,E as getConfigValue,A as initCodicentApp};
@@ -8,7 +8,10 @@ export interface Message {
8
8
  export declare function useChat(state: AppStateMachine, temporaryCodicent?: string): {
9
9
  messages: Message[];
10
10
  isBotTyping: boolean;
11
- handleSend: (text: string, retryCount?: number) => void;
11
+ handleSend: (text: string, retryCount?: number, gps?: {
12
+ lat: number;
13
+ lon: number;
14
+ }) => void;
12
15
  newChat: () => void;
13
16
  openChat: (id: string) => void;
14
17
  reloadChatHistory: () => Promise<boolean>;
@@ -1 +1 @@
1
- {"version":3,"file":"useChat.d.ts","sourceRoot":"","sources":["../../../src/hooks/useChat.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAO,MAAM,UAAU,CAAC;AAOhD,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,eAAe,EAAE,iBAAiB,CAAC,EAAE,MAAM;;;uBAoD/D,MAAM;;mBA2IR,MAAM;;EA2Bd"}
1
+ {"version":3,"file":"useChat.d.ts","sourceRoot":"","sources":["../../../src/hooks/useChat.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAO,MAAM,UAAU,CAAC;AAOhD,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,eAAe,EAAE,iBAAiB,CAAC,EAAE,MAAM;;;uBAoD/D,MAAM,6BAAwB;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE;;mBA2I5D,MAAM;;EA2Bd"}
@@ -1 +1 @@
1
- import{useState as e,useEffect as s,useCallback as t}from"react";import{chatStore as o}from"../stores/chatStore.js";import"../utils/MessageContent.js";import"../node_modules/tinycolor2/esm/tinycolor.js";import r from"../utils/logging.js";import"react/jsx-runtime";import"../_virtual/index.js";import"../config/index.js";import"../utils/cacheManager.js";import"../lib/wavtools/lib/wav_packer.js";import"../lib/wavtools/lib/analysis/audio_analysis.js";import"../lib/wavtools/lib/wav_stream_player.js";import"../lib/wavtools/lib/wav_recorder.js";import"exceljs";function n(n,a){const{service:i}=n,c=a||n.context.selectedApp||"",[d,g]=e(o.getState(c));s((()=>o.subscribe(c,g)),[c]);const l=t((async()=>{const e=o.getConversationId(c);if(e){console.log("Reloading chat history to check for missed messages...");try{const s=await i.getChatHistory(e),t=o.getMessages(c);return s.length>t.length?(console.log(`Found ${s.length-t.length} missed messages, updating chat...`),o.reset(c),s.forEach(((e,s)=>{const t={id:e.id,sender:s%2==0?"user":"bot",content:e.content};o.addMessage(c,t)})),o.setConversationId(c,e),r("chat-history-reloaded"),!0):(console.log("No missed messages found"),!1)}catch(e){return console.error("Failed to reload chat history:",e),!1}}return!1}),[i,c]),m=t(((e,s=0)=>{if(""===e.trim())return;const t=`$user-msg-${Date.now()}`,n={id:t,sender:"user",content:e},a=d.messages.length>0?d.messages[d.messages.length-1].id:void 0;o.addMessage(c,n),o.setBotTyping(c,!0),r("chat-send");const g=Promise.race([i.chat(e,a,c),new Promise(((e,s)=>{setTimeout((()=>s(new Error("Request timeout - please try again"))),36e4)}))]).then((e=>{const{id:s,content:t}=e,n={id:s,sender:"bot",content:t,isNew:!0};o.setConversationId(c,s),o.addMessage(c,n),o.setBotTyping(c,!1),r("chat-receive"),t.startsWith("Error code: ")&&r("chat-error: "+t)})).catch((async n=>{console.error("Chat error details:",{error:n,message:n?.message,name:n?.name,stack:n?.stack,tempId:t,lastMessageId:a,retryCount:s,timestamp:(new Date).toISOString()});if(0===s&&("AbortError"===n?.name||n?.message?.includes("timeout")||n?.message?.includes("Failed to fetch")||n?.message?.includes("NetworkError")))return console.log("Auto-retrying chat request..."),o.removeMessage(c,t),o.setBotTyping(c,!1),void setTimeout((()=>m(e,s+1)),2e3);function d(){let e="An error occurred while sending the message. Please try again.";if(i.onUnauthorized&&n?.toString().includes("401"))return alert("Session expired. Please log in again."),void i.onUnauthorized();"AbortError"===n?.name||n?.message?.includes("timeout")?(e="Request timed out. Please check your connection and try again.",r("chat-timeout")):n?.message?.includes("HTTP error: 500")?(e="Server error. Please try again in a moment.",r("chat-server-error")):(n?.message?.includes("Failed to fetch")||n?.message?.includes("NetworkError"))&&(e="Network error. Please check your connection and try again.",r("chat-network-error")),console.warn(e),o.removeMessage(c,t),o.setBotTyping(c,!1),r("chat-error")}"AbortError"===n?.name||n?.message?.includes("timeout")||n?.message?.includes("Failed to fetch")||n?.message?.includes("NetworkError")||n?.message?.includes("WebSocket")||n?.message?.includes("SignalR")||n?.message?.includes("Connection")?(console.log("Potential SignalR/connection issue detected, checking for missed messages..."),setTimeout((async()=>{if(await l())return o.removeMessage(c,t),o.setBotTyping(c,!1),console.log("Recovered missed message(s) from server"),void r("chat-recovered");d()}),2e3)):d()}));o.addPendingRequest(c,t,g)}),[i,d.messages,l,c]),u=t((()=>{o.reset(c),o.clearMessages(c),r("new-chat")}),[c]),h=t((e=>{o.reset(c),o.clearMessages(c),r("open-chat"),i.getChatHistory(e).then((e=>{e.forEach(((e,s)=>{const t={id:e.id,sender:s%2==0?"user":"bot",content:e.content};o.addMessage(c,t)}))}))}),[i,c]);return{messages:d.messages,isBotTyping:d.isBotTyping,handleSend:m,newChat:u,openChat:h,reloadChatHistory:l}}export{n as useChat};
1
+ import{useState as e,useEffect as s,useCallback as t}from"react";import{chatStore as o}from"../stores/chatStore.js";import"../utils/MessageContent.js";import"../node_modules/tinycolor2/esm/tinycolor.js";import r from"../utils/logging.js";import"react/jsx-runtime";import"../_virtual/index.js";import"../config/index.js";import"../utils/cacheManager.js";import"../lib/wavtools/lib/wav_packer.js";import"../lib/wavtools/lib/analysis/audio_analysis.js";import"../lib/wavtools/lib/wav_stream_player.js";import"../lib/wavtools/lib/wav_recorder.js";import"exceljs";function n(n,a){const{service:i}=n,c=a||n.context.selectedApp||"",[l,d]=e(o.getState(c));s((()=>o.subscribe(c,d)),[c]);const g=t((async()=>{const e=o.getConversationId(c);if(e){console.log("Reloading chat history to check for missed messages...");try{const s=await i.getChatHistory(e),t=o.getMessages(c);return s.length>t.length?(console.log(`Found ${s.length-t.length} missed messages, updating chat...`),o.reset(c),s.forEach(((e,s)=>{const t={id:e.id,sender:s%2==0?"user":"bot",content:e.content};o.addMessage(c,t)})),o.setConversationId(c,e),r("chat-history-reloaded"),!0):(console.log("No missed messages found"),!1)}catch(e){return console.error("Failed to reload chat history:",e),!1}}return!1}),[i,c]),m=t(((e,s=0,t)=>{if(""===e.trim())return;const n=`$user-msg-${Date.now()}`,a={id:n,sender:"user",content:e},d=l.messages.length>0?l.messages[l.messages.length-1].id:void 0;o.addMessage(c,a),o.setBotTyping(c,!0),r("chat-send");const u=Promise.race([i.chat(e,d,c,t?.lat,t?.lon),new Promise(((e,s)=>{setTimeout((()=>s(new Error("Request timeout - please try again"))),36e4)}))]).then((e=>{const{id:s,content:t}=e,n={id:s,sender:"bot",content:t,isNew:!0};o.setConversationId(c,s),o.addMessage(c,n),o.setBotTyping(c,!1),r("chat-receive"),t.startsWith("Error code: ")&&r("chat-error: "+t)})).catch((async a=>{console.error("Chat error details:",{error:a,message:a?.message,name:a?.name,stack:a?.stack,tempId:n,lastMessageId:d,retryCount:s,timestamp:(new Date).toISOString()});if(0===s&&("AbortError"===a?.name||a?.message?.includes("timeout")||a?.message?.includes("Failed to fetch")||a?.message?.includes("NetworkError")))return console.log("Auto-retrying chat request..."),o.removeMessage(c,n),o.setBotTyping(c,!1),void setTimeout((()=>m(e,s+1,t)),2e3);function l(){let e="An error occurred while sending the message. Please try again.";if(i.onUnauthorized&&a?.toString().includes("401"))return alert("Session expired. Please log in again."),void i.onUnauthorized();"AbortError"===a?.name||a?.message?.includes("timeout")?(e="Request timed out. Please check your connection and try again.",r("chat-timeout")):a?.message?.includes("HTTP error: 500")?(e="Server error. Please try again in a moment.",r("chat-server-error")):(a?.message?.includes("Failed to fetch")||a?.message?.includes("NetworkError"))&&(e="Network error. Please check your connection and try again.",r("chat-network-error")),console.warn(e),o.removeMessage(c,n),o.setBotTyping(c,!1),r("chat-error")}"AbortError"===a?.name||a?.message?.includes("timeout")||a?.message?.includes("Failed to fetch")||a?.message?.includes("NetworkError")||a?.message?.includes("WebSocket")||a?.message?.includes("SignalR")||a?.message?.includes("Connection")?(console.log("Potential SignalR/connection issue detected, checking for missed messages..."),setTimeout((async()=>{if(await g())return o.removeMessage(c,n),o.setBotTyping(c,!1),console.log("Recovered missed message(s) from server"),void r("chat-recovered");l()}),2e3)):l()}));o.addPendingRequest(c,n,u)}),[i,l.messages,g,c]),u=t((()=>{o.reset(c),o.clearMessages(c),r("new-chat")}),[c]),h=t((e=>{o.reset(c),o.clearMessages(c),r("open-chat"),i.getChatHistory(e).then((e=>{e.forEach(((e,s)=>{const t={id:e.id,sender:s%2==0?"user":"bot",content:e.content};o.addMessage(c,t)}))}))}),[i,c]);return{messages:l.messages,isBotTyping:l.isBotTyping,handleSend:m,newChat:u,openChat:h,reloadChatHistory:g}}export{n as useChat};
@@ -1 +1 @@
1
- import{useReducer as e,useCallback as t,useState as r,useMemo as n,useEffect as s,useRef as a}from"react";import{useAudioRecorder as c}from"./useAudioRecorder.js";import i from"./useAuthState.js";import o from"./useRealtimeVoiceAI.js";import p from"./useTools.js";import{getConfigValue as u}from"../config/index.js";import{stateMachineCacheManager as A}from"../utils/cacheManager.js";import{appStateReducer as E,createInitialState as d,saveSession as m,runBackgroundValidation as l,isBusyPhase as T}from"./useAppState.js";const h=({auth0:h,toolsConfig:S,authOptions:g})=>{const k=i(h,g),y=k.codicentService,[{phase:_,context:I},R]=e(E,null,d),f=t(((e,t)=>{const r=e.get("file").name;y.uploadFile(r,e).then((e=>{y.sendMessage(`#transcribe ${""!==t?(t.startsWith("#")?"":"#")+t+" ":""}#file:${e}`).catch(console.warn)}))}),[y]),C=c(f),[U,O]=r(),[D,N]=r(),[P,L]=r(!1),v=n((()=>new Audio("./notification.mp3")),[]),F=t((()=>L(!0)),[]),w=p(y,O,N,v,U,F,S),x=o(y,w);s((()=>{P&&(x?.disconnectConversation(),L(!1))}),[P,x]),s((()=>{k.isLoading||(k.isAuthenticated&&k.accessToken?R({type:"AUTHENTICATED",accessToken:k.accessToken,user:{sub:k.user?.sub??"",email:k.user?.email??""}}):k.isAuthenticated?k.authError&&R({type:"UPDATE_CONTEXT",updates:{error:k.authError}}):R({type:"NOT_AUTHENTICATED"}))}),[k.isLoading,k.isAuthenticated,k.accessToken,k.authError]),s((()=>{"checkingCodicentAccess"===_&&(void 0===k.isRegistered&&k.authError?R({type:"UPDATE_CONTEXT",updates:{error:k.authError,errorType:"CodicentLoginFailed"}}):void 0!==k.isRegistered&&(!0===k.isRegistered&&k.nickname?R({type:"REGISTERED",nickname:k.nickname}):!1===k.isRegistered&&R({type:"NOT_REGISTERED"})))}),[_,k.isRegistered,k.nickname,k.authError]),s((()=>{if("registering"!==_)return;if(!I.accessToken||!I.user)return;let e=!1;return y.setToken(I.accessToken),y.findUsername().then((async t=>{if(e)return;if(!t)return void R({type:"REGISTER_AUTO_FAIL",error:"Användarnamn kunde inte hittas.",errorType:"NoUsernameFound"});const r=await y.nicknameExists(t);e||(r?R({type:"REGISTER_AUTO_FAIL",error:"Användarnamnet finns redan.",errorType:"UsernameExists"}):(await y.registerUser(t,I.user.email,I.user.sub,I.accessToken),e||(y.setToken(I.accessToken),R({type:"REGISTER_AUTO_SUCCESS",nickname:t}))))})).catch((t=>{e||R({type:"REGISTER_AUTO_FAIL",error:t instanceof Error?t.message:String(t),errorType:"ErrorRegistering"})})),()=>{e=!0}}),[_]),s((()=>{if("loadingUser"!==_||!I.nickname)return;let e=!1;return localStorage.setItem("nickname",I.nickname),y.getUserInfo(I.nickname).then((t=>{e||R({type:"USER_LOADED",name:t?.name||t?.nickname||""})})).catch((()=>{e||R({type:"USER_LOADED",name:""})})),()=>{e=!0}}),[_]),s((()=>{if("checkingPurchase"!==_)return;if(!u("SUBSCRIPTION_NEEDED"))return void R({type:"PURCHASE_VALID"});let e=!1;return y.checkSubscriptionStatus().then((t=>{if(!e){R("active"===t||"trialing"===t?{type:"PURCHASE_VALID"}:{type:"PURCHASE_INVALID"})}})).catch((()=>{e||R({type:"PURCHASE_INVALID"})})),()=>{e=!0}}),[_]),s((()=>{if("gettingApps"!==_)return;let e=!1;return y.getApps().then((t=>{e||R(null!==t?{type:"APPS_LOADED",apps:t}:{type:"APPS_FAILED",error:"Failed to fetch apps."})})).catch((t=>{e||R({type:"APPS_FAILED",error:String(t)})})),()=>{e=!0}}),[_]),s((()=>{if("creatingApp"!==_)return;let e=!1;return y.createApp().then((t=>{e||R(t?{type:"APP_CREATED",appId:t}:{type:"APP_CREATE_FAILED",error:"Misslyckades att skapa din app. Försök igen senare."})})).catch((t=>{e||R({type:"APP_CREATE_FAILED",error:String(t)})})),()=>{e=!0}}),[_]),s((()=>{"hasAccess"===_&&I.selectedApp&&(y.codicent=I.selectedApp,localStorage.setItem("selectedApp",I.selectedApp),I.isFromCache||m(I))}),[_,I.selectedApp]);const M=a(!1);s((()=>{"hasAccess"===_&&I.isFromCache&&I.needsValidation&&k.accessToken&&k.isAuthenticated&&(M.current||(M.current=!0,l(y,I,R)))}),[_,I.isFromCache,I.needsValidation,k.accessToken,k.isAuthenticated]),s((()=>{"needsPurchase"===_&&(window.location.href="./#/purchase")}),[_]),s((()=>{if("anonymous"!==_)return;const e=u("ANONYMOUS_TOKEN"),t=u("ANONYMOUS_CODICENT")||u("APP_NAME")||"";e&&(y.setToken(e),y.codicent=t)}),[_]),s((()=>{"loggingOut"===_&&(u("ENABLE_STATE_CACHE")&&A.clear(),localStorage.removeItem("selectedApp"),localStorage.removeItem("nickname"),localStorage.removeItem("codicent"),sessionStorage.clear(),k.logout())}),[_]);const H=a(I);H.current=I;const j=a({}).current,G=a({}).current,V=n((()=>({service:y,get context(){return H.current},current:"hasAccess"===_?j:G,allStates:{hasAccess:j},setSelectedApp:e=>{R({type:"SET_SELECTED_APP",appId:e})},updateContext:e=>{R({type:"UPDATE_CONTEXT",updates:e})},logout:()=>{R({type:"LOGOUT"})},update:()=>{},isBusy:()=>T(_)})),[_,y]),b=t((e=>e.replace("{nickname}",I.nickname||"unknown").replace("{token}",encodeURIComponent(k.accessToken||"unknown")).replace("{app}",I.selectedApp||"unknown")),[I.nickname,k.accessToken,I.selectedApp]),B=t((e=>{e&&u("ANONYMOUS_TOKEN")&&R({type:"SET_ANONYMOUS"})}),[]),Y=t((()=>T(_)),[_]);return n((()=>({audio:C,auth:k,currentStateName:_,stateMachine:V,service:y,context:I,state:_,nickname:I.nickname||"",name:I.name||"",error:I.error||"",errorType:I.errorType||"",fixAppUrl:b,setAnonymous:B,allStates:V.allStates,isBusy:Y,voice:x,html:U||"",setHtml:O,script:D||""})),[_,I,U,D,k.isAuthenticated,k.isLoading,C.isRecording,x?.isConnected,b,B,Y,V])};export{h as useCodicentApp};
1
+ import{useReducer as e,useCallback as t,useState as r,useMemo as n,useEffect as s,useRef as a}from"react";import{useAudioRecorder as c}from"./useAudioRecorder.js";import i from"./useAuthState.js";import o from"./useRealtimeVoiceAI.js";import p from"./useTools.js";import{getConfigValue as u}from"../config/index.js";import{stateMachineCacheManager as A}from"../utils/cacheManager.js";import{appStateReducer as E,createInitialState as d,saveSession as m,runBackgroundValidation as l,isBusyPhase as T}from"./useAppState.js";const h=({auth0:h,toolsConfig:S,authOptions:g})=>{const k=i(h,g),y=k.codicentService,[{phase:_,context:I},R]=e(E,null,d),f=t(((e,t)=>{const r=e.get("file").name;y.uploadFile(r,e).then((e=>{y.sendMessage(`#transcribe ${""!==t?(t.startsWith("#")?"":"#")+t+" ":""}#file:${e}`).catch(console.warn)}))}),[y]),C=c(f),[U,O]=r(),[P,N]=r(),[D,L]=r(!1),v=n((()=>new Audio("./notification.mp3")),[]),F=t((()=>L(!0)),[]),M=p(y,O,N,v,U,F,S),w=o(y,M);s((()=>{D&&(w?.disconnectConversation(),L(!1))}),[D,w]),s((()=>{k.isLoading||(k.isAuthenticated&&k.accessToken?R({type:"AUTHENTICATED",accessToken:k.accessToken,user:{sub:k.user?.sub??"",email:k.user?.email??""}}):k.isAuthenticated?k.authError&&R({type:"UPDATE_CONTEXT",updates:{error:k.authError}}):R({type:"NOT_AUTHENTICATED"}))}),[k.isLoading,k.isAuthenticated,k.accessToken,k.authError]),s((()=>{"checkingCodicentAccess"===_&&(void 0===k.isRegistered&&k.authError?R({type:"UPDATE_CONTEXT",updates:{error:k.authError,errorType:"CodicentLoginFailed"}}):void 0!==k.isRegistered&&(!0===k.isRegistered&&k.nickname?R({type:"REGISTERED",nickname:k.nickname}):!1===k.isRegistered&&R({type:"NOT_REGISTERED"})))}),[_,k.isRegistered,k.nickname,k.authError]),s((()=>{if("registering"!==_)return;if(!I.accessToken||!I.user)return;let e=!1;return y.setToken(I.accessToken),y.findUsername().then((async t=>{if(e)return;if(!t)return void R({type:"REGISTER_AUTO_FAIL",error:"Användarnamn kunde inte hittas.",errorType:"NoUsernameFound"});const r=await y.nicknameExists(t);e||(r?R({type:"REGISTER_AUTO_FAIL",error:"Användarnamnet finns redan.",errorType:"UsernameExists"}):(await y.registerUser(t,I.user.email,I.user.sub,I.accessToken),e||(y.setToken(I.accessToken),R({type:"REGISTER_AUTO_SUCCESS",nickname:t}))))})).catch((t=>{e||R({type:"REGISTER_AUTO_FAIL",error:t instanceof Error?t.message:String(t),errorType:"ErrorRegistering"})})),()=>{e=!0}}),[_]),s((()=>{if("loadingUser"!==_||!I.nickname)return;let e=!1;return localStorage.setItem("nickname",I.nickname),y.getUserInfo(I.nickname).then((t=>{e||R({type:"USER_LOADED",name:t?.name||t?.nickname||""})})).catch((()=>{e||R({type:"USER_LOADED",name:""})})),()=>{e=!0}}),[_]),s((()=>{if("checkingPurchase"!==_)return;if(!u("SUBSCRIPTION_NEEDED"))return void R({type:"PURCHASE_VALID"});let e=!1;return y.checkSubscriptionStatus().then((t=>{if(!e){R("active"===t||"trialing"===t?{type:"PURCHASE_VALID"}:{type:"PURCHASE_INVALID"})}})).catch((()=>{e||R({type:"PURCHASE_INVALID"})})),()=>{e=!0}}),[_]),s((()=>{if("gettingApps"!==_)return;let e=!1;return y.getApps().then((t=>{e||R(null!==t?{type:"APPS_LOADED",apps:t}:{type:"APPS_FAILED",error:"Failed to fetch apps."})})).catch((t=>{e||R({type:"APPS_FAILED",error:String(t)})})),()=>{e=!0}}),[_]),s((()=>{if("creatingApp"!==_)return;let e=!1;return y.createApp().then((t=>{e||R(t?{type:"APP_CREATED",appId:t}:{type:"APP_CREATE_FAILED",error:"Misslyckades att skapa din app. Försök igen senare."})})).catch((t=>{e||R({type:"APP_CREATE_FAILED",error:String(t)})})),()=>{e=!0}}),[_]),s((()=>{"hasAccess"===_&&I.selectedApp&&(y.codicent=I.selectedApp,localStorage.setItem("selectedApp",I.selectedApp),I.isFromCache||m(I))}),[_,I.selectedApp]);const x=a(!1);s((()=>{"hasAccess"===_&&I.isFromCache&&I.needsValidation&&k.accessToken&&k.isAuthenticated&&(x.current||(x.current=!0,l(y,I,R)))}),[_,I.isFromCache,I.needsValidation,k.accessToken,k.isAuthenticated]),s((()=>{"needsPurchase"===_&&(window.location.href="./#/purchase")}),[_]),s((()=>{if("anonymous"!==_)return;const e=u("ANONYMOUS_TOKEN"),t=u("ANONYMOUS_CODICENT")||u("APP_NAME")||"";e&&(y.setToken(e),y.codicent=t)}),[_]),s((()=>{"loggingOut"===_&&(u("ENABLE_STATE_CACHE")&&A.clear(),localStorage.removeItem("selectedApp"),localStorage.removeItem("nickname"),localStorage.removeItem("codicent"),sessionStorage.clear(),k.logout())}),[_]);const H=a(I);H.current=I;const j=a({}).current,G=a({}).current,V=n((()=>({service:y,get context(){return H.current},current:"hasAccess"===_?j:G,allStates:{hasAccess:j},setSelectedApp:e=>{R({type:"SET_SELECTED_APP",appId:e})},updateContext:e=>{R({type:"UPDATE_CONTEXT",updates:e})},logout:()=>{R({type:"LOGOUT"})},update:()=>{},isBusy:()=>T(_)})),[_,y]),b=t((e=>e.replace("{nickname}",I.nickname||"unknown").replace("{token}",encodeURIComponent(k.accessToken||"unknown")).replace("{app}",I.selectedApp||u("APP_NAME")||"unknown")),[I.nickname,k.accessToken,I.selectedApp]),B=t((e=>{e&&u("ANONYMOUS_TOKEN")&&R({type:"SET_ANONYMOUS"})}),[]),Y=t((()=>T(_)),[_]);return n((()=>({audio:C,auth:k,currentStateName:_,stateMachine:V,service:y,context:I,state:_,nickname:I.nickname||"",name:I.name||"",error:I.error||"",errorType:I.errorType||"",fixAppUrl:b,setAnonymous:B,allStates:V.allStates,isBusy:Y,voice:w,html:U||"",setHtml:O,script:P||""})),[_,I,U,P,k.isAuthenticated,k.isLoading,C.isRecording,w?.isConnected,b,B,Y,V])};export{h as useCodicentApp};
@@ -1 +1 @@
1
- {"version":3,"file":"useRealtimeVoiceAI.d.ts","sourceRoot":"","sources":["../../../src/hooks/useRealtimeVoiceAI.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;AAK/E,OAAO,EAAE,eAAe,EAAE,MAAM,aA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