@dashadmin/dash-admin 1.3.16 → 1.3.19

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{jsx as r,jsxs as d}from"react/jsx-runtime";import{useEffect as h,useRef as g,useState as y}from"react";const f=a=>[...a.children.map(e=>e.display),...a.array?f(a.array):[]],x=(a,e,n)=>{a[0]=[...e.children.map(l=>({text:n[l.field],span:a.length})),...a[0]]},k=(a,e,n)=>({indices:l})=>{const[t,s]=y(!1),o=g(null);h(()=>{const c=p=>{o.current&&(o.current.contains(p.target)||s(!1))};return document.addEventListener("click",c),()=>{document.removeEventListener("click",c)}},[o]);const i=c=>()=>{c.callback(a(l)),s(!1)};return d("span",{ref:o,children:[d("span",{onClick:c=>s(!t),className:"flex flex-row items-center justify-center cursor-pointer",children:[n,t?r("span",{children:"\u2191"}):r("span",{children:"\u2193"})]}),t&&r("div",{className:"flex flex-col absolute right-0 bg-white rounded-md shadow-md gap-2 p-2 whitespace-nowrap border border-gray-300",children:e&&e.map(c=>r("span",{onClick:i(c),className:"flex flex-row items-center cursor-pointer text-md hover:bg-gray-300 p-2 rounded-md",children:c.name},c.name))})]})},v=(a,e,n)=>{const l=k(a,e,n);return(t,s,o)=>[...t.children.map(i=>({text:s[i.field],span:1})),...e.length?[{text:r(l,{indices:o}),span:1}]:[]]},w=a=>{const e=(n,l,t)=>l&&!n.array?l.map((s,o)=>a(n,s,[...t,o])):l?l.flatMap((s,o)=>{const i=e(n.array,s[n.array.name],[...t,o]);return i&&x(i,n,s),i}):null;return e},C=(a,e,n)=>{const l={};return a.forEach(t=>{l[e.name]=n[t],e=e.array,n=e&&n[t][e.name]}),l},L=(a,e)=>n=>C(n,a,e),u=({classNames:a,fields:e})=>r("thead",{className:a?.head,children:r("tr",{children:e.map(n=>r("th",{className:a?.headCell+" p-2 py-3",children:n},n))})}),T=({classNames:a,rows:e})=>r("tbody",{className:a?.tableBody,children:e&&e.map((n,l)=>r("tr",{className:a?.tableRow,children:n&&n.map((t,s)=>r("td",{rowSpan:t.span,children:t.text},s))},l))}),M=({data:a,structure:e,actions:n,actionLabel:l,className:t})=>{const s=n||[],o=l||"Action",i=L(e,a),c=v(i,s,o),m=w(c)(e,a,[]),b=[...f(e),...s.length?[o]:[]];return m&&d("table",{className:t?.table,children:[r(u,{fields:b,classNames:t}),r(T,{rows:m,classNames:t})]})};var E=M;export{E as default};
@@ -0,0 +1 @@
1
+ import{Fragment as d,jsx as t,jsxs as n}from"react/jsx-runtime";import{Card as a,CardContent as p,Typography as i}from"@mui/material";import l from"@mui/icons-material/Info";const g=s=>{const{title:e,description:o,children:r}=s;return t(a,{sx:{p:0},children:n(p,{sx:{display:"flex",flexDirection:"column",alignItems:"left",gap:2},children:[n("div",{style:{display:"flex",alignItems:"center",gap:2},children:[t(l,{sx:{fontSize:32}}),e?t(i,{variant:"h5",children:e}):"No hay registros"]}),o&&t(i,{variant:"body1",color:"text.secondary",children:o}),r||t(d,{})]})})};export{g as NoResults};
@@ -0,0 +1 @@
1
+ import{Fragment as d,jsx as e,jsxs as g}from"react/jsx-runtime";import{Button as f}from"@mui/material";import{useEffect as b,useState as w}from"react";import{useRecordContext as D}from"react-admin";import{Loading as y}from"react-admin";import{initAxios as C}from"../../hooks/axios";import{saveAs as F}from"file-saver";const h=({method:n,attribute:o})=>{const t=D(),c=C(),[i,m]=w(null),r=t&&t[o.attribute]?t[o.attribute]:null,p="nota-venta-"+t.id+".pdf";b(()=>{t&&t[o.attribute]&&l()},[t]);const l=async()=>{const{data:a}=await c.get(r,{responseType:"blob"}),s=new Blob([a],{type:"application/pdf"}),u=URL.createObjectURL(s);m(u)};return e(d,{children:i?g("div",{children:[e("object",{className:"embed-pdf",data:i,type:"application/pdf",style:{minHeight:800,minWidth:600},children:e("embed",{src:i,type:"application/pdf"})}),e("hr",{}),e(f,{onClick:async()=>{const{data:a}=await c.get(r,{responseType:"blob"}),s=new Blob([a],{type:""});F(s,p)},children:"Descargar"})]}):e(y,{})})},A=({method:n,attribute:o,resourceConfig:t})=>{switch(n){case"edit":case"create":return e(d,{children:"edit"});case"view":return e(h,{attribute:o,method:n,resourceConfig:t})}};var N=A;export{N as default};
@@ -0,0 +1 @@
1
+ import{jsx as t,jsxs as b}from"react/jsx-runtime";import I,{useMemo as S}from"react";import{Box as m,Typography as B}from"@mui/material";import{Link as y}from"react-router-dom";import{useSelector as N}from"react-redux";import v from"@mui/icons-material/NavigateNext";import R from"@mui/icons-material/Home";const A=({item:a,isLast:n})=>{const r=b(m,{component:"span",className:`dash-breadcrumb-item ${n?"dash-breadcrumb-item--active":""}`,sx:{display:"inline-flex",flexDirection:"row",alignItems:"center",gap:"2px",flexShrink:0},children:[a.icon&&t(m,{component:"span",className:"dash-breadcrumb-icon",sx:{display:"inline-flex",alignItems:"center",flexShrink:0,"& svg":{fontSize:"12px"}},children:a.icon}),t(B,{component:"span",className:"dash-breadcrumb-label",sx:{fontSize:"11px",fontWeight:n?500:400,lineHeight:1.2,color:n?"var(--text-header, #ffffff)":"var(--text-header-muted, rgba(255, 255, 255, 0.7))",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:"120px"},children:a.label})]});if(n||!a.path)return r;const i=a.path.startsWith("/")?a.path:`/${a.path}`;return t(y,{to:i,className:"dash-breadcrumb-link",style:{textDecoration:"none",display:"inline-flex",alignItems:"center"},children:r})},k=({items:a,separator:n,maxItems:r,className:i="",showHomeIcon:p=!1,homePath:d="/",homeLabel:f="Home",sx:u={}})=>{const x=n??t(v,{sx:{fontSize:"12px",color:"var(--text-header-muted, rgba(255, 255, 255, 0.5))"}}),h=N(e=>e.page),s=a||h.breadcrumbs,l=S(()=>{if(!s||s.length===0)return[];let e=[...s];if(p&&(e=[{label:f,path:d,icon:t(R,{})},...e]),r&&e.length>r){const o=e.slice(0,1),c=e.slice(-(r-2)),g={label:"...",path:void 0};e=[...o,g,...c]}return e},[s,p,f,d,r]);return l.length===0?null:t(m,{component:"nav","aria-label":"breadcrumb",className:`dash-breadcrumbs ${i}`,sx:{display:"flex",flexDirection:"row",alignItems:"center",flexWrap:"nowrap",gap:"2px",padding:0,margin:0,...u},children:l.map((e,o)=>{const c=o===l.length-1;return b(I.Fragment,{children:[t(A,{item:e,isLast:c}),!c&&t(m,{component:"span",className:"dash-breadcrumb-separator",sx:{display:"inline-flex",alignItems:"center",mx:"1px",flexShrink:0},children:x})]},`breadcrumb-${o}-${e.label}`)})})};var M=k;export{k as Breadcrumbs,M as default};
@@ -0,0 +1 @@
1
+ import{Fragment as E,jsx as M}from"react/jsx-runtime";import{useEffect as R,useMemo as g}from"react";import{useLocation as A}from"react-router-dom";import{useDispatch as P}from"react-redux";import{useStore as C}from"react-admin";import{DASH_REDUX_ACTIONS as D}from"@dashadmin/dash-admin-state";import{DASHAdminSystemConstants as B}from"@dashadmin/dash-constants";const h={create:"Crear",edit:"Editar",show:"Ver",list:"Lista",inline:"Detalle",trash:"Papelera",admin:"Admin",system:"Sistema",settings:"Configuraci\xF3n",users:"Usuarios",roles:"Roles",permissions:"Permisos",tenants:"Tenants",profile:"Perfil",dashboard:"Dashboard",apps:"Aplicaciones",client:"Cliente",mall:"Mall",public:"P\xFAblico"},S=(e,l,o)=>l[e]?l[e]:h[e]?h[e]:o&&(o.model?.split("/")||[]).includes(e)?o.label||e:e.replace(/[-_]/g," ").replace(/\b\w/g,d=>d.toUpperCase()),y=e=>!!(/^\d+$/.test(e)||/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)||/^[a-z0-9]{20,}$/i.test(e)),L=(e,l,o,d,f,m,p)=>{const u=B.system.URL_PREFIX||"";let c=e;u&&c.startsWith(u)&&(c=c.slice(u.length));const s=c.split("/").filter(Boolean);if(s.length===0)return[];const r=[];d&&r.push({label:m||"Home",path:f||"/"});let i=u;return i&&!i.startsWith("/")&&(i=`/${i}`),s.forEach((n,a)=>{i+=`/${n}`;const t=a===s.length-1;if(y(n)){if(p&&(t||a===s.length-2))r.push({label:p,path:t?void 0:i,isActive:t,data:{id:n}});else{const I=n.length>8?`#${n.substring(0,8)}...`:`#${n}`;r.push({label:I,path:t?void 0:i,isActive:t,data:{id:n}})}return}const b=S(n,l,o);r.push({label:b,path:t?void 0:i,isActive:t})}),r},$=({labelMap:e={},includeHome:l=!1,homePath:o="/",homeLabel:d="Home",customGenerator:f,recordNameField:m="name",children:p})=>{const u=P(),c=A(),[s]=C("resourceConfig"),r=null,i=g(()=>({...h,...e}),[e]),n=g(()=>{if(!r)return;const a=[m,"name","title","label","displayName","username"];for(const t of a)if(r[t])return String(r[t]);if(s?.recordRepresentation){const t=s.recordRepresentation;if(typeof t=="string"&&r[t])return String(r[t])}},[r,m,s]);return R(()=>{let a;f?a=f(c.pathname,s,r):a=L(c.pathname,i,s,l,o,d,n),a.length>0&&u(D.updatePage({breadcrumbs:a}))},[c.pathname,i,s,l,o,d,n,f,u,r]),M(E,{children:p})};var z=$;export{$ as BreadcrumbsManager,z as default};
@@ -0,0 +1 @@
1
+ import{Breadcrumbs as a,default as m}from"./Breadcrumbs";import{BreadcrumbsManager as s,default as d}from"./BreadcrumbsManager";export{a as Breadcrumbs,m as BreadcrumbsComponent,s as BreadcrumbsManager,d as BreadcrumbsManagerComponent};
@@ -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 A}from"react/jsx-runtime";import{useAxios as h}from"@dashadmin/dash-axios-hook";import{createContext as E,useState as f,useEffect as y,useContext as v}from"react";const F="SystemSettingsCacheDB",l="kvstore",P=1;function b(){return new Promise((s,a)=>{const t=indexedDB.open(F,P);t.onupgradeneeded=()=>{t.result.createObjectStore(l)},t.onsuccess=()=>s(t.result),t.onerror=()=>a(t.error)})}async function _(s,a){const t=await b();return new Promise((n,m)=>{const e=t.transaction(l,"readwrite");e.objectStore(l).put(a,s),e.oncomplete=()=>n(),e.onerror=()=>m(e.error)})}async function x(s){const a=await b();return new Promise((t,n)=>{const e=a.transaction(l,"readonly").objectStore(l).get(s);e.onsuccess=()=>t(e.result),e.onerror=()=>n(e.error)})}let i=null,r=null,c=0;const p=E({formats:null,fetchFormats:async()=>{},loading:!1}),S=({children:s})=>{const a=h(),[t,n]=f(r),[m,e]=f(!r&&!i),[C,w]=f(!!c),d=async()=>{if(i)return i;const u=Date.now();if(!c)try{c=await x("system_available_permissions_cache")||0}catch(o){console.error("Error reading from IndexedDB:",o)}if(r&&u-c<1e4){t||n(r);return}return e(!0),i=(async()=>{try{console.log("FETCHING AVAILABLE PERMISSIONS");const{data:o}=await a.get("system/permission/availablePermissions");r=o,c=Date.now(),n(o),w(!0);try{await _("system_available_permissions_cache",c),await _("system_available_permissions_formats",o)}catch(g){console.error("Error writing to IndexedDB:",g)}}catch(o){console.error("Error fetching settings formats:",o)}finally{e(!1),i=null}})(),i};return y(()=>{(async()=>{try{if(!r){const o=await x("system_available_permissions_formats");o&&(r=o,n(o),e(!1))}r||e(!0),await d()}catch(o){console.error("Error loading cached formats:",o),e(!0),await d()}})()},[]),y(()=>{t&&e(!1)},[t]),A(p.Provider,{value:{formats:(t||r)??null,fetchFormats:d,loading:m},children:s})},R=()=>v(p);var L=S;export{S as AvailablePermissionsContext,L as default,x as idbGet,_ as idbSet,R as useAvailablePermissionsFormats};
@@ -0,0 +1 @@
1
+ import{Fragment as Ie,jsx as e,jsxs as r}from"react/jsx-runtime";import{useCallback as h,useEffect as I,useState as b,useMemo as me,useRef as de}from"react";import{useRecordContext as He,useRefresh as Me,useEditContext as Ve}from"react-admin";import{useController as ue,useFormContext as qe,useFormState as Ke}from"react-hook-form";import{useAxios as Ue}from"@dashadmin/dash-axios-hook";import{Grid as A,Card as pe,CardContent as he,Typography as m,Button as P,Box as d,Chip as K,Divider as ge,Stack as fe,Toolbar as Je,Paper as U,TextField as xe,InputAdornment as W,CircularProgress as E,IconButton as ye}from"@mui/material";import{SelectAll as be,DeselectOutlined as Ce,Search as J,Clear as $,FilterList as Qe}from"@mui/icons-material";import{useSystemRequestsCache as Xe}from"../../contexts/SystemRequestsCache";import{NotFound as Ye}from"@dashadmin/dash-components";const H={checkbox:{marginRight:"8px",cursor:"pointer",accentColor:"#1976d2"},checkboxLabel:{display:"flex",alignItems:"center",fontSize:"14px",cursor:"pointer",padding:"4px 0",margin:0,userSelect:"none"},selectAllLabel:{display:"flex",alignItems:"center",fontSize:"14px",fontWeight:"bold",cursor:"pointer",margin:0,userSelect:"none"}},kt=({method:u,attribute:x})=>{const p=He(),[l,i]=b([]);return I(()=>{if(p?.permissions){const y=p.permissions.reduce((v,T)=>{const w=v.find(R=>R[0]?.group===T.group);return w?w.push(T):v.push([T]),v},[]);i(y)}},[p?.permissions]),!p?.permissions||p.permissions.length===0?e(d,{sx:{p:2,textAlign:"center"},children:e(m,{variant:"body2",color:"text.secondary",children:"No permissions assigned"})}):r(d,{sx:{p:2},children:[r(m,{variant:"h6",sx:{mb:3},children:["Assigned Permissions (",p.permissions.length,")"]}),e(A,{container:!0,spacing:3,children:l?.map((y,v)=>e(A,{item:!0,xs:12,sm:6,md:4,lg:3,children:e(pe,{variant:"outlined",sx:{height:"100%",display:"flex",flexDirection:"column"},children:r(he,{sx:{flexGrow:1},children:[r(d,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:2},children:[e(m,{variant:"subtitle1",sx:{fontWeight:600,fontSize:"1rem"},children:y[0]?.group.charAt(0).toUpperCase()+y[0]?.group.slice(1)}),e(K,{label:y.length,size:"small",color:"primary"})]}),e(fe,{spacing:.5,children:y.map((T,w)=>r(m,{variant:"body2",sx:{color:"text.secondary",fontSize:"0.875rem"},children:["\u2022 ",T.name.split(".").pop()]},w))})]})})},v))})]})};function Ze(u,x){if(!Array.isArray(u)||!Array.isArray(x)||u.length!==x.length)return!1;const p=u.map(i=>i.route_name).sort(),l=x.map(i=>i.route_name).sort();return p.every((i,y)=>i===l[y])}const Q=6,Se=({method:u,attribute:x,resourceConfig:p,record:l=null})=>{const[i,y]=b([]),[v,T]=b([]),[w,R]=b({}),[X,ke]=b(!1),[G,M]=b(""),[L,V]=b(""),[C,Y]=b(""),[g,Z]=b(""),F=de(null),_=de(null),nt=Ue(),rt=Me(),st=qe(),it=Ke(),ee=ue({name:"permission_objects"}),te=ue({name:"permissions"}),[a,S]=b([]),{formats:B,loading:D}=Xe(),oe=h(t=>t.reduce((o,n)=>{const s=o.find(c=>c[0]?.group===n.group);return s?s.push(n):o.push([n]),o},[]),[]);I(()=>(F.current&&clearTimeout(F.current),F.current=setTimeout(()=>{Y(G)},500),()=>{F.current&&clearTimeout(F.current)}),[G]),I(()=>(_.current&&clearTimeout(_.current),_.current=setTimeout(()=>{Z(L)},500),()=>{_.current&&clearTimeout(_.current)}),[L]),I(()=>{if(!X&&B){const t=Array.isArray(B.data)?B.data:Array.isArray(B)?B:[];if(t.length>0){const o=oe(t);y(o);const n=o.reduce((s,c)=>{const O=c[0]?.group||"Other";return s[O]=!1,s},{});R(n)}ke(!0)}},[B,X,oe]),I(()=>{if(!D&&l&&l.id&&i.length>0){const t=l.permission_objects||[];Ze(t,a)||S(t)}},[i,l?.permissions,l?.permission_objects,l?.id,D]),I(()=>{if(!D&&l&&l.id&&i.length>0){const t=l.permission_objects||[],o=new Set(t.map(s=>s.route_name)),n=i.flat().map(s=>({...s,checked:o.has(s.route_name)}));(a.length!==n.length||a.some((s,c)=>s.route_name!==n[c].route_name||s.checked!==n[c].checked))&&S(n)}},[i,l?.permissions,l?.permission_objects,l?.id,D]),I(()=>{a&&(ee.field.onChange(a.map(t=>({...t,checked:!0}))),te.field.onChange(a.map(t=>t.route_name)))},[a]);const Ae=h(t=>{S(o=>o.map(n=>n.route_name===t.route_name?{...n,checked:!n.checked}:n))},[]),Pe=h(t=>{S(o=>{const n=t.every(s=>o.find(c=>c.route_name===s.route_name&&c.checked));return o.map(s=>t.some(c=>c.route_name===s.route_name)?{...s,checked:!n}:s)})},[]),ve=h(()=>{console.log("Selecting all permissions",i.flat().length),S(t=>t.map(o=>({...o,checked:!0})))},[]),Te=h(()=>{S(t=>t.map(o=>({...o,checked:!1})))},[]);I(()=>{if(!a)return;const t=a.filter(o=>o.checked);ee.field.onChange(t),te.field.onChange(t.map(o=>o.route_name)),console.log("Syncing permissions to form:",{totalPermissions:a.length,checkedPermissions:t.length,selectedCount:a.filter(o=>o.checked).length,firstFew:t.slice(0,3).map(o=>o.name)})},[a]);const f=me(()=>{let t=i;if(C.trim()){const o=C.toLowerCase().trim();t=t.filter(n=>n[0]?.group.toLowerCase().includes(o))}if(g.trim()){const o=g.toLowerCase().trim();t=t.map(n=>n.filter(s=>s.name.toLowerCase().includes(o)||s.name.split(".").pop()?.toLowerCase().includes(o))).filter(n=>n.length>0)}return t},[i,C,g]),we=h(()=>{const t=new Set(f.flat().map(o=>o.route_name));console.log("Selecting all filtered permissions",t.size),S(o=>o.map(n=>t.has(n.route_name)?{...n,checked:!0}:n))},[f]),Be=h(()=>{const t=new Set(f.flat().map(o=>o.route_name));S(o=>o.map(n=>t.has(n.route_name)?{...n,checked:!1}:n))},[f]),q=i.flat().length,N=a.filter(t=>t.checked).length,ne=N===q,Fe=N===0,z=!!C.trim()||!!g.trim(),re=f.length,j=f.reduce((t,o)=>t+o.length,0),se=me(()=>{const t=new Set(f.flat().map(o=>o.route_name));return a.filter(o=>o.checked&&t.has(o.route_name)).length},[f,a]),_e=se===j,ze=se===0,Re=h(()=>M(""),[]),Ge=h(()=>V(""),[]),ie=h(()=>{M(""),V(""),Y(""),Z("")},[]),Le=h(t=>t.every(o=>a.find(n=>n.name===o.name&&n.checked)),[a]),De=h(t=>t.filter(o=>a.find(n=>n.name===o.name&&n.checked)).length,[a]),Ne=h(t=>!!a.find(n=>n.name===t.name)?.checked,[a]);return a?!i||!i.length?e(E,{}):l?r(d,{sx:{p:2},children:[e(U,{elevation:1,sx:{mb:3,borderRadius:2,overflow:"hidden"},children:r(Je,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",minHeight:"64px !important",px:3,bgcolor:"background.default"},children:[r(d,{sx:{display:"flex",alignItems:"center",gap:2},children:[e(m,{variant:"h6",sx:{fontWeight:600},children:"Permissions Selection"}),e(K,{label:`${N} / ${q} selected`,color:ne?"success":N>0?"warning":"default",variant:"outlined"})]}),r(d,{sx:{display:"flex",gap:1},children:[z&&r(Ie,{children:[r(P,{variant:"contained",startIcon:e(be,{}),onClick:we,disabled:_e,size:"small",color:"primary",sx:{textTransform:"none"},children:["Select Filtered (",j,")"]}),e(P,{variant:"contained",startIcon:e(Ce,{}),onClick:Be,disabled:ze,size:"small",color:"secondary",sx:{textTransform:"none"},children:"Deselect Filtered"}),e(ge,{orientation:"vertical",flexItem:!0,sx:{mx:1}})]}),e(P,{variant:"outlined",startIcon:e(be,{}),onClick:ve,disabled:ne,size:"small",sx:{textTransform:"none"},children:"Select All"}),e(P,{variant:"outlined",startIcon:e(Ce,{}),onClick:Te,disabled:Fe,size:"small",color:"secondary",sx:{textTransform:"none"},children:"Deselect All"})]})]})}),r(U,{elevation:1,sx:{mb:3,p:3,borderRadius:2,bgcolor:"background.paper"},children:[r(d,{sx:{display:"flex",alignItems:"center",gap:2,mb:2},children:[e(Qe,{color:"primary"}),e(m,{variant:"h6",sx:{fontWeight:600},children:"Search & Filter"}),z&&e(P,{size:"small",variant:"outlined",color:"secondary",onClick:ie,startIcon:e($,{}),sx:{textTransform:"none"},children:"Clear All Filters"})]}),r(A,{container:!0,spacing:2,children:[e(A,{item:!0,xs:12,md:6,children:e(xe,{fullWidth:!0,variant:"outlined",label:"Search by Group Name",placeholder:"e.g., user, admin, system...",value:G,onChange:t=>M(t.target.value),InputProps:{startAdornment:e(W,{position:"start",children:e(J,{color:"action"})}),endAdornment:G&&e(W,{position:"end",children:e(ye,{size:"small",onClick:Re,children:e($,{fontSize:"small"})})})}})}),e(A,{item:!0,xs:12,md:6,children:e(xe,{fullWidth:!0,variant:"outlined",label:"Search by Permission Name",placeholder:"e.g., create, edit, delete, view...",value:L,onChange:t=>V(t.target.value),InputProps:{startAdornment:e(W,{position:"start",children:e(J,{color:"action"})}),endAdornment:L&&e(W,{position:"end",children:e(ye,{size:"small",onClick:Ge,children:e($,{fontSize:"small"})})})}})})]}),z&&r(d,{sx:{mt:2,p:2,bgcolor:"action.hover",borderRadius:1},children:[r(m,{variant:"body2",color:"text.secondary",children:[e("strong",{children:"Search Results:"})," ",re," group",re!==1?"s":""," ","(",j," permission",j!==1?"s":"",")"," ","of ",i.length," total groups (",q," total permissions)"]}),C&&r(m,{variant:"caption",color:"primary",sx:{display:"block",mt:.5},children:['\u2022 Group filter: "',C,'"']}),g&&r(m,{variant:"caption",color:"primary",sx:{display:"block",mt:.5},children:['\u2022 Permission filter: "',g,'"']})]})]}),z&&f.length===0&&r(U,{sx:{p:4,textAlign:"center",bgcolor:"background.default",border:"1px dashed",borderColor:"divider"},children:[e(J,{sx:{fontSize:48,color:"text.disabled",mb:2}}),e(m,{variant:"h6",color:"text.secondary",gutterBottom:!0,children:"No permissions found"}),r(m,{variant:"body2",color:"text.disabled",sx:{mb:2},children:["No permissions match your search criteria",C&&` for group "${C}"`,g&&` for permission "${g}"`]}),e(P,{variant:"outlined",size:"small",onClick:ie,startIcon:e($,{}),children:"Clear All Filters"})]}),f.length>0&&e(A,{container:!0,spacing:3,children:f.map((t,o)=>{const n=t[0]?.group||"Other",s=n,c=w[s]||!1,O=De(t),ae=Le(t),le=t.length>Q,je=c?t:t.slice(0,Q),Oe=t.length-Q;return e(A,{item:!0,xs:12,md:4,children:e(pe,{variant:"outlined",sx:{height:"100%",display:"flex",flexDirection:"column",transition:"all 0.2s ease-in-out","&:hover":{boxShadow:3,borderColor:"primary.main"},...z&&{border:"2px solid",borderColor:"primary.light",bgcolor:"primary.50"}},children:r(he,{sx:{flexGrow:1,display:"flex",flexDirection:"column",p:2,"&:last-child":{pb:2}},children:[r(d,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:2,minHeight:"32px"},children:[e(m,{variant:"subtitle1",sx:{fontWeight:600,fontSize:"1rem",lineHeight:1.2},children:n}),e(K,{label:`${O}/${t.length}`,size:"small",color:ae?"primary":O>0?"warning":"default",sx:{fontSize:"0.75rem",height:24,mr:1}})]}),r(d,{sx:{mb:2},children:[r("label",{style:H.selectAllLabel,children:[e("input",{type:"checkbox",style:H.checkbox,checked:ae,onChange:()=>Pe(t)}),"Select all ",n," permissions"]}),e(ge,{sx:{mt:1}})]}),e(d,{sx:{flexGrow:1,mb:le?2:0},children:e(fe,{spacing:.5,children:je.map((k,We)=>{const ce=k.name.split(".").pop(),Ee=Ne(k),$e=g&&(k.name.toLowerCase().includes(g.toLowerCase())||ce?.toLowerCase().includes(g.toLowerCase()));return e(d,{children:r("label",{style:H.checkboxLabel,children:[e("input",{type:"checkbox",style:H.checkbox,checked:Ee,onChange:()=>Ae(k)}),r(d,{children:[e(m,{variant:"caption",sx:{fontSize:"0.8rem",lineHeight:1.3,...$e&&{bgcolor:"warning.light",color:"warning.contrastText",px:.5,borderRadius:.5,fontWeight:600}},children:ce}),e(m,{variant:"caption",sx:{color:"text.disabled",fontSize:"0.7rem",ml:0,display:"block",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:k.name})]})]})},We)})})}),le&&e(d,{sx:{display:"flex",justifyContent:"center",mt:"auto",pt:1,borderTop:"1px solid",borderColor:"divider"},children:e(P,{size:"small",variant:"text",onClick:()=>R(k=>({...k,[s]:!c})),sx:{fontSize:"0.75rem",minHeight:"28px",textTransform:"none"},children:c?"Show Less \u25B2":`Show ${Oe} More \u25BC`})})]})})},o)})})]}):e(E,{}):e(E,{})},et=u=>{const{record:x,resource:p,isPending:l,isLoading:i}=Ve();return l||i?e(E,{}):e(Se,{...u,record:x})},tt=u=>e(Se,{...u,record:{}}),ot=({method:u,attribute:x,resourceConfig:p})=>{switch(u){case"edit":return e(et,{attribute:x,method:u,resourceConfig:p});case"create":return e(tt,{attribute:x,method:u,resourceConfig:p});case"view":return e(Ie,{children:e(Ye,{})});default:return null}};var At=ot;export{At as default};
@@ -0,0 +1 @@
1
+ import{Fragment as we,jsx as n,jsxs as l}from"react/jsx-runtime";import{useEffect as M,useState as C,useCallback as w,useMemo as x,useRef as ne,memo as oe}from"react";import{useEditContext as se}from"react-admin";import{useController as L,useFormContext as ae}from"react-hook-form";import{Box as b,Chip as N,CircularProgress as z,Button as P,Typography as E,Checkbox as re,Paper as G,Table as le,TableBody as ie,TableCell as u,TableContainer as ce,TableHead as me,TableRow as _,TablePagination as ue,Divider as de,TextField as pe,Select as he,MenuItem as j,FormControl as ge,InputLabel as fe}from"@mui/material";import{SelectAll as H,DeselectOutlined as O}from"@mui/icons-material";import{useSystemRequestsCache as Ce}from"../../contexts/SystemRequestsCache";const be=oe(({permission:a,onToggle:c})=>l(_,{hover:!0,children:[n(u,{padding:"checkbox",children:n(re,{checked:a.checked||!1,onChange:()=>c(a.route_name),sx:{cursor:"pointer"}})}),n(u,{children:n(N,{label:a.group,size:"small",variant:"outlined"})}),n(u,{children:a.name}),n(u,{children:n(E,{variant:"body2",sx:{fontFamily:"monospace",fontSize:"0.85rem"},children:a.route_name})})]}),(a,c)=>a.permission.checked===c.permission.checked&&a.permission.route_name===c.permission.route_name),W=({method:a,attribute:c,resourceConfig:B,record:d=null})=>{const xe=ae(),q=L({name:"permission_objects"}),$=L({name:"permissions"}),[m,p]=C(new Map),[i,J]=C([]),[T,K]=C(""),[I,Q]=C(""),[A,v]=C(0),[y,U]=C(25),S=ne(null),{formats:h,loading:k}=Ce();M(()=>{if(!k&&h&&d){const e=Array.isArray(h.data)?h.data:Array.isArray(h)?h:[];if(e.length>0){const t=d.permission_objects||[],o=new Set(t.map(r=>r.route_name)),s=new Map;e.forEach(r=>{s.set(r.route_name,{...r,id:r.route_name,checked:o.has(r.route_name)})}),p(s)}}},[h,d,k]);const g=x(()=>Array.from(m.values()),[m]);M(()=>{let e=g;if(T){const t=T.toLowerCase();e=e.filter(o=>o.name.toLowerCase().includes(t)||o.route_name.toLowerCase().includes(t)||o.group.toLowerCase().includes(t))}I&&(e=e.filter(t=>t.group===I)),J(e),v(0)},[g,T,I]),M(()=>(S.current&&clearTimeout(S.current),S.current=setTimeout(()=>{if(g.length===0)return;const e=g.filter(t=>t.checked);q.field.onChange(e),$.field.onChange(e.map(t=>t.route_name))},300),()=>{S.current&&clearTimeout(S.current)}),[g]);const V=w(e=>{p(t=>{const o=new Map(t),s=o.get(e);return s&&o.set(e,{...s,checked:!s.checked}),o})},[]),X=w(()=>{p(e=>{const t=new Map(e);return t.forEach((o,s)=>{t.set(s,{...o,checked:!0})}),t})},[]),Y=w(()=>{p(e=>{const t=new Map(e);return t.forEach((o,s)=>{t.set(s,{...o,checked:!1})}),t})},[]),Z=w(()=>{const e=new Set(i.map(t=>t.route_name));p(t=>{const o=new Map(t);return o.forEach((s,r)=>{e.has(r)&&o.set(r,{...s,checked:!0})}),o})},[i]),ee=w(()=>{const e=new Set(i.map(t=>t.route_name));p(t=>{const o=new Map(t);return o.forEach((s,r)=>{e.has(r)&&o.set(r,{...s,checked:!1})}),o})},[i]),R=x(()=>{const e=new Set;return m.forEach(t=>e.add(t.group)),Array.from(e).sort()},[m]),f=x(()=>{let e=0;m.forEach(o=>{o.checked&&e++});const t=m.size;return{total:t,selected:e,isAllSelected:e===t&&t>0,isNoneSelected:e===0}},[m]),F=x(()=>{const e=new Set(i.map(s=>s.route_name));let t=0;m.forEach((s,r)=>{e.has(r)&&s.checked&&t++});const o=i.length;return{total:o,selected:t,isAllSelected:t===o&&o>0,isNoneSelected:t===0}},[i,m]),te=T!==""||I!=="",D=x(()=>{const e=A*y,t=e+y;return i.slice(e,t)},[i,A,y]);return k||!d||!g.length?n(b,{sx:{display:"flex",justifyContent:"center",p:4},children:n(z,{})}):l(b,{sx:{p:2},children:[l(G,{elevation:1,sx:{mb:3,p:2},children:[l(b,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[l(b,{sx:{display:"flex",alignItems:"center",gap:2},children:[n(E,{variant:"h6",sx:{fontWeight:600},children:"Permissions Selection"}),n(N,{label:`${f.selected} / ${f.total} selected`,color:f.isAllSelected?"success":f.selected>0?"warning":"default",variant:"outlined"})]}),l(b,{sx:{display:"flex",gap:1,alignItems:"center"},children:[te&&l(we,{children:[l(P,{variant:"contained",startIcon:n(H,{}),onClick:Z,disabled:F.isAllSelected,size:"small",color:"primary",children:["Select Filtered (",F.total,")"]}),n(P,{variant:"contained",startIcon:n(O,{}),onClick:ee,disabled:F.isNoneSelected,size:"small",color:"secondary",children:"Deselect Filtered"}),n(de,{orientation:"vertical",flexItem:!0,sx:{mx:1}})]}),n(P,{variant:"outlined",startIcon:n(H,{}),onClick:X,disabled:f.isAllSelected,size:"small",children:"Select All"}),n(P,{variant:"outlined",startIcon:n(O,{}),onClick:Y,disabled:f.isNoneSelected,size:"small",children:"Deselect All"})]})]}),l(b,{sx:{display:"flex",gap:2},children:[n(pe,{placeholder:"Search permissions",value:T,onChange:e=>K(e.target.value),size:"small",sx:{minWidth:200}}),R&&R.length>0&&l(ge,{size:"small",sx:{minWidth:150},children:[n(fe,{children:"Group"}),l(he,{value:I,onChange:e=>Q(e.target.value),label:"Group",children:[n(j,{value:"",children:n("em",{children:"All Groups"})}),R.map(e=>n(j,{value:e,children:e},e))]})]})]})]}),l(ce,{component:G,children:[l(le,{size:"small",children:[n(me,{children:l(_,{children:[n(u,{padding:"checkbox",children:"Enabled"}),n(u,{children:"Group"}),n(u,{children:"Name"}),n(u,{children:"Route Name"})]})}),n(ie,{children:D.length>0?D.map(e=>n(be,{permission:e,onToggle:V},e.route_name)):n(_,{children:n(u,{colSpan:4,align:"center",children:n(E,{variant:"body2",color:"text.secondary",sx:{py:3},children:"No permissions found"})})})})]}),n(ue,{count:i.length,page:A,onPageChange:(e,t)=>v(t),rowsPerPage:y,onRowsPerPageChange:e=>{U(parseInt(e.target.value,10)),v(0)},rowsPerPageOptions:[10,25,50,100]})]})]})},Te=a=>{const{record:c,isPending:B,isLoading:d}=se();return B||d?n(z,{}):n(W,{...a,record:c})},Ie=a=>n(W,{...a,record:{}}),Se=a=>{const{method:c}=a;switch(c){case"edit":return n(Te,{...a});case"create":return n(Ie,{...a});default:return null}};var De=Se;export{De as default};
File without changes
@@ -0,0 +1 @@
1
+ import{jsx as n}from"react/jsx-runtime";import{memo as i}from"react";import r from"prop-types";import m from"@mui/icons-material/RemoveRedEye";import{Link as p}from"react-router-dom";import{useResourceContext as R,useRecordContext as y,useCreatePath as T}from"react-admin";import{Button as f}from"react-admin";const c=o=>{const{icon:e=P,label:s="ra.action.show",record:C,resource:g,scrollToTop:a=!0,...d}=o,l=R(o),t=y(o),u=T();return t?n(f,{component:p,to:u({type:"show",resource:l,id:t.id}),state:B[String(a)],label:s,onClick:b,...d,children:e}):null},B={true:{_scrollToTop:!0},false:{}},P=n(m,{}),b=o=>o.stopPropagation();c.propTypes={icon:r.element,label:r.string,record:r.any,scrollToTop:r.bool};const h=i(c,(o,e)=>o.resource===e.resource&&(o.record&&e.record?o.record.id===e.record.id:o.record==e.record)&&o.label===e.label&&o.disabled===e.disabled);var z=h;export{z as default};
@@ -0,0 +1 @@
1
+ import{jsx as x}from"react/jsx-runtime";import{memo as f}from"react";import t from"prop-types";import{useResourceContext as h,useRecordContext as g,useRedirect as v}from"react-admin";import{Button as B}from"@mui/material";import{initAxios as C}from"../../hooks/axios";import P from"../../hooks/useVirtualHash";import{DASHAppConstants as S}from"@dashadmin/dash-constants";const b=S.system.URL_PREFIX,k={true:{_scrollToTop:!0},false:{}},a=(e,o)=>{const d=v(),l=C(),p=o?.type||B,u=o?.props||{},{record:w,resource:$,navigate:n,scrollToTop:R=!0,navigation:s="redirect",mode:i="edit",...y}=e,c=h(e),r=g(e);if(!r)return null;const{setVirtualHash:m}=P();return x(p,{onClick:()=>{if(i==="destroy")return l.delete(`${c}/${r.id}`,{headers:{"Content-Type":"application/json"}}),!1;if(s==="virtualhash"){const T=`${b}${c}/${n?n(r):r.id}`;m(T)}s==="redirect"&&d(i,c,n?n(r):r.id)},state:k[String(R)],...u,...y})};a.propTypes={icon:t.element,label:t.string,record:t.any,scrollToTop:t.bool,navigate:t.func,navigation:t.string};var U=f(a,(e,o)=>e.resource===o.resource&&(e.record&&o.record?e.record.id===o.record.id:e.record==o.record)&&e.label===o.label);export{U as default};
@@ -0,0 +1 @@
1
+ import{jsx as d}from"react/jsx-runtime";import*as h from"react";import{memo as y}from"react";import t from"prop-types";import T from"@mui/icons-material/RemoveRedEye";import{useLocation as P}from"react-router-dom";import{useResourceContext as b,useRecordContext as B,useCreatePath as v,useRedirect as k}from"react-admin";import{IconButton as C}from"@mui/material";import E from"../../hooks/useVirtualHash";import{DASHAdminSystemConstants as I}from"@dashadmin/dash-constants";const S=I.system.URL_PREFIX,s=o=>{const e=P(),u=k(),{icon:l=L,label:m="ra.action.show",record:x,resource:F,navigate:n,scrollToTop:p=!0,navigation:c="redirect",mode:a="edit",...R}=o,i=b(o),r=B(o),H=v();if(!r)return null;const{hash:Q,setVirtualHash:f}=E(),g=h.useCallback(()=>{c==="virtualhash"&&f(`${S}${i}/${r.id}/${a}`),c==="redirect"&&u(a,i,n?n(r.id):r.id)},[n]);return d(C,{onClick:g,state:w[String(p)],label:m,...R,children:l})},w={true:{_scrollToTop:!0},false:{}},L=d(T,{}),j=o=>o.stopPropagation();s.propTypes={icon:t.element,label:t.string,record:t.any,scrollToTop:t.bool,navigate:t.func,navigation:t.string};const $=y(s,(o,e)=>o.resource===e.resource&&(o.record&&e.record?o.record.id===e.record.id:o.record==e.record)&&o.label===e.label&&o.disabled===e.disabled);var oo=$;export{oo as default};
@@ -0,0 +1 @@
1
+ import{jsx as d}from"react/jsx-runtime";import{memo as h}from"react";import t from"prop-types";import T from"@mui/icons-material/RemoveRedEye";import{useResourceContext as g,useRecordContext as I,useRedirect as v}from"react-admin";import{IconButton as P}from"@mui/material";import{initAxios as B}from"../../hooks/axios";import b from"../../hooks/useVirtualHash";import{DASHAdminSystemConstants as C}from"@dashadmin/dash-constants";const S=C.system.URL_PREFIX,s=o=>{const e=v(),l=B(),{icon:u=w,label:p="ra.action.show",record:x,resource:E,navigate:n,scrollToTop:m=!0,navigation:a="redirect",mode:i="edit",...R}=o,c=g(o),r=I(o);if(!r)return null;const{hash:$,setVirtualHash:y}=b();return d(P,{onClick:()=>{if(i=="destroy")return l.delete(`${c}/${r.id}`,{headers:{"Content-Type":"application/json"}}),!1;if(a==="virtualhash"){let f=`${S}${c}/${n?n(r):r.id}`;y(f)}a==="redirect"&&e(i,c,n?n(r):r.id)},state:k[String(m)],label:p,...R,children:u})},k={true:{_scrollToTop:!0},false:{}},w=d(T,{}),q=o=>o.stopPropagation();s.propTypes={icon:t.element,label:t.string,record:t.any,scrollToTop:t.bool,navigate:t.func,navigation:t.string};var z=h(s,(o,e)=>o.resource===e.resource&&(o.record&&e.record?o.record.id===e.record.id:o.record==e.record)&&o.label===e.label);export{z as default};
@@ -0,0 +1 @@
1
+ import{jsx as a}from"react/jsx-runtime";import{Scrollbars as c}from"react-custom-scrollbars-2";const i=l=>{const{horizontal:t,children:e,...r}=l;return r.renderTrackVertical=o=>a("div",{...o,className:"track-vertical"}),t&&(r.renderTrackHorizontal=o=>a("div",{...o,className:"track-horizontal"})),a(c,{...l,...r,autoHide:!0,autoHideTimeout:1e3,autoHideDuration:200,children:e})};var p=i;export{p as default};
@@ -0,0 +1 @@
1
+ import{jsx as t}from"react/jsx-runtime";import{ReferenceArrayInput as c}from"react-admin";import{SelectArrayInput as s}from"react-admin";import{ChipField as m}from"react-admin";import{SingleFieldList as u}from"react-admin";import{ReferenceArrayField as p}from"react-admin";const l=({method:o,attribute:e})=>{const r=e.type,[i,n]=r.split(".");return t(p,{source:e.attribute,reference:i,children:t(u,{children:t(m,{source:n})})})},a=({method:o,attribute:e})=>{const r=e.type,[i,n]=r.split(".");return t(c,{reference:i,source:e.attribute,children:t(s,{optionText:n})})},d=({method:o,attribute:e,resourceConfig:r})=>{switch(o){case"edit":case"create":return t(a,{attribute:e,method:o,resourceConfig:r});case"view":return t(l,{attribute:e,method:o,resourceConfig:r})}};var g=d;export{g as default};
@@ -0,0 +1 @@
1
+ import{Fragment as I,jsx as i,jsxs as K}from"react/jsx-runtime";import{Autocomplete as B,Box as M,CircularProgress as Q,TextField as z}from"@mui/material";import{useEffect as G,useState as g}from"react";import{useController as H}from"react-hook-form";import{useGetList as W}from"react-admin";import{useRecordContext as _}from"react-admin";import{isArray as j}from"lodash";const A=({method:u,attribute:o,isMultiple:d=!1,searchResults:N=50,minSearch:k=3,timerSearch:D=500,resource:L,selectLabel:P,renderText:c,transformData:v,queryFilter:x="q",defaultValues:U=void 0,isEmpty:V=!1,filter:E,isOptionEqualToValue:h=void 0,viewAttribute:p=null,elementKeyId:S="id"})=>{const[O,C]=g(!0),[l,y]=g(null),[b,F]=g(""),a=_(),s=H({name:o.attribute,defaultValue:a?a[o.attribute]:null}),R=a&&a[o.attribute]&&j(a[o.attribute])?a[o.attribute].map(e=>e.hasOwnProperty(S)?e[S]:e):a[o.attribute],{data:f,total:X,isLoading:m,error:Y}=W(L,{filter:{[x]:b,...E,includes:R}});G(()=>(f&&!m&&(l&&y([...l,...f.map(e=>({...e,key:"option"+e.id}))]),y(f.map(e=>({...e,key:"option"+e.id})))),()=>y([])),[f,m]);const[T,q]=g(void 0),w=(e,t=500)=>{clearTimeout(T),q(setTimeout(()=>{e()},t))};return i(I,{children:l&&i(B,{multiple:d,loading:m&&O,fullWidth:!0,freeSolo:!0,options:l,open:O,onOpen:()=>C(!0),onClose:()=>C(!1),defaultValue:s.field?.value,isOptionEqualToValue:h,autoHighlight:!0,getOptionLabel:e=>{const t=Array.isArray(e)?e:l&&l.find(r=>h(r,s.field.value));if(!t)return b;const n=p&&!c?t[p]:c(t);return console.log("getOptionLabel",l.find(r=>h(r,s.field.value)),n),n||b},renderOption:(e,t)=>{const{key:n,...r}=e;return i(M,{component:"li",sx:{"& > img":{mr:2,flexShrink:0}},...r,children:p&&!c?t[p]:c(t)},t.key)},onChange:(e,t)=>{console.log("onChange",e,t);let n=t;Array.isArray(t)&&(n=V?[...t,...s.field.value]:[...new Map(n.map(r=>[r.id,r])).values()]),v?s.field.onChange(v(n)):s.field.onChange(n)},renderInput:e=>(console.log("renderInput",e.id),i(z,{...e,label:P,variant:"outlined",onChange:t=>{let n=t.target.value;n&&n!==""&&n.length>=k&&w(()=>F(n),D)},InputProps:{...e.InputProps,autoComplete:"new-password",endAdornment:K(I,{children:[m?i(Q,{color:"inherit",size:20}):null,e.InputProps.endAdornment]})}},e.id))},"autocomplete-"+o.attribute)})},J=({method:u,attribute:o,...d})=>{switch(u){case"edit":case"create":return i(A,{attribute:o,method:u,...d});case"view":return i(A,{attribute:o,method:u,...d})}};var de=J;export{de as default};
@@ -0,0 +1 @@
1
+ import{Fragment as S,jsx as o,jsxs as w}from"react/jsx-runtime";import{Autocomplete as X,Box as Y,Chip as Z,CircularProgress as $,TextField as K}from"@mui/material";import{useEffect as j,useState as h}from"react";import{useController as M}from"react-hook-form";import{useGetList as ee}from"react-admin";import{useRecordContext as te}from"react-admin";import{isArray as re}from"lodash";import{LoadingIndicator as oe}from"react-admin";const f=(n,a)=>{for(var r=a.split(".");r.length&&(n=n[r.shift()]););return n},V=({method:n,attribute:a,isMultiple:r=!1,searchResults:ae=50,minSearch:L=3,timerSearch:v=500,resource:P,selectLabel:k,renderText:y,transformData:se=s=>s,queryFilter:x="q",defaultValues:O=void 0,isEmpty:ie=!1,filter:_,isOptionEqualToValue:D=void 0,viewAttribute:le=null,valueKeyId:b="id",useBaseAttributeName:F=!1,useListAttributeForController:E=!1,transformOption:I})=>{let s=E?a.listAttribute:a.attribute;s=F?s.split(".")[0]:s;const l=te(),d=F?s.split(".")[0]:s,[q,g]=h(!1),[m,T]=h(null),[B,z]=h(""),u=(e,t)=>typeof I=="function"?I(e,m,t):e,C=e=>e?r&&Array.isArray(e)?e.map(t=>u(t,"_processFieldValue")):u(e,"_processFieldValue"):r?[]:null,A=O?C(O):l&&f(l,d)?C(f(l,d)):r?[]:null,G=M({name:s});let c=l&&f(l,d)?f(l,d):[];c=re(c)?c:[c[b]];const H=c.filter(e=>e).map(e=>e.hasOwnProperty(b)?e[b]:e),{data:p,total:ue,isLoading:R,error:ce}=ee(P,{meta:{removeSortFilters:!0},filter:{[x]:B,..._,includes:H}});j(()=>{if(p){const t=(Array.isArray(p)?p:Object.values(p)).map(i=>({...i,key:"option"+i.id}));T(t)}},[p]);const[N,Q]=h(void 0),W=(e,t=500)=>{clearTimeout(N),Q(setTimeout(()=>{e()},t))},J=e=>{const t=C(e);G.field.onChange(t)};return w(S,{children:[m?o(X,{multiple:r,loading:R,fullWidth:!0,freeSolo:!0,options:m,open:q,onOpen:()=>g(!0),onClose:()=>g(!1),defaultValue:A,isOptionEqualToValue:D,autoHighlight:!0,getOptionLabel:e=>y(u(e,"optionlabel"),"optionlabel"),renderOption:(e,t)=>{const{key:i,...U}=e;return o(Y,{component:"li",sx:{"& > img":{mr:2,flexShrink:0}},...U,children:y(u(t,"option"),"option")},t.key)},onChange:(e,t)=>{g(!1),J(t)},renderInput:e=>o(K,{...e,label:k,variant:"outlined",onChange:t=>{let i=t.target.value;i&&i!==""&&i.length>=L&&W(()=>z(i),v)},InputProps:{...e.InputProps,autoComplete:"new-password",endAdornment:w(S,{children:[R?o($,{color:"inherit",size:20}):null,e.InputProps.endAdornment]})}},e.id)},"autocomplete-"+a.attribute):o(oe,{}),!r&&m&&A&&o(S,{children:o(Z,{label:y(u(A,"chip"),"chip")})})]})},ne=({method:n,attribute:a,...r})=>{switch(n){case"edit":case"create":return o(V,{attribute:a,method:n,...r});case"view":return o(V,{attribute:a,method:n,...r})}};var Ie=ne;export{V as SearchableSelectChipsControl,Ie as default};
@@ -0,0 +1 @@
1
+ import{Fragment as p,jsx as n,jsxs as v}from"react/jsx-runtime";import{Autocomplete as w,Box as x,CircularProgress as B,InputLabel as R,TextField as F}from"@mui/material";import{useEffect as k,useState as u}from"react";import{useController as q}from"react-hook-form";import{useGetList as z}from"react-admin";import D from"@mui/icons-material/TrendingUpRounded";const G=({name:I,isMultiple:P=!1,resource:b,selectLabel:y,title:A,renderText:i,transformData:f,defaultValues:r=void 0,isEmpty:s=!1,filter:L={}})=>{const[d,g]=u(!1),[S,m]=u(!1),[O,c]=u(""),a=q({name:I}),{data:l,total:H,isLoading:h,error:M}=z(b,{pagination:{page:1,perPage:100},filter:{q:O,...L}});return k(()=>(l&&!S&&(r&&a.field.onChange(r),m(!0)),()=>{m(!1)}),[l]),v(p,{children:[n(R,{children:A}),D&&n(w,{multiple:P,loading:h&&d,sx:{width:373},options:l||[],open:d,onOpen:()=>g(!0),onClose:()=>g(!1),autoHighlight:!0,...!s&&{value:a.field.value},...s&&{renderTags:(t,e)=>n(p,{})},getOptionLabel:t=>i?i(t):t.name,renderOption:(t,e)=>n(x,{component:"li",sx:{"& > img":{mr:2,flexShrink:0}},...t,children:i?i(e):e.name}),onChange:(t,e)=>{let o=e;Array.isArray(e)&&(s&&(o=[...e,...a.field.value]),o=[...new Map(o.map(C=>[C.id,C])).values()]),f?a.field.onChange(f(o)):a.field.onChange(o)},renderInput:t=>n(F,{...t,label:y,variant:"outlined",onChange:e=>{(e.target.value!==""||e.target.value!==null)&&c(e.target.value)},onBlur:()=>c(""),InputProps:{...t.InputProps,autoComplete:"new-password",endAdornment:v(p,{children:[h?n(B,{color:"inherit",size:20}):null,t.InputProps.endAdornment]})}})})]})};var V=G;export{V as default};
@@ -0,0 +1 @@
1
+ import{jsx as t,jsxs as a}from"react/jsx-runtime";import{SelectInput as c}from"react-admin";import{Box as o,CircularProgress as d,Alert as p}from"@mui/material";const m=()=>({supportedBillingCycles:["daily","weekly","monthly","yearly"],isLoading:!1,gatewayName:"Default Gateway"}),u=()=>{const{supportedBillingCycles:n,isLoading:s,gatewayName:l}=m(),y=[{id:"daily",name:"Daily"},{id:"weekly",name:"Weekly"},{id:"monthly",name:"Monthly"},{id:"yearly",name:"Yearly"}];if(s)return a(o,{sx:{display:"flex",alignItems:"center",gap:2,my:2},children:[t(d,{size:20}),t("span",{children:"Loading payment gateway capabilities..."})]});const r=y.filter(e=>n.includes(e.id)),i=y.filter(e=>!n.includes(e.id)).map(e=>e.name);return a(o,{children:[t(c,{source:"billing_cycle",label:"Billing Cycle",choices:r,fullWidth:!0,defaultValue:"monthly",helperText:l?`Available cycles for ${l}`:"Select billing cycle for this plan",validate:e=>e?void 0:"Required"}),i.length>0&&a(p,{severity:"info",sx:{mt:1},children:["Note: ",i.join(", ")," billing cycle",i.length>1?"s are":" is"," not supported by your current payment gateway (",l,")."]})]})};var b=u;export{b as default};
@@ -0,0 +1 @@
1
+ import{jsx as e,jsxs as d}from"react/jsx-runtime";import{useEffect as C,useCallback as T}from"react";import{Loading as P,useRecordContext as S}from"react-admin";import{useFormContext as F,useWatch as B,Controller as k}from"react-hook-form";import{useSubscriptionPlanFormats as _}from"../../contexts/SubscriptionPlanFormatsProvider";import{Box as h,Switch as j,FormControlLabel as U,TextField as G,Typography as u,Paper as I,Chip as E,InputAdornment as V,Collapse as O,Divider as R,Grid as w}from"@mui/material";import{priceFormatter as $}from"@dashadmin/dash-utils";const D=["CLP","USD"],at="CLP",W={CLP:{symbol:"$",decimals:0,name:"Chilean Peso"},USD:{symbol:"$",decimals:2,name:"US Dollar"}},L=({addonId:n,entry:a,plan:r,mode:b})=>{const{control:c,setValue:m,watch:y}=F(),g=y(`addons.${n}`)??a.default_value??!1,A=y(`addon_prices.${n}`)??r?.addon_prices?.[n]??{},l=T(t=>{if(m(`addons.${n}`,t,{shouldDirty:!0}),t&&Object.keys(A).length===0){const s={};D.forEach(i=>{s[i]=a.prices?.[i]??0}),m(`addon_prices.${n}`,s,{shouldDirty:!0})}},[n,A,a.prices,m]),f=T((t,s)=>{const i=parseInt(s.replace(/[^0-9]/g,""),10)||0;m(`addon_prices.${n}.${t}`,i,{shouldDirty:!0})},[n,m]),o=(t,s)=>$(t,s),p=b==="view";return e(I,{elevation:1,sx:{p:2,mb:2,borderLeft:g?"4px solid #4caf50":"4px solid #e0e0e0",transition:"border-color 0.3s"},children:d(w,{container:!0,spacing:2,alignItems:"flex-start",children:[d(w,{component:"div",item:!0,xs:12,md:4,children:[e(k,{name:`addons.${n}`,control:c,defaultValue:a.default_value??!1,render:({field:t})=>e(U,{control:e(j,{checked:t.value??!1,onChange:s=>{t.onChange(s.target.checked),l(s.target.checked)},disabled:p,color:"primary"}),label:d(h,{children:[d(u,{variant:"subtitle1",fontWeight:"medium",children:[a.icon&&e("span",{style:{marginRight:8},children:a.icon}),a.label]}),a.description&&e(u,{variant:"caption",color:"text.secondary",children:a.description})]})})}),a.service_class&&e(E,{label:"Has Service Class",size:"small",variant:"outlined",sx:{mt:1}})]}),e(w,{component:"div",item:!0,xs:12,md:8,children:d(O,{in:g,children:[e(h,{sx:{display:"flex",gap:2,flexWrap:"wrap"},children:D.map(t=>{const s=W[t],i=A[t]??a.prices?.[t]??0;return e(k,{name:`addon_prices.${n}.${t}`,control:c,defaultValue:i,render:({field:x})=>e(G,{...x,label:`Price (${t})`,type:"text",size:"small",disabled:p,InputProps:{startAdornment:e(V,{position:"start",children:s.symbol})},sx:{width:150},value:o(x.value??0,t),onChange:v=>f(t,v.target.value),helperText:s.name})},t)})}),r?.flow_addon_items?.[n]&&d(u,{variant:"caption",color:"text.secondary",sx:{mt:1,display:"block"},children:["Flow Item ID: ",r.flow_addon_items[n]]})]})})]})})},z=({method:n,attribute:a})=>{const r=S(),b=F(),{setValue:c,watch:m}=b,y=m("addons"),g=m("addon_prices");C(()=>{Array.isArray(y)&&(console.warn("PlanAddonsSettings: Detected addons as array, converting to object"),c("addons",{...y}))},[y,c]),C(()=>{Array.isArray(g)?(console.warn("PlanAddonsSettings: Detected addon_prices as array, converting to object"),c("addon_prices",{})):!g&&r?.addon_prices&&!Array.isArray(r.addon_prices)?c("addon_prices",r.addon_prices):(!g||typeof g=="object"&&Object.keys(g).length===0)&&c("addon_prices",{})},[g,r,c]),B({control:b.control});const{addonFormats:A,loading:l}=_();if(l)return e(P,{});const p=(A?.formats||[]).filter(t=>t.visible!==!1).reduce((t,s)=>{const i=s.tab||"General";return t[i]||(t[i]=[]),t[i].push(s),t},{});return d(h,{sx:{p:2},children:[e(u,{variant:"h6",gutterBottom:!0,children:"Plan Add-ons Configuration"}),e(u,{variant:"body2",color:"text.secondary",sx:{mb:3},children:"Enable add-ons and set prices per currency. Prices are in the smallest currency unit (e.g., cents for USD, pesos for CLP)."}),Object.entries(p).map(([t,s])=>d(h,{sx:{mb:4},children:[e(u,{variant:"subtitle1",fontWeight:"bold",sx:{mb:2},children:t}),e(R,{sx:{mb:2}}),s.map(i=>{const x=i.attribute?i.attribute.replace("addons.",""):i.id;return e(L,{addonId:x,entry:i,plan:r,mode:"edit"},x)})]},t))]})},Y=({method:n,attribute:a})=>{const r=F(),{setValue:b,watch:c}=r,m=c("addons");C(()=>{Array.isArray(m)&&(console.warn("PlanAddonsSettings: Detected addons as array, converting to object"),b("addons",{...m}))},[m,b]),C(()=>{const o=c("addon_prices");Array.isArray(o)?(console.warn("PlanAddonsSettings: Detected addon_prices as array, converting to object"),b("addon_prices",{})):o||b("addon_prices",{})},[b,c]),B({control:r.control});const{addonFormats:y,loading:g}=_();if(g)return e(P,{});const f=(y?.formats||[]).filter(o=>o.visible!==!1).reduce((o,p)=>{const t=p.tab||"General";return o[t]||(o[t]=[]),o[t].push(p),o},{});return d(h,{sx:{p:2},children:[e(u,{variant:"h6",gutterBottom:!0,children:"Plan Add-ons Configuration"}),e(u,{variant:"body2",color:"text.secondary",sx:{mb:3},children:"Enable add-ons and set prices per currency. Prices are in the smallest currency unit."}),Object.entries(f).map(([o,p])=>d(h,{sx:{mb:4},children:[e(u,{variant:"subtitle1",fontWeight:"bold",sx:{mb:2},children:o}),e(R,{sx:{mb:2}}),p.map(t=>{const s=t.attribute?t.attribute.replace("addons.",""):t.id;return e(L,{addonId:s,entry:t,mode:"create"},s)})]},o))]})},q=({method:n,attribute:a})=>{const r=S(),{addonFormats:b,loading:c}=_(),m=(l,f)=>$(l,f);if(c)return e(P,{});const A=(b?.formats||[]).filter(l=>l.visible!==!1).reduce((l,f)=>{const o=f.tab||"General";return l[o]||(l[o]=[]),l[o].push(f),l},{});return d(h,{sx:{p:2},children:[e(u,{variant:"h6",gutterBottom:!0,children:"Plan Add-ons"}),Object.entries(A).map(([l,f])=>d(h,{sx:{mb:3},children:[e(u,{variant:"subtitle1",fontWeight:"bold",sx:{mb:2},children:l}),e(R,{sx:{mb:2}}),f.map(o=>{const p=o.attribute?o.attribute.replace("addons.",""):o.id,t=r?.addons?.[p]??!1,s=r?.addon_prices?.[p]??{},i=r?.flow_addon_items?.[p];return e(I,{elevation:0,sx:{p:2,mb:1,backgroundColor:t?"action.selected":"background.default",borderLeft:t?"4px solid #4caf50":"4px solid #e0e0e0"},children:d(h,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[d(h,{children:[d(u,{variant:"subtitle2",children:[o.icon&&e("span",{style:{marginRight:8},children:o.icon}),o.label]}),e(E,{label:t?"Enabled":"Disabled",size:"small",color:t?"success":"default",sx:{mt:.5}})]}),t&&d(h,{sx:{textAlign:"right"},children:[D.map(x=>{const v=s[x]??0;return d(u,{variant:"body2",children:[x,": ",m(v,x)]},x)}),i&&d(u,{variant:"caption",color:"text.secondary",children:["Flow ID: ",i]})]})]})},p)})]},l))]})},H=({method:n,attribute:a,resourceConfig:r})=>{switch(n){case"edit":return e(z,{attribute:a,method:n,resourceConfig:r});case"view":return e(q,{attribute:a,method:n,resourceConfig:r});case"create":return e(Y,{attribute:a,method:n,resourceConfig:r});case"list":return null;default:return null}};var it=H;export{it as default};
@@ -0,0 +1 @@
1
+ import{Fragment as q,jsx as e,jsxs as o}from"react/jsx-runtime";import{useState as b,useMemo as T,useCallback as v}from"react";import{useRecordContext as C,useGetList as L,Loading as _}from"react-admin";import{Box as d,Typography as i,Paper as l,Button as I,Dialog as R,DialogTitle as k,DialogContent as B,DialogActions as F,IconButton as w,Chip as G,Tooltip as N}from"@mui/material";import{DataGrid as M,GridToolbarContainer as z,GridToolbarExport as E}from"@mui/x-data-grid";import O from"@mui/icons-material/Visibility";import J from"@mui/icons-material/Close";import g from"@mui/icons-material/History";const W=()=>e(z,{children:e(E,{csvOptions:{fileName:"audit-logs-export",delimiter:",",utf8WithBom:!0},printOptions:{hideFooter:!0,hideToolbar:!0}})}),V=({open:r,log:t,onClose:a})=>{if(!t)return null;const c=s=>{try{return JSON.stringify(s,null,2)}catch{return String(s)}};return o(R,{open:r,onClose:a,maxWidth:"md",fullWidth:!0,"aria-labelledby":"audit-log-dialog-title",children:[e(k,{id:"audit-log-dialog-title",children:o(d,{display:"flex",justifyContent:"space-between",alignItems:"center",children:[o(i,{variant:"h6",children:["Audit Log Details - ",t.event||t.description]}),e(w,{edge:"end",color:"inherit",onClick:a,"aria-label":"close",children:e(J,{})})]})}),o(B,{dividers:!0,children:[o(d,{mb:2,children:[e(i,{variant:"subtitle2",color:"textSecondary",children:"Event Information"}),o(l,{variant:"outlined",sx:{p:2,mt:1},children:[o(i,{variant:"body2",children:[e("strong",{children:"ID:"})," ",t.id]}),o(i,{variant:"body2",children:[e("strong",{children:"Event:"})," ",t.event||"N/A"]}),o(i,{variant:"body2",children:[e("strong",{children:"Description:"})," ",t.description]}),o(i,{variant:"body2",children:[e("strong",{children:"Log Name:"})," ",t.log_name]}),o(i,{variant:"body2",children:[e("strong",{children:"Created At:"})," ",new Date(t.created_at).toLocaleString()]}),t.causer_name&&o(i,{variant:"body2",children:[e("strong",{children:"Changed By:"})," ",t.causer_name]})]})]}),o(d,{children:[e(i,{variant:"subtitle2",color:"textSecondary",children:"Properties (JSON)"}),e(l,{variant:"outlined",sx:{p:2,mt:1,bgcolor:"grey.900",color:"grey.100",maxHeight:400,overflow:"auto"},children:e("pre",{style:{margin:0,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:c(t.properties)})})]})]}),e(F,{children:e(I,{onClick:a,color:"primary",children:"Close"})})]})},H=r=>{const t=(r||"").toLowerCase();let a="default";switch(t){case"created":a="success";break;case"updated":a="warning";break;case"deleted":a="error";break;case"restored":a="info";break;default:a="default"}return e(G,{label:r||"N/A",color:a,size:"small",variant:"outlined"})},p=({resourceConfig:r})=>{const t=C(),[a,c]=b({page:0,pageSize:10}),[s,m]=b({open:!1,log:null}),x=`${r?.model||"system/subscription-plan"}/audit`,{data:u,total:D,isLoading:y,error:h}=L(x,{pagination:{page:a.page+1,perPage:a.pageSize},sort:{field:"created_at",order:"DESC"},filter:{subject_id:t?.id}},{enabled:!!t?.id,refetchOnWindowFocus:!1}),f=v(n=>{m({open:!0,log:n})},[]),A=v(()=>{m({open:!1,log:null})},[]),S=T(()=>[{field:"id",headerName:"ID",type:"number",width:80},{field:"event",headerName:"Event",width:120,renderCell:n=>H(n.value)},{field:"description",headerName:"Description",flex:1,minWidth:200},{field:"causer_name",headerName:"Changed By",width:150,valueGetter:(n,P)=>P.causer_name||"System"},{field:"created_at",headerName:"Date",width:180,valueFormatter:n=>n?new Date(n).toLocaleString():""},{field:"actions",headerName:"Actions",type:"actions",width:100,getActions:n=>[e(N,{title:"View Details",children:e(w,{size:"small",onClick:()=>f(n.row),color:"primary",children:e(O,{fontSize:"small"})})},"view")]}],[f]);return t?.id?y?e(_,{}):h?e(l,{variant:"outlined",sx:{p:2},children:o(i,{color:"error",children:["Error loading audit logs: ",h.message||"Unknown error"]})}):!u||u.length===0?o(l,{variant:"outlined",sx:{p:3,textAlign:"center"},children:[e(g,{sx:{fontSize:48,color:"text.secondary",mb:1}}),e(i,{variant:"body1",color:"text.secondary",children:"No audit logs available for this record"})]}):o(q,{children:[e(d,{sx:{width:"100%"},children:e(l,{variant:"outlined",children:e(M,{rows:u,columns:S,rowCount:D||0,loading:y,pageSizeOptions:[5,10,25,50],paginationModel:a,paginationMode:"server",onPaginationModelChange:c,disableRowSelectionOnClick:!0,autoHeight:!0,slots:{toolbar:W},sx:{"& .MuiDataGrid-cell:focus":{outline:"none"}}})})}),e(V,{open:s.open,log:s.log,onClose:A})]}):o(l,{variant:"outlined",sx:{p:3,textAlign:"center"},children:[e(g,{sx:{fontSize:48,color:"text.secondary",mb:1}}),e(i,{variant:"body1",color:"text.secondary",children:"Save the record first to view audit logs"})]})},j=r=>e(p,{...r}),U=()=>{const r=C();return e(i,{variant:"body2",color:"text.secondary",children:"\u2014"})},$=r=>{const{method:t}=r;switch(t){case"view":return e(p,{...r});case"edit":return e(j,{...r});case"list":return e(U,{...r});case"create":return o(l,{variant:"outlined",sx:{p:3,textAlign:"center"},children:[e(g,{sx:{fontSize:48,color:"text.secondary",mb:1}}),e(i,{variant:"body1",color:"text.secondary",children:"Audit logs will be available after the record is created"})]});default:return e(p,{...r})}};var de=$;export{de as default};
@@ -0,0 +1 @@
1
+ import{jsx as e,jsxs as p}from"react/jsx-runtime";import{useState as g,useEffect as x}from"react";import{useRecordContext as u}from"react-admin";import{useFormContext as T}from"react-hook-form";import{Box as v,Chip as l,TextField as A,IconButton as P,Typography as i,Paper as F,Stack as d,Table as k,TableBody as w,TableCell as I,TableContainer as R,TableRow as S}from"@mui/material";import D from"@mui/icons-material/Add";import B from"@mui/icons-material/Delete";const z=()=>{const a=u()?.features||[];return a.length?e(R,{component:F,variant:"outlined",children:e(k,{size:"small",children:e(w,{children:a.map((o,n)=>e(S,{children:e(I,{children:e(l,{label:o,size:"small",color:"primary",variant:"outlined"})})},n))})})}):e(i,{variant:"body2",color:"text.secondary",sx:{py:2},children:"No features configured"})},E=()=>{const a=u()?.features||[];return a.length?p(d,{direction:"row",spacing:.5,flexWrap:"wrap",useFlexGap:!0,children:[a.slice(0,3).map((o,n)=>e(l,{label:o,size:"small",variant:"outlined"},n)),a.length>3&&e(l,{label:`+${a.length-3}`,size:"small",color:"default"})]}):e(i,{variant:"body2",color:"text.secondary",children:"\u2014"})},K=()=>{const r=u(),{setValue:a,watch:o}=T(),[n,m]=g(""),[s,y]=g([]),f=o("features");x(()=>{const t=f||r?.features||[];y(Array.isArray(t)?t:[])},[r,f]);const b=t=>{y(t),a("features",t,{shouldDirty:!0})},h=()=>{const t=n.trim();t&&!s.includes(t)&&(b([...s,t]),m(""))},C=t=>{b(s.filter(c=>c!==t))};return p(v,{children:[e(i,{variant:"subtitle2",gutterBottom:!0,children:"Plan Features"}),e(i,{variant:"caption",color:"text.secondary",display:"block",sx:{mb:2},children:'Add feature keys that are enabled for this plan (e.g., "api_access", "custom_branding")'}),p(d,{direction:"row",spacing:1,sx:{mb:2},children:[e(A,{value:n,onChange:t=>m(t.target.value),onKeyPress:t=>{t.key==="Enter"&&(t.preventDefault(),h())},placeholder:"Enter feature key...",size:"small",fullWidth:!0}),e(P,{onClick:h,color:"primary",disabled:!n.trim(),children:e(D,{})})]}),s.length>0?e(F,{variant:"outlined",sx:{p:1},children:e(d,{direction:"row",spacing:1,flexWrap:"wrap",useFlexGap:!0,children:s.map((t,c)=>e(l,{label:t,onDelete:()=>C(t),deleteIcon:e(B,{}),color:"primary",variant:"outlined"},c))})}):e(i,{variant:"body2",color:"text.secondary",children:"No features added yet"})]})},N=({method:r,attribute:a,resourceConfig:o})=>{switch(r){case"edit":case"create":return e(K,{method:r,attribute:a,resourceConfig:o});case"view":return e(z,{method:r,attribute:a,resourceConfig:o});case"list":return e(E,{method:r,attribute:a,resourceConfig:o});default:return null}};var O=N;export{O as default};
@@ -0,0 +1 @@
1
+ import{Fragment as V,jsx as o}from"react/jsx-runtime";import{DashAutoFormTabs as C}from"@dashadmin/dash-auto-admin";import{useState as p,useEffect as b}from"react";import{Loading as c,useRecordContext as h}from"react-admin";import{useFormContext as S,useWatch as F}from"react-hook-form";import L from"../misc/MuiSimpleJsonTable";import{useSubscriptionPlanFormats as g}from"../../contexts/SubscriptionPlanFormatsProvider";const A=({method:n,attribute:r})=>{const[i,l]=p(null),m=h(),a=S();F({control:a.control});const{formats:s,loading:u}=g();return b(()=>{if(s&&s.formats){const t=s.formats.filter(e=>e.visible!==!1).map(e=>{const f=e.attribute?e.attribute.replace("limits.",""):e.id,d=m?.limits?.[f]??e.default_value;return{...e,fieldOptions:{defaultValue:d,fullWidth:!0,helperText:e.description},...n==="view"&&{readOnly:!0}}});console.log("PlanLimitsSettings SCHEMA",t),l(t)}},[s,m]),u?o(c,{}):o("section",{children:i?C({schema:i,resourceConfig:null,options:{mode:n,label:"Plan Limits Configuration"}}):null})},P=({method:n,attribute:r})=>{const[i,l]=p(null),m=S();F({control:m.control});const{formats:a,loading:s}=g();return b(()=>{if(!s&&a&&a.formats){const u=a.formats.filter(t=>t.visible!==!1).map(t=>({...t,fieldOptions:{defaultValue:t.default_value,fullWidth:!0,helperText:t.description}}));l(u)}},[a,s]),s?o(c,{}):o("section",{children:i?C({schema:i,resourceConfig:null,options:{mode:n,label:"Plan Limits Configuration"}}):null})},D=({method:n,attribute:r})=>{const i=h(),[l,m]=p(null),{formats:a,loading:s}=g(),u=(t,e)=>{if(t==null||t===-1)return"Unlimited";switch(e){case"boolean":return t?"\u2713 Enabled":"\u2717 Disabled";case"integer":return typeof t=="number"?t.toLocaleString():t;default:return t}};return b(()=>{if(a?.formats&&i){const t={};a.formats.filter(e=>e.visible!==!1).forEach(e=>{const f=e.attribute?e.attribute.replace("limits.",""):e.id,d=i.limits?.[f]??e.default_value;t[e.label]=o(V,{children:u(d,e.type)})}),m(t)}},[a,i]),s?o(c,{}):l?o(L,{tableData:l,vertical:!0}):o(c,{})},R=({method:n,attribute:r,resourceConfig:i})=>{switch(n){case"edit":return o(A,{attribute:r,method:n,resourceConfig:i});case"view":return o(D,{attribute:r,method:n,resourceConfig:i});case"create":return o(P,{attribute:r,method:n,resourceConfig:i});case"list":return null;default:return null}};var O=R;export{O as default};
@@ -0,0 +1 @@
1
+ import{jsx as e,jsxs as d}from"react/jsx-runtime";import{useState as p,useEffect as M}from"react";import{useRecordContext as C}from"react-admin";import{useFormContext as z}from"react-hook-form";import{Box as E,TextField as f,IconButton as S,Typography as u,Paper as A,Stack as N,Table as k,TableBody as V,TableCell as n,TableContainer as F,TableRow as b,TableHead as I}from"@mui/material";import O from"@mui/icons-material/Add";import j from"@mui/icons-material/Delete";const H=()=>{const i=C()?.metadata||{},o=Object.entries(i);return o.length?e(F,{component:A,variant:"outlined",children:d(k,{size:"small",children:[e(I,{children:d(b,{children:[e(n,{children:e("strong",{children:"Key"})}),e(n,{children:e("strong",{children:"Value"})})]})}),e(V,{children:o.map(([s,c])=>d(b,{children:[e(n,{children:s}),e(n,{children:typeof c=="object"?JSON.stringify(c):String(c)})]},s))})]})}):e(u,{variant:"body2",color:"text.secondary",sx:{py:2},children:"No metadata configured"})},J=()=>{const i=C()?.metadata||{},o=Object.keys(i).length;return o?d(u,{variant:"body2",children:[o," ",o===1?"entry":"entries"]}):e(u,{variant:"body2",color:"text.secondary",children:"\u2014"})},q=()=>{const l=C(),{setValue:i,watch:o}=z(),[s,c]=p([]),[g,h]=p(""),[x,v]=p(""),[P,y]=p(""),w=o("metadata");M(()=>{const t=w||l?.metadata||{},a=Object.entries(t).map(([r,m])=>({key:r,value:typeof m=="object"?JSON.stringify(m):String(m)}));c(a)},[l,w]);const T=t=>{c(t);const a={};t.forEach(({key:r,value:m})=>{try{a[r]=JSON.parse(m)}catch{a[r]=m}}),i("metadata",a,{shouldDirty:!0})},K=()=>{const t=g.trim(),a=x.trim();if(!t){y("Key is required");return}if(s.some(r=>r.key===t)){y("Key already exists");return}y(""),T([...s,{key:t,value:a}]),h(""),v("")},B=t=>{T(s.filter(a=>a.key!==t))},D=(t,a)=>{T(s.map(r=>r.key===t?{...r,value:a}:r))},R=t=>{t.key==="Enter"&&(t.preventDefault(),K())};return d(E,{children:[e(u,{variant:"subtitle2",gutterBottom:!0,children:"Plan Metadata"}),e(u,{variant:"caption",color:"text.secondary",display:"block",sx:{mb:2},children:"Add key-value pairs for additional plan configuration"}),d(N,{direction:"row",spacing:1,sx:{mb:2},alignItems:"flex-start",children:[e(f,{value:g,onChange:t=>{h(t.target.value),y("")},onKeyPress:R,placeholder:"Key",size:"small",error:!!P,helperText:P,sx:{flex:1}}),e(f,{value:x,onChange:t=>v(t.target.value),onKeyPress:R,placeholder:"Value",size:"small",sx:{flex:2}}),e(S,{onClick:K,color:"primary",disabled:!g.trim(),children:e(O,{})})]}),s.length>0?e(F,{component:A,variant:"outlined",children:d(k,{size:"small",children:[e(I,{children:d(b,{children:[e(n,{width:"30%",children:e("strong",{children:"Key"})}),e(n,{children:e("strong",{children:"Value"})}),e(n,{width:"50px"})]})}),e(V,{children:s.map(({key:t,value:a})=>d(b,{children:[e(n,{children:t}),e(n,{children:e(f,{value:a,onChange:r=>D(t,r.target.value),size:"small",fullWidth:!0,variant:"standard"})}),e(n,{children:e(S,{size:"small",onClick:()=>B(t),color:"error",children:e(j,{fontSize:"small"})})})]},t))})]})}):e(u,{variant:"body2",color:"text.secondary",children:"No metadata added yet"})]})},L=({method:l,attribute:i,resourceConfig:o})=>{switch(l){case"edit":case"create":return e(q,{method:l,attribute:i,resourceConfig:o});case"view":return e(H,{method:l,attribute:i,resourceConfig:o});case"list":return e(J,{method:l,attribute:i,resourceConfig:o});default:return null}};var ee=L;export{ee as default};
@@ -0,0 +1 @@
1
+ import{jsx as e,jsxs as a}from"react/jsx-runtime";import{useMemo as O}from"react";import{useRecordContext as x,useGetList as A,Loading as F}from"react-admin";import{useFormContext as S}from"react-hook-form";import{Box as T,TextField as R,Typography as s,InputAdornment as D,Paper as $,Table as j,TableBody as k,TableCell as b,TableContainer as z,TableHead as _,TableRow as v,Chip as P}from"@mui/material";import w from"numeral";const B=()=>{const t=x()?.prices,{data:n,isLoading:l}=A("ecommerce/currency",{pagination:{page:1,perPage:100},sort:{field:"code",order:"ASC"},filter:{show_disabled:!0}},{staleTime:300*1e3,refetchOnWindowFocus:!1});return l?e(F,{}):!t||Object.keys(t).length===0?e(s,{variant:"body2",color:"text.secondary",children:"No prices configured"}):e(z,{component:$,variant:"outlined",sx:{maxWidth:400},children:a(j,{size:"small",children:[e(_,{children:a(v,{children:[e(b,{children:"Currency"}),e(b,{align:"right",children:"Price"})]})}),e(k,{children:Object.entries(t).map(([c,p])=>{const o=n?.find(d=>d.code===c),g=o?.format?w(p).format(o.format):p;return a(v,{children:[e(b,{children:a(T,{sx:{display:"flex",alignItems:"center",gap:1},children:[e(P,{label:c,size:"small",color:o?.is_default?"primary":"default"}),o?.is_default&&e(s,{variant:"caption",color:"text.secondary",children:"(Default)"})]})}),e(b,{align:"right",children:a(s,{variant:"body2",children:[o?.symbol,g]})})]},c)})})]})})},W=()=>{const t=x()?.prices;return!t||Object.keys(t).length===0?e(s,{variant:"body2",color:"text.secondary",children:"\u2014"}):a(T,{sx:{display:"flex",gap:.5,flexWrap:"wrap"},children:[Object.entries(t).slice(0,3).map(([n,l])=>e(P,{label:`${n}: ${l}`,size:"small",variant:"outlined",sx:{fontSize:"11px"}},n)),Object.keys(t).length>3&&e(P,{label:`+${Object.keys(t).length-3}`,size:"small",variant:"outlined",sx:{fontSize:"11px"}})]})},E=({method:i})=>{const t=x(),n=S(),{register:l,setValue:c,watch:p}=n,{data:o,isLoading:g,error:d}=A("ecommerce/currency",{pagination:{page:1,perPage:100},sort:{field:"code",order:"ASC"},filter:{show_disabled:!0}},{staleTime:300*1e3,refetchOnWindowFocus:!1}),m=p("prices"),y=O(()=>m&&typeof m=="object"?m:t?.prices||{},[m,t?.prices]),I=(r,f)=>{const h=f===""?null:parseInt(f,10),u={...y,[r]:h};Object.keys(u).forEach(C=>{(u[C]===null||u[C]===void 0)&&delete u[C]}),c("prices",u,{shouldDirty:!0})};return g?e(F,{}):d?a(s,{color:"error",children:["Error loading currencies: ",d.message]}):!o||o.length===0?e(s,{variant:"body2",color:"text.secondary",children:"No currencies available. Please configure currencies first."}):a(T,{sx:{display:"flex",flexDirection:"column",gap:2},children:[e(s,{variant:"subtitle2",color:"text.secondary",children:"Set the price for each available currency (in cents/smallest unit)"}),o.map(r=>{const f=y[r.code]??"";return e(R,{label:`${r.code} Price${r.is_default?" (Default)":""}`,type:"number",value:f,onChange:h=>I(r.code,h.target.value),InputProps:{startAdornment:e(D,{position:"start",children:r.symbol})},helperText:r.format?`Format: ${r.format} \u2022 Example: ${r.symbol}${w(29900).format(r.format)}`:"Enter price in smallest unit (cents)",fullWidth:!0,size:"small",sx:{"& .MuiOutlinedInput-root":r.is_default?{borderColor:"primary.main","& fieldset":{borderWidth:2}}:{}}},r.code)}),e("input",{type:"hidden",...l("prices"),value:JSON.stringify(y)})]})},L=({method:i,attribute:t,resourceConfig:n})=>{switch(i){case"edit":case"create":return e(E,{method:i,attribute:t,resourceConfig:n});case"view":return e(B,{method:i,attribute:t,resourceConfig:n});case"list":return e(W,{method:i,attribute:t,resourceConfig:n});default:return null}};var Q=L;export{Q as default};
@@ -0,0 +1 @@
1
+ import{default as e}from"./PlanLimitsSettings";import{default as r}from"./PlanPricesSettings";import{default as o}from"./PlanFeaturesSettings";import{default as l}from"./PlanMetadataSettings";import{default as i}from"./PlanAddonsSettings";export{i as PlanAddonsSettings,o as PlanFeaturesSettings,e as PlanLimitsSettings,l as PlanMetadataSettings,r as PlanPricesSettings};
@@ -0,0 +1 @@
1
+ import{jsx as a,jsxs as t}from"react/jsx-runtime";function l(){return a("svg",{xmlns:"http://www.w3.org/2000/svg",width:"150.244",height:"142.391",viewBox:"0 0 150.244 142.391",children:t("g",{"data-name":"Grupo 784",transform:"translate(-663 -369)",children:[t("g",{"data-name":"Grupo 694",transform:"translate(-9263.156 83.407)",children:[a("path",{fill:"#ffb74d",d:"M438.364 428.47c-2.071-11.082 1.189-23.69 10.25-30.4a51.943 51.943 0 0010.829 33.979c2.908 3.728 6.532 7.571 6.419 12.3a11.611 11.611 0 01-3.757 7.745 34.49 34.49 0 01-7.23 5.018l-.4.618c-7.475-8.437-14.04-18.178-16.111-29.26z","data-name":"Trazado 547",transform:"translate(9503.073 -112.264)"}),a("path",{fill:"#fff",d:"M457.983 397.944a44.4 44.4 0 00-2.931 27.159 19.12 19.12 0 002.025 5.638 10.966 10.966 0 004.143 4.018 22.7 22.7 0 014.636 2.947 6.714 6.714 0 011.977 5.123 17.444 17.444 0 01-1.933 6.671c-1.068 2.348-2.214 4.771-2.145 7.411.008.32-.488.314-.5-.005-.12-4.594 3.2-8.283 3.941-12.69a6.8 6.8 0 00-1.373-5.824 17.609 17.609 0 00-4.65-3.082 11.7 11.7 0 01-4.2-3.778 17.678 17.678 0 01-2.234-5.539 43.074 43.074 0 01-.976-13.427 45.186 45.186 0 013.789-14.873c.13-.291.556-.034.426.255z","data-name":"Trazado 548",transform:"translate(9493.87 -111.968)"}),a("path",{fill:"#fff",d:"M445.537 448.809a6.661 6.661 0 01-6.949-5.109c-.073-.311.408-.439.48-.127a6.168 6.168 0 006.474 4.739c.319-.023.312.473-.005.497z","data-name":"Trazado 549",transform:"translate(9502.601 -138.58)"}),a("path",{fill:"#fff",d:"M469.6 472.917a12.839 12.839 0 003.218-8.786c-.007-.32.49-.314.5.005a13.354 13.354 0 01-3.367 9.136c-.217.24-.563-.117-.351-.355z","data-name":"Trazado 550",transform:"translate(9484.627 -150.483)"}),a("path",{fill:"#fff",d:"M455.987 419.964a3.77 3.77 0 003.349-1.258c.21-.242.556.115.348.355a4.225 4.225 0 01-3.7 1.4.257.257 0 01-.246-.251.25.25 0 01.251-.246z","data-name":"Trazado 551",transform:"translate(9492.639 -124.199)"}),a("path",{fill:"#ffb74d",d:"M508.279 419.929c-.127.155-.253.31-.379.468a49.658 49.658 0 00-4.545 6.65c-.106.179-.21.362-.311.544a52.348 52.348 0 00-6.108 18.279 50.841 50.841 0 00-.466 7.71c.056 3.56.4 7.416-.691 10.691a8.722 8.722 0 01-.393 1.005l-17.513 5.58-.138-.018-.689.255c-.011-.133-.02-.271-.032-.4-.007-.077-.01-.155-.017-.232 0-.052-.007-.1-.013-.15v-.048c-.006-.047-.007-.09-.011-.133-.052-.771-.1-1.544-.14-2.319v-.009a74.749 74.749 0 01.98-17.645c.033-.173.064-.351.105-.526a48.509 48.509 0 012.145-7.62 42.9 42.9 0 011.729-3.98 35.66 35.66 0 016.474-9.078c5.225-5.318 12.092-8.905 19.45-9.018.184-.005.373-.007.563-.006z","data-name":"Trazado 552",transform:"translate(9480.463 -124.956)"}),a("path",{fill:"#fff",d:"M508.687 419.809A44.4 44.4 0 00490 439.729a19.12 19.12 0 00-1.778 5.721 10.965 10.965 0 00.888 5.7 22.7 22.7 0 011.927 5.145 6.714 6.714 0 01-1.506 5.281 17.446 17.446 0 01-5.557 4.16c-2.266 1.232-4.64 2.476-6.175 4.626-.186.26-.579-.043-.394-.3 2.669-3.74 7.542-4.686 10.787-7.76a6.8 6.8 0 002.41-5.477 17.609 17.609 0 00-1.857-5.26 11.7 11.7 0 01-1.076-5.543 17.675 17.675 0 011.551-5.768 43.074 43.074 0 017.3-11.309 45.186 45.186 0 0111.979-9.594c.279-.154.464.307.187.461z","data-name":"Trazado 553",transform:"translate(9480.088 -124.6)"}),a("path",{fill:"#fff",d:"M505.974 449.686a6.661 6.661 0 01-2.473-8.263c.129-.292.59-.1.46.188a6.168 6.168 0 002.316 7.682c.269.173-.036.565-.3.394z","data-name":"Trazado 554",transform:"translate(9465.23 -137.35)"}),a("path",{fill:"#fff",d:"M503.966 486.142a12.839 12.839 0 007.859-5.077c.187-.26.58.044.394.3a13.355 13.355 0 01-8.189 5.267c-.315.068-.377-.432-.064-.49z","data-name":"Trazado 555",transform:"translate(9464.754 -160.395)"}),a("path",{fill:"#fff",d:"M531.323 434.422a3.771 3.771 0 003.432 1.013c.313-.067.375.426.064.493a4.225 4.225 0 01-3.8-1.112.257.257 0 01-.045-.348.25.25 0 01.348-.045z","data-name":"Trazado 556",transform:"translate(9448.979 -133.341)"}),a("path",{fill:"#fff",d:"M502.806 522.474a3.969 3.969 0 00-3.332-3.892l-56.956-9.353a3.969 3.969 0 00-1.641.073l-13.348 3.451-7.659 1.983-14.134 3.654a3.982 3.982 0 00-2.981 3.852v59.682a4 4 0 003.15 3.889l58.013-.657a3.865 3.865 0 00.829.086 3.972 3.972 0 001.2-.182l34.467.858a3.962 3.962 0 002.782-3.826z","data-name":"Trazado 568",transform:"translate(9523.4 -176.776)"}),a("path",{fill:"#ccc",d:"M502.806 522.474a3.969 3.969 0 00-3.332-3.892l-56.956-9.353a3.969 3.969 0 00-1.641.073l-13.348 3.451-7.659 1.983-14.134 3.654a3.982 3.982 0 00-2.981 3.852v59.682a4 4 0 003.15 3.889l58.013-.657a3.865 3.865 0 00.829.086 3.972 3.972 0 001.2-.182l34.467.858a3.962 3.962 0 002.782-3.826zm-2.692 62.495l-34.467.82a3.025 3.025 0 01-1.518.073l-58.016-1.021a3 3 0 01-2.361-2.918v-59.681a2.987 2.987 0 011.956-2.8 2.468 2.468 0 01.278-.086l14.953-3.866 8.842-2.288 11.345-2.934a2.844 2.844 0 01.746-.1 2.95 2.95 0 01.484.04l56.956 9.353a2.969 2.969 0 012.5 2.917l.388 59.622a2.973 2.973 0 01-2.087 2.869z","data-name":"Trazado 569",transform:"translate(9523.4 -176.776)"}),a("path",{fill:"#ccc",d:"M503.084 535.03a.431.431 0 01-.126.056l-16.758 4.529-5.215 1.409-14.833 4.008a.574.574 0 01-.129.017.827.827 0 01-.089-.007l-59.81-10.9-.2-.036a.5.5 0 11.179-.981l1.2.219 58.7 10.7 12.784-3.455 7.151-1.933 16.494-4.459.262-.07a.5.5 0 01.58.272.39.39 0 01.03.08.5.5 0 01-.22.551z","data-name":"Trazado 570",transform:"translate(9521.796 -190.674)"}),a("path",{fill:"#ccc",d:"M549.614 614.407c-.273 0-.495-.22-.5 1.185l-.5-54.207c0-1.952.218-2.177.493-2.179.273 0 .495.219.5 2.17l.5 54.207c0-1.4-.218-1.178-.493-1.176z","data-name":"Trazado 571",transform:"translate(9438.707 -205.824)"}),a("path",{fill:"#ccc",d:"M508.437 590.941l-5.356.057-2.2-59.356-56.081-11.159a1.284 1.284 0 01-.162-.04 1.977 1.977 0 01-1.068-.753l7.659-1.983 2.251.448 53.219 10.586a1.978 1.978 0 011.339.968c.162.291.396 60.891.399 61.232z","data-name":"Trazado 572",transform:"translate(9499.705 -181.73)"}),t("g",{"data-name":"Grupo 693",transform:"translate(10000.705 365.536)",children:[a("path",{fill:"#ffb6b6",d:"M624.941 270.06a5.027 5.027 0 00-.114.784l-20.534 11.846-4.991-2.873-5.321 6.966 8.341 5.945a3.824 3.824 0 004.588-.112l21.174-16.7a5.018 5.018 0 10-3.143-5.851z","data-name":"Trazado 557",transform:"translate(-589.857 -262.724)"}),a("path",{fill:"#fff",d:"M521.048 267.951a2.991 2.991 0 012.511-2.933l42.925-7.049a2.991 2.991 0 011.237.055l10.06 2.6 5.772 1.494 10.652 2.754a3 3 0 012.246 2.9v35.181a3.014 3.014 0 01-2.374 2.931l-43.722 9.3a2.912 2.912 0 01-.625.065 2.994 2.994 0 01-.9-.137l-25.976-8.2a2.986 2.986 0 01-2.1-2.883z","data-name":"Trazado 573",transform:"translate(-520.755 -257.928)"}),a("path",{fill:"#ff9800",d:"M570.6 264.184a.362.362 0 01.093.012l26.484 6.849a.374.374 0 01.281.362v35.181a.376.376 0 01-.3.366l-43.722 9.3a.377.377 0 01-.191-.009l-25.977-8.2a.372.372 0 01-.261-.36l.293-36.085a.374.374 0 01.314-.366l42.925-7.048a.4.4 0 01.061-.002z","data-name":"Trazado 574",transform:"translate(-524.387 -261.561)"}),a("path",{fill:"#3f3d56",d:"M521.048 267.951a2.991 2.991 0 012.511-2.933l42.925-7.049a2.991 2.991 0 011.237.055l10.06 2.6 5.772 1.494 10.652 2.754a3 3 0 012.246 2.9v35.181a3.014 3.014 0 01-2.374 2.931l-43.722 9.3a2.912 2.912 0 01-.625.065 2.994 2.994 0 01-.9-.137l-25.976-8.2a2.986 2.986 0 01-2.1-2.883zm2.029 38.25l25.976 8.2a2.28 2.28 0 001.144.055l43.724-9.3a2.261 2.261 0 001.779-2.2v-35.18a2.252 2.252 0 00-1.474-2.111 1.872 1.872 0 00-.21-.065l-11.269-2.913-6.664-1.724-8.551-2.211a2.143 2.143 0 00-.562-.072 2.223 2.223 0 00-.365.03l-42.925 7.049a2.237 2.237 0 00-1.884 2.2l-.292 36.081a2.241 2.241 0 001.572 2.164z","data-name":"Trazado 575",transform:"translate(-520.755 -257.928)"}),a("path",{fill:"#3f3d56",d:"M523.021 277.413a.326.326 0 00.095.042l12.626 3.413 3.93 1.062 11.179 3.021a.434.434 0 00.1.012.607.607 0 00.068 0l45.076-8.218.15-.027a.376.376 0 00-.135-.74l-.907.165-44.239 8.057-9.635-2.6-5.39-1.457-12.431-3.361-.2-.052a.377.377 0 00-.437.2.3.3 0 00-.022.06.376.376 0 00.172.423z","data-name":"Trazado 576",transform:"translate(-521.729 -268.402)"}),a("path",{fill:"#3f3d56",d:"M631.06 337.236a.375.375 0 00.375-.371l.375-40.853a.375.375 0 00-.371-.378.375.375 0 00-.375.371l-.375 40.853a.375.375 0 00.371.378z","data-name":"Trazado 577",transform:"translate(-602.215 -279.821)"}),a("path",{fill:"#3f3d56",d:"M551.513 314.106l3.93 1.062 1.657-40.309 42.27-8.411a.968.968 0 00.122-.03 1.491 1.491 0 00.8-.567l-5.772-1.494-1.7.337-40.109 7.978a1.491 1.491 0 00-1.009.73c-.117.218-.187 40.444-.189 40.704z","data-name":"Trazado 578",transform:"translate(-537.5 -261.661)"}),a("path",{fill:"#fff",d:"M531.384 335.031a.632.632 0 00.139-.016l13-2.936a.629.629 0 00-.277-1.227l-13 2.936a.629.629 0 00.138 1.243z","data-name":"Trazado 583",transform:"translate(-473.512 -300.262)"})]}),t("g",{"data-name":"Grupo 684",transform:"translate(9952.387 370.569)",children:[a("path",{fill:"#ffb6b6",d:"M603.884 270.06a5.041 5.041 0 01.114.784l20.534 11.846 4.991-2.873 5.321 6.966-8.341 5.945a3.824 3.824 0 01-4.588-.112l-21.174-16.7a5.018 5.018 0 113.143-5.851z","data-name":"Trazado 557",transform:"translate(-563.273 -262.724)"}),a("path",{fill:"#fff",d:"M596.158 267.951a2.991 2.991 0 00-2.511-2.933l-42.925-7.049a2.992 2.992 0 00-1.237.055l-10.06 2.6-5.772 1.494L523 264.872a3 3 0 00-2.246 2.9v35.181a3.014 3.014 0 002.374 2.931l43.722 9.3a2.91 2.91 0 00.625.065 2.993 2.993 0 00.9-.137l25.976-8.2a2.986 2.986 0 002.1-2.883z","data-name":"Trazado 573",transform:"translate(-520.755 -257.928)"}),a("path",{fill:"#ff9800",d:"M553.869 264.184a.362.362 0 00-.093.012l-26.484 6.849a.374.374 0 00-.28.362v35.181a.376.376 0 00.3.366l43.722 9.3a.378.378 0 00.191-.009l25.977-8.2a.372.372 0 00.261-.36l-.291-36.081a.374.374 0 00-.314-.366l-42.924-7.048a.394.394 0 00-.065-.006z","data-name":"Trazado 574",transform:"translate(-524.388 -261.561)"}),a("path",{fill:"#3f3d56",d:"M596.158 267.951a2.991 2.991 0 00-2.511-2.933l-42.925-7.049a2.992 2.992 0 00-1.237.055l-10.06 2.6-5.772 1.494L523 264.872a3 3 0 00-2.246 2.9v35.181a3.014 3.014 0 002.374 2.931l43.722 9.3a2.91 2.91 0 00.625.065 2.993 2.993 0 00.9-.137l25.976-8.2a2.986 2.986 0 002.1-2.883zM594.13 306.2l-25.976 8.2a2.28 2.28 0 01-1.144.055l-43.724-9.3a2.261 2.261 0 01-1.779-2.2v-35.179a2.251 2.251 0 011.474-2.111 1.866 1.866 0 01.21-.065l11.269-2.913 6.664-1.724 8.551-2.211a2.142 2.142 0 01.562-.072 2.223 2.223 0 01.365.03l42.925 7.049a2.237 2.237 0 011.884 2.2l.292 36.081a2.241 2.241 0 01-1.572 2.164z","data-name":"Trazado 575",transform:"translate(-520.755 -257.928)"}),a("path",{fill:"#3f3d56",d:"M596.368 277.413a.326.326 0 01-.095.042l-12.626 3.413-3.93 1.062-11.179 3.021a.436.436 0 01-.1.012.607.607 0 01-.067 0L523.3 276.74l-.15-.027a.376.376 0 11.135-.74l.907.165 44.236 8.066 9.635-2.6 5.39-1.457 12.431-3.361.2-.052a.377.377 0 01.437.2.293.293 0 01.022.06.376.376 0 01-.175.419z","data-name":"Trazado 576",transform:"translate(-521.965 -268.402)"}),a("path",{fill:"#3f3d56",d:"M631.435 337.236a.375.375 0 01-.375-.371l-.375-40.853a.375.375 0 01.371-.378.375.375 0 01.375.371l.375 40.853a.375.375 0 01-.371.378z","data-name":"Trazado 577",transform:"translate(-584.585 -279.821)"}),a("path",{fill:"#3f3d56",d:"M600.3 314.106l-3.93 1.062-1.657-40.309-42.27-8.411a.97.97 0 01-.122-.03 1.49 1.49 0 01-.8-.567l5.772-1.494 1.7.337 40.109 7.978a1.491 1.491 0 011.01.73c.112.218.182 40.444.188 40.704z","data-name":"Trazado 578",transform:"translate(-538.614 -261.661)"}),a("path",{fill:"#fff",d:"M544.385 335.031a.632.632 0 01-.139-.016l-13-2.936a.629.629 0 01.277-1.227l13 2.936a.629.629 0 01-.138 1.243z","data-name":"Trazado 583",transform:"translate(-526.562 -300.262)"})]}),a("path",{fill:"#e6e6e6",d:"M424.452 620.539a.63.63 0 01-.139.013l-13.326-.224a.629.629 0 01.021-1.258l13.326.224a.629.629 0 01.118 1.245z","data-name":"Trazado 584",transform:"translate(9518.98 -240.584)"}),a("path",{fill:"#e6e6e6",d:"M435.451 637.539a.629.629 0 01-.139.013l-13.326-.224a.629.629 0 11.021-1.258l13.326.224a.629.629 0 01.118 1.245z","data-name":"Trazado 585",transform:"translate(9512.594 -250.455)"})]}),a("g",{"data-name":"MDI / progress-upload",transform:"translate(762.124 390)",children:a("path",{fill:"#ff9800",d:"M22.925 2.03a19.064 19.064 0 010 37.937v-3.813a15.251 15.251 0 000-30.273V2.03m-3.813.057V5.9a15.242 15.242 0 00-7.435 3.2L8.951 6.281a18.735 18.735 0 0110.161-4.194M6.263 8.969L8.989 11.7a15.283 15.283 0 00-3.126 7.43H2.05A18.844 18.844 0 016.263 8.969M2.069 22.943h3.813a15.255 15.255 0 003.107 7.435L6.282 33.1a19.139 19.139 0 01-4.213-10.157m9.608 10.237a15.255 15.255 0 007.435 3.107V40.1a19.052 19.052 0 01-10.161-4.308l2.726-2.612m9.341-20.722l-8.578 8.579h6.672v7.625h3.813v-7.625H29.6z","data-name":"Path / progress-upload",transform:"translate(1.763 1.784)"})})]})})}var n=l;export{n as default};
@@ -0,0 +1 @@
1
+ import{jsx as a,jsxs as t}from"react/jsx-runtime";function r(){return a("svg",{xmlns:"http://www.w3.org/2000/svg",width:"536",height:"92",viewBox:"0 0 536 92",children:t("g",{id:"Grupo_749","data-name":"Grupo 749",transform:"translate(-1358 -1489)",children:[a("rect",{id:"Rect\xE1ngulo_429","data-name":"Rect\xE1ngulo 429",width:"536",height:"92",transform:"translate(1358 1489)",fill:"#222641"}),t("g",{id:"Grupo_748","data-name":"Grupo 748",children:[a("rect",{id:"Rect\xE1ngulo_430","data-name":"Rect\xE1ngulo 430",width:"263",height:"92",transform:"translate(1358 1489)",fill:"#fff"}),a("path",{id:"Trazado_647","data-name":"Trazado 647",d:"M4.565,0H14.52C25.19,0,31.79-6.16,31.79-18.15c0-11.935-6.6-17.82-17.6-17.82H4.565ZM11.11-5.28V-30.635h2.64c7.15,0,11.275,3.685,11.275,12.485C25.025-9.3,20.9-5.28,13.75-5.28ZM69.308.66A14.428,14.428,0,0,0,80.693-4.565L77.173-8.47a9.817,9.817,0,0,1-7.59,3.465c-6,0-9.79-4.95-9.79-13.035,0-8.03,4.18-12.87,9.9-12.87a9.336,9.336,0,0,1,6.82,2.86l3.465-4.015A14.075,14.075,0,0,0,69.583-36.63c-9.13,0-16.5,6.985-16.5,18.755C53.083-5.94,60.288.66,69.308.66ZM102.646,0h6.545V-35.97h-6.545ZM148.58.66a14.428,14.428,0,0,0,11.385-5.225l-3.52-3.905a9.817,9.817,0,0,1-7.59,3.465c-5.995,0-9.79-4.95-9.79-13.035,0-8.03,4.18-12.87,9.9-12.87a9.336,9.336,0,0,1,6.82,2.86l3.465-4.015a14.075,14.075,0,0,0-10.4-4.565c-9.13,0-16.5,6.985-16.5,18.755C132.355-5.94,139.56.66,148.58.66Z",transform:"translate(1378 1556)",fill:"#242943"}),a("path",{id:"Trazado_646","data-name":"Trazado 646",d:"M20.185.66A17.477,17.477,0,0,0,32.12-3.685V-20.4H18.81v6.985h5.72v5.775a5.943,5.943,0,0,1-3.41.935c-6.655,0-9.9-4.125-9.9-11.275,0-6.93,3.85-11.11,9.13-11.11A9.008,9.008,0,0,1,27-26.62l4.51-5.17a15.349,15.349,0,0,0-11.44-4.675c-9.57,0-17.6,6.875-17.6,18.81C2.475-5.555,10.285.66,20.185.66ZM54.34,0h8.58V-12.6H67.1L73.7,0h9.57L75.295-14.19c3.685-1.76,6.16-5.115,6.16-10.34,0-8.635-6.38-11.275-13.97-11.275H54.34Zm8.58-19.36v-9.68h3.9c4.07,0,6.27,1.1,6.27,4.51s-2.2,5.17-6.27,5.17ZM118.085.66c9.735,0,16.39-6.985,16.39-18.7s-6.655-18.425-16.39-18.425-16.39,6.655-16.39,18.425C101.695-6.325,108.35.66,118.085.66Zm0-7.37c-4.675,0-7.645-4.4-7.645-11.33,0-6.985,2.97-11.055,7.645-11.055,4.73,0,7.645,4.07,7.645,11.055C125.73-11.11,122.815-6.71,118.085-6.71ZM170.445.66c9.515,0,14.3-5.39,14.3-17.49V-35.805h-8.2V-15.9c0,6.82-2.145,9.185-6.1,9.185-3.9,0-5.94-2.365-5.94-9.185v-19.91H155.98V-16.83C155.98-4.73,160.93.66,170.445.66Zm37.4-.66h8.58V-11.88h4.235c7.535,0,14.08-3.74,14.08-12.32,0-8.8-6.435-11.6-14.3-11.6h-12.6Zm8.58-18.645v-10.4h3.52c4.18,0,6.435,1.265,6.435,4.84s-1.98,5.555-6.215,5.555Z",transform:"translate(1634 1556)",fill:"#fffeff"})]})]})})}var c=r;export{c as default};
@@ -0,0 +1 @@
1
+ import{jsx as a,jsxs as t}from"react/jsx-runtime";function r(){return t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"80",viewBox:"0 0 199 92",children:[a("defs",{children:a("clipPath",{id:"clipPath",children:a("rect",{id:"Rect\xE1ngulo_1","data-name":"Rect\xE1ngulo 1",width:"199",height:"92",transform:"translate(179 398)",fill:"#fff",stroke:"#707070",strokeWidth:"1",opacity:"0.432"})})}),a("g",{id:"Enmascarar_grupo_1","data-name":"Enmascarar grupo 1",transform:"translate(-179 -398)",clipPath:"url(#clipPath)",children:t("g",{id:"Grupo_749","data-name":"Grupo 749",transform:"translate(179 398)",children:[a("rect",{id:"Rect\xE1ngulo_429","data-name":"Rect\xE1ngulo 429",width:"531",height:"92",fill:"#222641"}),t("g",{id:"Grupo_748","data-name":"Grupo 748",children:[a("rect",{id:"Rect\xE1ngulo_430","data-name":"Rect\xE1ngulo 430",width:"260",height:"92",fill:"#fff"}),a("path",{id:"Trazado_647","data-name":"Trazado 647",d:"M4.565,0h9.853C24.979,0,31.511-6.16,31.511-18.15c0-11.935-6.532-17.82-17.42-17.82H4.565Zm6.478-5.28V-30.635h2.613c7.077,0,11.159,3.685,11.159,12.485,0,8.85-4.083,12.87-11.159,12.87ZM68.644.66A14.22,14.22,0,0,0,79.913-4.565l-3.484-3.9a9.675,9.675,0,0,1-7.512,3.465c-5.938,0-9.69-4.95-9.69-13.035,0-8.03,4.137-12.87,9.8-12.87a9.194,9.194,0,0,1,6.75,2.86l3.429-4.015A13.866,13.866,0,0,0,68.917-36.63c-9.036,0-16.331,6.985-16.331,18.755C52.586-5.94,59.717.66,68.644.66Zm33-.66h6.478V-35.97h-6.478ZM147.1.66a14.22,14.22,0,0,0,11.268-5.225l-3.484-3.9a9.675,9.675,0,0,1-7.512,3.465c-5.934,0-9.69-4.95-9.69-13.035,0-8.03,4.137-12.87,9.8-12.87a9.194,9.194,0,0,1,6.75,2.86l3.429-4.015a13.866,13.866,0,0,0-10.293-4.565c-9.036,0-16.331,6.985-16.331,18.755C131.045-5.94,138.176.66,147.1.66Z",transform:"translate(19.748 67)",fill:"#242943"}),a("path",{id:"Trazado_646","data-name":"Trazado 646",d:"M20,.66A17.192,17.192,0,0,0,31.816-3.685V-20.4H18.643v6.985H24.3V-7.64a5.837,5.837,0,0,1-3.375.935c-6.587,0-9.8-4.125-9.8-11.275,0-6.93,3.811-11.11,9.036-11.11a8.863,8.863,0,0,1,6.582,2.47l4.464-5.17A15.113,15.113,0,0,0,19.89-36.465c-9.472,0-17.42,6.875-17.42,18.81C2.475-5.555,10.2.66,20,.66ZM53.808,0H62.3V-12.6h4.137L72.97,0h9.472L74.549-14.19c3.647-1.76,6.1-5.115,6.1-10.34,0-8.635-6.315-11.275-13.827-11.275H53.808ZM62.3-19.36v-9.68h3.86c4.028,0,6.206,1.1,6.206,4.51s-2.177,5.17-6.206,5.17ZM116.9.66c9.635,0,16.222-6.985,16.222-18.7S126.535-36.465,116.9-36.465,100.678-29.81,100.678-18.04C100.678-6.325,107.265.66,116.9.66Zm0-7.37c-4.627,0-7.567-4.4-7.567-11.33,0-6.985,2.94-11.055,7.567-11.055,4.682,0,7.567,4.07,7.567,11.055C124.467-11.11,121.581-6.71,116.9-6.71ZM168.723.66c9.417,0,14.153-5.39,14.153-17.49V-35.805h-8.116V-15.9c0,6.82-2.123,9.185-6.037,9.185-3.86,0-5.879-2.365-5.879-9.185V-35.81h-8.438v18.98C154.407-4.73,159.306.66,168.723.66ZM205.74,0h8.492V-11.88h4.192c7.458,0,13.936-3.74,13.936-12.32,0-8.8-6.369-11.6-14.153-11.6H205.735Zm8.492-18.645v-10.4h3.484c4.137,0,6.369,1.265,6.369,4.84s-1.96,5.555-6.151,5.555Z",transform:"translate(273.146 67)",fill:"#fffeff"})]})]})})]})}var e=r;export{e as default};
@@ -0,0 +1 @@
1
+ import{jsx as a,jsxs as l}from"react/jsx-runtime";function t(){return a("svg",{xmlns:"http://www.w3.org/2000/svg",width:"254.636",height:"126.61",viewBox:"0 0 254.636 126.61",children:l("g",{"data-name":"Grupo 682",transform:"translate(-1253 -1619.426)",children:[a("path",{fill:"#f2f2f2",d:"M350.125 586.775c-6.21-.149-12.867 3.331-14.635 9.286l33.71-1.372q-.956-.661-1.921-1.305c-5.171-3.441-10.943-6.461-17.154-6.609z","data-name":"Trazado 457",transform:"translate(986.548 1128.679)"}),a("path",{fill:"#f2f2f2",d:"M476.116 577.423c4.483 3.1 8.858 6.406 13.852 8.557 12.368 5.327 26.606 2.842 39.619-.62s26.3-7.861 39.645-6.076c7.569 1.012 14.714 3.973 22.02 6.195s15.166 3.709 22.537 1.715 14.021-8.32 14.211-15.954c-55.644-10.288-107.234-10.594-151.884 6.183z","data-name":"Trazado 458",transform:"translate(879.633 1145.944)"}),a("path",{fill:"#f2f2f2",d:"M62.125 632.774c-6.21-.149-12.867 3.331-14.635 9.286l33.71-1.372q-.956-.661-1.921-1.305c-5.171-3.44-10.943-6.46-17.154-6.609z","data-name":"Trazado 459",transform:"translate(1205.509 1093.706)"}),a("path",{fill:"#f2f2f2",d:"M188.116 623.423c4.483 3.1 8.858 6.406 13.853 8.557 12.368 5.327 26.606 2.842 39.619-.62s26.3-7.861 39.645-6.076c7.569 1.012 14.714 3.973 22.02 6.195s15.166 3.709 22.537 1.715 14.02-8.32 14.21-15.954c-55.644-10.288-107.234-10.594-151.884 6.183z","data-name":"Trazado 460",transform:"translate(1098.594 1110.971)"}),a("path",{fill:"#e6e6e6",d:"M383.368 451.644h-34.845a1.876 1.876 0 00-1.875 1.875v12.7a1.876 1.876 0 001.875 1.875h34.845a1.876 1.876 0 001.875-1.875v-12.7a1.876 1.876 0 00-1.875-1.875z","data-name":"Trazado 461",transform:"translate(978.065 1231.413)"}),a("path",{fill:"#ccc",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 226",transform:"translate(1327.231 1683.057)"}),a("path",{fill:"#ccc",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 227",transform:"translate(1331.306 1683.057)"}),a("path",{fill:"#ccc",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 228",transform:"translate(1335.381 1683.057)"}),a("path",{fill:"#ccc",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 229",transform:"translate(1339.456 1683.057)"}),a("path",{fill:"#ccc",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 230",transform:"translate(1343.531 1683.057)"}),a("path",{fill:"#ccc",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 231",transform:"translate(1347.607 1683.057)"}),a("path",{fill:"#ccc",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 232",transform:"translate(1351.682 1683.057)"}),a("path",{fill:"#ccc",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 233",transform:"translate(1355.757 1683.057)"}),a("path",{fill:"#ccc",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 234",transform:"translate(1359.832 1683.057)"}),a("path",{fill:"#e6e6e6",d:"M740.368 451.644h-34.845a1.876 1.876 0 00-1.875 1.875v12.7a1.876 1.876 0 001.875 1.875h34.845a1.876 1.876 0 001.875-1.875v-12.7a1.876 1.876 0 00-1.875-1.875z","data-name":"Trazado 463",transform:"translate(706.645 1231.413)"}),a("path",{fill:"#ccc",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 235",transform:"translate(1412.81 1683.057)"}),a("path",{fill:"#ccc",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 236",transform:"translate(1416.885 1683.057)"}),a("path",{fill:"#ccc",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 237",transform:"translate(1420.96 1683.057)"}),a("path",{fill:"#ccc",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 238",transform:"translate(1425.036 1683.057)"}),a("path",{fill:"#ccc",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 239",transform:"translate(1429.111 1683.057)"}),a("path",{fill:"#ccc",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 240",transform:"translate(1433.186 1683.057)"}),a("path",{fill:"#ccc",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 241",transform:"translate(1437.261 1683.057)"}),a("path",{fill:"#ccc",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 242",transform:"translate(1441.336 1683.057)"}),a("path",{fill:"#ccc",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 243",transform:"translate(1445.412 1683.057)"}),a("path",{fill:"#e6e6e6",d:"M578.368 451.644h-34.845a1.876 1.876 0 00-1.875 1.875v12.7a1.876 1.876 0 001.875 1.875h34.845a1.876 1.876 0 001.875-1.875v-12.7a1.876 1.876 0 00-1.875-1.875z","data-name":"Trazado 464",transform:"translate(829.81 1231.413)"}),a("path",{fill:"#ccc",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 244",transform:"translate(1373.976 1683.057)"}),a("path",{fill:"#ccc",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 245",transform:"translate(1378.051 1683.057)"}),a("path",{fill:"#ccc",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 246",transform:"translate(1382.126 1683.057)"}),a("path",{fill:"#ccc",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 247",transform:"translate(1386.201 1683.057)"}),a("path",{fill:"#ccc",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 248",transform:"translate(1390.276 1683.057)"}),a("path",{fill:"#ccc",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 249",transform:"translate(1394.352 1683.057)"}),a("path",{fill:"#ccc",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 250",transform:"translate(1398.427 1683.057)"}),a("path",{fill:"#ccc",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 251",transform:"translate(1402.502 1683.057)"}),a("path",{fill:"#ccc",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 252",transform:"translate(1406.577 1683.057)"}),a("path",{fill:"#e6e6e6",d:"M751.368 382.644h-34.845a1.876 1.876 0 00-1.875 1.875v12.7a1.876 1.876 0 001.875 1.875h34.845a1.876 1.876 0 001.875-1.875v-12.7a1.876 1.876 0 00-1.875-1.875z","data-name":"Trazado 465",transform:"translate(698.282 1283.873)"}),a("path",{fill:"#ccc",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 253",transform:"translate(1415.447 1666.516)"}),a("path",{fill:"#ccc",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 254",transform:"translate(1419.522 1666.516)"}),a("path",{fill:"#ccc",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 255",transform:"translate(1423.597 1666.516)"}),a("path",{fill:"#ccc",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 256",transform:"translate(1427.672 1666.516)"}),a("path",{fill:"#ccc",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 257",transform:"translate(1431.748 1666.516)"}),a("path",{fill:"#ccc",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 258",transform:"translate(1435.823 1666.516)"}),a("path",{fill:"#ccc",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 259",transform:"translate(1439.898 1666.516)"}),a("path",{fill:"#ccc",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 260",transform:"translate(1443.973 1666.516)"}),a("path",{fill:"#ccc",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 261",transform:"translate(1448.049 1666.516)"}),a("path",{fill:"#6c63ff",d:"M708.368 456.644h-34.845a1.876 1.876 0 00-1.875 1.875v12.7a1.876 1.876 0 001.875 1.875h34.845a1.876 1.876 0 001.875-1.875v-12.7a1.876 1.876 0 00-1.875-1.875z","data-name":"Trazado 466",transform:"translate(730.974 1227.612)"}),a("path",{fill:"#3f3d56",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 262",transform:"translate(1405.139 1684.256)"}),a("path",{fill:"#3f3d56",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 263",transform:"translate(1409.214 1684.256)"}),a("path",{fill:"#3f3d56",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 264",transform:"translate(1413.289 1684.256)"}),a("path",{fill:"#3f3d56",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 265",transform:"translate(1417.365 1684.256)"}),a("path",{fill:"#3f3d56",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 266",transform:"translate(1421.44 1684.256)"}),a("path",{fill:"#3f3d56",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 267",transform:"translate(1425.515 1684.256)"}),a("path",{fill:"#3f3d56",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 268",transform:"translate(1429.59 1684.256)"}),a("path",{fill:"#3f3d56",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 269",transform:"translate(1433.665 1684.256)"}),a("path",{fill:"#3f3d56",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 270",transform:"translate(1437.741 1684.256)"}),a("path",{fill:"#6c63ff",d:"M525.368 456.644h-34.845a1.876 1.876 0 00-1.875 1.875v12.7a1.876 1.876 0 001.875 1.875h34.845a1.876 1.876 0 001.875-1.875v-12.7a1.876 1.876 0 00-1.875-1.875z","data-name":"Trazado 467",transform:"translate(870.105 1227.612)"}),a("path",{fill:"#3f3d56",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 271",transform:"translate(1361.271 1684.256)"}),a("path",{fill:"#3f3d56",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 272",transform:"translate(1365.346 1684.256)"}),a("path",{fill:"#3f3d56",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 273",transform:"translate(1369.421 1684.256)"}),a("path",{fill:"#3f3d56",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 274",transform:"translate(1373.496 1684.256)"}),a("path",{fill:"#3f3d56",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 275",transform:"translate(1377.571 1684.256)"}),a("path",{fill:"#3f3d56",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 276",transform:"translate(1381.647 1684.256)"}),a("path",{fill:"#3f3d56",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 277",transform:"translate(1385.722 1684.256)"}),a("path",{fill:"#3f3d56",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 278",transform:"translate(1389.797 1684.256)"}),a("path",{fill:"#3f3d56",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 279",transform:"translate(1393.872 1684.256)"}),a("path",{fill:"#6c63ff",d:"M580.368 387.644h-34.845a1.876 1.876 0 00-1.875 1.875v12.7a1.876 1.876 0 001.875 1.875h34.845a1.876 1.876 0 001.875-1.875v-12.7a1.876 1.876 0 00-1.875-1.875z","data-name":"Trazado 468",transform:"translate(828.29 1280.071)"}),a("path",{fill:"#3f3d56",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 280",transform:"translate(1374.455 1667.715)"}),a("path",{fill:"#3f3d56",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 281",transform:"translate(1378.53 1667.715)"}),a("path",{fill:"#3f3d56",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 282",transform:"translate(1382.605 1667.715)"}),a("path",{fill:"#3f3d56",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 283",transform:"translate(1386.681 1667.715)"}),a("path",{fill:"#3f3d56",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 284",transform:"translate(1390.756 1667.715)"}),a("path",{fill:"#3f3d56",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 285",transform:"translate(1394.831 1667.715)"}),a("path",{fill:"#3f3d56",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 286",transform:"translate(1398.906 1667.715)"}),a("path",{fill:"#3f3d56",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 287",transform:"translate(1402.982 1667.715)"}),a("path",{fill:"#3f3d56",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 288",transform:"translate(1407.057 1667.715)"}),a("path",{fill:"#6c63ff",d:"M330.368 456.644h-34.845a1.876 1.876 0 00-1.875 1.875v12.7a1.876 1.876 0 001.875 1.875h34.845a1.876 1.876 0 001.875-1.875v-12.7a1.876 1.876 0 00-1.875-1.875z","data-name":"Trazado 469",transform:"translate(1018.36 1227.612)"}),a("path",{fill:"#3f3d56",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 289",transform:"translate(1314.525 1684.256)"}),a("path",{fill:"#3f3d56",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 290",transform:"translate(1318.601 1684.256)"}),a("path",{fill:"#3f3d56",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 291",transform:"translate(1322.676 1684.256)"}),a("path",{fill:"#3f3d56",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 292",transform:"translate(1326.751 1684.256)"}),a("path",{fill:"#3f3d56",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 293",transform:"translate(1330.826 1684.256)"}),a("path",{fill:"#3f3d56",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 294",transform:"translate(1334.901 1684.256)"}),a("path",{fill:"#3f3d56",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 295",transform:"translate(1338.977 1684.256)"}),a("path",{fill:"#3f3d56",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 296",transform:"translate(1343.052 1684.256)"}),a("path",{fill:"#3f3d56",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 297",transform:"translate(1347.127 1684.256)"}),a("path",{fill:"#6c63ff",d:"M366.368 387.644h-34.845a1.876 1.876 0 00-1.875 1.875v12.7a1.876 1.876 0 001.875 1.875h34.845a1.876 1.876 0 001.875-1.875v-12.7a1.876 1.876 0 00-1.875-1.875z","data-name":"Trazado 470",transform:"translate(990.99 1280.071)"}),a("path",{fill:"#3f3d56",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 298",transform:"translate(1323.155 1667.715)"}),a("path",{fill:"#3f3d56",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 299",transform:"translate(1327.231 1667.715)"}),a("path",{fill:"#3f3d56",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 300",transform:"translate(1331.306 1667.715)"}),a("path",{fill:"#3f3d56",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 301",transform:"translate(1335.381 1667.715)"}),a("path",{fill:"#3f3d56",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 302",transform:"translate(1339.456 1667.715)"}),a("path",{fill:"#3f3d56",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 303",transform:"translate(1343.531 1667.715)"}),a("path",{fill:"#3f3d56",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 304",transform:"translate(1347.607 1667.715)"}),a("path",{fill:"#3f3d56",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 305",transform:"translate(1351.682 1667.715)"}),a("path",{fill:"#3f3d56",d:"M0 0H0.959V16.445H0z","data-name":"Rect\xE1ngulo 306",transform:"translate(1355.757 1667.715)"}),a("path",{fill:"#3f3d56",d:"M427.331 473.749a4 4 0 00-.222-.6l-4.278-9.2a3.908 3.908 0 00-3.544-2.261h-17.548a3.908 3.908 0 00-3.544 2.261l-3.517 7.568H294.391l-3.406-7.328a3.908 3.908 0 00-3.544-2.261h-17.547a3.9 3.9 0 00-1.921.507l-2.95-5.268a1.8 1.8 0 00-3.374.881v41.377a4.694 4.694 0 004.694 4.694h134.284a4.694 4.694 0 003.356-1.412l22.7-23.213a4.653 4.653 0 00.648-5.745z","data-name":"Trazado 471",transform:"translate(1042.689 1227.922)"}),a("path",{fill:"#fff",d:"M841.627 498.437h-2.2a1.776 1.776 0 01-1.774-1.774v-2.445a1.776 1.776 0 011.774-1.774h2.2a1.776 1.776 0 011.774 1.774v2.444a1.776 1.776 0 01-1.774 1.775z","data-name":"Trazado 472",transform:"translate(604.767 1200.394)"}),a("path",{fill:"#fff",d:"M874.627 498.437h-2.2a1.776 1.776 0 01-1.774-1.774v-2.445a1.776 1.776 0 011.774-1.774h2.2a1.776 1.776 0 011.774 1.774v2.444a1.776 1.776 0 01-1.774 1.775z","data-name":"Trazado 473",transform:"translate(579.677 1200.394)"}),a("path",{fill:"#fff",d:"M907.627 498.437h-2.2a1.776 1.776 0 01-1.774-1.774v-2.445a1.776 1.776 0 011.774-1.774h2.2a1.776 1.776 0 011.774 1.774v2.444a1.776 1.776 0 01-1.774 1.775z","data-name":"Trazado 474",transform:"translate(554.588 1200.394)"}),a("path",{fill:"#fff",d:"M291.627 499.437h-2.2a1.776 1.776 0 01-1.774-1.774v-2.445a1.776 1.776 0 011.774-1.774h2.2a1.776 1.776 0 011.774 1.774v2.444a1.776 1.776 0 01-1.774 1.775z","data-name":"Trazado 478",transform:"translate(1022.922 1199.634)"}),a("path",{fill:"#fff",d:"M324.627 499.437h-2.2a1.776 1.776 0 01-1.774-1.774v-2.445a1.776 1.776 0 011.774-1.774h2.2a1.776 1.776 0 011.774 1.774v2.444a1.776 1.776 0 01-1.774 1.775z","data-name":"Trazado 479",transform:"translate(997.832 1199.634)"}),a("path",{fill:"#fff",d:"M357.627 499.437h-2.2a1.776 1.776 0 01-1.774-1.774v-2.445a1.776 1.776 0 011.774-1.774h2.2a1.776 1.776 0 011.774 1.774v2.444a1.776 1.776 0 01-1.774 1.775z","data-name":"Trazado 480",transform:"translate(972.743 1199.634)"}),a("path",{fill:"#6c63ff",d:"M200.756 623.744c-6.21-.149-12.867 3.331-14.635 9.286l33.71-1.372q-.956-.661-1.921-1.305c-5.171-3.44-10.944-6.46-17.154-6.609z","data-name":"Trazado 481",transform:"translate(1100.11 1100.572)"}),a("path",{fill:"#6c63ff",d:"M326.746 614.393c4.483 3.1 8.858 6.406 13.853 8.557 12.368 5.326 26.606 2.842 39.62-.62s26.3-7.861 39.645-6.076c7.569 1.012 14.714 3.973 22.02 6.195s15.166 3.709 22.537 1.715 14.019-8.32 14.212-15.953c-55.647-10.29-107.233-10.595-151.887 6.182z","data-name":"Trazado 482",transform:"translate(993.197 1117.837)"}),a("circle",{cx:"6.401",cy:"6.401",r:"6.401",fill:"#ff9800","data-name":"Elipse 3",transform:"translate(1430.482 1619.426)"}),a("path",{fill:"#e6e6e6",d:"M824.414 192.964a3.173 3.173 0 00-2.678-2.227.261.261 0 00-.043 0 .341.341 0 00-.053-.012 7.819 7.819 0 00-6.13 1.87l-.018.016a3.246 3.246 0 01-3.075.745 2.851 2.851 0 00-.9-.1 3.16 3.16 0 00-2.829 2.28.366.366 0 00.165.405 1.6 1.6 0 00.669.34c.53.113 1.064.216 1.6.309q1.568.273 3.152.443 1.046.111 2.1.177c1.448.091 2.9.113 4.353.067a4.967 4.967 0 002.066-.364 3.068 3.068 0 001.187-1.033 3.488 3.488 0 00.434-2.916z","data-name":"Trazado 483",transform:"translate(626.793 1429.832)"}),a("path",{fill:"#e6e6e6",d:"M769.054 229.362a3.274 3.274 0 00-.134-.791 3.179 3.179 0 00-2.68-2.227.23.23 0 00-.041 0 .453.453 0 00-.055-.012 7.957 7.957 0 00-3.521.362 7.267 7.267 0 00-2.623 1.522 3.245 3.245 0 01-3.075.746 2.859 2.859 0 00-.9-.1 3.16 3.16 0 00-2.829 2.28.373.373 0 00.165.405 1.614 1.614 0 00.669.34c.532.113 1.064.216 1.6.309q1.568.273 3.15.443a46.788 46.788 0 006.453.245 4.974 4.974 0 002.066-.364 3.061 3.061 0 001.184-1.033 3.419 3.419 0 00.571-2.125z","data-name":"Trazado 484",transform:"translate(668.985 1402.759)"}),a("path",{fill:"#3f3d56",d:"M829.2 303.265a1.345 1.345 0 00.15.979.817.817 0 00.95.314c.671-.208 1.332-.452 2-.678a.368.368 0 00.251-.442.363.363 0 00-.442-.251l-1.661.564c-.125.043-.25.091-.378.126l-.059.014c.006 0 .044 0 0 0q-.036-.011 0 0l-.032-.018c.029.024 0 0-.013-.013s-.035-.045-.015-.015a.452.452 0 01-.038-.066c.018.039-.015-.057-.018-.071a1.542 1.542 0 01.026-.448.361.361 0 00-.36-.36.369.369 0 00-.361.365z","data-name":"Trazado 485",transform:"translate(611.216 1344.497)"}),a("path",{fill:"#3f3d56",d:"M717.3 307.729l1.772 2.235c.226.284.709-.023.6-.35-.221-.667.542-1.039 1.068-1.149a9.354 9.354 0 002.062-.422c.421-.191.056-.811-.363-.621-.775.351-1.679.19-2.464.532a1.573 1.573 0 00-1 1.852l.6-.35-1.772-2.235a.362.362 0 00-.508 0 .368.368 0 000 .509z","data-name":"Trazado 486",transform:"translate(696.341 1341.295)"}),a("path",{fill:"#3f3d56",d:"M702.3 198.729l1.772 2.235c.226.284.709-.023.6-.35-.221-.667.542-1.039 1.068-1.149a9.355 9.355 0 002.062-.422c.421-.191.056-.811-.363-.621-.775.351-1.679.19-2.464.532a1.574 1.574 0 00-1 1.852l.6-.35-1.772-2.235a.362.362 0 00-.508 0 .368.368 0 000 .509z","data-name":"Trazado 487",transform:"translate(707.745 1424.166)"})]})})}var e=t;export{e as default};
@@ -0,0 +1 @@
1
+ import{Fragment as f,jsx as o}from"react/jsx-runtime";import{DashAutoFormTabs as A}from"@dashadmin/dash-auto-admin";import{useState as d,useEffect as b}from"react";import{Loading as C,useRecordContext as F}from"react-admin";import T from"../misc/MuiSimpleJsonTable";import{useTenantAttributesFormats as S}from"./TenantAttributesContext";import{useSystemRequestsCache as p}from"../../contexts/SystemRequestsCache";const h=({schema:e,method:u,label:t})=>o(f,{children:A({schema:e,resourceConfig:null,options:{mode:u,label:t}})}),D=({method:e,attribute:u,tenant:t})=>{const[s,i]=d(null),{formats:r,loading:l}=p();return b(()=>{if(r&&r.data&&r.data.attribute_formats){const n=r.data.attribute_formats.map(a=>{const m=a.attribute?a.attribute.replace("attributes.",""):a.id,c=t.attributes&&t.attributes[m]||a?.default_value;return{...a,...(c!==null||c!==void 0)&&{fieldOptions:{defaultValue:c,fullWidth:!0}},...e==="view"&&{readOnly:!0}}});console.log("ATTRIBUTES SCHEMA",n),i(n)}},[r]),o("section",{children:s&&o(h,{schema:s,method:e,label:"Datos de contacto"})})},g=({method:e,attribute:u})=>{const[t,s]=d(null),{formats:i,loading:r}=p();return b(()=>{if(!r&&i&&i.data&&i.data.attribute_formats){const l=i.data.attribute_formats.map(n=>({...n,...e==="view"&&{readOnly:!0}}));s(l)}},[i,r]),o("section",{children:t&&o(h,{schema:t,method:e,label:"Datos de contacto"})})},R=({method:e,attribute:u,tenant:t})=>{const{formats:s,loading:i}=S(),[r,l]=d(null),n=a=>typeof a==="boolean"?a?"S\xED":"No":a;return b(()=>{let a={};s&&t&&(s.forEach(m=>{const c=t.attributes&&t.attributes.hasOwnProperty(m.id)?t.attributes[m.id]:m?.default_value;a[m.label]=o(f,{children:n(c)})}),console.log("ATTRIBUTES SCHEMA",a),l(a))},[s,t]),r?o(T,{tableData:r,vertical:!0}):o(C,{})},w=({method:e,attribute:u,resourceConfig:t})=>{const s=F();switch(e){case"edit":return o(D,{attribute:u,method:e,tenant:s,resourceConfig:t});case"view":return o(R,{attribute:u,method:e,tenant:s,resourceConfig:t});case"create":return o(g,{attribute:u,method:e,resourceConfig:t});case"list":return o(f,{})}};var k=w;export{k as default};
@@ -0,0 +1 @@
1
+ import{jsx as S}from"react/jsx-runtime";import{useAxios as x}from"@dashadmin/dash-axios-hook";import{createContext as A,useState as m,useEffect as y,useContext as E}from"react";const g="TenantAttributesCacheDB",l="kvstore",D=1;function F(){return new Promise((o,a)=>{const t=indexedDB.open(g,D);t.onupgradeneeded=()=>{t.result.createObjectStore(l)},t.onsuccess=()=>o(t.result),t.onerror=()=>a(t.error)})}async function w(o,a){const t=await F();return new Promise((n,u)=>{const e=t.transaction(l,"readwrite");e.objectStore(l).put(a,o),e.oncomplete=()=>n(),e.onerror=()=>u(e.error)})}async function _(o){const a=await F();return new Promise((t,n)=>{const e=a.transaction(l,"readonly").objectStore(l).get(o);e.onsuccess=()=>t(e.result),e.onerror=()=>n(e.error)})}let s=null,c=null,i=0;const h=A({formats:null,fetchFormats:async()=>{},loading:!1}),I=({children:o})=>{const a=x(),[t,n]=m(c),[u,e]=m(!!s),[p,B]=m(!!i),d=async()=>{if(s)return s;const b=Date.now();if(!i)try{i=await _("tenant_attributes_cache")||0}catch(r){console.error("Error reading from IndexedDB:",r)}if(c&&b-i<1e4){t||n(c);return}return e(!0),s=(async()=>{try{console.log("FETCHING ATTRIBUTES FORMATS");const{data:r}=await a.get("system/tenant/systemAttributeFormats"),f=r.data?.attribute_formats||r.data;c=f,i=Date.now(),n(f);try{await w("tenant_attributes_cache",i),await w("tenant_attributes_formats",f)}catch(T){console.error("Error writing to IndexedDB:",T)}}catch(r){console.error("Error fetching attributes formats:",r)}finally{e(!1),s=null}})(),s};return y(()=>{(async()=>{try{if(!c){const r=await _("tenant_attributes_formats");r&&(c=r,n(r),e(!1))}await d()}catch(r){console.error("Error loading cached formats:",r),await d()}})()},[]),y(()=>{t&&e(!1)},[t]),S(h.Provider,{value:{formats:t,fetchFormats:d,loading:u},children:o})};function O(){return E(h)}export{I as TenantAttributesFormatsProvider,_ as idbGet,w as idbSet,O as useTenantAttributesFormats};
@@ -0,0 +1 @@
1
+ import{Fragment as u,jsx as o,jsxs as m}from"react/jsx-runtime";import{Autocomplete as w,Box as A,CircularProgress as L,TextField as v}from"@mui/material";import p,{useEffect as y,useImperativeHandle as H,useState as c}from"react";import{useController as b}from"react-hook-form";import{useGetList as R}from"react-admin";import q from"../../hooks/axios";import{Loading as B}from"react-admin";const E=p.forwardRef(({selectedTenantInput:n,...F},d)=>{const{axios:f}=q(),[g,h]=c(""),[a,T]=c(null),S="Seleccionar Cliente",x=b({name:"tenant"});H(d,()=>({getSelectedTenant:C}));const C=()=>a;y(()=>{n&&n!=="null"&&(async t=>{const{data:P}=await f.get(`tenant/${t}`);T(P)})(n)},[n]);const{data:l,total:W,isLoading:r,error:k}=R("tenant",{filter:{q:g}}),O=e=>{h(e)},I=(e,t)=>{x.field.onChange(t)},[i,s]=p.useState(!1);return r?o(B,{}):m(u,{children:["Cliente impersonado: ",n,o(w,{fullWidth:!0,loading:r&&i,sx:{width:300},options:l||[],open:i,onOpen:()=>{s(!0)},onClose:()=>{s(!1)},autoHighlight:!0,getOptionLabel:e=>e.name,renderOption:(e,t)=>o(A,{component:"li",sx:{"& > img":{mr:2,flexShrink:0}},...e,children:t.name}),onChange:I,defaultValue:a,renderInput:e=>o(v,{fullWidth:!0,...e,label:S,variant:"outlined",onChange:t=>{(t.target.value!==""||t.target.value!==null)&&O(t.target.value)},InputProps:{...e.InputProps,autoComplete:"new-password",endAdornment:m(u,{children:[r?o(L,{color:"inherit",size:20}):null,e.InputProps.endAdornment]})}})})]})});var Y=E;export{Y as default};
@@ -0,0 +1 @@
1
+ import{Fragment as g,jsx as a}from"react/jsx-runtime";import{DashAutoFormTabs as C}from"@dashadmin/dash-auto-admin";import{useState as d,useEffect as f}from"react";import{Loading as b,useRecordContext as F}from"react-admin";import S from"../misc/MuiSimpleJsonTable";import{useTenantSettingsFormats as A}from"./TenantSettingsContext";import{useSystemRequestsCache as p}from"../../contexts/SystemRequestsCache";const h=({schema:s,method:m,label:t})=>a(g,{children:C({schema:s,resourceConfig:null,options:{mode:m,label:t}})}),D=({method:s,attribute:m,tenant:t})=>{const[o,l]=d(null),{formats:n,loading:c}=p();return f(()=>{if(n&&n.data&&n.data.setting_formats){const i=n.data.setting_formats.filter(e=>e.tab!=="colors"&&e.visible!==!1).map(e=>{const r=e.attribute?e.attribute.replace("settings.",""):e.id,u=t.settings&&t.settings[r]||e?.default_value;return{...e,...(u!==null||u!==void 0)&&{fieldOptions:{defaultValue:u,fullWidth:!0}},...s==="view"&&{readOnly:!0}}});console.log("SCHEMA",i),l(i)}},[n]),a("section",{children:o&&a(h,{schema:o,method:s,label:"Opciones de configuraci\xF3n"})})},T=({method:s,attribute:m})=>{const[t,o]=d(null),{formats:l,loading:n}=p();return f(()=>{if(!n&&l&&l.data&&l.data.setting_formats){const c=l.data.setting_formats.filter(i=>i.tab!=="colors"&&i.visible!==!1).map(i=>({...i,...s==="view"&&{readOnly:!0}}));o(c)}},[l,n]),a("section",{children:t&&a(h,{schema:t,method:s,label:"Opciones de configuraci\xF3n"})})},R=({method:s,attribute:m,tenant:t})=>{const{formats:o,loading:l}=A(),[n,c]=d(null),i=e=>typeof e==="boolean"?e?"S\xED":"No":e;return f(()=>{let e={};o&&t&&(o.filter(r=>r.tab!=="colors"&&r.visible!==!1).forEach(r=>{const u=t.settings&&t.settings.hasOwnProperty(r.id)?t.settings[r.id]:r?.default_value;e[r.label]=a(g,{children:i(u)})}),console.log("SCHEMA",e),c(e))},[o,t]),n?a(S,{tableData:n,vertical:!0}):a(b,{})},v=({method:s,attribute:m,resourceConfig:t})=>{const o=F();switch(s){case"edit":return a(D,{attribute:m,method:s,tenant:o,resourceConfig:t});case"view":return a(R,{attribute:m,method:s,tenant:o,resourceConfig:t});case"create":return a(T,{attribute:m,method:s,resourceConfig:t});case"list":return a(g,{})}};var B=v;export{B as default};
@@ -0,0 +1 @@
1
+ import{jsx as B}from"react/jsx-runtime";import{useAxios as w}from"@dashadmin/dash-axios-hook";import{createContext as E,useState as u,useEffect as T,useContext as p}from"react";const D="TenantSettingsCacheDB",l="kvstore",b=1;function y(){return new Promise((r,n)=>{const t=indexedDB.open(D,b);t.onupgradeneeded=()=>{t.result.createObjectStore(l)},t.onsuccess=()=>r(t.result),t.onerror=()=>n(t.error)})}async function S(r,n){const t=await y();return new Promise((a,d)=>{const e=t.transaction(l,"readwrite");e.objectStore(l).put(n,r),e.oncomplete=()=>a(),e.onerror=()=>d(e.error)})}async function x(r){const n=await y();return new Promise((t,a)=>{const e=n.transaction(l,"readonly").objectStore(l).get(r);e.onsuccess=()=>t(e.result),e.onerror=()=>a(e.error)})}let c=null,s=null,i=0;const F=E({formats:null,fetchFormats:async()=>{},loading:!1}),C=({children:r})=>{const n=w(),[t,a]=u(s),[d,e]=u(!!c),[P,_]=u(!!i),m=async()=>{if(c)return c;const g=Date.now();if(!i)try{i=await x("tenant_settings_cache")||0}catch(o){console.error("Error reading from IndexedDB:",o)}if(s&&g-i<1e4){t||a(s);return}return e(!0),c=(async()=>{try{console.log("FETCHING SETTINGS FORMATS");const{data:o}=await n.get("system/tenant/systemSettingFormats"),f=o.data?.setting_formats||o.data;s=f,i=Date.now(),a(f),_(!0);try{await S("tenant_settings_cache",i),await S("tenant_settings_formats",f)}catch(h){console.error("Error writing to IndexedDB:",h)}}catch(o){console.error("Error fetching settings formats:",o)}finally{e(!1),c=null}})(),c};return T(()=>{(async()=>{try{if(!s){const o=await x("tenant_settings_formats");o&&(s=o,a(o))}m()}catch(o){console.error("Error loading cached formats:",o),m()}})()},[]),B(F.Provider,{value:{formats:t||s,fetchFormats:m,loading:d},children:r})},O=()=>p(F);var v=C;export{C as TenantSettingsFormatsProvider,v as default,x as idbGet,S as idbSet,O as useTenantSettingsFormats};
@@ -0,0 +1 @@
1
+ import{Fragment as g,jsx as a}from"react/jsx-runtime";import{DashAutoFormTabs as C}from"@dashadmin/dash-auto-admin";import{useState as d,useEffect as f}from"react";import{Loading as F,useRecordContext as b}from"react-admin";import{useFormContext as S,useWatch as T}from"react-hook-form";import A from"../misc/MuiSimpleJsonTable";import{useTenantSettingsFormats as D}from"./TenantSettingsContext";import{useSystemRequestsCache as h}from"../../contexts/SystemRequestsCache";const p=({schema:o,method:i,label:t})=>a(g,{children:C({schema:o,resourceConfig:null,options:{mode:i,label:t}})}),R=({method:o,attribute:i,tenant:t})=>{const[n,l]=d(null),{formats:r,loading:m}=h();return f(()=>{if(r&&r.data&&r.data.setting_formats){const u=r.data.setting_formats.filter(e=>e.tab==="colors").map(e=>{const s=e.attribute?e.attribute.replace("settings.",""):e.id,c=t.settings&&t.settings[s]||e?.default_value;return{...e,...(c!==null||c!==void 0)&&{fieldOptions:{defaultValue:c,fullWidth:!0}},...o==="view"&&{readOnly:!0}}});console.log("SCHEMA",u),l(u)}},[r]),a("section",{children:n&&a(p,{schema:n,method:o,label:"Tema"})})},w=({method:o,attribute:i})=>{const[t,n]=d(null),l=S(),r=T({control:l.control}),{formats:m,loading:u}=h();return f(()=>{if(!u&&m&&m.data&&m.data.setting_formats){const e=m.data.setting_formats.filter(s=>s.tab==="colors").map(s=>({...s,...o==="view"&&{readOnly:!0}}));n(e)}},[m,u]),a("section",{children:t&&a(p,{schema:t,method:o,label:"Tema"})})},V=({method:o,attribute:i,tenant:t})=>{const{formats:n,loading:l}=D(),[r,m]=d(null),u=e=>typeof e==="boolean"?e?"S\xED":"No":e;return f(()=>{let e={};n&&t&&(n.filter(s=>s.tab==="colors").forEach(s=>{const c=t.settings&&t.settings.hasOwnProperty(s.id)?t.settings[s.id]:s?.default_value;e[s.label]=a(g,{children:u(c)})}),console.log("SCHEMA",e),m(e))},[n,t]),r?a(A,{tableData:r,vertical:!0}):a(F,{})},x=({method:o,attribute:i,resourceConfig:t})=>{const n=b();switch(o){case"edit":return a(R,{attribute:i,method:o,tenant:n,resourceConfig:t});case"view":return a(V,{attribute:i,method:o,tenant:n,resourceConfig:t});case"create":return a(w,{attribute:i,method:o,resourceConfig:t});case"list":return a(g,{})}};var z=x;export{z as default};
@@ -0,0 +1 @@
1
+ import{Fragment as ee,jsx as t,jsxs as L}from"react/jsx-runtime";import{Avatar as A,useMediaQuery as B,useTheme as Q}from"@mui/material";import{useEffect as i,useState as d,useRef as g}from"react";import{IconMenuItem as E}from"mui-nested-menu";import X from"react-dom";import $ from"@mui/icons-material/AccountCircle";import q from"@mui/icons-material/Logout";import{useWindowSize as G}from"@dashadmin/dash-utils";import{useAuthContext as J}from"../../contexts/auth/AuthContext";import{useTranslate as K}from"react-admin";import{useNavigate as Z}from"react-router-dom";import{NavEventManager as R}from"../../utils/navEvents";const j=({sidebarPosition:N="left"})=>{const{user:o,logout:T,authenticated:y}=J(),s=G(),v=K(),_=Q(),D=B(_.breakpoints.down("md")),[u,b]=d(!1),[m,a]=d(!1),f=g(null),P=g(null),[M,k]=d({top:0,left:0}),n=g(null),I=Z(),[r,S]=d(o);i(()=>{console.log("AvatarComponent: User data changed in auth context:",o),S(o),(o?.image_url!==r?.image_url||o?.image_path!==r?.image_path)&&console.log("AvatarComponent: User image changed, forcing update")},[o,o?.name,o?.image_url,o?.image_path,o?.id]),i(()=>{document.body.classList.contains("webview")?b(!0):b(!1)},[]);const U=async e=>{e.preventDefault(),localStorage.clear(),await T(),window.location.href="/"},x=()=>{I("/profile")},p=()=>{if(f.current&&s.width&&s.height){const e=f.current.getBoundingClientRect(),l=230,Y=120;let c=e.left+window.scrollX,C=e.top+window.scrollY;c+l>s.width&&(c=s.width-l-10),c<10&&(c=10),N==="bottom"&&(C=e.top+window.scrollY-Y-10),k({top:C,left:c+40})}},H=e=>{console.log("handleAvatarMouseEnter"),e.preventDefault(),n.current&&(clearTimeout(n.current),n.current=null),a(!0),p()},O=e=>{console.log("handleAvatarClick"),e.preventDefault(),a(l=>!l),p()},z=()=>{console.log("handleMouseLeave"),u||(n.current=setTimeout(()=>{a(!1)},100))},W=()=>{console.log("handleMenuMouseEnter"),n.current&&(clearTimeout(n.current),n.current=null)},F=()=>{console.log("handleMenuMouseLeave"),u||a(!1)};if(i(()=>()=>{n.current&&clearTimeout(n.current)},[]),i(()=>{m&&p()},[s.width,s.height,m,D]),i(()=>{const e=R.onSubmenuOpened(()=>{a(!1)}),l=R.onCloseAllSubmenus(()=>{a(!1)});return()=>{e(),l()}},[]),!y||!r)return null;const h=()=>r?.image_url||r?.image_path||null,w=()=>r?.name||"Usuario",V=()=>{const e=w();return e?e.charAt(0).toUpperCase():"?"};return L(ee,{children:[t("div",{ref:f,className:"dash-user-avatar",...u?{onClick:O}:{onMouseEnter:H,onMouseLeave:z},children:h()?t(A,{src:h(),className:"dash-icon-button-color dash-icon-button-bg"},h()):t(A,{className:"dash-icon-button-color dash-icon-button-bg",children:V()})}),m&&X.createPortal(t("div",{ref:P,className:"dash-user-menu-portal",onMouseEnter:u?void 0:W,onMouseLeave:u?void 0:F,children:L("div",{className:`dash-user-menu ${m?"show":""}`,style:{zIndex:1e4,position:"absolute",top:M.top,left:M.left},children:[t("span",{className:"dash-user-name",style:{padding:"8px 16px",display:"block"},children:w()}),t(E,{onClick:e=>{e.preventDefault(),a(!1),x()},leftIcon:t("span",{className:"dash-user-icon",children:t($,{})}),label:v("ra.auth.user_menu",{_:"Perfil"}),className:"dash-icon-button-color dash-icon-button-bg"}),t(E,{onClick:e=>{a(!1),U(e)},leftIcon:t("span",{className:"dash-user-icon",children:t(q,{})}),label:v("ra.auth.logout",{_:"Cerrar sesi\xF3n"}),className:"dash-icon-button-color dash-icon-button-bg"})]})}),document.body)]})};var be=j;export{be as default};
@@ -0,0 +1 @@
1
+ import{jsx as s}from"react/jsx-runtime";import{Box as h}from"@mui/material";const d=({imageUrl:m,maxWidth:n=130,maxHeight:r=130,alt:g="Tenant Logo",sidebarPosition:t="left",sidebarSmallWidth:a="64px",navExpanded:i=!1,navSize:o="large",onClick:l})=>{const p=t==="top"||t==="bottom",e=t==="left"||t==="right",c={padding:"8px",display:"flex",alignItems:"center",justifyContent:"center",...p&&{height:r,maxHeight:r},...e&&o==="small"&&{width:a,maxWidth:a},...e&&o==="large"&&i&&{width:n,maxWidth:n},...e&&o==="large"&&!i&&{width:a,maxWidth:a}};return s(h,{component:"div",sx:{...c,cursor:l?"pointer":"default"},className:"dash-tenant-avatar",onClick:l,children:s("img",{src:m,alt:g,style:{width:"auto",height:"auto",maxWidth:"100%",maxHeight:"100%",objectFit:"contain"}})})};var y=d;export{y as default};
@@ -0,0 +1 @@
1
+ import{Fragment as fe,jsx as t,jsxs as i}from"react/jsx-runtime";import{useState as d,useEffect as ee,useCallback as D,useMemo as ne,useRef as te}from"react";import{CircularProgress as j,Box as l,Typography as a,Switch as k,FormControlLabel as z,Card as y,CardContent as b,Alert as f,Button as re,Snackbar as se,Tabs as ae,Tab as ie,TextField as N,Slider as oe,InputAdornment as ce}from"@mui/material";import{Save as le,Notifications as de,Settings as pe}from"@mui/icons-material";import{useAxios as ue}from"@dashadmin/dash-axios-hook";import{AuthPersistenceService as ge}from"@dashadmin/dash-auth";const ye=x=>x==="notifications"?t(de,{}):t(pe,{}),be=()=>{const[x,V]=d(!0),[c,T]=d(!1),[S,h]=d(!1),[C,W]=d(0),[F,w]=d([]),[B,A]=d({}),[O,q]=d([]),[I,H]=d({}),[P,m]=d({open:!1,message:"",severity:"success"}),R=ue(),v=ne(()=>ge.getSystemValues()?.user_notifications||[],[]),L=te(v);L.current=v;const p=Object.entries(I).sort(([,e],[,n])=>(e.order||0)-(n.order||0)).map(([e,n])=>({key:e,...n})),M=e=>O.filter(n=>n.group===e&&n.visible),G=D((e,n)=>{const r=e?.notifications||[];return n.map(s=>{const o=Array.isArray(r)?r.find(u=>u.id===s.id):null;return{id:s.id,name:s.name,email:o?.email!==void 0?o.email:s.hasEmail,push:o?.push!==void 0?o.push:s.hasPush}})},[]),_=D(async()=>{try{console.log("\u{1F504} UserPreferences - Fetching preferences from API...");const n=(await R.get("/system/user/preferences")).data;console.log("\u2705 UserPreferences - Fetched:",n),q(n.preference_formats||[]),H(n.groups||{});const r=n.preferences||{},s=G(r,L.current);w(s);const o={};(n.preference_formats||[]).forEach(u=>{u.type!=="custom"&&(o[u.id]=r[u.id]??u.default_value)}),A(o),h(!1)}catch(e){console.error("\u274C UserPreferences - Fetch error:",e),m({open:!0,message:"Failed to load preferences",severity:"error"})}},[G]);ee(()=>{(async()=>(await _(),V(!1)))()},[]);const Y=(e,n)=>{W(n)},E=(e,n,r)=>{w(s=>s.map(o=>o.id===e?{...o,[n]:r}:o)),h(!0)},g=(e,n)=>{A(r=>({...r,[e]:n})),h(!0)},Z=async()=>{T(!0);try{const e={notifications:F,...B},n=await R.put("/system/user/preferences",{preferences:e});console.log("\u2705 UserPreferences - Saved:",n.data),m({open:!0,message:"Preferences saved successfully!",severity:"success"}),h(!1),await _()}catch(e){console.error("\u274C UserPreferences - Save error:",e),m({open:!0,message:e.response?.data?.message||"Failed to save preferences",severity:"error"})}finally{T(!1)}},U=()=>{m(e=>({...e,open:!1}))},J=e=>v.find(n=>n.id===e),Q=e=>e.replace(/Notification$/,"").replace(/([A-Z])/g," $1").trim(),X=e=>{const n=B[e.id];switch(e.type){case"boolean":return t(y,{sx:{mb:2},children:i(b,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[i(l,{children:[t(a,{variant:"subtitle1",children:e.label}),e.description&&t(a,{variant:"caption",color:"text.secondary",children:e.description})]}),t(k,{checked:!!n,onChange:r=>g(e.id,r.target.checked),disabled:c||!e.editable})]})},e.id);case"integer":return t(y,{sx:{mb:2},children:i(b,{children:[t(a,{variant:"subtitle1",gutterBottom:!0,children:e.label}),e.description&&t(a,{variant:"caption",color:"text.secondary",display:"block",mb:2,children:e.description}),i(l,{sx:{display:"flex",alignItems:"center",gap:2},children:[t(oe,{value:n??e.default_value??0,onChange:(r,s)=>g(e.id,s),min:e.min??0,max:e.max??100,disabled:c||!e.editable,sx:{flexGrow:1},valueLabelDisplay:"auto"}),t(N,{type:"number",value:n??e.default_value??0,onChange:r=>g(e.id,parseInt(r.target.value,10)),disabled:c||!e.editable,inputProps:{min:e.min??0,max:e.max??100},sx:{width:80},size:"small"})]})]})},e.id);case"string":return t(y,{sx:{mb:2},children:i(b,{children:[t(a,{variant:"subtitle1",gutterBottom:!0,children:e.label}),e.description&&t(a,{variant:"caption",color:"text.secondary",display:"block",mb:2,children:e.description}),t(N,{fullWidth:!0,value:n??"",onChange:r=>g(e.id,r.target.value),disabled:c||!e.editable,inputProps:{maxLength:e.maxLength},InputProps:e.maxLength?{endAdornment:i(ce,{position:"end",children:[n?.length||0,"/",e.maxLength]})}:void 0})]})},e.id);case"textarea":return t(y,{sx:{mb:2},children:i(b,{children:[t(a,{variant:"subtitle1",gutterBottom:!0,children:e.label}),e.description&&t(a,{variant:"caption",color:"text.secondary",display:"block",mb:2,children:e.description}),t(N,{fullWidth:!0,multiline:!0,rows:e.rows??3,value:n??"",onChange:r=>g(e.id,r.target.value),disabled:c||!e.editable,inputProps:{maxLength:e.maxLength},helperText:e.maxLength?`${n?.length||0}/${e.maxLength} characters`:void 0})]})},e.id);default:return null}},K=()=>v.length===0?t(f,{severity:"info",children:"No notification types available."}):t(fe,{children:F.map(e=>{const n=J(e.id);return t(y,{sx:{mb:2},children:i(b,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[i(l,{children:[t(a,{variant:"subtitle1",children:Q(e.name)}),t(a,{variant:"caption",color:"text.secondary",children:e.name})]}),i(l,{sx:{display:"flex",gap:2},children:[n?.hasEmail&&t(z,{control:t(k,{checked:e.email,onChange:r=>E(e.id,"email",r.target.checked),color:"primary",disabled:c}),label:"Email"}),n?.hasPush&&t(z,{control:t(k,{checked:e.push,onChange:r=>E(e.id,"push",r.target.checked),color:"primary",disabled:c}),label:"Push"}),!n?.hasEmail&&!n?.hasPush&&t(a,{variant:"caption",color:"text.secondary",children:"(No configurable channels)"})]})]})},e.id)})}),$=e=>{const n=M(e),r=I[e];return i(l,{sx:{pt:2},children:[r?.description&&t(a,{variant:"body2",color:"text.secondary",sx:{mb:3},children:r.description}),n.map(s=>s.type==="custom"&&s.component==="NotificationPreferences"?t(l,{children:K()},s.id):X(s)),n.length===0&&t(f,{severity:"info",children:"No preferences available in this group."})]})};return x?t(l,{sx:{display:"flex",justifyContent:"center",p:4},children:t(j,{})}):i(l,{sx:{p:2},children:[t(l,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:t(a,{variant:"h5",children:"User Preferences"})}),S&&t(f,{severity:"info",sx:{mb:2},children:'You have unsaved changes. Click "Save Preferences" to apply them.'}),p.length>1&&t(ae,{value:C,onChange:Y,sx:{borderBottom:1,borderColor:"divider",mb:2},children:p.map((e,n)=>t(ie,{label:e.label,icon:ye(e.icon),iconPosition:"start",id:`preference-tab-${n}`,"aria-controls":`preference-tabpanel-${n}`},e.key))}),p.map((e,n)=>t(l,{role:"tabpanel",hidden:C!==n,id:`preference-tabpanel-${n}`,"aria-labelledby":`preference-tab-${n}`,children:C===n&&$(e.key)},e.key)),p.length===1&&$(p[0].key),p.length===0&&t(f,{severity:"warning",children:"No preference groups configured."}),t(se,{open:P.open,autoHideDuration:4e3,onClose:U,anchorOrigin:{vertical:"bottom",horizontal:"center"},children:t(f,{onClose:U,severity:P.severity,sx:{width:"100%"},children:P.message})}),t(re,{variant:"contained",fullWidth:!0,color:"primary",startIcon:c?t(j,{size:16,color:"inherit"}):t(le,{}),onClick:Z,disabled:c||!S,children:c?"Saving...":"Save Preferences"})]})};var ke=be;export{ke as default};
@@ -0,0 +1 @@
1
+ import I from"./PARSERS";const T={GET_NOTIFICATIONS:{ACTION:"GET_NOTIFICATIONS",SUCCESS:"GET_NOTIFICATIONS_SUCCESS",FAILURE:"GET_NOTIFICATIONS_FAILURE",PATH:"/api/notification",METHOD:"POST",AUTH:!0,PARSER:I.GET_NOTIFICATIONS},READ_NOTIFICATION:{ACTION:"READ_NOTIFICATION",SUCCESS:"READ_NOTIFICATION_SUCCESS",FAILURE:"READ_NOTIFICATION_FAILURE",PATH:"/api/notification/read/:id",METHOD:"GET",AUTH:!0}};var S=T;export{S as default};
@@ -0,0 +1 @@
1
+ import{jsx as d}from"react/jsx-runtime";import*as t from"react";import p from"@dashadmin/dash-constants/src/DASHAdminSystemConstants";const i=function(){return t.createContext(null)},c=i(),x=function(s){const{initialAppConstants:o,children:e}=s,[a,r]=t.useState(o||null),C={appConstants:a,systemConstants:p,setAppConstants:r};return d(c.Provider,{value:C,children:e})};var u=x;export{c as ConstantsContext,i as createConstantsContext,u as default};
@@ -0,0 +1 @@
1
+ const T=E=>process.env[E]||null,_=E=>{const A=process.env.ENV_PREFIX||process.env.NEXT_PUBLIC_ENV_PREFIX||process.env.VITE_ENV_PREFIX||process.env.REACT_ENV_PREFIX||"VITE_";return A==="NEXT_PUBLIC_"?T(A+E):process.env[A+E]||null},L={FRONTEND_URL:_("APP_FRONTEND_URL")||"http://localhost:3006",API_URL:_("APP_BACKEND_URL")||"http://localhost:8000",SOCKET_URL:(_("APP_SOCKETS_HOST")||(typeof window<"u"?window.location.hostname:"localhost"))+(_("APP_SOCKETS_PORT")?":"+_("APP_SOCKETS_PORT"):""),SOCKETS_ENABLED:JSON.parse(_("APP_SOCKETS_ENABLED"))||!1,SOCKETS_BROADCASTER:_("APP_SOCKETS_BROADCASTER")||"pusher",SOCKETS_KEY:_("APP_SOCKETS_KEY")||"dash",ADMIN_API_URL:_("APP_ADMIN_API_URL"),DEBUG:!0,SHOW_GLOBAL_TOAST_ERROR:!1,SHOW_GLOBAL_DIALOG_ERROR:!0,DASH_SYSTEM_ROLE:_("DASH_SYSTEM_ROLE")||"System",DASH_ADMIN_ROLE:_("DASH_ADMIN_ROLE")||"Administrator",HAS_ADMINISTRATOR_ID_ROLE:"HasAdministratorId",ENABLE_TENANT_LOGIC:_("ENABLE_TENANT_LOGIC")||!0,ENABLE_TENANT_IMPERSONATION:_("ENABLE_TENANT_LOGIC")||!0,ENABLE_LOGS_AND_NOTIFICATIONS:_("ENABLE_LOGS_AND_NOTIFICATIONS")||!1,DEFAULT_PER_PAGE:Number(_("DEFAULT_PER_PAGE"))||null,URL_PREFIX:_("DASH_ADMIN_URL_PREFIX")||"/",PAGE_TRANSITIONS:!1,GOOGLE_SIGNUP:JSON.parse(_("APP_GOOGLE_SIGNUP"))||!1,RECAPTCHA_ENABLED:JSON.parse(_("APP_RECAPTCHA_ENABLED"))||!1,RECAPTCHA_TOKEN:_("APP_RECAPTCHA_TOKEN")||"UNSET",APP_VERSION:_("APP_VERSION")||"1.0.0",BUILD_TIME:_("BUILD_TIME")||new Date().toISOString(),IS_ELECTRON:JSON.parse(_("IS_ELECTRON"))||!1,PLATFORM:_("PLATFORM")||"unknown",IS_WINDOWS:JSON.parse(_("IS_WINDOWS"))||!1,IS_MAC:JSON.parse(_("IS_MAC"))||!1,IS_LINUX:JSON.parse(_("IS_LINUX"))||!1,PLATFORM_TYPE:_("PLATFORM_TYPE")||"browser"},e={SIDEBAR_WIDTH:_("SIDEBAR_WIDH")||256,SIDEBAR_COLLAPSED_WIDTH:_("SIDEBAR_COLLAPSED_WIDH")||63,TAB_SIZE:992,MOBILE_SIZE:575,THEME_TYPE:"THEME_TYPE",THEME_TYPE_LIGHT:"light",THEME_TYPE_DARK:"dark",THEME_TYPE_DASH_DEFAULT:"light",THEME_TYPE_SEMI_DARK:"THEME_TYPE_SEMI_DARK",THEME_COLOR:"THEME_COLOR",UPDATE_RTL_STATUS:"UPDATE_RTL_STATUS",LAYOUT_TYPE:"LAYOUT_TYPE",LAYOUT_TYPE_FRAMED:"framed-layout",LAYOUT_TYPE_BOXED:"boxed-layout",LAYOUT_TYPE_FULL:"full-layout",NAV_STYLE:"NAV_STYLE",NAV_STYLE_FIXED:"NAV_STYLE_FIXED",NAV_STYLE_MINI_SIDEBAR:"NAV_STYLE_MINI_SIDEBAR",NAV_STYLE_DRAWER:"NAV_STYLE_DRAWER",NAV_STYLE_NO_HEADER_MINI_SIDEBAR:"NAV_STYLE_NO_HEADER_MINI_SIDEBAR",NAV_STYLE_NO_HEADER_EXPANDED_SIDEBAR:"NAV_STYLE_NO_HEADER_EXPANDED_SIDEBAR",NAV_STYLE_DEFAULT_HORIZONTAL:"NAV_STYLE_DEFAULT_HORIZONTAL",NAV_STYLE_DARK_HORIZONTAL:"NAV_STYLE_DARK_HORIZONTAL",NAV_STYLE_INSIDE_HEADER_HORIZONTAL:"NAV_STYLE_INSIDE_HEADER_HORIZONTAL",NAV_STYLE_BELOW_HEADER:"NAV_STYLE_BELOW_HEADER",NAV_STYLE_ABOVE_HEADER:"NAV_STYLE_ABOVE_HEADER",NAV_STYLE_COLLAPSABLE:"NAV_STYLE_COLLAPSABLE",LIGHT_PURPLE:"light_purple",LIGHT_PURPLE_SEC:"#00B378",LIGHT_PURPLE_DARK_TEXT_COLOR:"#9799AC",RED:"red",RED_SEC:"#00D9C9",RED_DARK_TEXT_COLOR:"#878BAB",BLUE:"blue",BLUE_SEC:"#FCB53B",BLUE_DARK_TEXT_COLOR:"#AAA59A",DARK_BLUE:"dark_blue",DARK_BLUE_SEC:"#17BDE5",DARK_BLUE_DARK_TEXT_COLOR:"#9DDAE9",ORANGE:"orange",ORANGE_SEC:"#F1D065",ORANGE_DARK_TEXT_COLOR:"#ABA895",LIGHT_BLUE:"light_blue",LIGHT_BLUE_SEC:"#59DCFF",LIGHT_BLUE_DARK_TEXT_COLOR:"#92A2C8",DEEP_ORANGE:"deep_orange",DEEP_ORANGE_SEC:"#70A288",DEEP_ORANGE_DARK_TEXT_COLOR:"#97B8C7",LIGHT_PURPLE_1:"light_purple_1",LIGHT_PURPLE_1_SEC:"#E14594",LIGHT_PURPLE_1_DARK_TEXT_COLOR:"#8288B4",LIGHT_PURPLE_2:"light_purple_2",LIGHT_PURPLE_2_SEC:"#64D7D6",LIGHT_PURPLE_2_DARK_TEXT_COLOR:"#5782BB",ACTIVE_COLOR_OPTION:"#ffffff"},O={SYSTEM_FORM_DEFAULT_SELECT_OPTION:"Seleccione una opci\xF3n",NO_AVAILABLE_NOTIFICATIONS:"No hay notificaciones nuevas",ALL_NOTIFICATIONS:"Todas las notificaciones",NOTIFICATIONS_WIDGET_TITLE:"Notificaciones",type:"Tipo",date:"Fecha",name:"Nombre",filepath:"Archivo",json:"Data",clientName:"Cliente",withdrawsToday:"Retiros Hoy",withdrawsYesterday:"Retiros Ayer",withdrawsLastWeek:"Retiros \xDAltima Semana",volumeCp:"Vol\xFAmen","validation.recaptcha":"Recaptcha inv\xE1lido"},S={profile:"perfil"},R={},I={system:L,panel:e,dict:O,helpers:R,replacements:S};var N=I;export{N as default,_ as getEnv};
@@ -0,0 +1 @@
1
+ const i={GET_NOTIFICATIONS:t=>t.notifications};var r=i;export{r as default};
@@ -0,0 +1 @@
1
+ import{jsx as r}from"react/jsx-runtime";import d,{useContext as o}from"react";import{QueryClientProvider as a}from"@tanstack/react-query";import{PersistQueryClientProvider as y}from"@tanstack/react-query-persist-client";const t=d.createContext(void 0),P=({queryClient:e,children:i,persister:s,persistOptions:C})=>{const n={queryClient:e,persister:s};if(e){if(s){const l={maxAge:72e5,dehydrateOptions:{shouldDehydrateQuery:u=>u.state.status==="success"&&u.state.data!==void 0},...C};return r(y,{client:e,persistOptions:{persister:s,...l},children:r(t.Provider,{value:n,children:i})})}return r(a,{client:e,children:r(t.Provider,{value:n,children:i})})}return r(t.Provider,{value:n,children:i})},D=()=>{const e=o(t);if(!e)throw new Error("useDashQueryClient must be used within a DASHQueryClientProvider");return e.queryClient},m=()=>o(t)?.persister,O=()=>!!o(t)?.persister;var I=P;export{t as DashQueryClientContext,I as default,D as useDashQueryClient,m as useDashQueryPersister,O as useIsCachePersisted};
@@ -0,0 +1 @@
1
+ import{jsx as a}from"react/jsx-runtime";import t,{createContext as n,useContext as u,useMemo as c}from"react";const o=n(void 0),i=t.memo(({resourceConfig:e,children:r})=>{const s=c(()=>({resourceConfig:e}),[e]);return a(o.Provider,{value:s,children:r})});i.displayName="DashResourceProvider";const D=()=>{const e=u(o);if(e===void 0)throw new Error("useDashResource must be used within a DashResourceProvider");return e};export{i as DashResourceProvider,D as useDashResource};
@@ -0,0 +1 @@
1
+ import{jsx as C}from"react/jsx-runtime";import I,{createContext as f,useContext as x,useState as g,useCallback as L,useEffect as P}from"react";const u="dash:locale-change",l=f({i18nProvider:null,locale:"es",setI18nProvider:()=>{},setLocale:()=>{}}),B=({children:e})=>{const[n,i]=g(null),[o,a]=g(()=>typeof window<"u"&&localStorage.getItem("dash-user-locale")||"es"),v=L(async t=>{console.log("\u{1F310} I18nBridgeContext: Setting bridged i18nProvider",{hasGetLocales:!!t?.getLocales,locales:t?.getLocales?.(),providerLocale:t?.getLocale?.(),desiredLocale:o}),i(t);const c=t?.getLocale?.();if(c&&c!==o&&t?.changeLocale){console.log(`\u{1F310} I18nBridgeContext: Provider locale (${c}) differs from desired (${o}), switching...`);try{await t.changeLocale(o),console.log(`\u{1F310} I18nBridgeContext: Successfully switched provider to ${o}`)}catch(d){console.warn("\u{1F310} I18nBridgeContext: Failed to switch provider locale:",d)}}else t?.getLocale&&a(t.getLocale())},[o]);return P(()=>{const t=async c=>{const r=c.detail?.locale;if(r&&r!==o){if(console.log("\u{1F310} I18nBridgeContext: Received locale change event:",r),n?.changeLocale)try{await n.changeLocale(r)}catch(h){console.warn("Failed to change provider locale:",h)}a(r)}};return window.addEventListener(u,t),()=>{window.removeEventListener(u,t)}},[n,o]),C(l.Provider,{value:{i18nProvider:n,locale:o,setI18nProvider:v,setLocale:a},children:e})},s=()=>x(l),E=()=>{const{i18nProvider:e}=s();return I.useMemo(()=>e?.getLocales?e.getLocales():[],[e])},m=()=>{const{i18nProvider:e,setLocale:n}=s();return L(async o=>{e?.changeLocale&&await e.changeLocale(o),n(o)},[e,n])},p=()=>{const{locale:e}=s();return e};var y=l;export{B as I18nBridgeProvider,u as LOCALE_CHANGE_EVENT,y as default,m as useBridgedChangeLocale,p as useBridgedLocale,E as useBridgedLocales,s as useI18nBridge};
@@ -0,0 +1 @@
1
+ import{useEffect as c}from"react";import{useI18nProvider as n,useLocaleState as s}from"react-admin";import{useI18nBridge as i}from"./I18nBridgeContext";const l=()=>{const e=n(),[t]=s(),{setI18nProvider:o,setLocale:r}=i();return c(()=>{e&&(console.log("\u{1F310} I18nBridgeSetter: Setting bridge from AdminContext",{hasGetLocales:!!e.getLocales,locales:e.getLocales?.(),currentLocale:t}),o(e))},[e,o,t]),c(()=>{t&&r(t)},[t,r]),null};var m=l;export{m as default};
@@ -0,0 +1 @@
1
+ import{useEffect as c}from"react";import{useSetLocale as r,useLocaleState as o}from"react-admin";const s=({locale:e})=>{const t=r(),[n]=o();return c(()=>{e&&e!==n&&t(e)},[e,n,t]),null};var i=s;export{i as default};
@@ -0,0 +1 @@
1
+ import{jsx as E}from"react/jsx-runtime";import{useAxios as w}from"@dashadmin/dash-axios-hook";import{createContext as C,useContext as x,useState as f,useRef as T,useEffect as b}from"react";import{idbSet as u,idbGet as F}from"./SystemRequestsCache";const r=!0,S=C({formats:null,addonFormats:null,loading:!1,fetchFormats:async()=>{}}),D=({cacheSeconds:i=300,children:_})=>{const p=w(),P="subscription_plan_limit_formats_cache",h="subscription_plan_addon_formats_cache",t=T({fetchPromise:null,formats:null,addonFormats:null,lastFetchTime:0}),[s,c]=f(t.current.formats),[n,m]=f(t.current.addonFormats),[g,e]=f(!t.current.formats&&!t.current.fetchPromise),l=async()=>{if(r&&console.log("[SubscriptionPlanFormats] fetchFormats called"),t.current.fetchPromise)return r&&console.log("[SubscriptionPlanFormats] fetchPromise already in progress"),t.current.fetchPromise;const d=Date.now();if(t.current.formats&&t.current.addonFormats&&d-t.current.lastFetchTime<i*1e3){r&&console.log(`[SubscriptionPlanFormats] Using cached data (age: ${(d-t.current.lastFetchTime)/1e3}s)`),s||c(t.current.formats),n||m(t.current.addonFormats);return}return e(!0),t.current.fetchPromise=(async()=>{try{r&&console.log("[SubscriptionPlanFormats] FETCHING limit formats and addon formats");const[a,o]=await Promise.all([p.get("system/subscription-plan/limitFormats"),p.get("system/subscription-plan/addonFormats")]);t.current.formats=a.data,t.current.addonFormats=o.data,t.current.lastFetchTime=Date.now(),c(a.data),m(o.data);try{await u(`${P}_formats`,a.data),await u(`${h}_formats`,o.data),await u("subscription_plan_formats_lastFetchTime",t.current.lastFetchTime),r&&console.log("[SubscriptionPlanFormats] Saved to IndexedDB")}catch(y){r&&console.error("[SubscriptionPlanFormats] Error writing to IndexedDB:",y)}}catch(a){r&&console.error("[SubscriptionPlanFormats] Error fetching formats:",a)}finally{e(!1),t.current.fetchPromise=null,r&&console.log("[SubscriptionPlanFormats] fetchPromise cleared")}})(),t.current.fetchPromise};return b(()=>{(async()=>{r&&console.log("[SubscriptionPlanFormats] loadCachedFormats");try{if(!t.current.formats){const o=await F(`${P}_formats`);o&&(t.current.formats=o,c(o),r&&console.log("[SubscriptionPlanFormats] Loaded limit formats from IndexedDB"))}if(!t.current.addonFormats){const o=await F(`${h}_formats`);o&&(t.current.addonFormats=o,m(o),r&&console.log("[SubscriptionPlanFormats] Loaded addon formats from IndexedDB"))}const a=await F("subscription_plan_formats_lastFetchTime");if(a&&(t.current.lastFetchTime=a),t.current.formats&&t.current.addonFormats&&Date.now()-t.current.lastFetchTime<i*1e3){e(!1);return}await l()}catch(a){r&&console.error("[SubscriptionPlanFormats] Error loading cached formats:",a),await l()}})()},[i]),b(()=>{s&&n&&e(!1)},[s,n]),E(S.Provider,{value:{formats:(s||t.current.formats)??null,addonFormats:(n||t.current.addonFormats)??null,fetchFormats:l,loading:g},children:_})};function R(){return x(S)}var B=D;export{D as SubscriptionPlanFormatsProvider,B as default,R as useSubscriptionPlanFormats};
@@ -0,0 +1 @@
1
+ import{jsx as p}from"react/jsx-runtime";import{useAxios as P}from"@dashadmin/dash-axios-hook";import{createContext as x,useContext as w,useState as h,useRef as D,useEffect as y}from"react";const E="SystemRequestsCacheDB",i="kvstore",T=1;function C(){return new Promise((t,n)=>{const r=indexedDB.open(E,T);r.onupgradeneeded=()=>{r.result.createObjectStore(i)},r.onsuccess=()=>t(r.result),r.onerror=()=>n(r.error)})}async function S(t,n){const r=await C();return new Promise((c,m)=>{const e=r.transaction(i,"readwrite");e.objectStore(i).put(n,t),e.oncomplete=()=>c(),e.onerror=()=>m(e.error)})}async function R(t){const n=await C();return new Promise((r,c)=>{const e=n.transaction(i,"readonly").objectStore(i).get(t);e.onsuccess=()=>r(e.result),e.onerror=()=>c(e.error)})}const o=!0,g=x({formats:null,fetchFormats:async()=>{},loading:!1}),$=({cacheKey:t,apiUrl:n,cacheSeconds:r=10,children:c})=>{const m=P(),e=D({fetchPromise:null,formats:null,lastFetchTime:0}),[f,u]=h(e.current.formats),[q,a]=h(!e.current.formats&&!e.current.fetchPromise),l=async()=>{if(o&&console.log(`[SystemRequestsCache] fetchFormats called for key=${t}, url=${n}`),e.current.fetchPromise)return o&&console.log(`[SystemRequestsCache] fetchPromise already in progress for key=${t}`),e.current.fetchPromise;const d=Date.now();if(!e.current.lastFetchTime)try{e.current.lastFetchTime=await R(t)||0,o&&console.log(`[SystemRequestsCache] Loaded lastFetchTime from IndexedDB: ${e.current.lastFetchTime}`)}catch(s){o&&console.error("[SystemRequestsCache] Error reading lastFetchTime from IndexedDB:",s)}if(e.current.formats&&d-e.current.lastFetchTime<r*1e3){o&&console.log(`[SystemRequestsCache] Using cached formats for key=${t} (age: ${(d-e.current.lastFetchTime)/1e3}s)`),f||u(e.current.formats);return}return a(!0),e.current.fetchPromise=(async()=>{try{o&&console.log(`[SystemRequestsCache] FETCHING ${n} for key=${t}`);const{data:s}=await m.get(n);e.current.formats=s,e.current.lastFetchTime=Date.now(),u(s);try{await S(t,e.current.lastFetchTime),await S(`${t}_formats`,s),o&&console.log(`[SystemRequestsCache] Saved formats and lastFetchTime to IndexedDB for key=${t}`)}catch(F){o&&console.error("[SystemRequestsCache] Error writing to IndexedDB:",F)}}catch(s){o&&console.error("[SystemRequestsCache] Error fetching settings formats:",s)}finally{a(!1),e.current.fetchPromise=null,o&&console.log(`[SystemRequestsCache] fetchPromise cleared for key=${t}`)}})(),e.current.fetchPromise};return y(()=>{(async()=>{o&&console.log(`[SystemRequestsCache] loadCachedFormats for key=${t}`);try{if(!e.current.formats){const s=await R(`${t}_formats`);s&&(e.current.formats=s,u(s),a(!1),o&&console.log(`[SystemRequestsCache] Loaded formats from IndexedDB for key=${t}`))}e.current.formats||a(!0),await l()}catch(s){o&&console.error("[SystemRequestsCache] Error loading cached formats:",s),a(!0),await l()}})()},[t,n,r]),y(()=>{f&&a(!1)},[f]),p(g.Provider,{value:{formats:(f||e.current.formats)??null,fetchFormats:l,loading:q},children:c})};function v(){return w(g)}var k=$;export{$ as SystemRequestsCacheProvider,k as default,R as idbGet,S as idbSet,v as useSystemRequestsCache};