@dashadmin/dash-admin 1.3.17 → 1.3.20

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/AppAsyncWrapper.js +1 -0
  2. package/dist/AppWrapper.js +1 -0
  3. package/dist/DASHAdmin.js +1 -0
  4. package/dist/DASHAdmin.tsx.old +456 -0
  5. package/dist/RoutingWrapper.js +1 -0
  6. package/dist/classes/DASHStorageClass.js +1 -0
  7. package/dist/components/Input/RichTextField.js +1 -0
  8. package/dist/components/Redirect.js +1 -0
  9. package/dist/components/avatar/Avatar.js +1 -0
  10. package/dist/components/avatar/SingleImageUploader.js +1 -0
  11. package/dist/components/currency/Format.js +1 -0
  12. package/dist/components/custom/Redirect.js +1 -0
  13. package/dist/components/error/Error.js +1 -0
  14. package/dist/components/geocoding/GeocodingField.js +1 -0
  15. package/dist/components/i18n/BridgedLocalesMenuButton.js +1 -0
  16. package/dist/components/i18n/LangSwitcher.js +1 -0
  17. package/dist/components/loader/GlobalLoader.js +1 -0
  18. package/dist/components/logs/LogFile.js +1 -0
  19. package/dist/components/logs/LogFileById.js +1 -0
  20. package/dist/components/logs/LogViewer.js +1 -0
  21. package/dist/components/menu/AppMenu.js +1 -0
  22. package/dist/components/menu/CustomMenuItemLink.js +1 -0
  23. package/dist/components/menu/DarkToggleMode.js +1 -0
  24. package/dist/components/menu/LanguageToggleMode.js +1 -0
  25. package/dist/components/misc/CustomImageInput.js +1 -0
  26. package/dist/components/misc/DASHGlobalErrorHandler.js +1 -0
  27. package/dist/components/misc/DarkModeSwitcher.js +1 -0
  28. package/dist/components/misc/LanguageSwitcher.js +1 -0
  29. package/dist/components/misc/MUIHtmlToolTip.js +1 -0
  30. package/dist/components/misc/MuiSimpleJsonTable.js +1 -0
  31. package/dist/components/misc/MultiLevelTable.js +1 -0
  32. package/dist/components/misc/NoResults.js +1 -0
  33. package/dist/components/misc/PDFViewer.js +1 -0
  34. package/dist/components/navigation/Breadcrumbs.js +1 -0
  35. package/dist/components/navigation/BreadcrumbsManager.js +1 -0
  36. package/dist/components/navigation/index.js +1 -0
  37. package/dist/components/panel/Error.js +1 -0
  38. package/dist/components/permission/AvailablePermissionsContext.js +1 -0
  39. package/dist/components/permission/PermissionsSelector.js +1 -0
  40. package/dist/components/permission/PermissionsSelectorList.js +1 -0
  41. package/dist/components/permission/tsx +0 -0
  42. package/dist/components/racustombuttons/CustomRAButton.js +1 -0
  43. package/dist/components/racustombuttons/QuickButton.js +1 -0
  44. package/dist/components/racustombuttons/QuickEditButton.js +1 -0
  45. package/dist/components/racustombuttons/QuickIconButton.js +1 -0
  46. package/dist/components/scrollbar/Scrollbar.js +1 -0
  47. package/dist/components/selects/MultiSelect.js +1 -0
  48. package/dist/components/selects/RASearchableSelect.js +1 -0
  49. package/dist/components/selects/RASearchableSelectChips.js +1 -0
  50. package/dist/components/selects/SearchableSelect.js +1 -0
  51. package/dist/components/subscription/BillingCycleSelectInput.js +1 -0
  52. package/dist/components/subscription/PlanAddonsSettings.js +1 -0
  53. package/dist/components/subscription/PlanAuditLog.js +1 -0
  54. package/dist/components/subscription/PlanFeaturesSettings.js +1 -0
  55. package/dist/components/subscription/PlanLimitsSettings.js +1 -0
  56. package/dist/components/subscription/PlanMetadataSettings.js +1 -0
  57. package/dist/components/subscription/PlanPricesSettings.js +1 -0
  58. package/dist/components/subscription/index.js +1 -0
  59. package/dist/components/svgelements/SvgLoading.js +1 -0
  60. package/dist/components/svgelements/SvgLogo.js +1 -0
  61. package/dist/components/svgelements/SvgLogoMin.js +1 -0
  62. package/dist/components/svgelements/SvgShipping.js +1 -0
  63. package/dist/components/tenant/AvailablePermissionsContext.js +0 -0
  64. package/dist/components/tenant/TenantAttributes.js +1 -0
  65. package/dist/components/tenant/TenantAttributesContext.js +1 -0
  66. package/dist/components/tenant/TenantSelector.js +1 -0
  67. package/dist/components/tenant/TenantSettings.js +1 -0
  68. package/dist/components/tenant/TenantSettingsContext.js +1 -0
  69. package/dist/components/tenant/TenantTheme.js +1 -0
  70. package/dist/components/user/AvatarComponent.js +1 -0
  71. package/dist/components/user/TenantAvatarComponent.js +1 -0
  72. package/dist/components/user/UserPreferences.js +1 -0
  73. package/dist/config/ACTIONS.js +1 -0
  74. package/dist/config/ConstantsService.js +1 -0
  75. package/dist/config/DASHAdminSystemConstants.js +1 -0
  76. package/dist/config/PARSERS.js +1 -0
  77. package/dist/contexts/DashQueryClientContext.js +1 -0
  78. package/dist/contexts/DashResourceContext.js +1 -0
  79. package/dist/contexts/I18nBridgeContext.js +1 -0
  80. package/dist/contexts/I18nBridgeSetter.js +1 -0
  81. package/dist/contexts/I18nReduxSync.js +1 -0
  82. package/dist/contexts/SubscriptionPlanFormatsProvider.js +1 -0
  83. package/dist/contexts/SystemRequestsCache.js +1 -0
  84. package/dist/contexts/auth/AuthContext.js +1 -0
  85. package/dist/contexts/auth/AuthContextLocalStorage.js +1 -0
  86. package/dist/contexts/auth/DASHAuthenticationService.js +1 -0
  87. package/dist/contexts/auth/WindowContext.js +1 -0
  88. package/dist/contexts/auth/index.js +1 -0
  89. package/dist/contexts/com/FCMContext.js +1 -0
  90. package/dist/contexts/com/LaravelEchoContext.js +1 -0
  91. package/dist/contexts/com/LaravelEchoMgr.js +1 -0
  92. package/dist/contexts/com/components/DefaultNotificationComponent.js +1 -0
  93. package/dist/contexts/com/components/NotificationAttributesTable.js +1 -0
  94. package/dist/contexts/com/components/NotificationRenderer.js +1 -0
  95. package/dist/contexts/com/components/NotificationsWidget.js +1 -0
  96. package/dist/contexts/com/components/notificationFormats.js +1 -0
  97. package/dist/contexts/com/useLaravelEcho.js +1 -0
  98. package/dist/contexts/dictionary/DictionaryContext.js +1 -0
  99. package/dist/declarations.d.ts +17 -0
  100. package/dist/default-theme/DASHAppProviders.js +1 -0
  101. package/dist/default-theme/DashThemeContext.js +1 -0
  102. package/dist/default-theme/DashThemeContext.tsx.fast +143 -0
  103. package/dist/default-theme/DashThemeContext.tsx.old +306 -0
  104. package/dist/default-theme/DashThemeHelperProvider.js +1 -0
  105. package/dist/default-theme/DomainAppLayout.js +1 -0
  106. package/dist/default-theme/DomainHeader.js +1 -0
  107. package/dist/default-theme/DomainTheme.js +1 -0
  108. package/dist/default-theme/FullLayoutMarkup.js +1 -0
  109. package/dist/default-theme/StaticLayout.js +1 -0
  110. package/dist/default-theme/index.js +1 -0
  111. package/dist/default-theme/menu/AppMaterialMenu.js +1 -0
  112. package/dist/default-theme/menu/AppMenuComponents/SubmenuPortal.js +1 -0
  113. package/dist/default-theme/menu/AppMenuComponents/collapsed/CollapsedSidebarItem.js +1 -0
  114. package/dist/default-theme/menu/AppMenuComponents/collapsed/CollapsedSidebarItems.js +1 -0
  115. package/dist/default-theme/menu/AppMenuComponents/expanded/CollapsableSidebarMenu.js +1 -0
  116. package/dist/default-theme/menu/AppMenuComponents/expanded/SidebarItem.js +1 -0
  117. package/dist/default-theme/menu/AppMenuComponents/getItem.js +1 -0
  118. package/dist/default-theme/menu/AppMenuComponents/interfaces.js +0 -0
  119. package/dist/default-theme/menu/AppMenuComponents/submenuConstants.js +1 -0
  120. package/dist/default-theme/menu/AppSidebarMaterial.js +1 -0
  121. package/dist/default-theme/menu/SidebarActions.js +1 -0
  122. package/dist/default-theme/updateDomCssVariables.js +1 -0
  123. package/dist/helpers/checkRole.js +1 -0
  124. package/dist/helpers/parseAxiosError.js +2 -0
  125. package/dist/hooks/audio/useAudio.js +1 -0
  126. package/dist/hooks/axios.js +1 -0
  127. package/dist/hooks/data/useDashboardStats.js +1 -0
  128. package/dist/hooks/data/usePackageByClientsStats.js +1 -0
  129. package/dist/hooks/data/usePackageByCommunesStats.js +1 -0
  130. package/dist/hooks/data/usePackageStats.js +1 -0
  131. package/dist/hooks/data/usePackageWithdrawDetails.js +1 -0
  132. package/dist/hooks/data/useStats.js +1 -0
  133. package/dist/hooks/isCurrentPath.js +1 -0
  134. package/dist/hooks/notifications/WSMessagesManager.js +1 -0
  135. package/dist/hooks/notifications/WSPusherManager.js +1 -0
  136. package/dist/hooks/useBreadcrumbs.js +1 -0
  137. package/dist/hooks/useClickOutside.js +1 -0
  138. package/dist/hooks/useFormPersistance.js +1 -0
  139. package/dist/hooks/useGlobalErrorMediator.js +1 -0
  140. package/dist/hooks/useGlobalLoaderMgr.js +1 -0
  141. package/dist/hooks/useHash.js +1 -0
  142. package/dist/hooks/useLocalStorage.js +1 -0
  143. package/dist/hooks/usePolyglotTranslation.js +1 -0
  144. package/dist/hooks/usePrevious.js +1 -0
  145. package/dist/hooks/usePrintSelected.js +1 -0
  146. package/dist/hooks/useVirtualHash.js +1 -0
  147. package/dist/hooks/window/useWindowSize.js +1 -0
  148. package/dist/interfaces/IAppResourceConfig.js +0 -0
  149. package/dist/interfaces/Log.js +0 -0
  150. package/dist/interfaces/Tenant.js +0 -0
  151. package/dist/interfaces/communication/IActions.js +0 -0
  152. package/dist/interfaces/communication/INotification.js +0 -0
  153. package/dist/interfaces/communication/IPayload.js +0 -0
  154. package/dist/interfaces/communication/IRequestAction.js +0 -0
  155. package/dist/interfaces/communication/IRequestPayload.js +0 -0
  156. package/dist/interfaces/communication/IResponseAction.js +0 -0
  157. package/dist/interfaces/misc/IAny.js +0 -0
  158. package/dist/interfaces/misc/IFlashMessage.js +0 -0
  159. package/dist/interfaces/navigation/IAppMenu.js +0 -0
  160. package/dist/interfaces/navigation/ICollapsableSidebarMenu.js +0 -0
  161. package/dist/interfaces/navigation/IMenuItem.js +0 -0
  162. package/dist/interfaces/notifications/IModel.js +0 -0
  163. package/dist/interfaces/notifications/IModelField.js +0 -0
  164. package/dist/interfaces/notifications/IUserNotification.js +0 -0
  165. package/dist/interfaces/notifications/IUserNotificationData.js +0 -0
  166. package/dist/interfaces/notifications/IUserNotificationPayload.js +0 -0
  167. package/dist/interfaces/user/IGetAuth.js +0 -0
  168. package/dist/interfaces/user/ITenantSettings.js +0 -0
  169. package/dist/interfaces/user/IUser.js +0 -0
  170. package/dist/interfaces/user/IUserSettings.js +0 -0
  171. package/dist/interfaces.js +1 -0
  172. package/dist/layout/AppLayout.js +1 -0
  173. package/dist/layout/ApplicationLayout.js +1 -0
  174. package/dist/layout/MotionWrapper.js +1 -0
  175. package/dist/layout/MotionWrapper.original.js +1 -0
  176. package/dist/layout/ResourceMenu.js +1 -0
  177. package/dist/layout/ResoureLayout.js +1 -0
  178. package/dist/layout/TransitionWrapper.js +24 -0
  179. package/dist/pages/ChangePassword.js +1 -0
  180. package/dist/pages/DASHLanding.js +1 -0
  181. package/dist/pages/DASHLightWeightLogin.js +1 -0
  182. package/dist/pages/DASHSimpleLogin.js +1 -0
  183. package/dist/pages/Login.js +1 -0
  184. package/dist/pages/Profile.js +1 -0
  185. package/dist/pages/RecoverPassword.js +1 -0
  186. package/dist/pages/SingleImageUploader.js +1 -0
  187. package/dist/pages/VerifyAccount.js +1 -0
  188. package/dist/providers/authProvider.js +1 -0
  189. package/dist/providers/dataProvider.js +1 -0
  190. package/dist/providers/i18n/en.js +1 -0
  191. package/dist/providers/i18n/es.js +1 -0
  192. package/dist/providers/i18n/languages.js +1 -0
  193. package/dist/providers/i18nProvider.js +1 -0
  194. package/dist/react-admin-dash/RADashComponent.js +1 -0
  195. package/dist/react-admin-dash/Resource.js +1 -0
  196. package/dist/resources/Brand/BrandResource.js +1 -0
  197. package/dist/resources/DASHResourceLoader.js +1 -0
  198. package/dist/resources/Log/LogResource.js +1 -0
  199. package/dist/resources/Tenant/ImpersonateTenantResource.js +1 -0
  200. package/dist/resources/Trash/TrashTemplate.js +1 -0
  201. package/dist/resources.js +1 -0
  202. package/dist/schemas/log.js +1 -0
  203. package/dist/schemas/notification.js +1 -0
  204. package/dist/schemas/permissions.js +1 -0
  205. package/dist/schemas/roles.js +1 -0
  206. package/dist/schemas/rolesDataGrid.js +1 -0
  207. package/dist/schemas/subscription/components/SubscriptionActions.js +1 -0
  208. package/dist/schemas/subscription/components/SubscriptionPaymentHistory.js +1 -0
  209. package/dist/schemas/subscription/components/SubscriptionPlanFeatures.js +1 -0
  210. package/dist/schemas/subscription/components/SubscriptionPlanPreview.js +1 -0
  211. package/dist/schemas/subscription/components/SubscriptionPlanStats.js +1 -0
  212. package/dist/schemas/subscription/components/SubscriptionStatusIndicator.js +1 -0
  213. package/dist/schemas/subscription/subscriptionPlanSchema.js +1 -0
  214. package/dist/schemas/subscription/subscriptionSchema.js +1 -0
  215. package/dist/schemas/subscriptionPlan.js +1 -0
  216. package/dist/schemas/tenant.js +1 -0
  217. package/dist/schemas/tenantUser.js +1 -0
  218. package/dist/schemas/tenant_superadmin.js +1 -0
  219. package/dist/schemas/user.js +1 -0
  220. package/dist/systemResources.js +1 -0
  221. package/dist/systemResources.old.js +1 -0
  222. package/dist/templates/ResourceTemplate.js +1 -0
  223. package/dist/templates/ResourceTemplate.tsx.memoized_experiment +350 -0
  224. package/dist/templates/ResourceTemplate.tsx.original +396 -0
  225. package/dist/templates/ResourceTemplateCreate.js +1 -0
  226. package/dist/templates/ResourceTemplateEdit.js +1 -0
  227. package/dist/templates/ResourceTemplateFull.js +1 -0
  228. package/dist/templates/ResourceTemplateList.js +1 -0
  229. package/dist/templates/ResourceTemplateOld.tsx.bkup +567 -0
  230. package/dist/templates/ResourceTemplateShow.js +1 -0
  231. package/dist/templates/TrashTemplate.js +1 -0
  232. package/dist/tenantResources.js +1 -0
  233. package/dist/test_portal_bubbles.js +1 -0
  234. package/dist/theme/AppHeader.js +1 -0
  235. package/dist/theme/AppLayoutSetting.js +1 -0
  236. package/dist/theme/AppLogo.js +1 -0
  237. package/dist/theme/AppSidebar.js +1 -0
  238. package/dist/theme/AppSidebarContent.js +1 -0
  239. package/dist/theme/AppSidebarLogo.js +1 -0
  240. package/dist/theme/components/PageTitle.js +1 -0
  241. package/dist/utils/cache/CacheInvalidatorContext.js +1 -0
  242. package/dist/utils/cache/CacheInvalidatorListenerComponent.js +1 -0
  243. package/dist/utils/cache/useCacheInvalidatorListener.js +1 -0
  244. package/dist/utils/convertFileToBase64.js +1 -0
  245. package/dist/utils/convertToFile.js +1 -0
  246. package/dist/utils/cookies.js +1 -0
  247. package/dist/utils/dashDefaultQueryClient.js +1 -0
  248. package/dist/utils/dataUrlToBlob.js +1 -0
  249. package/dist/utils/deepReplace.js +1 -0
  250. package/dist/utils/getProfileMenu.js +1 -0
  251. package/dist/utils/getTenantSettings.js +1 -0
  252. package/dist/utils/getType.js +1 -0
  253. package/dist/utils/getUserSettings.js +1 -0
  254. package/dist/utils/hasCode.js +1 -0
  255. package/dist/utils/index.js +1 -0
  256. package/dist/utils/injectTenantStyles.js +1 -0
  257. package/dist/utils/isComponent.js +1 -0
  258. package/dist/utils/navEvents.js +1 -0
  259. package/dist/utils/prototypes.js +1 -0
  260. package/dist/utils/regexp.js +1 -0
  261. package/dist/utils/resolveObjectPath.js +1 -0
  262. package/dist/utils/setNativeValue.js +1 -0
  263. package/dist/utils/slugify.js +1 -0
  264. package/dist/utils/validators/emailValidator.js +1 -0
  265. package/dist/utils/validators/requiredValidator.js +1 -0
  266. package/dist/utils/validators/rutValidator.js +1 -0
  267. package/dist/utils/validators.js +1 -0
  268. package/package.json +13 -2
@@ -0,0 +1 @@
1
+ import{Fragment as u,jsx as o,jsxs as c}from"react/jsx-runtime";import e,{Suspense as a}from"react";import t from"./components/loader/GlobalLoader";import{Loading as r}from"react-admin";import{ErrorBoundary as s}from"react-error-boundary";const p=n=>n?typeof n=="string"?n:typeof n=="object"&&n!==null&&"message"in n?String(n.message||"Unknown error"):"Unknown error":"Unknown error",l=({error:n})=>o(r,{loadingPrimary:"Error",loadingSecondary:p(n)}),i=e.lazy(()=>new Promise(n=>setTimeout(n,1*1e3)).then(()=>import("@app/DASHApp"))),m=()=>c(u,{children:[o(s,{FallbackComponent:l,children:o(a,{fallback:o(r,{loadingPrimary:"",loadingSecondary:""}),children:o(i,{})})}),o(t,{children:"..."})]});var b=m;export{b as default};
@@ -0,0 +1 @@
1
+ import{Fragment as h,jsx as r,jsxs as y}from"react/jsx-runtime";import l,{Suspense as d,useState as p,useTransition as c}from"react";import u from"./components/loader/GlobalLoader";import{Loading as o}from"react-admin";import{ErrorBoundary as f}from"react-error-boundary";const g=n=>n?typeof n=="string"?n:typeof n=="object"&&n!==null&&"message"in n?String(n.message||"Unknown error"):"Unknown error":"Unknown error",m=({error:n,resetErrorBoundary:e})=>r(o,{loadingPrimary:"Error",loadingSecondary:g(n)}),k=n=>{const{children:e}=n,[a,s]=c(),[t,i]=p(!0);return l.useEffect(()=>{s(()=>{i(!1)})},[]),y(h,{children:[r(f,{FallbackComponent:m,onReset:()=>{},children:r(d,{fallback:r(o,{loadingPrimary:"",loadingSecondary:""}),children:e})}),r(u,{children:"..."}),r("div",{className:!a&&!t?"dash-splash fade-out":"dash-splash"})]})};var w=k;export{w as default};
@@ -0,0 +1 @@
1
+ import{jsx as a,jsxs as C}from"react/jsx-runtime";import*as i from"react";import{useNavigate as $}from"react-router-dom";const ct=i.lazy(()=>import("./pages/Login")),bt=i.lazy(()=>import("./pages/Profile"));import{useDispatch as at,useSelector as q}from"react-redux";import{setCookie as B}from"./utils/cookies";import{useAuthContext as M}from"./contexts/auth";import{Error as O}from"./components/error/Error";import W from"./resources";import{dashStorage as x}from"@dashadmin/dash-utils";import{CustomRoutes as G,AdminUI as K,AdminContext as Y}from"react-admin";import Z from"./contexts/I18nBridgeSetter";import j from"./contexts/I18nReduxSync";import tt from"./contexts/auth/DASHAuthenticationService";import ut from"./providers/authProvider";import it from"./providers/dataProvider";import mt from"./providers/i18nProvider";import lt from"./classes/DASHStorageClass";import dt from"./helpers/checkRole";import Rt,{ConstantsContext as yt}from"./config/ConstantsService";import At from"./layout/AppLayout";const ee=i.lazy(()=>import("./pages/VerifyAccount")),oe=i.lazy(()=>import("./pages/RecoverPassword")),se=i.lazy(()=>import("./pages/ChangePassword"));import{setResources as ht}from"@dashadmin/dash-admin-state/src/redux/actions/Resources";import{DictionaryProvider as et}from"./contexts/dictionary/DictionaryContext";import ft from"./templates/ResourceTemplate";import{useMemo as f,useCallback as S}from"react";import{useDashThemeContext as gt}from"../src/default-theme/DashThemeContext";import{DASHAdminSystemConstants as pt}from"@dashadmin/dash-constants";const Ct=e=>e.settings.locale,St=e=>e.resources.items,Dt=i.memo(e=>{const{resources:t,locale:r,customAuthRoutes:s=[],customRoutes:l=[],...g}=e,{authenticated:m}=M(),D=f(()=>t.map(o=>{const{component:n,...E}=o;return(n||ft)({...E,locale:r})}),[t,r]),c=S(()=>s,[s]),d=S(()=>l,[l]),p=(o,n)=>i.cloneElement(o,{key:n}),H=f(()=>C(G,{children:[m?c().filter(o=>!o.props?.["data-layout"]?.toString().includes("no-layout")).map((o,n)=>p(o,o.key||`auth-route-${n}`)):null,d().filter(o=>m&&c().some(n=>n.props?.path===o.props?.path)?!1:!o.props?.["data-layout"]?.toString().includes("no-layout")).map((o,n)=>p(o,o.key||`custom-route-${n}`))]}),[m,c,d]),k=f(()=>C(G,{noLayout:!0,children:[m?c().filter(o=>o.props?.["data-layout"]?.toString().includes("no-layout")).map((o,n)=>p(o,o.key||`auth-no-layout-${n}`)):null,d().filter(o=>m&&c().some(n=>n.props?.path===o.props?.path)?!1:o.props?.["data-layout"]?.toString().includes("no-layout")).map((o,n)=>p(o,o.key||`custom-no-layout-${n}`))]}),[m,c,d]);return C(K,{...g,children:[D,H,k]})},(e,t)=>{const r=e.resources||[],s=t.resources||[];return r.length===s.length&&r.every((g,m)=>g===s[m])&&e.locale===t.locale&&e.layout===t.layout&&e.loginPage===t.loginPage&&e.notification===t.notification&&e.catchAll===t.catchAll&&e.error===t.error&&e.customAuthRoutes===t.customAuthRoutes&&e.customRoutes===t.customRoutes}),ot=()=>{const e=$();return i.useEffect(()=>{const t=tt.getPendingRedirect();if(t){console.log("\u{1F504} PrivateRedirectListener: Found persisted pending redirect:",t),tt.clearPendingRedirect();const r=t.startsWith("#")?t.substring(1):t;e(r)}},[e]),i.useEffect(()=>{const t=r=>{const{to:s}=r.detail;if(s){console.log("\u{1F504} PrivateRedirectListener: Navigating to",s);const l=s.startsWith("#")?s.substring(1):s;e(l)}};return window.addEventListener("auth:redirect",t),()=>window.removeEventListener("auth:redirect",t)},[e]),null},st=i.memo(e=>{const{customLoginPage:t=ct,customLayout:r=At,customNotification:s,customErrorPage:l,customDataProvider:g,customAuthProvider:m,customI18nProvider:D,customResources:c,useCoreResources:d=!0,customRecoverPassword:p,customChangePassword:H,customVerifyAccount:k,customThemeConfig:o,customAuthRoutes:n,customRoutes:E,customQueryClient:I,customDict:L,customReplacements:v,history:b,basePath:_,AdminHook:U=u=>u.children,children:R,dashboard:z}=e,P=q(Ct),y=q(St),X=at(),It=$(),Lt=S((u,w)=>dt(u,w),[]),{authenticated:J,user:A}=M(),T=S(()=>{const u=R?[]:c?c&&d===!1?c:[...W,...c]:W;console.log("\u{1F4CA} DASHAdmin.calculateResources:",{count:u.length,useCoreResources:d,hasChildren:!!R,hasCustomResources:!!c,customResourcesCount:Array.isArray(c)?c.length:0,models:u.map(w=>w.model).filter(Boolean)}),u&&u.length>0?(console.log("\u{1F4E4} DASHAdmin: Dispatching",u.length,"resources to Redux"),X(ht(u))):console.warn("\u26A0\uFE0F DASHAdmin.calculateResources: No resources to dispatch!")},[R,c,d,X]);i.useEffect(()=>{console.log("\u{1F504} DASHAdmin: calculateResources effect triggered (deps: [calculateResources])"),T()},[T]),i.useEffect(()=>{console.log("\u{1F4CA} DASHAdmin: Redux resources updated -",y?.length,"items, models:",y?.map(u=>u.model).filter(Boolean)),lt.resources=y},[y]),i.useEffect(()=>{if(J&&y&&!R)try{A?.tenant_id&&(x.setItem("tenant_id",A.tenant_id.toString()),B("tenant_id",A.tenant_id.toString()),x.setItem("user_id",A.id.toString()),B("user_id",A.id.toString()))}catch(u){console.error(u)}},[J,A,y,R]);const h=i.useContext(yt),F=f(()=>L?{...h.systemConstants.dict,...L}:h.systemConstants.dict,[L,h.systemConstants.dict]),N=f(()=>v?{...h.systemConstants.replacements,...v}:h.systemConstants.replacements,[v,h.systemConstants.replacements]),{themeOptions:nt}=gt(),{colorSchemes:vt,cssVariables:Pt,defaultColorScheme:wt,...rt}=nt,Q={dataProvider:g||it,i18nProvider:D||mt,...m!==null&&{authProvider:m||ut},...o?{theme:o}:{theme:rt},...I&&{queryClient:I},...b&&{history:b},..._?{basename:_}:{basename:pt.system.URL_PREFIX}},V=f(()=>({...s&&{notification:s},layout:r,loginPage:t,...l&&{catchAll:l},...O&&{error:O},dashboard:z}),[s,r,t,l,z]);return R?a(et,{dictionary:F,replacements:N,children:C(Y,{...Q,children:[a(j,{locale:P}),a(Z,{}),a(U,{}),a(ot,{}),a(K,{...V,children:R})]})}):a(et,{dictionary:F,replacements:N,children:C(Y,{...Q,children:[a(j,{locale:P}),a(Z,{}),a(U,{}),a(ot,{}),a(Dt,{...V,resources:y,locale:P,customAuthRoutes:n,customRoutes:E})]})})},(e,t)=>e.customResources===t.customResources&&e.useCoreResources===t.useCoreResources&&e.children===t.children&&e.customLoginPage===t.customLoginPage&&e.customLayout===t.customLayout&&e.customDataProvider===t.customDataProvider&&e.customAuthProvider===t.customAuthProvider&&e.dashboard===t.dashboard&&e.customAuthRoutes===t.customAuthRoutes&&e.customRoutes===t.customRoutes),Et=e=>{const{initialAppConstants:t,children:r,...s}=e;return a(Rt,{initialAppConstants:t,children:r?a(st,{...s,children:r}):a(st,{...s})})};var Re=Et;export{Re as default};
@@ -0,0 +1,456 @@
1
+ /* eslint-disable @typescript-eslint/indent */
2
+ /* eslint-disable no-mixed-spaces-and-tabs */
3
+ /**
4
+ * TODO: Customize the error page
5
+ * TODO: Implement MemoryHistory instead of history.
6
+ */
7
+ import * as React from 'react';
8
+ import { Route, Routes, useLocation, useNavigate } from 'react-router-dom';
9
+ import { appTheme } from 'dash-styles';
10
+
11
+ import RoutingWrapper from './RoutingWrapper';
12
+ import DomainAppLayout from 'dash-default-theme/src/DomainAppLayout';
13
+
14
+ import MyLoginPage from './pages/Login';
15
+ import Profile from './pages/Profile';
16
+
17
+ import { useDispatch, useSelector } from 'react-redux';
18
+ import { getCookie, setCookie } from './utils/cookies';
19
+ import { AuthContext, IAuthContext, useAuthContext } from './contexts/auth';
20
+ import { IDASHAppState } from 'dash-admin-state';
21
+ import { Error } from './components/error/Error';
22
+ //import { lightTheme } from './themes';
23
+ import coreResources from './resources';
24
+
25
+ import { CustomRoutes, useTheme, AdminUI, AdminContext, AdminUIProps, Resource } from 'react-admin';
26
+
27
+ export interface IAppResourceGroupsIcon {
28
+ [x: string]: JSX.Element;
29
+ }
30
+
31
+ /**
32
+ * Defines the interface for the DASHAdmin application, which includes various configuration options for customizing the application's behavior.
33
+ *
34
+ * @template U - The interface for the application's user data.
35
+ * @template A - The interface for the application's authentication data.
36
+ * @template R - The interface for the application's resource data, which must be an extension of `IAutoResourceConfig`.
37
+ * @template C - The interface for the application's constants.
38
+ *
39
+ * @property {C} [initialAppConstants] - The initial app constants for the application.
40
+ * @property {IDASHAppState<U, A, R>} [initialAppState] - The initial app state for the application.
41
+ * @property {any} [customDataProvider] - A custom data provider to replace the default one.
42
+ * @property {R[]} [customResources] - The custom resources for the application.
43
+ * @property {React.FC<any>} [customLoginPage] - A custom login page to replace the default one.
44
+ * @property {React.FC<IAppLayout>} [customLayout] - A custom layout to replace the default one.
45
+ * @property {() => JSX.Element} [customNotification] - A custom notification component to replace the default one.
46
+ * @property {any} [customErrorPage] - A custom error page to replace the default one.
47
+ * @property {any} [customAuthProvider] - A custom auth provider to replace the default one.
48
+ * @property {any} [customI18nProvider] - A custom i18n provider to replace the default one.
49
+ * @property {boolean} [useCoreResources] - Whether to use the default core resources or not.
50
+ * @property {JSX.Element | false} [customProfilePage] - A custom profile page or `false` to disable the default one.
51
+ * @property {JSX.Element | false} [customRecoverPassword] - A custom recover password page or `false` to disable the default one.
52
+ * @property {JSX.Element | false} [customVerifyAccount] - A custom verify account page or `false` to disable the default one.
53
+ * @property {JSX.Element | false} [customChangePassword] - A custom change password page or `false` to disable the default one.
54
+ * @property {any} [customThemeConfig] - A custom Material UI theme configuration.
55
+ * @property {Route[]} [customAuthRoutes] - Custom authentication routes.
56
+ * @property {Route[]} [customRoutes] - Custom routes.
57
+ * @property {QueryClient} [customQueryClient] - A custom QueryClient.
58
+ * @property {any} [history] - The history object (deprecated).
59
+ * @property {{ [x: string]: string }} [customDict] - Custom dictionary translations.
60
+ * @property {{ [x: string]: string }} [customReplacements] - Custom string replacements.
61
+ * @property {JSX.Element} [children] - The child components of the DASHAdmin application.
62
+ */
63
+ export interface IDASHAdmin<U, A, R, C> {
64
+ /**
65
+ * DASHAdmin application default app state; you can specify the User <U> interface, the Auth <A> interface and the Resources <R> interface
66
+ * U: App User Interface
67
+ * A: App Auth Interface (Auth is for system config for an auth user)
68
+ * R: Resource items interface, always will be an IAutoResourceConfig extension class.
69
+ * C: Interface for app constants
70
+ */
71
+ initialAppConstants?: C;
72
+ //initialAppState?: IDASHAppState<U, A, R>;
73
+ //dashAdminState?: S;
74
+ /** A default data provider is included, replaces the entire data provider */
75
+ customDataProvider?: any;
76
+ /** Your application resources */
77
+ customResources?: R[];
78
+ /** replaces the login page */
79
+ customLoginPage?: React.FC<any>;
80
+ /** replaces the layout */
81
+ customLayout?: React.FC<IAppLayout>;
82
+ /** replaces the default notification; https://marmelab.com/react-admin/Admin.html#notification */
83
+ customNotification?: () => React.JSX.Element;
84
+ /** replaces the default error page */
85
+ customErrorPage?: any;
86
+ /** replaces the default data provider*/
87
+ customAuthProvider?: any;
88
+ /** replaces the I18n provider*/
89
+ customI18nProvider?: any;
90
+ /** Default resources for system/admin model to work with the default backend api are included, if set to false, no system resources will be appended */
91
+ useCoreResources?: boolean;
92
+ /** false to disable and handle your own route */
93
+ customProfilePage?: JSX.Element | false;
94
+ /** false to disable and handle your own route */
95
+ customRecoverPassword?: JSX.Element | false;
96
+ /** false to disable and handle your own route */
97
+ customVerifyAccount?: JSX.Element | false;
98
+ /** false to disable and handle your own route */
99
+ customChangePassword?: JSX.Element | false;
100
+ /** Material UI theme */
101
+ customThemeConfig?: any;
102
+ /** Custom Auth Routes */
103
+ customAuthRoutes?: React.ReactElement[] /*React.ReactElement[];*/
104
+ /** Custom Not Authenticated Routes */
105
+ customRoutes?: React.ReactElement[] /*React.ReactElement[];*/
106
+ /** QueryClient */
107
+ customQueryClient?: QueryClient;
108
+ /** History. @deprecated notice */
109
+ history?: any; // TODO: MemoryHistory
110
+ // error={{errorComponent:Error}} // TODO as defined in the header of this file.
111
+ customDict?: { [x: string]: string }
112
+ customReplacements?: { [x: string]: string }
113
+ children?: JSX.Element;
114
+ }
115
+
116
+ import authProvider from './providers/authProvider';
117
+ import dataProvider from './providers/dataProvider';
118
+ import i18nProvider from './providers/i18nProvider';
119
+
120
+ import DASHStorageClass from './classes/DASHStorageClass';
121
+
122
+ import { QueryClient } from '@tanstack/react-query';
123
+
124
+
125
+ import checkRole from './helpers/checkRole';
126
+
127
+ import { Provider } from 'react-redux';
128
+
129
+ import ConstantsProvider, { ConstantsContext } from './config/ConstantsService';
130
+
131
+ import AppLayout, { IAppLayout } from './layout/AppLayout';
132
+ import VerifyAccount from './pages/VerifyAccount';
133
+ import RecoverPassword from './pages/RecoverPassword';
134
+ import ChangePassword from './pages/ChangePassword';
135
+
136
+ import { setResources } from 'dash-admin-state/src/redux/actions/Resources';
137
+ //import configureStore from 'dash-admin-state/src/redux/store';
138
+ import {
139
+ DictionaryProvider,
140
+ } from './contexts/dictionary/DictionaryContext';
141
+ import { IDashAutoAdminResourceConfig } from 'dash-auto-admin';
142
+ import ResourceTemplate from './templates/ResourceTemplate';
143
+ import { JSX, useEffect } from 'react';
144
+ import RADashComponent from './react-admin-dash/RADashComponent';
145
+ import DASHAuthenticationService from './contexts/auth/DASHAuthenticationService';
146
+
147
+
148
+ interface IAsyncResources extends AdminUIProps {
149
+ resources: any;
150
+ }
151
+
152
+
153
+ const DASHAdminApp: React.FC<IDASHAdmin<unknown, unknown, unknown, unknown>> = (props) => {
154
+ const {
155
+ customLoginPage = MyLoginPage,
156
+ customLayout = AppLayout,
157
+ customNotification,
158
+ customErrorPage,
159
+ customDataProvider,
160
+ customAuthProvider,
161
+ customI18nProvider,
162
+ customResources,
163
+ useCoreResources = true,
164
+ customProfilePage,
165
+ customRecoverPassword,
166
+ customChangePassword,
167
+ customVerifyAccount,
168
+ customThemeConfig,
169
+ customAuthRoutes,
170
+ customRoutes,
171
+ customQueryClient,
172
+ customDict,
173
+ customReplacements,
174
+ history,
175
+ children,
176
+ } = props;
177
+
178
+ //Locale
179
+ const ReactLocale = useSelector(
180
+ (state: IDASHAppState<unknown, unknown, IDashAutoAdminResourceConfig>) =>
181
+ state.settings.locale,
182
+ );
183
+ const resources = useSelector(
184
+ (state: IDASHAppState<unknown, unknown, IDashAutoAdminResourceConfig>) =>
185
+ state.resources.items,
186
+ );
187
+
188
+ const dispatch = useDispatch();
189
+ //const currentAppLocale = AppLocale[locale.locale];
190
+
191
+
192
+ //Roles
193
+ const _checkRole = (permissions, roles) => {
194
+ return checkRole(permissions, roles);
195
+ };
196
+
197
+ //const a = useSelector((state: IDASHAppState) => state.settings.locale);
198
+ /** The auth context watches for auth changes */
199
+ //const { authenticated, user }: IAuthContext = React.useContext(AuthContext);
200
+ const { authenticated, user } = useAuthContext();
201
+ // Concatenate default system resources (coreResources) with the AppResouces (customResources):
202
+ const calculateResources = () => {
203
+ const _resources = !children
204
+ ? customResources
205
+ ? customResources && useCoreResources === false
206
+ ? customResources
207
+ : [...coreResources, ...customResources]
208
+ : coreResources
209
+ : [];
210
+ if (_resources && _resources.length > 0) {
211
+ dispatch<any>(setResources(_resources));
212
+ }
213
+ };
214
+
215
+ /** When the application loads, process the resources, and dispatch the redux setter. */
216
+ /*React.useEffect(() => {
217
+ console.log("calculateResources on refresh")
218
+ calculateResources();
219
+ }, []);*/
220
+
221
+ /** When the authcontext changes, update the resources; this is necessary to render different menus, if the user log out, then log in with a different role. */
222
+ React.useEffect(() => {
223
+ //console.log("calculateResources on auth")
224
+ if(authenticated ) calculateResources();
225
+ }, [authenticated]);
226
+
227
+ /** When the redux resources are updated, store them in an ES6 Class, in order to be accessible in the data-provider without redux */
228
+ React.useEffect(() => {
229
+ //console.log("updating resources")
230
+ // DASHStorageClass is required to be access the current Resources in the dataProvider;
231
+ // TODO: store just a simplified serialized version.
232
+ DASHStorageClass.resources = resources;
233
+ }, [resources]);
234
+
235
+ /**
236
+ * DASH Admin AuthContext
237
+ * AuthContext from RA can't be used because this happens before RA initialization
238
+ */
239
+ React.useEffect(() => {
240
+ if (authenticated && resources) {
241
+ if (!children) {
242
+ try {
243
+ if (user?.tenant_id) {
244
+
245
+
246
+ dashStorage.setItem('tenant_id', user.tenant_id.toString());
247
+ setCookie('tenant_id', user.tenant_id.toString());
248
+
249
+
250
+ }
251
+ } catch (e) {
252
+ console.error(e);
253
+ }
254
+ }
255
+ }
256
+ }, [authenticated, user, resources]);
257
+
258
+ /* Sets the application auth and no auth custom routes */
259
+ /* @ts-ignore */
260
+ const getCustomAuthRoutes = (): Route[] => customAuthRoutes ?? [];
261
+
262
+ /* @ts-ignore */
263
+ const getCustomRoutes = (): Route[] => customRoutes ?? [];
264
+ const navigate = useNavigate();
265
+ useEffect(() =>{
266
+ const redirect = DASHAuthenticationService.getPendingRedirect();
267
+ if(redirect) {
268
+ DASHAuthenticationService.clearPendingRedirect();
269
+ navigate(redirect)
270
+ }
271
+ },[authenticated])
272
+
273
+ const AsyncResources: React.FC<IAsyncResources> = (p) => {
274
+ const { resources: res, ...rest } = p;
275
+
276
+ const _resources = res.map((originalResource:any /*IDashAutoAdminResourceConfig)*/) => {
277
+
278
+ /* Deprecated
279
+
280
+ if (_checkRole(permissions, resource.roles) && resource.component) {
281
+ _resources.push(resource.component && resource.component(resource));
282
+ }
283
+
284
+ */
285
+
286
+
287
+ const { component: InputResourceTemplate, ...restProps } = originalResource;
288
+ const ResourceComponent = InputResourceTemplate || ResourceTemplate;
289
+ return ResourceComponent(restProps);
290
+ });
291
+
292
+ return (
293
+ <>
294
+ <AdminUI {...rest} /*ready={Loading}*/>
295
+
296
+ {_resources.map((parsedResource) => parsedResource)}
297
+
298
+ <CustomRoutes>
299
+ {(authenticated) && customProfilePage !== false ? (
300
+ <Route
301
+ key={'/profile'}
302
+ path='/profile'
303
+ element={customProfilePage || <Profile />}
304
+ />
305
+ ) : <></>}
306
+
307
+ {(authenticated) && getCustomAuthRoutes()
308
+ .filter(route => !route.props['data-layout']?.toString().includes('no-layout'))
309
+ .map((route, index) => {
310
+
311
+ //console.log('Auth Route Key:', route.props.get)
312
+ return <Route key={`auth-route-${index}`} {...route.props} />
313
+ })}
314
+
315
+
316
+ {getCustomRoutes()
317
+ .filter(route => {
318
+
319
+ if ((authenticated ) && getCustomAuthRoutes().some(authRoute => authRoute.props.path === route.props.path)) {
320
+ return false
321
+ }
322
+ return !route.props['data-layout']?.toString().includes('no-layout')
323
+ })
324
+ .map((route, index) => {
325
+
326
+ //console.log('Normal Route Key:', route.props)
327
+ return <Route key={`custom-auth-route-${index}`} {...route.props}>
328
+ {route.props.children || <></>}
329
+ </Route>
330
+
331
+ })}
332
+
333
+ </CustomRoutes>
334
+
335
+ <CustomRoutes noLayout>
336
+
337
+ {authenticated ? getCustomAuthRoutes()
338
+ .filter(route => route.props['data-layout']?.toString().includes('no-layout'))
339
+ .map((route, index) => {
340
+
341
+ //console.log('No layout Auth Route Key:', route.props.get)
342
+ return <Route key={`auth-route-${index}`} {...route.props} />
343
+ }) : <></>}
344
+
345
+ {getCustomRoutes()
346
+ .filter(route => {
347
+
348
+ if (authenticated && getCustomAuthRoutes().some(authRoute => authRoute.props.path === route.props.path)) {
349
+ return false
350
+ }
351
+ return route.props['data-layout']?.toString().includes('no-layout')
352
+ })
353
+ .map((route, index) => {
354
+
355
+ //console.log('No layout Normal Route Key:', route.props)
356
+ return <Route key={`custom-auth-route-${index}`} {...route.props}>
357
+ {route.props.children || <></>}
358
+ </Route>
359
+
360
+ })}
361
+
362
+
363
+ </CustomRoutes>
364
+
365
+ </AdminUI></>
366
+ );
367
+ };
368
+
369
+ const constants = React.useContext(ConstantsContext);
370
+
371
+ return children ? (
372
+ <DictionaryProvider
373
+ dictionary={customDict ? { ...constants.systemConstants.dict, ...customDict } : constants.systemConstants.dict}
374
+ replacements={customReplacements ? { ...constants.systemConstants.replacements, ...customReplacements } : constants.systemConstants.replacements}
375
+ >
376
+ <AdminContext
377
+ dataProvider={customDataProvider || dataProvider}
378
+ i18nProvider={customI18nProvider || i18nProvider}
379
+ authProvider={customAuthProvider || authProvider}
380
+ {...(customThemeConfig && { theme:customThemeConfig })}
381
+ {...(customQueryClient && { queryClient: customQueryClient as QueryClient })}
382
+ {...((history !== null || history !== undefined) && { history })}
383
+ //store={store} //TODO implement the store override
384
+ // error={{ errorComponent: Error }} // TODO ¿how to customize the error page?
385
+ >
386
+
387
+ <AdminUI
388
+ {...(customNotification && { notification: customNotification })}
389
+ layout={customLayout}
390
+ /* @ts-ignore Known issue type mismatch */
391
+ loginPage={customLoginPage}
392
+ {...(customErrorPage && { catchAll: customErrorPage })}
393
+ {...(Error && { error: Error })}
394
+ //error={Error} // TODO ¿how to customize the error page?
395
+ >
396
+ {children}
397
+ </AdminUI>
398
+ <RADashComponent />
399
+ </AdminContext>
400
+ </DictionaryProvider>
401
+ ) : (
402
+ <DictionaryProvider
403
+ dictionary={customDict ? { ...constants.systemConstants.dict, ...customDict } : constants.systemConstants.dict}
404
+ replacements={customReplacements ? { ...constants.systemConstants.replacements, ...customReplacements } : constants.systemConstants.replacements}
405
+ >
406
+
407
+ <AdminContext
408
+ dataProvider={customDataProvider || dataProvider}
409
+ i18nProvider={customI18nProvider || i18nProvider}
410
+ authProvider={customAuthProvider || authProvider}
411
+ {...(customThemeConfig && { theme:customThemeConfig })}
412
+ {...(customQueryClient && { queryClient: customQueryClient as QueryClient })}
413
+ {...(history && { history: history })}
414
+ // error={{ errorComponent: Error }} // TODO how to customize the error page
415
+ >
416
+
417
+ <AsyncResources
418
+ {...(customNotification && { notification: customNotification })}
419
+ /* @ts-ignore type mismatch */
420
+ loginPage={customLoginPage}
421
+ layout={customLayout}
422
+ {...(customErrorPage && { catchAll: customErrorPage })}
423
+ {...(Error && { error: Error })}
424
+ resources={resources}
425
+ />
426
+ <RADashComponent />
427
+ </AdminContext>
428
+
429
+ </DictionaryProvider>
430
+ );
431
+ };
432
+
433
+ /**
434
+ * The main DASHAdmin component
435
+ *
436
+ * @param props - The props object containing the initial app state, initial app constants, and optional children components.
437
+ * @returns A React component that renders the DASHAdminApp with the provided props and context.
438
+ */
439
+
440
+
441
+ const DASHAdmin = <U, A, R, C, S>(props: IDASHAdmin<U, A, R, C>): JSX.Element => {
442
+
443
+ const { initialAppConstants, children, ...rest } = props;
444
+
445
+ return (
446
+ /* @ts-ignore */
447
+
448
+ <ConstantsProvider<C> initialAppConstants={initialAppConstants}>
449
+ {children ? <DASHAdminApp {...rest}>{children}</DASHAdminApp> : <DASHAdminApp {...rest} />}
450
+ </ConstantsProvider>
451
+
452
+ );
453
+ };
454
+ export default React.memo(
455
+ DASHAdmin as React.ComponentType<IDASHAdmin<unknown, unknown, unknown, unknown>>
456
+ ) as typeof DASHAdmin;
@@ -0,0 +1 @@
1
+ import{jsx as t}from"react/jsx-runtime";import{useEffect as u,useState as c,useRef as f}from"react";import{BrowserRouter as R,Route as h,Routes as p,useLocation as y}from"react-router-dom";import{AnimatePresence as d}from"framer-motion";import C from"./layout/MotionWrapper";const P=({Wrapper:o,BrowserRouterComponent:e,LayoutComponent:r,children:n})=>{const a=e||R;return r?t(a,{children:t(r,{children:o?t(o,{children:n}):n})}):t(a,{children:o?t(o,{children:n}):n})},x=({children:o})=>{const e=y();let r="wait",n=!1;const a=e.pathname.split("/"),m=a[a.length-1],[l,s]=c(!0),i=f(!0);return isNaN(parseInt(m))||(r="sync"),u(()=>{i.current&&s(!0)},[e.pathname]),u(()=>(i.current=!0,()=>{i.current=!1}),[]),n?t(d,{mode:r,onExitComplete:()=>{i.current&&s(!1)},children:t(p,{location:e,children:t(h,{element:t(C,{pageTransition:!0,loadingSpinner:!0,transitionDuration:.5,initialShow:l,maxTimeOut:8e3,usePortalForBackground:!0,portalTarget:".dash-app-layout-content",usePortalForSpinner:!0,spinnerPortalTarget:"body"}),children:o})},e.pathname)}):t(p,{location:e,children:o},e.pathname)};var A=P;export{x as AnimatedRoutesWrapper,A as default};
@@ -0,0 +1 @@
1
+ var e=Object.defineProperty;var i=(s,t,a)=>t in s?e(s,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):s[t]=a;var c=(s,t,a)=>i(s,typeof t!="symbol"?t+"":t,a);class n{}c(n,"resources",[]),c(n,"constants");var r=n;export{r as default};
@@ -0,0 +1 @@
1
+ import{jsx as o}from"react/jsx-runtime";import{RichTextInput as r}from"ra-input-rich-text";import{RichTextField as m}from"react-admin";const c=({method:t,attribute:e})=>o(r,{label:e.label,source:e.attribute}),n=({method:t,attribute:e,resourceConfig:i})=>{switch(t){case"edit":case"create":return o(c,{attribute:e,method:t,resourceConfig:i});case"view":return o(m,{source:e.attribute})}};var h=n;export{h as default};
@@ -0,0 +1 @@
1
+ import{jsx as h}from"react/jsx-runtime";import{useEffect as m}from"react";import{useRedirect as c,Loading as n}from"react-admin";import{useParams as f}from"react-router";import{DASHAdminSystemConstants as l}from"@dashadmin/dash-constants";const p=l.system.URL_PREFIX,R=({method:t,resourceConfig:r,stateHashPattern:a=p,drawerMethod:i="edit",...u})=>{const o=f(),d=c(),s=r?.idParamName||"id";return m(()=>{let e=a.replace(`:${s}`,o[s]);e=e.replace(":method",i),d(t,r.model,t==="edit"?o.id:null,null,{hash:e})},[]),h(n,{})};var w=R;export{w as default};
@@ -0,0 +1 @@
1
+ import{Fragment as h,jsx as o,jsxs as F}from"react/jsx-runtime";import{useRecordContext as s}from"react-admin";import{Box as l}from"@mui/material";import p from"./SingleImageUploader";import{useFormContext as d}from"react-hook-form";import C from"@mui/material/Avatar";const A=e=>{const{method:r,attribute:t}=e,a=s(),i=t.listAttribute||t.attribute,{setValue:m,formState:{errors:n}}=d(),u=c=>{m(t.attribute,c,{shouldDirty:!0})};return F(h,{children:[o(p,{classNamePrefix:"dash-profile",...r==="edit"&&a&&a[i]?{currentUrl:a[i]}:{},onChange:u}),n[t.attribute]&&o("span",{style:{color:"red"},children:n[t.attribute]?.message?.toString()||"Error"})]})},f=e=>{const{attribute:r}=e,t=s(),a=r.listAttribute||r.attribute,i=t?.[a];return o(l,{display:"flex",alignItems:"center",children:o(C,{src:i,alt:"avatar"})})},b=({method:e,attribute:r,resourceConfig:t})=>{switch(e){case"edit":case"create":return o(A,{attribute:r,method:e,resourceConfig:t});case"view":case"list":return o(f,{attribute:r,method:e,resourceConfig:t})}};var _=b;export{f as AvatarDisplay,A as AvatarHandler,_ as default};
@@ -0,0 +1 @@
1
+ import{jsx as e,jsxs as r}from"react/jsx-runtime";import{IconButton as c}from"@mui/material";import{useState as g}from"react";import s from"@mui/icons-material/Edit";import p from"@mui/icons-material/Image";const d=n=>{const{classNamePrefix:a="default",currentUrl:i="single-image-uploader",onChange:t}=n,[l,m]=g(null);return r("div",{className:`single-image-uploader ${a}-img`,children:[l||i?e("img",{src:l||i,alt:""}):e("div",{className:`${a}-icon`,children:e(p,{})}),r(c,{"aria-label":"upload image",component:"label",className:`${a}-edit`,children:[e("input",{hidden:!0,accept:"image/*",type:"file",onChange:o=>{m(URL.createObjectURL(o.target.files[0])),t&&t(o.target.files[0])}}),e(s,{style:{opacity:"0.6"}})]})]})};var N=d;export{N as default};
@@ -0,0 +1 @@
1
+ import{Fragment as f,jsx as r,jsxs as I}from"react/jsx-runtime";import{useEffect as h,useState as c}from"react";import{useRecordContext as i}from"react-admin";import{TextField as d}from"@mui/material";import{useWatch as l}from"react-hook-form";import F from"numeral";const A=({method:o,attribute:a})=>{const t=i();return r(f,{})},y=({method:o,attribute:a})=>{const[t,C]=c(""),[p,b]=c("0"),g=i(),m=l({name:"format"}),s=l({name:"symbol"}),u=e=>{try{C(e);const n=m?F(e).format(m):e;b(s?s+n:n)}catch(n){return console.log(n),0}};return h(()=>{u(t)},[m,s]),I(f,{children:[r(d,{label:"Probar formateo",value:t,onChange:({target:{value:e}})=>u(e)}),r(d,{label:"Valor formateado",value:p,inputProps:{readOnly:!0}})]})},D=({method:o,attribute:a,resourceConfig:t})=>{switch(o){case"edit":case"create":return r(y,{attribute:a,method:o,resourceConfig:t});case"view":return r(A,{attribute:a,method:o,resourceConfig:t})}};var V=D;export{V as default};
@@ -0,0 +1 @@
1
+ import{Fragment as a,jsx as f}from"react/jsx-runtime";import{useEffect as i}from"react";import{useNavigate as o}from"react-router-dom";const c=({path:e,timer:r})=>{const t=o();return i(()=>{r?setTimeout(()=>{t(e)},10):t(e)},[]),f(a,{})};var u=c;export{u as default};
@@ -0,0 +1 @@
1
+ import{jsx as t,jsxs as l}from"react/jsx-runtime";import{Fragment as g}from"react";import{styled as u}from"@mui/material/styles";import a from"prop-types";import{Button as y}from"@mui/material";import E from"@mui/icons-material/Report";import"@mui/icons-material/ExpandMore";import I from"@mui/icons-material/History";import{useTranslate as b}from"react-admin";import{useResetErrorBoundaryOnLocationChange as $}from"react-admin";import{Title as k}from"react-admin";const v=r=>r?typeof r=="string"?r:typeof r=="object"&&r!==null&&"message"in r?String(r.message||"Unknown error"):"Unknown error":"Unknown error",T=r=>{const{error:n,errorComponent:c,errorInfo:m,resetErrorBoundary:p,className:d,title:s,...f}=r,i=b();if($(p),c)return t(c,{error:n,errorInfo:m,title:s});const h=v(n);return l(g,{children:[s&&t(k,{title:s}),l(C,{className:d,...f,children:[l("h1",{className:o.title,role:"alert",children:[t(E,{className:o.icon}),i("ra.page.error")]}),t("div",{children:i("ra.message.error")}),!1,t("div",{className:o.toolbar,children:t(y,{variant:"contained",startIcon:t(I,{}),onClick:N,children:i("ra.action.back")})})]})]})};T.propTypes={className:a.string,error:a.object.isRequired,errorInfo:a.object,title:a.string};const e="RaError",o={container:`${e}-container`,title:`${e}-title`,icon:`${e}-icon`,panel:`${e}-panel`,panelSumary:`${e}-panelSumary`,panelDetails:`${e}-panelDetails`,toolbar:`${e}-toolbar`,advice:`${e}-advice`},C=u("div",{name:e,overridesResolver:(r,n)=>n.root})(({theme:r})=>({display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",[r.breakpoints.down("md")]:{padding:"1em"},fontFamily:"Roboto, sans-serif",opacity:.5,[`& .${o.title}`]:{display:"flex",alignItems:"center"},[`& .${o.icon}`]:{width:"2em",height:"2em",marginRight:"0.5em"},[`& .${o.panel}`]:{marginTop:"1em",maxWidth:"60em"},[`& .${o.panelSumary}`]:{userSelect:"all"},[`& .${o.panelDetails}`]:{whiteSpace:"pre-wrap"},[`& .${o.toolbar}`]:{marginTop:"2em"},[`& .${o.advice}`]:{marginTop:"2em"}}));function N(){window.history.go(-1)}export{T as Error,o as ErrorClasses};
@@ -0,0 +1 @@
1
+ import{jsx as o,jsxs as m}from"react/jsx-runtime";import{createElement as T}from"react";import{useEffect as F,useState as A}from"react";import{TextField as _}from"react-admin";import{useRecordContext as l}from"react-admin";import b,{geocodeByAddress as x}from"react-places-autocomplete";import{useController as y}from"react-hook-form";import{TextField as I}from"@mui/material";const N=({method:d,attribute:e,resourceConfig:r})=>{const i=l();return o(_,{label:e.label,source:e.attribute,options:e.fieldProps})},R=({method:d,attribute:e})=>{const[r,i]=A(""),n=l(),u={componentRestrictions:{country:"CL"},location:new google.maps.LatLng(-34,151),radius:2e3,types:["address"]},c=y({name:e.attribute,defaultValue:""}),p=t=>{x(t).then(s=>{c.field.onChange(JSON.stringify(s[0])),i(s[0].formatted_address)}).catch(s=>console.error("Error",s))};return F(()=>{n?.geocoded_address&&i(n.geocoded_address)},[n]),o(b,{value:r,onChange:t=>i(t),onSelect:t=>p(t),searchOptions:u,children:({getInputProps:t,suggestions:s,getSuggestionItemProps:f,loading:C})=>m("div",{className:"form__item",children:[o("div",{className:"form__item__icon",children:o(I,{label:e.label,...c.field,...t({placeholder:e.label,className:"input location-search-input"}),options:{...e.fieldProps},autoComplete:"off",defaultValue:r,variant:"filled"})}),m("div",{className:"autocomplete-dropdown-container",children:[C&&o("div",{children:"Cargando..."}),s.map((a,g)=>{const h=a.active?"suggestion-item--active":"suggestion-item",v=a.active?{backgroundColor:"#fafafa",cursor:"pointer"}:{backgroundColor:"#ffffff",cursor:"pointer"};return T("div",{...f(a,{className:h,style:v}),key:g},o("span",{children:a.description}))})]})]})})},w=({method:d,attribute:e,resourceConfig:r})=>{switch(d){case"edit":case"create":return o(R,{attribute:e,method:d,resourceConfig:r});case"view":return o(N,{attribute:e,method:d,resourceConfig:r})}};var J=w;export{J as default};
@@ -0,0 +1 @@
1
+ import{Fragment as N,jsx as n,jsxs as D}from"react/jsx-runtime";import{useState as f,useCallback as s}from"react";import{Menu as C,MenuItem as I,Button as R,Tooltip as y,IconButton as E}from"@mui/material";import S from"@mui/icons-material/Language";import{useI18nBridge as T,useBridgedLocales as b}from"../../contexts/I18nBridgeContext";import{useLocaleState as k}from"react-admin";import{useDispatch as w}from"react-redux";import{DASH_REDUX_ACTIONS as A}from"@dashadmin/dash-admin-state";const P=({iconOnly:p=!0,icon:u=n(S,{})})=>{const[i,d]=f(null),o=b(),{i18nProvider:l,locale:a,setLocale:g}=T(),[,B]=k(),L=s(e=>{d(e.currentTarget)},[]),c=s(()=>{d(null)},[]),m=w(),M=s(async e=>{if(console.log("\u{1F310} BridgedLocalesMenuButton: Changing locale to:",e),l?.changeLocale){console.log("\u{1F310} BridgedLocalesMenuButton: Awaiting changeLocale...");try{await l.changeLocale(e),console.log("\u{1F310} BridgedLocalesMenuButton: changeLocale complete.")}catch(r){console.error("\u{1F310} BridgedLocalesMenuButton: changeLocale failed:",r)}}try{localStorage.setItem("dash-user-locale",e),console.log("\u{1F310} BridgedLocalesMenuButton: Persisted locale to localStorage:",e)}catch(r){console.warn("\u{1F310} BridgedLocalesMenuButton: Failed to persist locale to localStorage:",r)}console.log("\u{1F310} BridgedLocalesMenuButton: Updating state..."),m(A.switchLanguage(e)),g(e),B(e),c()},[l,g,B,c,m]);if(!o||o.length<=1)return console.log("\u{1F310} BridgedLocalesMenuButton: Not rendering - locales:",o),null;console.log("\u{1F310} BridgedLocalesMenuButton: Rendering with locales:",o,"current:",a);const t=!!i,h=o.find(e=>e.locale===a)?.name||a;return D(N,{children:[p?n(y,{title:`Language: ${h}`,children:n(E,{onClick:L,color:"inherit",size:"small","aria-label":"change language","aria-controls":t?"locale-menu":void 0,"aria-haspopup":"true","aria-expanded":t?"true":void 0,children:u})}):n(R,{onClick:L,color:"inherit",startIcon:u,"aria-controls":t?"locale-menu":void 0,"aria-haspopup":"true","aria-expanded":t?"true":void 0,children:h}),n(C,{id:"locale-menu",anchorEl:i,open:t,onClose:c,MenuListProps:{"aria-labelledby":"locale-button"},children:o.map(e=>n(I,{selected:e.locale===a,onClick:()=>M(e.locale),children:e.name||e.locale},e.locale))})]})};var G=P;export{G as default};
@@ -0,0 +1 @@
1
+ import{Fragment as U,jsx as s,jsxs as X}from"react/jsx-runtime";import{useState as i,useRef as f,useEffect as g}from"react";import{Avatar as H,useMediaQuery as N,useTheme as B}from"@mui/material";import W from"@mui/icons-material/Translate";import A from"react-dom";import{useWindowSize as I}from"@dashadmin/dash-utils";import{useLocales as O,useLocaleState as V}from"../../hooks/usePolyglotTranslation";import{useBridgedChangeLocale as $}from"../../contexts/I18nBridgeContext";const F=s(W,{}),Q=w=>{const{icon:Y=F,languages:L}=w,[q,G]=i(null),p=O({locales:L}),[c,M]=V(),E=$(),b=B(),R=N(b.breakpoints.down("md")),[a,h]=i(!1),[l,r]=i(!1),u=f(null),T=f(null),[v,S]=i({top:0,left:0}),t=f(null),d=I();g(()=>{document.body.classList.contains("webview")?h(!0):h(!1)},[]);const x=e=>{const n=p.find(o=>o.locale===e);return n?n.name:""},y=e=>()=>{M(e),E(e),r(!1)},m=()=>{if(u.current&&d.width){const e=u.current.getBoundingClientRect(),n=200;let o=e.left+window.scrollX;o+n>d.width&&(o=d.width-n-10),o<10&&(o=10),S({top:e.top+window.scrollY+30,left:o})}},z=e=>{e.preventDefault(),t.current&&(clearTimeout(t.current),t.current=null),r(!0),m()},D=e=>{e.preventDefault(),r(n=>!n),m()},C=()=>{a||(t.current=setTimeout(()=>{r(!1)},100))},P=()=>{t.current&&(clearTimeout(t.current),t.current=null)},k=()=>{a||r(!1)};return g(()=>()=>{t.current&&clearTimeout(t.current)},[]),g(()=>{const e=()=>{l&&m()};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[l,R]),X(U,{children:[s("div",{ref:u,...a?{onClick:D}:{onMouseEnter:z,onMouseLeave:C},children:s(H,{sizes:"small",sx:{fontSize:"1rem"},style:{width:"30px",height:"30px",minHeight:"30px"},className:"dash-icon-button-color dash-icon-button-bg",children:x(c).substring(0,2).toUpperCase()})}),l&&A.createPortal(s("div",{ref:T,className:"dash-language-menu-portal",onMouseEnter:a?void 0:P,onMouseLeave:a?void 0:k,children:s("div",{className:`dash-language-menu ${l?"show":""}`,style:{zIndex:1e4,position:"absolute",top:v.top,left:v.left},children:p.map(e=>s("div",{className:`dash-language-menu-item ${e.locale===c?"selected":""}`,onClick:y(e.locale),style:{padding:"8px 16px",cursor:"pointer",backgroundColor:e.locale===c?"rgba(0, 0, 0, 0.08)":"transparent",minWidth:"150px"},children:e.name},e.locale))})}),document.body)]})};var se=Q;export{se as default};
@@ -0,0 +1 @@
1
+ import{Fragment as c,jsx as o}from"react/jsx-runtime";import{deepmerge as s}from"@mui/utils";import{useEffect as d}from"react";import i from"@achmadk/react-loading-overlay";import n from"../../hooks/useGlobalLoaderMgr";const p=({styles:r,children:a,...g})=>{const[e,f]=n();d(()=>{console.log("GlobalLoader loading state changed:",e)},[e]);const l=s({wrapper:{width:"100%",height:"100%",overflow:e?"hidden":"scroll"},overlay:t=>({...t})},r);return e?o(i,{className:"loadingOverlay",active:e,styles:l,spinner:a}):o(c,{})};var G=p;export{G as default};
@@ -0,0 +1 @@
1
+ import{jsx as n,jsxs as u}from"react/jsx-runtime";import{Button as f,DialogActions as F,DialogContent as h,TextareaAutosize as x}from"@mui/material";import{useEffect as A,useState as r}from"react";import{useRecordContext as m}from"react-admin";import L from"../../hooks/axios";import{saveAs as D}from"file-saver";const c=({log:t})=>{const{axios:e}=L(),[o,g]=r(null),[i,s]=r(null),p=async()=>{let a=t.filepath.split("/")[t.filepath.split("/").length-1];D(o,a)},d=async a=>{if(t?.filepath){const{data:l}=await e.get(`/system/log/${t.id}/download`,{responseType:"blob"});let C=await l.text();g(l),s(C)}else s("Proceso completado correctamente")};return A(()=>{d(t)},[]),u(h,{children:[n(x,{style:{width:"100%"},maxRows:50,defaultValue:i!==""?i:" Cargando... "}),t?.filepath&&u(F,{children:[n(f,{onClick:()=>p(),children:"Descargar"})," "]})]})},I=({method:t,attribute:e})=>{const o=m();return n(c,{log:o})},w=({method:t,attribute:e})=>{const o=m();return n(c,{log:o})},T=({method:t,attribute:e,resourceConfig:o})=>{switch(t){case"edit":case"create":return n(I,{attribute:e,method:t,resourceConfig:o});case"view":return n(w,{attribute:e,method:t,resourceConfig:o})}};var S=T;export{c as LogTxtFileComponent,S as default};
@@ -0,0 +1 @@
1
+ import{jsx as l,jsxs as B}from"react/jsx-runtime";import{Button as m,DialogActions as y,DialogContent as C,TextareaAutosize as L}from"@mui/material";import{useEffect as h,useState as a}from"react";import w from"../../hooks/axios";import{saveAs as F}from"file-saver";const x=({id:e})=>{const{axios:n}=w(),[r,g]=a(null),[s,i]=a(null),[o,c]=a(null),p=async()=>{if(o){let t=o.split("/")[o.split("/").length-1];F(r,t)}},f=async()=>{try{const{data:t}=await n.get(`/system/log/${e}/download`,{responseType:"blob"}),{data:d}=await n.get(`/system/log/${e}`);c(d.filepath);let u=await t.text();g(t),i(u)}catch{i("Error al cargar el archivo")}};return h(()=>{f()},[e]),B(C,{children:[l(L,{style:{width:"100%"},maxRows:50,defaultValue:s!==""?s:" Cargando... "}),o&&l(y,{children:l(m,{onClick:p,children:"Descargar"})})]})};var v=x;export{x as LogFileById,v as default};
@@ -0,0 +1 @@
1
+ import{Fragment as r,jsx as e}from"react/jsx-runtime";import{useRecordContext as i}from"react-admin";const m=({log:t})=>e(r,{children:e("h1",{children:"Log"})}),s=({method:t,attribute:n})=>{const o=i();return e(r,{children:o&&e(m,{log:o})})},a=({method:t,attribute:n})=>{const o=i();return e(r,{children:o&&e(m,{log:o})})},u=({method:t,attribute:n,resourceConfig:o})=>{switch(t){case"edit":case"create":return e(s,{attribute:n,method:t,resourceConfig:o});case"view":return e(a,{attribute:n,method:t,resourceConfig:o})}};var l=u;export{m as LogViewerComponent,l as default};
@@ -0,0 +1 @@
1
+ import{Fragment as e,jsx as a}from"react/jsx-runtime";const n=({hasDashboard:o,autoHideScroll:r=!1,children:t})=>a(e,{children:"Deprecated"});export{n as AppMenu};
@@ -0,0 +1 @@
1
+ import{jsx as P,jsxs as h}from"react/jsx-runtime";import{useCallback as d}from"react";import I from"clsx";import{Link as L,useMatch as R}from"react-router-dom";import{useTranslate as y,useBasename as C}from"react-admin";import{useSidebarState as M}from"react-admin";const x=e=>{const{className:m,primaryText:t,leftIcon:o,onClick:n,...i}=e,p=y(),l=C(),[N,a]=M(),f=d(k=>{a(!1),n&&n(k)},[a,n]),s=(typeof e.to=="string"?e.to:e.to.pathname)||"",u=R({path:s,end:s===`${l}/`});return h(L,{className:I(m,{[c.active]:!!u}),tabIndex:0,...i,onClick:f,children:[o&&P("span",{className:c.icon,children:o}),typeof t=="string"?p(t,{_:t}):t]})},r="RaMenuItemLink",c={active:`${r}-active`,icon:`${r}-icon`};var q=x;export{c as MenuItemLinkClasses,q as default};
@@ -0,0 +1 @@
1
+ import{Fragment as v,jsx as t}from"react/jsx-runtime";import{useEffect as h}from"react";import{useDispatch as c}from"react-redux";import{LightMode as n,DarkMode as l}from"@mui/icons-material";import{dashStorage as r}from"@dashadmin/dash-utils";import{DASH_REDUX_ACTIONS as p}from"@dashadmin/dash-admin-state";import{Avatar as g,useColorScheme as f}from"@mui/material";import{DashThemeHelperProvider as k}from"../../default-theme";const u=()=>{const{mode:o,setMode:m}=f(),i=c(),d=o==="light"||o==="dark"?o:r.getItem("theme")||"dark",a=d==="dark",s=()=>{const e=d==="dark"?"light":"dark";m(e),r.setItem("theme",e),document.documentElement.setAttribute("data-theme",e),i(p.toggleThemeType(e))};return h(()=>{const e=r.getItem("theme");e&&(e==="light"||e==="dark")&&o!==e&&m(e)},[]),t(v,{children:t("div",{onClick:s,children:t(k,{children:t(g,{sizes:"small",sx:{fontSize:"1rem"},style:{width:"30px",height:"30px",minHeight:"30px"},className:"dash-icon-button-color dash-icon-button-bg",children:a?t(n,{}):t(l,{})})})})})};var H=u;export{H as default};
@@ -0,0 +1 @@
1
+ import{Fragment as z,jsx as o,jsxs as i}from"react/jsx-runtime";import{useEffect as p,useState as d}from"react";import{useSetLocale as f,useLocaleState as L}from"react-admin";import{dashStorage as c}from"@dashadmin/dash-utils";import{Avatar as I,Menu as v,MenuItem as E,ListItemIcon as M,ListItemText as T}from"@mui/material";import{DashThemeHelperProvider as S}from"../../default-theme";const x=()=>{const[t]=L(),a=f(),[l,s]=d(null),m=!!l,n=[{locale:"en",languageId:"english",name:"English",icon:"\u{1F1FA}\u{1F1F8}"},{locale:"es",languageId:"spanish",name:"Espa\xF1ol",icon:"\u{1F1EA}\u{1F1F8}"}],g=n.find(e=>e.locale===t)||n[1],h=e=>{s(e.currentTarget)},r=()=>{s(null)},u=e=>{a(e),c.setItem("locale",e),r(),console.log("Language changed to:",e)};return p(()=>{const e=c.getItem("locale");e&&e!==t&&a(e)},[]),i(z,{children:[o("div",{onClick:h,children:o(S,{children:o(I,{sizes:"small",sx:{fontSize:"1rem",cursor:"pointer"},style:{width:"30px",height:"30px",minHeight:"30px"},className:"dash-icon-button-color dash-icon-button-bg",children:o("span",{style:{fontSize:"1.2rem"},children:g.icon})})})}),o(v,{anchorEl:l,open:m,onClose:r,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:n.map(e=>i(E,{onClick:()=>u(e.locale),selected:e.locale===t,children:[o(M,{children:o("span",{style:{fontSize:"1.5rem"},children:e.icon})}),o(T,{children:e.name})]},e.locale))})]})};var R=x;export{R as default};
@@ -0,0 +1 @@
1
+ import{Fragment as i,jsx as e,jsxs as p}from"react/jsx-runtime";import{useRecordContext as a}from"react-admin";import m from"@mui/icons-material/CloudUpload";import{ImageInput as n}from"react-admin";import{ImageField as s}from"react-admin";const c=({method:o,attribute:t})=>{const r=a();return r?e("img",{src:r[t.listAttribute]||"",alt:"imagen"}):e(i,{})},d=({record:o,attribute:t})=>p("div",{style:{padding:"30px",border:"4px dashed rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",gap:"10px"},children:[e("img",{src:o?.[t.listAttribute]||"",alt:"imagen"}),e(m,{}),"Arr\xE1stre una im\xE1gen o haga click aqu\xED para seleccionar"]}),u=({method:o,attribute:t})=>{const r=a();return e(i,{children:e(n,{fullWidth:!0,placeholder:e(d,{record:r,attribute:t}),source:t.attribute,label:t.label,accept:"image/*",children:e(s,{source:"src",title:"title"})})})},l=({method:o,attribute:t,resourceConfig:r})=>{switch(o){case"edit":case"create":return e(u,{attribute:t,method:o,resourceConfig:r});case"view":return e(c,{attribute:t,method:o,resourceConfig:r})}};var x=l;export{x as default};
@@ -0,0 +1 @@
1
+ import{Fragment as g,jsx as c}from"react/jsx-runtime";import{useEffect as E,useState as b}from"react";import{toast as u}from"react-toastify";import{useDialog as y}from"@dashadmin/dash-dialog";const p=t=>{if(t.originalError&&t.status&&t.message){const n=t;let e=n.message||"";if(n.status>=400&&n.status<499)switch(n.status){case 401:e="\u{1F6AB} "+e;break;case 403:e="\u{1F512} "+e;break;case 404:e="\u274C "+e;break;case 422:e="\u26A0 "+e;break}try{if(t?.originalError?.response?.data?.errors){const a=t.originalError.response.data.errors;let i=[];Array.isArray(a)?i=a.map(r=>String(r)):typeof a=="object"&&a!==null?Object.values(a).forEach(r=>{typeof r=="string"?i.push(r):Array.isArray(r)?i.push(r.join(", ")):typeof r=="object"&&r!==null&&i.push(JSON.stringify(r))}):typeof a=="string"&&i.push(a),i.length>0&&(e+=" "+i.join(", "))}}catch(a){console.error("error parsing validation errors",a)}return{status:n.status,body:e,message:n.message}}let o={...t?.error?t.error:{}},l="";return o.status>=400&&o.status<499&&(o.status===401&&(l="\u{1F6AB} "),o.status===403&&(l="\u{1F512} "),o.status===404&&(l="\u274C "),o.status===422&&(l="\u26A0 "),o={status:o.status,body:l+(o.body?" "+o.body:"")}),o},m=({checkError:t})=>{const o=y(),[l,n]=b(!1),e=(r,s)=>{s.config?.toast&&u.error(c(g,{children:r.body}),{position:"bottom-center",autoClose:4e3,hideProgressBar:!1,closeOnClick:!0,pauseOnHover:!0,draggable:!0}),s.config?.dialog!==!1&&o({variant:"danger",title:"Error",content:r.body})},a=r=>{const s=r.data||r;if(s?.error||s?.originalError||s?.status&&s?.message){if(!l)try{const f=t?t(s):p(s),d={data:s,config:s.config||{dialog:!0,toast:!1},origin:s.origin||"Unknown"};e(f,d)}catch(f){console.error("Error processing global error:",f),e({status:500,body:"Error inesperado en la aplicaci\xF3n"},{data:s,config:{dialog:!0,toast:!1}})}l&&n(!1)}},i=()=>{n(!0),setTimeout(()=>{n(!1)},3e4)};return E(()=>(window.addEventListener("DASHGlobalError",a),window.addEventListener("DASHGlobalErrorIgnore",i),()=>{window.removeEventListener("DASHGlobalError",a),window.removeEventListener("DASHGlobalErrorIgnore",i)}),[l,t]),c(g,{})};var v=m;export{v as default};
@@ -0,0 +1 @@
1
+ import{jsx as e}from"react/jsx-runtime";import{useColorScheme as a}from"@mui/material";import{LightMode as m,DarkMode as n}from"@mui/icons-material";import{Avatar as p}from"@mui/material";import{useDispatch as d,useSelector as h}from"react-redux";import{DashThemeHelperProvider as c}from"../../default-theme";const l=()=>{const S=h(r=>r.settings.themeType),{mode:o,setMode:i}=a(),D=d(),t=o==="dark",s=()=>{debugger;i(t?"light":"dark")};return o?e("div",{onClick:s,children:e(c,{children:e(p,{sizes:"small",sx:{fontSize:"1rem"},style:{width:"30px",height:"30px",minHeight:"30px"},className:"dash-icon-button-color dash-icon-button-bg",children:t?e(m,{}):e(n,{})})})}):null};var w=l;export{w as default};
@@ -0,0 +1 @@
1
+ import{Fragment as F,jsx as s,jsxs as Q}from"react/jsx-runtime";import{useState as i,useRef as f,useEffect as p}from"react";import{useLocaleState as C,useLocales as H}from"react-admin";import{Avatar as N,useMediaQuery as W,useTheme as A}from"@mui/material";import B from"@mui/icons-material/Translate";import I from"react-dom";import{useWindowSize as O}from"@dashadmin/dash-utils";const V=s(B,{}),$=w=>{const{icon:U=V,languages:L}=w,[X,Y]=i(null),g=H({locales:L}),[c,M]=C(),E=A(),b=W(E.breakpoints.down("md")),[a,h]=i(!1),[r,l]=i(!1),u=f(null),R=f(null),[v,T]=i({top:0,left:0}),t=f(null),d=O();p(()=>{document.body.classList.contains("webview")?h(!0):h(!1)},[]);const S=e=>{const n=g.find(o=>o.locale===e);return n?n.name:""},x=e=>()=>{M(e),l(!1)},m=()=>{if(u.current&&d.width){const e=u.current.getBoundingClientRect(),n=200;let o=e.left+window.scrollX;o+n>d.width&&(o=d.width-n-10),o<10&&(o=10),T({top:e.top+window.scrollY+30,left:o})}},y=e=>{e.preventDefault(),t.current&&(clearTimeout(t.current),t.current=null),l(!0),m()},z=e=>{e.preventDefault(),l(n=>!n),m()},D=()=>{a||(t.current=setTimeout(()=>{l(!1)},100))},P=()=>{t.current&&(clearTimeout(t.current),t.current=null)},k=()=>{a||l(!1)};return p(()=>()=>{t.current&&clearTimeout(t.current)},[]),p(()=>{const e=()=>{r&&m()};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[r,b]),Q(F,{children:[s("div",{ref:u,...a?{onClick:z}:{onMouseEnter:y,onMouseLeave:D},children:s(N,{sizes:"small",sx:{fontSize:"1rem"},style:{width:"30px",height:"30px",minHeight:"30px"},className:"dash-icon-button-color dash-icon-button-bg",children:S(c).substring(0,2).toUpperCase()})}),r&&I.createPortal(s("div",{ref:R,className:"dash-language-menu-portal",onMouseEnter:a?void 0:P,onMouseLeave:a?void 0:k,children:s("div",{className:`dash-language-menu ${r?"show":""}`,style:{zIndex:1e4,position:"absolute",top:v.top,left:v.left},children:g.map(e=>s("div",{className:`dash-language-menu-item ${e.locale===c?"selected":""}`,onClick:x(e.locale),style:{padding:"8px 16px",cursor:"pointer",backgroundColor:e.locale===c?"rgba(0, 0, 0, 0.08)":"transparent",minWidth:"150px"},children:e.name},e.locale))})}),document.body)]})};var te=$;export{te as default};
@@ -0,0 +1 @@
1
+ import{jsx as s}from"react/jsx-runtime";import{styled as t}from"@mui/material/styles";import l,{tooltipClasses as r}from"@mui/material/Tooltip";const i=t(({className:o,...p})=>s(l,{...p,classes:{popper:o}}))(({theme:o})=>({[`& .${r.tooltip}`]:{backgroundColor:"#f5f5f9",color:"rgba(0, 0, 0, 0.87)",maxWidth:220,fontSize:o.typography.pxToRem(12),border:"1px solid #dadde9"}}));var f=i;export{f as default};
@@ -0,0 +1 @@
1
+ import{jsx as t,jsxs as b}from"react/jsx-runtime";import{Paper as x,Table as u,TableBody as A,TableCell as p,TableContainer as S,TableHead as J,TableRow as l,List as k,ListItem as E,ListItemText as M,Box as D,Chip as H,Accordion as L,AccordionSummary as B,AccordionDetails as N,Typography as X}from"@mui/material";import $ from"@mui/icons-material/ExpandMore";import{isComponent as F}from"@dashadmin/dash-auto-admin";import C,{useEffect as P,useState as U}from"react";function w(e){return e&&typeof e=="object"&&e.$typeof===Symbol.for("react.element")}function I(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||e instanceof C.Component||e instanceof C.Fragment||Array.isArray(e)&&e.every(o=>I(o))}function K(e){return Array.isArray(e)&&(e.every(o=>I(o))||e.every(o=>w(o)))}function Z(e){return Array.isArray(e)&&e.every(o=>typeof o=="string")}function z(e){return e==null||typeof e!="object"||Array.isArray(e)||w(e)?!1:e.constructor===Object||e.constructor===void 0}const j=({tableData:e,vertical:o,ignore:s,include:y,dict:c,showKey:m,maxDepth:d=3,currentDepth:g=0})=>{s||(s=[]),y||(y=[]),c||(c={});const[i,T]=U([]);P(()=>{if(e){let r=Object.keys(e);y.length&&(r=r.filter(n=>y.includes(n))),s.length&&(r=r.filter(n=>!s.includes(n))),T(r)}else T([])},[e]);const f=(r,n)=>{try{if(r==null)return"n/a";if(z(r)&&g<d){const a=Object.keys(r);if(a.length>0)return b(L,{sx:{width:"100%",boxShadow:1,margin:0},children:[t(B,{expandIcon:t($,{}),sx:{backgroundColor:"rgba(0, 0, 0, 0.03)",minHeight:40,"&.Mui-expanded":{minHeight:40}},children:t(X,{variant:"body2",sx:{fontWeight:500},children:n?`${n} (${a.length} properties)`:`Object (${a.length} properties)`})}),t(N,{sx:{padding:1},children:t(j,{tableData:r,vertical:o,ignore:s,include:y,dict:c,showKey:m,maxDepth:d,currentDepth:g+1})})]})}return Array.isArray(r)?t(H,{label:t(D,{sx:{maxHeight:200,overflow:"auto",width:"100%"},children:t(k,{dense:!0,sx:{py:0},children:r.map((a,R)=>t(E,{sx:{py:.5,px:1},children:t(M,{primary:String(a),sx:{margin:0,"& .MuiListItemText-primary":{fontSize:"0.875rem",lineHeight:1.2}}})},R))})}),sx:{height:"auto","& .MuiChip-label":{display:"block",whiteSpace:"normal"}}}):typeof r!="object"?c.hasOwnProperty(r)?c[r]:String(r):F(r)||K(r)?r:typeof r=="object"?JSON.stringify(r):r}catch{return"n/a"}},O=()=>i&&i.map((r,n)=>t(p,{children:f(r)},n)),h=()=>o?i&&i.map((r,n)=>b(l,{children:[m&&t(p,{children:f(r)}),t(p,{children:f(e[r],r)})]},n)):t(l,{children:i&&i.map((r,n)=>t(p,{children:f(e[r],r)},n))});return o?t(S,{component:x,children:t(u,{children:t(A,{children:h()})})}):t(S,{component:x,children:b(u,{children:[t(J,{children:t(l,{children:O()})}),t(A,{children:h()})]})})};var _=j;export{_ as default};