@ibdop/platform-kit 1.0.12 → 1.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -0
- package/dist/components/ErrorBoundary.d.ts +0 -0
- package/dist/components/ErrorBoundary.d.ts.map +0 -0
- package/dist/components/Notification.d.ts +0 -0
- package/dist/components/Notification.d.ts.map +0 -0
- package/dist/components/VersionInfo.d.ts +0 -0
- package/dist/components/VersionInfo.d.ts.map +0 -0
- package/dist/components/index.d.ts +0 -0
- package/dist/components/index.d.ts.map +0 -0
- package/dist/hooks/index.d.ts +2 -1
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/useApi.d.ts +13 -2
- package/dist/hooks/useApi.d.ts.map +1 -1
- package/dist/hooks/useFeatures.d.ts +0 -0
- package/dist/hooks/useFeatures.d.ts.map +0 -0
- package/dist/hooks/useInfoData.d.ts +0 -0
- package/dist/hooks/useInfoData.d.ts.map +0 -0
- package/dist/hooks/usePermissions.d.ts +0 -0
- package/dist/hooks/usePermissions.d.ts.map +0 -0
- package/dist/hooks/useShellAuth.d.ts +0 -0
- package/dist/hooks/useShellAuth.d.ts.map +0 -0
- package/dist/hooks/useV1Config.d.ts +0 -0
- package/dist/hooks/useV1Config.d.ts.map +0 -0
- package/dist/index.d.ts +0 -0
- package/dist/index.d.ts.map +0 -0
- package/dist/index.js +10 -10
- package/dist/index.mjs +854 -809
- package/dist/index.umd.js +9 -9
- package/dist/services/api.d.ts +0 -0
- package/dist/services/api.d.ts.map +1 -1
- package/dist/services/index.d.ts +0 -0
- package/dist/services/index.d.ts.map +0 -0
- package/dist/services/logger.d.ts +0 -0
- package/dist/services/logger.d.ts.map +0 -0
- package/dist/types/index.d.ts +0 -23
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/index.d.ts +0 -0
- package/dist/utils/index.d.ts.map +0 -0
- package/dist/utils/mfeName.d.ts +0 -0
- package/dist/utils/mfeName.d.ts.map +0 -0
- package/dist/utils/shellAuth.d.ts +1 -0
- package/dist/utils/shellAuth.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/ErrorBoundary.tsx +0 -0
- package/src/components/Notification.tsx +0 -0
- package/src/components/VersionInfo.tsx +0 -0
- package/src/components/index.ts +0 -0
- package/src/global.d.ts +0 -0
- package/src/hooks/index.ts +2 -1
- package/src/hooks/useApi.ts +48 -40
- package/src/hooks/useFeatures.ts +0 -0
- package/src/hooks/useInfoData.ts +0 -0
- package/src/hooks/usePermissions.ts +0 -0
- package/src/hooks/useShellAuth.ts +0 -0
- package/src/hooks/useV1Config.ts +0 -0
- package/src/index.ts +0 -0
- package/src/services/api.ts +12 -1
- package/src/services/index.ts +0 -0
- package/src/services/logger.ts +0 -0
- package/src/types/index.ts +1 -24
- package/src/utils/index.ts +0 -0
- package/src/utils/mfeName.ts +0 -0
- package/src/utils/shellAuth.ts +31 -1
package/dist/index.umd.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
(function(_,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("react"),require("axios")):typeof define=="function"&&define.amd?define(["exports","react","axios"],o):(_=typeof globalThis<"u"?globalThis:_||self,o(_.PlatformKit={},_.React,_.axios))})(this,(function(_,o,ut){"use strict";function U(){if(typeof window>"u")return null;const t=window;if(t.__SHELL_AUTH_INSTANCE__)return t.__SHELL_AUTH_INSTANCE__;const n=window;return n.__SHELL_AUTH__?.authInstance?n.__SHELL_AUTH__.authInstance:null}function we(){const t=U();return t?{isAuthenticated:t.isAuthenticated,user:t.user??void 0}:{isAuthenticated:!1}}function lt(){const t=U();return t?.isAuthenticated?t.user?.profile?.access_token??null:null}function ft(){return U()?.isAuthenticated??!1}async function be(){const t=U();t?.signinRedirect?await t.signinRedirect():typeof window<"u"&&(window.location.href="/")}async function dt(){const t=U();t?.removeUser&&await t.removeUser()}const Se={log:(...t)=>{},warn:(...t)=>{}};function Y(){const[t,n]=o.useState(null),[s,c]=o.useState(!0),l=o.useRef(0),h=20,r=o.useCallback(()=>U(),[]);o.useEffect(()=>{const w=r();if(w){n(w),c(!1);return}const d=u=>{n(u.detail),c(!1)},g=setInterval(()=>{l.current++;const u=r();u?(Se.log("Auth found via polling, attempts:",l.current),n(u),c(!1),clearInterval(g)):l.current>=h&&(c(!1),clearInterval(g))},500);return window.addEventListener("shell-auth-ready",d),()=>{clearInterval(g),window.removeEventListener("shell-auth-ready",d)}},[r]);const f=t||{user:null,isAuthenticated:!1,isLoading:s,signinRedirect:async()=>{const w=U();w?.signinRedirect?await w.signinRedirect():typeof window<"u"&&(window.location.href="/")},removeUser:async()=>{const w=U();w?.removeUser&&await w.removeUser()}};return Se.log("Auth result:",{isAuthenticated:f.isAuthenticated,isLoading:f.isLoading}),f}const pt={log:(...t)=>{},warn:(...t)=>{},error:(...t)=>{console.error("[useInfoData]",...t)}};function ht(t){if(t)return t;if(typeof window<"u"){const n=window;if(n.__MF_NAME__)return n.__MF_NAME__}return"unknown-mfe"}function xe(t){const[n,s]=o.useState(null),[c,l]=o.useState(!0),[h,r]=o.useState(null),v=o.useCallback(()=>{const w=ht(t?.mfeName).replace("@ib-dop/","");l(!0),r(null),fetch(`/svc/${w}/info.json`).then(d=>{if(!d.ok)throw new Error(`HTTP ${d.status}: ${d.statusText}`);return d.json()}).then(d=>{s(d)}).catch(d=>{pt.error("Failed to load info:",d),r(d instanceof Error?d.message:String(d))}).finally(()=>{l(!1)})},[t?.mfeName]);return o.useEffect(()=>{v()},[v]),{data:n,isLoading:c,error:h,refetch:v}}const ie={log:(...t)=>{},warn:(...t)=>{},error:(...t)=>{console.error("[useV1Config]",...t)}},q={authority:"",client_id:"",environment:"development"};function gt(){const[t,n]=o.useState(null),[s,c]=o.useState(!0),[l,h]=o.useState(null);return o.useEffect(()=>{(()=>{if(typeof sessionStorage>"u"){h("sessionStorage not available"),n(q),c(!1);return}try{const v=sessionStorage.getItem("config");if(v){const f=JSON.parse(v);n({...q,...f}),h(null),ie.log("Config loaded successfully")}else n(q),h("Config not found in sessionStorage"),ie.warn("Config not found in sessionStorage")}catch(v){ie.error("Error parsing config:",v),n(q),h("Error parsing config")}finally{c(!1)}})()},[]),{data:t,isLoading:s,error:l}}function Ce(t){if(typeof window>"u")return;const n=window.__MF_NAME__||"unknown",s={...t,mfeName:n,timestamp:Date.now()};window.dispatchEvent(new CustomEvent("mfe-notification",{detail:s,bubbles:!0}))}function Ae(t,n){const s={network:{title:"Нет подключения",message:"Сервер недоступен. Проверьте подключение к интернету."},unauthorized:{title:"Требуется вход",message:"Ваша сессия истекла. Войдите в систему снова."},forbidden:{title:"Доступ запрещён",message:"У вас нет прав для выполнения этого действия."},not_found:{title:"Не найдено",message:"Запрошенный ресурс не найден."},server:{title:"Ошибка сервера",message:"Произошла ошибка на сервере. Попробуйте позже."},client:{title:"Ошибка",message:t.message||"Произошла ошибка при выполнении запроса."},unknown:{title:"Неизвестная ошибка",message:t.message||"Произошла неизвестная ошибка."}},c=s[t.type]||s.unknown;Ce({type:t.type==="network"?"warning":"error",title:c.title,message:n?`${c.message} (${n})`:c.message})}function mt(t){return t instanceof Error&&t.name==="AbortError"}function _t(t,n={}){const{notifyOnError:s=!0,notifyOnSuccess:c=!1,successMessage:l,errorContext:h,onSuccess:r,onError:v}=n,[f,w]=o.useState(null),[d,g]=o.useState(null),[u,b]=o.useState(!1),y=o.useRef(null),N=d!==null,T=f!==null&&!u&&!N;o.useEffect(()=>()=>{y.current&&y.current.abort()},[]);const C=o.useCallback(()=>{y.current&&(y.current.abort(),y.current=null,b(!1))},[]),E=o.useCallback(async()=>{y.current&&y.current.abort(),y.current=new AbortController;const j=y.current.signal;b(!0),g(null);try{const P=await t(j);if(j.aborted)return null;if(P.ok)return w(P.data),c&&l&&Ce({type:"success",title:"Успешно",message:l}),r?.(P.data),P.data;{const V={message:P.data||"Request failed",status:P.status,type:"client",timestamp:Date.now()};return g(V),s&&Ae(V,h),v?.(V),null}}catch(P){if(mt(P))return null;const V=P;return g(V),s&&Ae(V,h),v?.(V),null}finally{j.aborted||b(!1),y.current=null}},[t,s,c,l,h,r,v]),R=o.useCallback(()=>{w(null),g(null),b(!1)},[]);return{data:f,error:d,isLoading:u,isError:N,isSuccess:T,execute:E,reset:R,abort:C}}const vt={canView:["all"],canEdit:["ibdop-user","ibdop-admin","ibdop-devops"],canDelete:["ibdop-admin","ibdop-devops"],canAdmin:["ibdop-admin"],canViewSensitiveData:["ibdop-admin","ibdop-devops"],canExportData:["ibdop-user"],canManageUsers:["ibdop-admin"]};function Et(t={}){const n=Y(),s=o.useMemo(()=>({...vt,...t}),[t]),c=o.useMemo(()=>{const h=n.user?.profile?.realm_roles||n.user?.profile?.roles||[];return Array.isArray(h)?h:[h]},[n.user]),l=h=>h.includes("all")?!0:h.some(r=>c.includes(r));return{canView:l(s.canView),canEdit:l(s.canEdit),canDelete:l(s.canDelete),canAdmin:l(s.canAdmin),canViewSensitiveData:l(s.canViewSensitiveData),canExportData:l(s.canExportData),canManageUsers:l(s.canManageUsers)}}function yt(){const t=Y(),[n,s]=o.useState([]),[c,l]=o.useState(0),[h,r]=o.useState([]),[v,f]=o.useState(!0),[w,d]=o.useState(null),g=o.useCallback(async()=>{if(!t.isAuthenticated){console.debug("[useFeatures] Not authenticated"),f(!1);return}f(!0),d(null);try{const y={"Content-Type":"application/json"},N=t.user?.access_token;N&&(y.Authorization=`Bearer ${N}`);const T=await fetch("/api/features",{headers:y});if(!T.ok)throw new Error(`HTTP ${T.status}: ${T.statusText}`);const C=await T.json();s(C.features||[]),l(C.totalCount||0),r(C.userRoles||[])}catch(y){console.debug("Features fetch error:",y),d(y instanceof Error?y.message:String(y)),s([]),r([])}finally{f(!1)}},[t.isAuthenticated,t.user?.access_token]);o.useEffect(()=>{g()},[g]);const u=o.useCallback(y=>n.find(T=>T.name===y)?.userEnabled??!1,[n]),b=o.useCallback(y=>n.filter(N=>N.mfDependencies?.includes(y)),[n]);return{features:n,totalCount:c,userRoles:h,isLoading:v,error:w,refetch:g,isFeatureEnabled:u,getFeaturesByMf:b}}function wt(){const t=Y(),[n,s]=o.useState([]),[c,l]=o.useState([]),[h,r]=o.useState(!1),[v,f]=o.useState(!0),[w,d]=o.useState(null),g=o.useCallback(async()=>{if(!t.isAuthenticated){console.debug("[useFeatureAdmin] Not authenticated"),f(!1);return}f(!0),d(null);try{const T={"Content-Type":"application/json"},C=t.user?.access_token;C&&(T.Authorization=`Bearer ${C}`);const E=await fetch("/api/features/admin",{headers:T});if(!E.ok){if(E.status===403){console.warn("[useFeatureAdmin] 403 Forbidden - checking if token has admin role"),r(!1),s([]),l([]),f(!1);return}throw new Error(`HTTP ${E.status}: ${E.statusText}`)}const R=await E.json();s(R.featureToggles||[]),l(R.microfrontends||[]),r(R.isAdmin||!1)}catch(T){console.debug("FeatureAdmin fetch error:",T),s([]),l([]),r(!1)}finally{f(!1)}},[t.isAuthenticated,t.user?.access_token]),u=o.useCallback(async T=>{try{const C={"Content-Type":"application/json"},E=t.user?.access_token;E&&(C.Authorization=`Bearer ${E}`);const R=await fetch("/api/features/admin",{method:"POST",headers:C,body:JSON.stringify(T)});if(!R.ok){const j=await R.json().catch(()=>({}));throw new Error(j.error||`HTTP ${R.status}`)}return await g(),!0}catch(C){return d(C instanceof Error?C.message:String(C)),!1}},[g]),b=o.useCallback(async(T,C)=>{try{const E={"Content-Type":"application/json"},R=t.user?.access_token;R&&(E.Authorization=`Bearer ${R}`);const j=await fetch(`/api/features/admin/${encodeURIComponent(T)}`,{method:"PUT",headers:E,body:JSON.stringify(C)});if(!j.ok){const P=await j.json().catch(()=>({}));throw new Error(P.error||`HTTP ${j.status}`)}return await g(),!0}catch(E){return d(E instanceof Error?E.message:String(E)),!1}},[g]),y=o.useCallback(async(T,C)=>{try{const E={},R=t.user?.access_token;R&&(E.Authorization=`Bearer ${R}`);const j=await fetch(`/api/features/admin/${encodeURIComponent(T)}/toggle?enabled=${C}`,{method:"POST",headers:E});if(!j.ok){const P=await j.json().catch(()=>({}));throw new Error(P.error||`HTTP ${j.status}`)}return await g(),!0}catch(E){return d(E instanceof Error?E.message:String(E)),!1}},[g]),N=o.useCallback(async T=>{try{const C={},E=t.user?.access_token;E&&(C.Authorization=`Bearer ${E}`);const R=await fetch(`/api/features/admin/${encodeURIComponent(T)}`,{method:"DELETE",headers:C});if(!R.ok){const j=await R.json().catch(()=>({}));throw new Error(j.error||`HTTP ${R.status}`)}return await g(),!0}catch(C){return d(C instanceof Error?C.message:String(C)),!1}},[g]);return o.useEffect(()=>{g()},[g]),{features:n,microfrontends:c,isAdmin:h,isLoading:v,error:w,refetch:g,createFeature:u,updateFeature:b,toggleFeature:y,deleteFeature:N}}function bt(){const t=Y(),[n,s]=o.useState([]),[c,l]=o.useState(0),[h,r]=o.useState(!0),[v,f]=o.useState(null),w=o.useCallback(async()=>{if(!t.isAuthenticated){r(!1);return}r(!0),f(null);try{const d={"Content-Type":"application/json"},g=t.user?.access_token;g&&(d.Authorization=`Bearer ${g}`);const u=await fetch("/api/features/microfrontends",{headers:d});if(!u.ok)throw new Error(`HTTP ${u.status}: ${u.statusText}`);const b=await u.json();s(b.microfrontends||[]),l(b.totalCount||0)}catch(d){f(d instanceof Error?d.message:String(d))}finally{r(!1)}},[t.isAuthenticated,t.user?.access_token]);return o.useEffect(()=>{w()},[w]),{microfrontends:n,totalCount:c,isLoading:h,error:v,refetch:w}}var ee={exports:{}},J={};var ke;function St(){if(ke)return J;ke=1;var t=o,n=Symbol.for("react.element"),s=Symbol.for("react.fragment"),c=Object.prototype.hasOwnProperty,l=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,h={key:!0,ref:!0,__self:!0,__source:!0};function r(v,f,w){var d,g={},u=null,b=null;w!==void 0&&(u=""+w),f.key!==void 0&&(u=""+f.key),f.ref!==void 0&&(b=f.ref);for(d in f)c.call(f,d)&&!h.hasOwnProperty(d)&&(g[d]=f[d]);if(v&&v.defaultProps)for(d in f=v.defaultProps,f)g[d]===void 0&&(g[d]=f[d]);return{$$typeof:n,type:v,key:u,ref:b,props:g,_owner:l.current}}return J.Fragment=s,J.jsx=r,J.jsxs=r,J}var K={};var Te;function xt(){return Te||(Te=1,process.env.NODE_ENV!=="production"&&(function(){var t=o,n=Symbol.for("react.element"),s=Symbol.for("react.portal"),c=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),h=Symbol.for("react.profiler"),r=Symbol.for("react.provider"),v=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),w=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),g=Symbol.for("react.memo"),u=Symbol.for("react.lazy"),b=Symbol.for("react.offscreen"),y=Symbol.iterator,N="@@iterator";function T(e){if(e===null||typeof e!="object")return null;var a=y&&e[y]||e[N];return typeof a=="function"?a:null}var C=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function E(e){{for(var a=arguments.length,i=new Array(a>1?a-1:0),p=1;p<a;p++)i[p-1]=arguments[p];R("error",e,i)}}function R(e,a,i){{var p=C.ReactDebugCurrentFrame,A=p.getStackAddendum();A!==""&&(a+="%s",i=i.concat([A]));var k=i.map(function(x){return String(x)});k.unshift("Warning: "+a),Function.prototype.apply.call(console[e],console,k)}}var j=!1,P=!1,V=!1,Qt=!1,$t=!1,Le;Le=Symbol.for("react.module.reference");function qt(e){return!!(typeof e=="string"||typeof e=="function"||e===c||e===h||$t||e===l||e===w||e===d||Qt||e===b||j||P||V||typeof e=="object"&&e!==null&&(e.$$typeof===u||e.$$typeof===g||e.$$typeof===r||e.$$typeof===v||e.$$typeof===f||e.$$typeof===Le||e.getModuleId!==void 0))}function en(e,a,i){var p=e.displayName;if(p)return p;var A=a.displayName||a.name||"";return A!==""?i+"("+A+")":i}function Ue(e){return e.displayName||"Context"}function B(e){if(e==null)return null;if(typeof e.tag=="number"&&E("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case c:return"Fragment";case s:return"Portal";case h:return"Profiler";case l:return"StrictMode";case w:return"Suspense";case d:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case v:var a=e;return Ue(a)+".Consumer";case r:var i=e;return Ue(i._context)+".Provider";case f:return en(e,e.render,"ForwardRef");case g:var p=e.displayName||null;return p!==null?p:B(e.type)||"Memo";case u:{var A=e,k=A._payload,x=A._init;try{return B(x(k))}catch{return null}}}return null}var W=Object.assign,Q=0,Ve,Be,We,ze,He,Ge,Ye;function Je(){}Je.__reactDisabledLog=!0;function tn(){{if(Q===0){Ve=console.log,Be=console.info,We=console.warn,ze=console.error,He=console.group,Ge=console.groupCollapsed,Ye=console.groupEnd;var e={configurable:!0,enumerable:!0,value:Je,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}Q++}}function nn(){{if(Q--,Q===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:W({},e,{value:Ve}),info:W({},e,{value:Be}),warn:W({},e,{value:We}),error:W({},e,{value:ze}),group:W({},e,{value:He}),groupCollapsed:W({},e,{value:Ge}),groupEnd:W({},e,{value:Ye})})}Q<0&&E("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var pe=C.ReactCurrentDispatcher,he;function re(e,a,i){{if(he===void 0)try{throw Error()}catch(A){var p=A.stack.trim().match(/\n( *(at )?)/);he=p&&p[1]||""}return`
|
|
2
|
-
`+
|
|
3
|
-
`),O=
|
|
1
|
+
(function(g,u){typeof exports=="object"&&typeof module<"u"?u(exports,require("react"),require("axios")):typeof define=="function"&&define.amd?define(["exports","react","axios"],u):(g=typeof globalThis<"u"?globalThis:g||self,u(g.PlatformKit={},g.React,g.axios))})(this,(function(g,u,lt){"use strict";function U(){if(typeof window>"u")return null;const t=window;if(t.__SHELL_AUTH_INSTANCE__)return t.__SHELL_AUTH_INSTANCE__;const n=window;return n.__SHELL_AUTH__?.authInstance?n.__SHELL_AUTH__.authInstance:null}function be(){const t=U();if(!t)return{isAuthenticated:!1};let n;const a=t;if(t.user?.access_token)n=t.user.access_token;else if(t.user?.profile?.access_token)n=t.user.profile.access_token;else if(typeof a.getAccessToken=="function")try{const o=a.getAccessToken();o instanceof Promise?console.warn("[shellAuth] getAccessToken returned Promise - token may not be available synchronously"):typeof o=="string"&&(n=o)}catch(o){console.warn("[shellAuth] Failed to get access token via getAccessToken:",o)}return{isAuthenticated:t.isAuthenticated,user:t.user?{...t.user,access_token:n}:void 0}}function ft(){const t=U();return t?.isAuthenticated?t.user?.profile?.access_token??null:null}function dt(){return U()?.isAuthenticated??!1}async function Se(){const t=U();t?.signinRedirect?await t.signinRedirect():typeof window<"u"&&(window.location.href="/")}async function pt(){const t=U();t?.removeUser&&await t.removeUser()}const ke={log:(...t)=>{},warn:(...t)=>{}};function J(){const[t,n]=u.useState(null),[a,o]=u.useState(!0),i=u.useRef(0),p=20,r=u.useCallback(()=>U(),[]);u.useEffect(()=>{const E=r();if(E){n(E),o(!1);return}const l=d=>{n(d.detail),o(!1)},_=setInterval(()=>{i.current++;const d=r();d?(ke.log("Auth found via polling, attempts:",i.current),n(d),o(!1),clearInterval(_)):i.current>=p&&(o(!1),clearInterval(_))},500);return window.addEventListener("shell-auth-ready",l),()=>{clearInterval(_),window.removeEventListener("shell-auth-ready",l)}},[r]);const f=t||{user:null,isAuthenticated:!1,isLoading:a,signinRedirect:async()=>{const E=U();E?.signinRedirect?await E.signinRedirect():typeof window<"u"&&(window.location.href="/")},removeUser:async()=>{const E=U();E?.removeUser&&await E.removeUser()}};return ke.log("Auth result:",{isAuthenticated:f.isAuthenticated,isLoading:f.isLoading}),f}const ht={log:(...t)=>{},warn:(...t)=>{},error:(...t)=>{console.error("[useInfoData]",...t)}};function gt(t){if(t)return t;if(typeof window<"u"){const n=window;if(n.__MF_NAME__)return n.__MF_NAME__}return"unknown-mfe"}function Ae(t){const[n,a]=u.useState(null),[o,i]=u.useState(!0),[p,r]=u.useState(null),h=u.useCallback(()=>{const E=gt(t?.mfeName).replace("@ib-dop/","");i(!0),r(null),fetch(`/svc/${E}/info.json`).then(l=>{if(!l.ok)throw new Error(`HTTP ${l.status}: ${l.statusText}`);return l.json()}).then(l=>{a(l)}).catch(l=>{ht.error("Failed to load info:",l),r(l instanceof Error?l.message:String(l))}).finally(()=>{i(!1)})},[t?.mfeName]);return u.useEffect(()=>{h()},[h]),{data:n,isLoading:o,error:p,refetch:h}}const ue={log:(...t)=>{},warn:(...t)=>{},error:(...t)=>{console.error("[useV1Config]",...t)}},ee={authority:"",client_id:"",environment:"development"};function mt(){const[t,n]=u.useState(null),[a,o]=u.useState(!0),[i,p]=u.useState(null);return u.useEffect(()=>{(()=>{if(typeof sessionStorage>"u"){p("sessionStorage not available"),n(ee),o(!1);return}try{const h=sessionStorage.getItem("config");if(h){const f=JSON.parse(h);n({...ee,...f}),p(null),ue.log("Config loaded successfully")}else n(ee),p("Config not found in sessionStorage"),ue.warn("Config not found in sessionStorage")}catch(h){ue.error("Error parsing config:",h),n(ee),p("Error parsing config")}finally{o(!1)}})()},[]),{data:t,isLoading:a,error:i}}const Ce="platform-kit",te={log:(...t)=>{},warn:(...t)=>{},error:(...t)=>{console.error(`[${Ce}]`,...t)},info:(...t)=>{}};function _t(t){const n=t.response;let a="unknown";return n?n.status===401?a="unauthorized":n.status===403?a="forbidden":n.status===404?a="not_found":n.status>=500&&(a="server"):a="network",{message:n?.data?.message??t.message??"Unknown error",code:n?.data?.code,status:n?.status,type:a,timestamp:Date.now(),url:t.config?.url}}const vt=3,yt=1e3;function Et(t){return!t||t>=500||t===429}function wt(t){return new Promise(n=>setTimeout(n,t))}function xe(t={}){const n=t.name||Ce,a=t.retries??vt,o=t.retryDelay??yt,i={log:(...r)=>te.log(`[API:${n}]`,...r),warn:(...r)=>te.warn(`[API:${n}]`,...r),error:(...r)=>te.error(`[API:${n}]`,...r),info:(...r)=>te.info(`[API:${n}]`,...r)},p=lt.create({timeout:t.timeout??1e4,baseURL:t.baseURL??"",headers:{"Content-Type":"application/json"}});return p.interceptors.request.use(r=>{const h=be();if(i.info("Auth state check:",{isAuthenticated:h?.isAuthenticated,hasUser:!!h?.user,userKeys:h?.user?Object.keys(h.user):[],token:h?.user?.access_token?"(present)":"(missing)"}),h?.isAuthenticated){const f=h.user?.access_token||h.user?.profile?.access_token;f&&r.headers?(r.headers.Authorization=`Bearer ${f}`,i.info("Auth token attached")):i.warn("User is authenticated but no token found in authState.user or authState.user.profile")}else i.info("User not authenticated - request without token");return i.log(`${r.method?.toUpperCase()} ${r.url}`),r},r=>(i.error("Request interceptor error:",r.message),Promise.reject(r))),p.interceptors.response.use(r=>(i.log(`Response ${r.status}:`,r.config.url),r),async r=>{const h=r.response?.status,f=r.config?.url,E=r.config?._retryCount??0;if(Et(h)&&E<a){const l=r.config;l._retryCount=E+1;const _=o*Math.pow(2,E);return i.warn(`Retrying (${l._retryCount}/${a}) after ${_}ms:`,f),await wt(_),p.request(l)}return h===401?(i.warn("401 Unauthorized - triggering re-auth"),Se()):h===403?i.warn("403 Forbidden - insufficient permissions"):h===404?i.warn("404 Not found:",f):h===429?i.warn("429 Rate limited"):h===500?i.error("500 Server error:",f):r.response?i.warn(`Error ${h}:`,r.message):i.error("Network error - backend may be unavailable:",f),Promise.reject(_t(r))}),p}const V=xe();async function bt(t,n,a=V){const o=await a.get(t,{params:n});return{data:o.data,status:o.status,ok:o.status>=200&&o.status<300}}async function St(t,n,a=V){const o=await a.post(t,n);return{data:o.data,status:o.status,ok:o.status>=200&&o.status<300}}async function kt(t,n,a=V){const o=await a.put(t,n);return{data:o.data,status:o.status,ok:o.status>=200&&o.status<300}}async function At(t,n=V){const a=await n.delete(t);return{data:a.data,status:a.status,ok:a.status>=200&&a.status<300}}function Te(t){if(typeof window>"u")return;const n=window.__MF_NAME__||"unknown",a={...t,mfeName:n,timestamp:Date.now()};window.dispatchEvent(new CustomEvent("mfe-notification",{detail:a,bubbles:!0}))}function Re(t,n){const a={network:{title:"Нет подключения",message:"Сервер недоступен. Проверьте подключение к интернету."},unauthorized:{title:"Требуется вход",message:"Ваша сессия истекла. Войдите в систему снова."},forbidden:{title:"Доступ запрещён",message:"У вас нет прав для выполнения этого действия."},not_found:{title:"Не найдено",message:"Запрошенный ресурс не найден."},server:{title:"Ошибка сервера",message:"Произошла ошибка на сервере. Попробуйте позже."},client:{title:"Ошибка",message:t.message||"Произошла ошибка при выполнении запроса."},unknown:{title:"Неизвестная ошибка",message:t.message||"Произошла неизвестная ошибка."}},o=a[t.type]||a.unknown;Te({type:t.type==="network"?"warning":"error",title:o.title,message:n?`${o.message} (${n})`:o.message})}function Ct(t){return t instanceof Error&&t.name==="AbortError"}function K(t,n={}){const{notifyOnError:a=!0,notifyOnSuccess:o=!1,successMessage:i,errorContext:p,onSuccess:r,onError:h}=n,[f,E]=u.useState(null),[l,_]=u.useState(null),[d,b]=u.useState(!1),w=u.useRef(null),N=l!==null,T=f!==null&&!d&&!N;u.useEffect(()=>()=>{w.current&&w.current.abort()},[]);const A=u.useCallback(()=>{w.current&&(w.current.abort(),w.current=null,b(!1))},[]),y=u.useCallback(async()=>{w.current&&w.current.abort(),w.current=new AbortController;const j=w.current.signal;b(!0),_(null);try{const P=await t(j);if(j.aborted)return null;if(P.ok)return E(P.data),o&&i&&Te({type:"success",title:"Успешно",message:i}),r?.(P.data),P.data;{const B={message:P.data||"Request failed",status:P.status,type:"client",timestamp:Date.now()};return _(B),a&&Re(B,p),h?.(B),null}}catch(P){if(Ct(P))return null;const B=P;return _(B),a&&Re(B,p),h?.(B),null}finally{j.aborted||b(!1),w.current=null}},[t,a,o,i,p,r,h]),R=u.useCallback(()=>{E(null),_(null),b(!1)},[]);return{data:f,error:l,isLoading:d,isError:N,isSuccess:T,execute:y,reset:R,abort:A}}function xt(t,n={}){const{skip:a=!1,headers:o,immediate:i=!0,...p}=n,r=u.useMemo(()=>f=>{const E=o?o():{};return V.get(t,{headers:{"Content-Type":"application/json",...E},signal:f}).then(l=>({data:l.data,status:l.status,ok:l.status>=200&&l.status<300}))},[t,o]),h=K(r,{...p});return u.useEffect(()=>{i&&!a&&h.execute()},[i,a,t]),h}function Tt(t,n,a={}){return K(i=>V.post(t,n,{signal:i}).then(p=>({data:p.data,status:p.status,ok:p.status>=200&&p.status<300})),a)}function Rt(t,n,a={}){return K(i=>V.put(t,n,{signal:i}).then(p=>({data:p.data,status:p.status,ok:p.status>=200&&p.status<300})),a)}function Mt(t,n={}){return K(o=>V.delete(t,{signal:o}).then(i=>({data:i.data,status:i.status,ok:i.status>=200&&i.status<300})),n)}const It={canView:["all"],canEdit:["ibdop-user","ibdop-admin","ibdop-devops"],canDelete:["ibdop-admin","ibdop-devops"],canAdmin:["ibdop-admin"],canViewSensitiveData:["ibdop-admin","ibdop-devops"],canExportData:["ibdop-user"],canManageUsers:["ibdop-admin"]};function Nt(t={}){const n=J(),a=u.useMemo(()=>({...It,...t}),[t]),o=u.useMemo(()=>{const p=n.user?.profile?.realm_roles||n.user?.profile?.roles||[];return Array.isArray(p)?p:[p]},[n.user]),i=p=>p.includes("all")?!0:p.some(r=>o.includes(r));return{canView:i(a.canView),canEdit:i(a.canEdit),canDelete:i(a.canDelete),canAdmin:i(a.canAdmin),canViewSensitiveData:i(a.canViewSensitiveData),canExportData:i(a.canExportData),canManageUsers:i(a.canManageUsers)}}function jt(){const t=J(),[n,a]=u.useState([]),[o,i]=u.useState(0),[p,r]=u.useState([]),[h,f]=u.useState(!0),[E,l]=u.useState(null),_=u.useCallback(async()=>{if(!t.isAuthenticated){console.debug("[useFeatures] Not authenticated"),f(!1);return}f(!0),l(null);try{const w={"Content-Type":"application/json"},N=t.user?.access_token;N&&(w.Authorization=`Bearer ${N}`);const T=await fetch("/api/features",{headers:w});if(!T.ok)throw new Error(`HTTP ${T.status}: ${T.statusText}`);const A=await T.json();a(A.features||[]),i(A.totalCount||0),r(A.userRoles||[])}catch(w){console.debug("Features fetch error:",w),l(w instanceof Error?w.message:String(w)),a([]),r([])}finally{f(!1)}},[t.isAuthenticated,t.user?.access_token]);u.useEffect(()=>{_()},[_]);const d=u.useCallback(w=>n.find(T=>T.name===w)?.userEnabled??!1,[n]),b=u.useCallback(w=>n.filter(N=>N.mfDependencies?.includes(w)),[n]);return{features:n,totalCount:o,userRoles:p,isLoading:h,error:E,refetch:_,isFeatureEnabled:d,getFeaturesByMf:b}}function Pt(){const t=J(),[n,a]=u.useState([]),[o,i]=u.useState([]),[p,r]=u.useState(!1),[h,f]=u.useState(!0),[E,l]=u.useState(null),_=u.useCallback(async()=>{if(!t.isAuthenticated){console.debug("[useFeatureAdmin] Not authenticated"),f(!1);return}f(!0),l(null);try{const T={"Content-Type":"application/json"},A=t.user?.access_token;A&&(T.Authorization=`Bearer ${A}`);const y=await fetch("/api/features/admin",{headers:T});if(!y.ok){if(y.status===403){console.warn("[useFeatureAdmin] 403 Forbidden - checking if token has admin role"),r(!1),a([]),i([]),f(!1);return}throw new Error(`HTTP ${y.status}: ${y.statusText}`)}const R=await y.json();a(R.featureToggles||[]),i(R.microfrontends||[]),r(R.isAdmin||!1)}catch(T){console.debug("FeatureAdmin fetch error:",T),a([]),i([]),r(!1)}finally{f(!1)}},[t.isAuthenticated,t.user?.access_token]),d=u.useCallback(async T=>{try{const A={"Content-Type":"application/json"},y=t.user?.access_token;y&&(A.Authorization=`Bearer ${y}`);const R=await fetch("/api/features/admin",{method:"POST",headers:A,body:JSON.stringify(T)});if(!R.ok){const j=await R.json().catch(()=>({}));throw new Error(j.error||`HTTP ${R.status}`)}return await _(),!0}catch(A){return l(A instanceof Error?A.message:String(A)),!1}},[_]),b=u.useCallback(async(T,A)=>{try{const y={"Content-Type":"application/json"},R=t.user?.access_token;R&&(y.Authorization=`Bearer ${R}`);const j=await fetch(`/api/features/admin/${encodeURIComponent(T)}`,{method:"PUT",headers:y,body:JSON.stringify(A)});if(!j.ok){const P=await j.json().catch(()=>({}));throw new Error(P.error||`HTTP ${j.status}`)}return await _(),!0}catch(y){return l(y instanceof Error?y.message:String(y)),!1}},[_]),w=u.useCallback(async(T,A)=>{try{const y={},R=t.user?.access_token;R&&(y.Authorization=`Bearer ${R}`);const j=await fetch(`/api/features/admin/${encodeURIComponent(T)}/toggle?enabled=${A}`,{method:"POST",headers:y});if(!j.ok){const P=await j.json().catch(()=>({}));throw new Error(P.error||`HTTP ${j.status}`)}return await _(),!0}catch(y){return l(y instanceof Error?y.message:String(y)),!1}},[_]),N=u.useCallback(async T=>{try{const A={},y=t.user?.access_token;y&&(A.Authorization=`Bearer ${y}`);const R=await fetch(`/api/features/admin/${encodeURIComponent(T)}`,{method:"DELETE",headers:A});if(!R.ok){const j=await R.json().catch(()=>({}));throw new Error(j.error||`HTTP ${R.status}`)}return await _(),!0}catch(A){return l(A instanceof Error?A.message:String(A)),!1}},[_]);return u.useEffect(()=>{_()},[_]),{features:n,microfrontends:o,isAdmin:p,isLoading:h,error:E,refetch:_,createFeature:d,updateFeature:b,toggleFeature:w,deleteFeature:N}}function Ot(){const t=J(),[n,a]=u.useState([]),[o,i]=u.useState(0),[p,r]=u.useState(!0),[h,f]=u.useState(null),E=u.useCallback(async()=>{if(!t.isAuthenticated){r(!1);return}r(!0),f(null);try{const l={"Content-Type":"application/json"},_=t.user?.access_token;_&&(l.Authorization=`Bearer ${_}`);const d=await fetch("/api/features/microfrontends",{headers:l});if(!d.ok)throw new Error(`HTTP ${d.status}: ${d.statusText}`);const b=await d.json();a(b.microfrontends||[]),i(b.totalCount||0)}catch(l){f(l instanceof Error?l.message:String(l))}finally{r(!1)}},[t.isAuthenticated,t.user?.access_token]);return u.useEffect(()=>{E()},[E]),{microfrontends:n,totalCount:o,isLoading:p,error:h,refetch:E}}var ne={exports:{}},X={};var Me;function Ft(){if(Me)return X;Me=1;var t=u,n=Symbol.for("react.element"),a=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,i=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:!0,ref:!0,__self:!0,__source:!0};function r(h,f,E){var l,_={},d=null,b=null;E!==void 0&&(d=""+E),f.key!==void 0&&(d=""+f.key),f.ref!==void 0&&(b=f.ref);for(l in f)o.call(f,l)&&!p.hasOwnProperty(l)&&(_[l]=f[l]);if(h&&h.defaultProps)for(l in f=h.defaultProps,f)_[l]===void 0&&(_[l]=f[l]);return{$$typeof:n,type:h,key:d,ref:b,props:_,_owner:i.current}}return X.Fragment=a,X.jsx=r,X.jsxs=r,X}var Z={};var Ie;function Dt(){return Ie||(Ie=1,process.env.NODE_ENV!=="production"&&(function(){var t=u,n=Symbol.for("react.element"),a=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),p=Symbol.for("react.profiler"),r=Symbol.for("react.provider"),h=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),E=Symbol.for("react.suspense"),l=Symbol.for("react.suspense_list"),_=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),b=Symbol.for("react.offscreen"),w=Symbol.iterator,N="@@iterator";function T(e){if(e===null||typeof e!="object")return null;var s=w&&e[w]||e[N];return typeof s=="function"?s:null}var A=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function y(e){{for(var s=arguments.length,c=new Array(s>1?s-1:0),m=1;m<s;m++)c[m-1]=arguments[m];R("error",e,c)}}function R(e,s,c){{var m=A.ReactDebugCurrentFrame,C=m.getStackAddendum();C!==""&&(s+="%s",c=c.concat([C]));var x=c.map(function(k){return String(k)});x.unshift("Warning: "+s),Function.prototype.apply.call(console[e],console,x)}}var j=!1,P=!1,B=!1,tn=!1,nn=!1,Ue;Ue=Symbol.for("react.module.reference");function rn(e){return!!(typeof e=="string"||typeof e=="function"||e===o||e===p||nn||e===i||e===E||e===l||tn||e===b||j||P||B||typeof e=="object"&&e!==null&&(e.$$typeof===d||e.$$typeof===_||e.$$typeof===r||e.$$typeof===h||e.$$typeof===f||e.$$typeof===Ue||e.getModuleId!==void 0))}function sn(e,s,c){var m=e.displayName;if(m)return m;var C=s.displayName||s.name||"";return C!==""?c+"("+C+")":c}function Ve(e){return e.displayName||"Context"}function W(e){if(e==null)return null;if(typeof e.tag=="number"&&y("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case o:return"Fragment";case a:return"Portal";case p:return"Profiler";case i:return"StrictMode";case E:return"Suspense";case l:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case h:var s=e;return Ve(s)+".Consumer";case r:var c=e;return Ve(c._context)+".Provider";case f:return sn(e,e.render,"ForwardRef");case _:var m=e.displayName||null;return m!==null?m:W(e.type)||"Memo";case d:{var C=e,x=C._payload,k=C._init;try{return W(k(x))}catch{return null}}}return null}var z=Object.assign,q=0,Be,We,ze,He,Ge,Ye,Je;function Ke(){}Ke.__reactDisabledLog=!0;function an(){{if(q===0){Be=console.log,We=console.info,ze=console.warn,He=console.error,Ge=console.group,Ye=console.groupCollapsed,Je=console.groupEnd;var e={configurable:!0,enumerable:!0,value:Ke,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}q++}}function on(){{if(q--,q===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:z({},e,{value:Be}),info:z({},e,{value:We}),warn:z({},e,{value:ze}),error:z({},e,{value:He}),group:z({},e,{value:Ge}),groupCollapsed:z({},e,{value:Ye}),groupEnd:z({},e,{value:Je})})}q<0&&y("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var he=A.ReactCurrentDispatcher,ge;function se(e,s,c){{if(ge===void 0)try{throw Error()}catch(C){var m=C.stack.trim().match(/\n( *(at )?)/);ge=m&&m[1]||""}return`
|
|
2
|
+
`+ge+e}}var me=!1,ae;{var un=typeof WeakMap=="function"?WeakMap:Map;ae=new un}function Xe(e,s){if(!e||me)return"";{var c=ae.get(e);if(c!==void 0)return c}var m;me=!0;var C=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var x;x=he.current,he.current=null,an();try{if(s){var k=function(){throw Error()};if(Object.defineProperty(k.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(k,[])}catch(F){m=F}Reflect.construct(e,[],k)}else{try{k.call()}catch(F){m=F}e.call(k.prototype)}}else{try{throw Error()}catch(F){m=F}e()}}catch(F){if(F&&m&&typeof F.stack=="string"){for(var S=F.stack.split(`
|
|
3
|
+
`),O=m.stack.split(`
|
|
4
4
|
`),M=S.length-1,I=O.length-1;M>=1&&I>=0&&S[M]!==O[I];)I--;for(;M>=1&&I>=0;M--,I--)if(S[M]!==O[I]){if(M!==1||I!==1)do if(M--,I--,I<0||S[M]!==O[I]){var L=`
|
|
5
|
-
`+S[M].replace(" at new "," at ");return e.displayName&&L.includes("<anonymous>")&&(L=L.replace("<anonymous>",e.displayName)),typeof e=="function"&&ae.set(e,L),L}while(M>=1&&I>=0);break}}}finally{
|
|
5
|
+
`+S[M].replace(" at new "," at ");return e.displayName&&L.includes("<anonymous>")&&(L=L.replace("<anonymous>",e.displayName)),typeof e=="function"&&ae.set(e,L),L}while(M>=1&&I>=0);break}}}finally{me=!1,he.current=x,on(),Error.prepareStackTrace=C}var Y=e?e.displayName||e.name:"",H=Y?se(Y):"";return typeof e=="function"&&ae.set(e,H),H}function cn(e,s,c){return Xe(e,!1)}function ln(e){var s=e.prototype;return!!(s&&s.isReactComponent)}function oe(e,s,c){if(e==null)return"";if(typeof e=="function")return Xe(e,ln(e));if(typeof e=="string")return se(e);switch(e){case E:return se("Suspense");case l:return se("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case f:return cn(e.render);case _:return oe(e.type,s,c);case d:{var m=e,C=m._payload,x=m._init;try{return oe(x(C),s,c)}catch{}}}return""}var $=Object.prototype.hasOwnProperty,Ze={},Qe=A.ReactDebugCurrentFrame;function ie(e){if(e){var s=e._owner,c=oe(e.type,e._source,s?s.type:null);Qe.setExtraStackFrame(c)}else Qe.setExtraStackFrame(null)}function fn(e,s,c,m,C){{var x=Function.call.bind($);for(var k in e)if(x(e,k)){var S=void 0;try{if(typeof e[k]!="function"){var O=Error((m||"React class")+": "+c+" type `"+k+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[k]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw O.name="Invariant Violation",O}S=e[k](s,k,m,c,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(M){S=M}S&&!(S instanceof Error)&&(ie(C),y("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",m||"React class",c,k,typeof S),ie(null)),S instanceof Error&&!(S.message in Ze)&&(Ze[S.message]=!0,ie(C),y("Failed %s type: %s",c,S.message),ie(null))}}}var dn=Array.isArray;function _e(e){return dn(e)}function pn(e){{var s=typeof Symbol=="function"&&Symbol.toStringTag,c=s&&e[Symbol.toStringTag]||e.constructor.name||"Object";return c}}function hn(e){try{return qe(e),!1}catch{return!0}}function qe(e){return""+e}function $e(e){if(hn(e))return y("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",pn(e)),qe(e)}var et=A.ReactCurrentOwner,gn={key:!0,ref:!0,__self:!0,__source:!0},tt,nt;function mn(e){if($.call(e,"ref")){var s=Object.getOwnPropertyDescriptor(e,"ref").get;if(s&&s.isReactWarning)return!1}return e.ref!==void 0}function _n(e){if($.call(e,"key")){var s=Object.getOwnPropertyDescriptor(e,"key").get;if(s&&s.isReactWarning)return!1}return e.key!==void 0}function vn(e,s){typeof e.ref=="string"&&et.current}function yn(e,s){{var c=function(){tt||(tt=!0,y("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",s))};c.isReactWarning=!0,Object.defineProperty(e,"key",{get:c,configurable:!0})}}function En(e,s){{var c=function(){nt||(nt=!0,y("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",s))};c.isReactWarning=!0,Object.defineProperty(e,"ref",{get:c,configurable:!0})}}var wn=function(e,s,c,m,C,x,k){var S={$$typeof:n,type:e,key:s,ref:c,props:k,_owner:x};return S._store={},Object.defineProperty(S._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(S,"_self",{configurable:!1,enumerable:!1,writable:!1,value:m}),Object.defineProperty(S,"_source",{configurable:!1,enumerable:!1,writable:!1,value:C}),Object.freeze&&(Object.freeze(S.props),Object.freeze(S)),S};function bn(e,s,c,m,C){{var x,k={},S=null,O=null;c!==void 0&&($e(c),S=""+c),_n(s)&&($e(s.key),S=""+s.key),mn(s)&&(O=s.ref,vn(s,C));for(x in s)$.call(s,x)&&!gn.hasOwnProperty(x)&&(k[x]=s[x]);if(e&&e.defaultProps){var M=e.defaultProps;for(x in M)k[x]===void 0&&(k[x]=M[x])}if(S||O){var I=typeof e=="function"?e.displayName||e.name||"Unknown":e;S&&yn(k,I),O&&En(k,I)}return wn(e,S,O,C,m,et.current,k)}}var ve=A.ReactCurrentOwner,rt=A.ReactDebugCurrentFrame;function G(e){if(e){var s=e._owner,c=oe(e.type,e._source,s?s.type:null);rt.setExtraStackFrame(c)}else rt.setExtraStackFrame(null)}var ye;ye=!1;function Ee(e){return typeof e=="object"&&e!==null&&e.$$typeof===n}function st(){{if(ve.current){var e=W(ve.current.type);if(e)return`
|
|
6
6
|
|
|
7
|
-
Check the render method of \``+e+"`."}return""}}function
|
|
7
|
+
Check the render method of \``+e+"`."}return""}}function Sn(e){return""}var at={};function kn(e){{var s=st();if(!s){var c=typeof e=="string"?e:e.displayName||e.name;c&&(s=`
|
|
8
8
|
|
|
9
|
-
Check the top-level render call using <`+
|
|
9
|
+
Check the top-level render call using <`+c+">.")}return s}}function ot(e,s){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var c=kn(s);if(at[c])return;at[c]=!0;var m="";e&&e._owner&&e._owner!==ve.current&&(m=" It was passed a child from "+W(e._owner.type)+"."),G(e),y('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',c,m),G(null)}}function it(e,s){{if(typeof e!="object")return;if(_e(e))for(var c=0;c<e.length;c++){var m=e[c];Ee(m)&&ot(m,s)}else if(Ee(e))e._store&&(e._store.validated=!0);else if(e){var C=T(e);if(typeof C=="function"&&C!==e.entries)for(var x=C.call(e),k;!(k=x.next()).done;)Ee(k.value)&&ot(k.value,s)}}}function An(e){{var s=e.type;if(s==null||typeof s=="string")return;var c;if(typeof s=="function")c=s.propTypes;else if(typeof s=="object"&&(s.$$typeof===f||s.$$typeof===_))c=s.propTypes;else return;if(c){var m=W(s);fn(c,e.props,"prop",m,e)}else if(s.PropTypes!==void 0&&!ye){ye=!0;var C=W(s);y("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",C||"Unknown")}typeof s.getDefaultProps=="function"&&!s.getDefaultProps.isReactClassApproved&&y("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Cn(e){{for(var s=Object.keys(e.props),c=0;c<s.length;c++){var m=s[c];if(m!=="children"&&m!=="key"){G(e),y("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",m),G(null);break}}e.ref!==null&&(G(e),y("Invalid attribute `ref` supplied to `React.Fragment`."),G(null))}}var ut={};function ct(e,s,c,m,C,x){{var k=rn(e);if(!k){var S="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(S+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var O=Sn();O?S+=O:S+=st();var M;e===null?M="null":_e(e)?M="array":e!==void 0&&e.$$typeof===n?(M="<"+(W(e.type)||"Unknown")+" />",S=" Did you accidentally export a JSX literal instead of a component?"):M=typeof e,y("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",M,S)}var I=bn(e,s,c,C,x);if(I==null)return I;if(k){var L=s.children;if(L!==void 0)if(m)if(_e(L)){for(var Y=0;Y<L.length;Y++)it(L[Y],e);Object.freeze&&Object.freeze(L)}else y("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else it(L,e)}if($.call(s,"key")){var H=W(e),F=Object.keys(s).filter(function(Nn){return Nn!=="key"}),we=F.length>0?"{key: someKey, "+F.join(": ..., ")+": ...}":"{key: someKey}";if(!ut[H+we]){var In=F.length>0?"{"+F.join(": ..., ")+": ...}":"{}";y(`A props object containing a "key" prop is being spread into JSX:
|
|
10
10
|
let props = %s;
|
|
11
11
|
<%s {...props} />
|
|
12
12
|
React keys must be passed directly to JSX without using spread:
|
|
13
13
|
let props = %s;
|
|
14
|
-
<%s key={someKey} {...props} />`,
|
|
14
|
+
<%s key={someKey} {...props} />`,we,H,In,H),ut[H+we]=!0}}return e===o?Cn(I):An(I),I}}function xn(e,s,c){return ct(e,s,c,!0)}function Tn(e,s,c){return ct(e,s,c,!1)}var Rn=Tn,Mn=xn;Z.Fragment=o,Z.jsx=Rn,Z.jsxs=Mn})()),Z}var Ne;function Lt(){return Ne||(Ne=1,process.env.NODE_ENV==="production"?ne.exports=Ft():ne.exports=Dt()),ne.exports}var v=Lt();const je="platform-kit",Ut=!1,ce={log:(...t)=>{},warn:(...t)=>{},error:(...t)=>{console.error(`[${je}]`,...t)}};class Vt extends u.Component{hasDispatched=!1;constructor(n){super(n),this.state={hasError:!1}}getMfeName(){if(this.props.mfeName)return this.props.mfeName;if(typeof window<"u"){const n=window;if(n.__MF_NAME__)return n.__MF_NAME__}return je}shouldShowDetails(){if(this.props.showDetails!==void 0)return this.props.showDetails;if(typeof sessionStorage<"u")try{const n=sessionStorage.getItem("config");if(n){const a=JSON.parse(n);if(a.showErrorDetails!==void 0)return a.showErrorDetails}}catch{}return Ut}dispatchError(n,a){if(this.hasDispatched||typeof window>"u")return;this.hasDispatched=!0;const o=this.getMfeName();ce.error("ErrorBoundary caught:",n);try{window.dispatchEvent(new CustomEvent("mfe-error",{detail:{mfeName:o,error:n.message||String(n),stack:n.stack,componentStack:a?.componentStack,timestamp:Date.now()},bubbles:!0}))}catch(i){ce.error("Failed to dispatch mfe-error event:",i)}}static getDerivedStateFromError(n){return{hasError:!0,error:n}}componentDidCatch(n,a){this.dispatchError(n,a),ce.error("Error info:",a.componentStack)}handleCopy=()=>{const n=`Error in ${this.getMfeName()}:
|
|
15
15
|
${this.state.error?.message}
|
|
16
|
-
${this.state.error?.stack}`;typeof navigator<"u"&&navigator.clipboard&&navigator.clipboard.writeText(n).then(()=>{alert("Ошибка скопирована в буфер обмена")}).catch(()=>{prompt("Скопируйте ошибку:",n)})};handleRetry=()=>{this.setState({hasError:!1,error:void 0}),this.hasDispatched=!1,typeof window<"u"&&window.location.reload()};handleGoHome=()=>{typeof window<"u"&&(window.location.href="/")};render(){if(this.state.hasError){const n=this.state.error?.message||"Unknown error",
|
|
16
|
+
${this.state.error?.stack}`;typeof navigator<"u"&&navigator.clipboard&&navigator.clipboard.writeText(n).then(()=>{alert("Ошибка скопирована в буфер обмена")}).catch(()=>{prompt("Скопируйте ошибку:",n)})};handleRetry=()=>{this.setState({hasError:!1,error:void 0}),this.hasDispatched=!1,typeof window<"u"&&window.location.reload()};handleGoHome=()=>{typeof window<"u"&&(window.location.href="/")};render(){if(this.state.hasError){const n=this.state.error?.message||"Unknown error",a=this.state.error?.stack||"",o=this.shouldShowDetails(),i=this.getMfeName();return v.jsxs("div",{style:{padding:"20px",textAlign:"center",color:"#d32f2f",fontFamily:"monospace",background:"#ffebee",border:"1px solid #ef5350",borderRadius:"4px",margin:"10px"},children:[v.jsxs("h2",{style:{fontSize:"16px",margin:"0 0 8px 0"},children:["⚠️ Ошибка в ",i]}),v.jsx("p",{style:{fontSize:"12px",margin:0},children:"Произошла ошибка в микрофронтенде. Сообщение отправлено в shell."}),o&&v.jsxs("details",{style:{whiteSpace:"pre-wrap",textAlign:"left",marginTop:"10px",background:"#fff",padding:"8px",borderRadius:"4px"},children:[v.jsx("summary",{style:{cursor:"pointer",fontWeight:"bold"},children:"Детали ошибки"}),v.jsxs("pre",{style:{fontSize:"11px",overflow:"auto",maxHeight:"150px",margin:"8px 0 0 0",padding:"8px",background:"#f5f5f5",borderRadius:"4px"},children:[n,a&&`
|
|
17
17
|
|
|
18
|
-
${s}`]})]}),m.jsxs("div",{style:{marginTop:"12px",display:"flex",gap:"8px",justifyContent:"center"},children:[m.jsx("button",{onClick:this.handleCopy,style:{padding:"8px 12px",background:"#666",color:"white",border:"none",borderRadius:"4px",cursor:"pointer"},children:"📋 Копировать"}),m.jsx("button",{onClick:this.handleRetry,style:{padding:"8px 12px",background:"#d32f2f",color:"white",border:"none",borderRadius:"4px",cursor:"pointer"},children:"🔄 Обновить"}),m.jsx("button",{onClick:this.handleGoHome,style:{padding:"8px 12px",background:"#1976d2",color:"white",border:"none",borderRadius:"4px",cursor:"pointer"},children:"🏠 На главную"})]})]})}return this.props.children==null?null:this.props.children}}const D={info:"ℹ️",code:"💻",link:"🔗",user:"👤",clock:"🕐",apps:"📦",storage:"💾",tags:"🏷️",spreadsheet:"📊"};function Tt({mfeName:t}){const{data:n,isLoading:s,error:c}=xe({mfeName:t}),[l,h]=o.useState(!1);if(s)return m.jsxs("span",{className:"text-muted small me-2",children:[m.jsx("span",{className:"me-1",children:"⏳"}),"Загрузка..."]});if(c||!n)return m.jsxs("span",{className:"text-muted small me-2",title:`Ошибка: ${c||"нет данных"}`,children:[m.jsx("span",{className:"me-1",children:"ℹ️"}),"N/A"]});const r=n,v=r.BUILD_VERSION||r.IMAGE_VERSION||r.APP_NAME||"N/A",f=[];return r.APP_NAME&&f.push({key:"APP_NAME",value:r.APP_NAME,label:"Приложение",icon:D.apps}),r.BUILD_VERSION&&f.push({key:"BUILD_VERSION",value:r.BUILD_VERSION,label:"Версия",icon:D.tags}),r.IMAGE_VERSION&&f.push({key:"IMAGE_VERSION",value:r.IMAGE_VERSION,label:"Образ",icon:D.storage}),r.GIT_COMMIT&&f.push({key:"GIT_COMMIT",value:r.GIT_COMMIT,label:"Commit",icon:D.spreadsheet}),r.GIT_BRANCH&&f.push({key:"GIT_BRANCH",value:r.GIT_BRANCH,label:"Ветка",icon:D.spreadsheet}),r.CI_COMMIT_AUTHOR&&f.push({key:"CI_COMMIT_AUTHOR",value:r.CI_COMMIT_AUTHOR,label:"Автор",icon:D.user}),r.CI_COMMIT_TIMESTAMP&&f.push({key:"CI_COMMIT_TIMESTAMP",value:r.CI_COMMIT_TIMESTAMP,label:"Дата",icon:D.clock}),r.CI_JOB_URL&&f.push({key:"CI_JOB_URL",value:r.CI_JOB_URL,label:"CI Job",icon:D.link}),r.CI_PIPELINE_URL&&f.push({key:"CI_PIPELINE_URL",value:r.CI_PIPELINE_URL,label:"Pipeline",icon:D.link}),r.CI_COMMIT_MESSAGE&&(r.CI_COMMIT_MESSAGE.length>60?r.CI_COMMIT_MESSAGE.substring(0,57)+"":r.CI_COMMIT_MESSAGE,f.push({key:"CI_COMMIT_MESSAGE",value:r.CI_COMMIT_MESSAGE,label:"Сообщение",icon:D.code})),m.jsxs("div",{style:{display:"inline-block",position:"relative"},children:[m.jsxs("button",{onClick:()=>h(!l),style:{background:"transparent",border:"none",cursor:"pointer",padding:"4px 8px",fontSize:"14px",display:"inline-flex",alignItems:"center"},title:"Информация о версии",children:[m.jsx("span",{className:"me-1",children:D.info}),m.jsx("span",{className:"text-dark",children:v})]}),l&&m.jsxs("div",{style:{position:"absolute",top:"100%",right:0,zIndex:1e3,minWidth:"300px",background:"white",border:"1px solid #dee2e6",borderRadius:"8px",boxShadow:"0 4px 12px rgba(0,0,0,0.15)",padding:"16px",marginTop:"4px"},children:[m.jsxs("div",{style:{marginBottom:"12px",paddingBottom:"8px",borderBottom:"1px solid #dee2e6",display:"flex",alignItems:"center"},children:[m.jsx("span",{className:"me-2",children:D.apps}),m.jsx("strong",{children:r.APP_NAME||t})]}),m.jsxs("div",{style:{marginBottom:"12px"},children:[m.jsx("span",{className:"text-muted",children:"Версия: "}),m.jsx("strong",{children:v})]}),f.length>0&&m.jsx("div",{style:{fontSize:"13px"},children:f.map(({key:w,value:d,label:g,icon:u})=>{const b=d.length>40&&(w.includes("URL")||w.includes("MESSAGE"))?`${d.substring(0,37)}...`:d;return m.jsxs("div",{style:{marginBottom:"8px",display:"flex",alignItems:"flex-start"},children:[m.jsx("span",{className:"me-2",style:{flexShrink:0},children:u}),m.jsxs("div",{style:{flex:1,minWidth:0},children:[m.jsx("div",{className:"small text-muted",children:g}),m.jsx("div",{className:"font-monospace small text-truncate",style:{maxWidth:"100%"},title:d,children:w.includes("URL")?m.jsx("a",{href:d,target:"_blank",rel:"noopener noreferrer",style:{color:"#007bff"},children:b}):b})]})]},w)})}),f.length===0&&m.jsx("div",{className:"text-center text-muted py-2 small",children:"Нет информации о версии"}),m.jsx("div",{style:{marginTop:"12px",paddingTop:"8px",borderTop:"1px solid #dee2e6",textAlign:"center",fontSize:"12px",color:"#6c757d"},children:"IngoBank DevOps Platform"}),m.jsx("button",{onClick:()=>h(!1),style:{position:"absolute",top:"8px",right:"8px",background:"transparent",border:"none",cursor:"pointer",fontSize:"16px",color:"#6c757d"},children:"×"})]}),l&&m.jsx("div",{onClick:()=>h(!1),style:{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:999}})]})}const ue="platform-kit",Ie=o.createContext(null);function Rt({children:t}){const[n,s]=o.useState([]),c=typeof window<"u"&&window.__MF_NAME__||ue,l=o.useCallback((u,b,y,N)=>({id:`${Date.now()}-${Math.random().toString(36).substr(2,9)}`,type:u,title:b,message:y,mfeName:c,timestamp:Date.now(),duration:N}),[c]),h=o.useCallback(u=>{s(y=>[...y,u].slice(0,5));const b=u.duration||5e3;b>0&&setTimeout(()=>{s(y=>y.filter(N=>N.id!==u.id))},b)},[]),r=o.useCallback(u=>{const b=l(u.type,u.title,u.message,u.duration);h(b),typeof window<"u"&&window.dispatchEvent(new CustomEvent("mfe-notification",{detail:b,bubbles:!0}))},[l,h]),v=o.useCallback((u,b="Успешно")=>{r({type:"success",title:b,message:u})},[r]),f=o.useCallback((u,b="Ошибка")=>{r({type:"error",title:b,message:u})},[r]),w=o.useCallback((u,b="Предупреждение")=>{r({type:"warning",title:b,message:u})},[r]),d=o.useCallback((u,b="Информация")=>{r({type:"info",title:b,message:u})},[r]),g=o.useCallback(u=>{s(b=>b.filter(y=>y.id!==u))},[]);return o.useEffect(()=>{if(typeof window>"u")return;const u=b=>{const y=b.detail;if(y&&y.type&&y.title&&y.message){const N={...y,id:`${Date.now()}-${Math.random().toString(36).substr(2,9)}`};h(N)}};return window.addEventListener("mfe-notification",u),()=>{window.removeEventListener("mfe-notification",u)}},[h]),m.jsxs(Ie.Provider,{value:{notify:r,notifySuccess:v,notifyError:f,notifyWarning:w,notifyInfo:d,removeNotification:g},children:[t,n.length>0&&m.jsx("div",{style:{position:"fixed",top:"80px",right:"20px",zIndex:9998,maxWidth:"400px",width:"100%",display:"flex",flexDirection:"column",gap:"8px",pointerEvents:"none"},children:n.map(u=>m.jsxs("div",{className:`notification notification-${u.type}`,style:{pointerEvents:"auto",padding:"12px 16px",borderRadius:"8px",background:u.type==="success"?"#d4edda":u.type==="error"?"#f8d7da":u.type==="warning"?"#fff3cd":"#d1ecf1",color:u.type==="success"?"#155724":u.type==="error"?"#721c24":u.type==="warning"?"#856404":"#0c5460",boxShadow:"0 4px 12px rgba(0,0,0,0.15)",display:"flex",alignItems:"flex-start",gap:"12px"},children:[m.jsxs("div",{style:{flex:1},children:[m.jsx("strong",{style:{display:"block",marginBottom:"4px"},children:u.title}),m.jsx("p",{style:{margin:0,fontSize:"14px"},children:u.message}),m.jsx("small",{style:{opacity:.7,fontSize:"12px"},children:u.mfeName})]}),m.jsx("button",{onClick:()=>g(u.id),style:{background:"transparent",border:"none",cursor:"pointer",fontSize:"18px",lineHeight:1,opacity:.5},children:"×"})]},u.id))})]})}function Mt(){const t=o.useContext(Ie);return t||{notify:()=>{},notifySuccess:()=>{},notifyError:()=>{},notifyWarning:()=>{},notifyInfo:()=>{},removeNotification:()=>{}}}function It(t){if(typeof window>"u")return;const n=window.__MF_NAME__||ue,s={...t,mfeName:n,timestamp:Date.now()};window.dispatchEvent(new CustomEvent("mfe-notification",{detail:s,bubbles:!0}))}const Ne="platform-kit",te={log:(...t)=>{},warn:(...t)=>{},error:(...t)=>{console.error(`[${Ne}]`,...t)},info:(...t)=>{}};function Nt(t){const n=t.response;let s="unknown";return n?n.status===401?s="unauthorized":n.status===403?s="forbidden":n.status===404?s="not_found":n.status>=500&&(s="server"):s="network",{message:n?.data?.message??t.message??"Unknown error",code:n?.data?.code,status:n?.status,type:s,timestamp:Date.now(),url:t.config?.url}}const jt=3,Pt=1e3;function Ot(t){return!t||t>=500||t===429}function Ft(t){return new Promise(n=>setTimeout(n,t))}function je(t={}){const n=t.name||Ne,s=t.retries??jt,c=t.retryDelay??Pt,l={log:(...r)=>te.log(`[API:${n}]`,...r),warn:(...r)=>te.warn(`[API:${n}]`,...r),error:(...r)=>te.error(`[API:${n}]`,...r),info:(...r)=>te.info(`[API:${n}]`,...r)},h=ut.create({timeout:t.timeout??1e4,baseURL:t.baseURL??"",headers:{"Content-Type":"application/json"}});return h.interceptors.request.use(r=>{const v=we();if(v?.isAuthenticated){const f=v.user?.profile?.access_token;f&&r.headers&&(r.headers.Authorization=`Bearer ${f}`,l.info("Auth token attached"))}else l.info("User not authenticated - request without token");return l.log(`${r.method?.toUpperCase()} ${r.url}`),r},r=>(l.error("Request interceptor error:",r.message),Promise.reject(r))),h.interceptors.response.use(r=>(l.log(`Response ${r.status}:`,r.config.url),r),async r=>{const v=r.response?.status,f=r.config?.url,w=r.config?._retryCount??0;if(Ot(v)&&w<s){const d=r.config;d._retryCount=w+1;const g=c*Math.pow(2,w);return l.warn(`Retrying (${d._retryCount}/${s}) after ${g}ms:`,f),await Ft(g),h.request(d)}return v===401?(l.warn("401 Unauthorized - triggering re-auth"),be()):v===403?l.warn("403 Forbidden - insufficient permissions"):v===404?l.warn("404 Not found:",f):v===429?l.warn("429 Rate limited"):v===500?l.error("500 Server error:",f):r.response?l.warn(`Error ${v}:`,r.message):l.error("Network error - backend may be unavailable:",f),Promise.reject(Nt(r))}),h}const X=je();async function Dt(t,n,s=X){const c=await s.get(t,{params:n});return{data:c.data,status:c.status,ok:c.status>=200&&c.status<300}}async function Lt(t,n,s=X){const c=await s.post(t,n);return{data:c.data,status:c.status,ok:c.status>=200&&c.status<300}}async function Ut(t,n,s=X){const c=await s.put(t,n);return{data:c.data,status:c.status,ok:c.status>=200&&c.status<300}}async function Vt(t,n=X){const s=await n.delete(t);return{data:s.data,status:s.status,ok:s.status>=200&&s.status<300}}function Z(t,n){const s=n?.prefix?`[${n.prefix}]`:`[${t}]`;return{log:(...c)=>{},warn:(...c)=>{},error:(...c)=>{console.error(s,...c)},info:(...c)=>{}}}const Bt=Z("platform-kit",{prefix:"AUTH"}),Wt=Z("platform-kit",{prefix:"API"}),zt=Z("platform-kit",{prefix:"ERROR"}),Ht=Z("platform-kit",{prefix:"INFO"}),Gt={},Yt={log:(...t)=>{},warn:(...t)=>{},error:(...t)=>{console.error("[getMfeName]",...t)}};function le(t){return t?t.mfeName?t.mfeName:t.name?t.name.replace("@ib-dop/",""):null:null}function Pe(){if(typeof window>"u")return null;const t=window;return t.__MF_NAME__?t.__MF_NAME__:null}function Oe(){if(typeof window>"u")return null;try{const t=sessionStorage.getItem("mf-config");if(t){const n=JSON.parse(t);if(n.mfeName)return n.mfeName;if(n.name)return n.name;if(n.appName)return n.appName}}catch{}return null}function fe(){const t=Gt;return t.VITE_MFE_NAME?String(t.VITE_MFE_NAME):t.MFE_NAME?String(t.MFE_NAME):null}let ne=null,de=!1;function Fe(t,n){const s=le(t);if(s)return s;if(de&&ne)return ne;const c=[{source:"window.__MF_NAME__",value:Pe()},{source:"sessionStorage.mf-config",value:Oe()},{source:"import.meta.env.VITE_MFE_NAME",value:fe()}];for(const{source:h,value:r}of c)if(r)return ne=r,de=!0,r;if(n)return n;const l="Cannot determine MFE name. Please pass mfeName in props, set window.__MF_NAME__, sessionStorage.mf-config, or VITE_MFE_NAME";throw Yt.error(l),new Error(l)}function Jt(t){return Fe(t)}function De(t){return le(t)?"props.mfeName":Pe()?"window.__MF_NAME__":Oe()?"sessionStorage.mf-config":fe()?"import.meta.env.VITE_MFE_NAME":null}function Kt(t){return De(t)!==null}function Xt(){ne=null,de=!1}function Zt(t){const n=[];return le(t)&&n.push("props.mfeName"),typeof window<"u"&&(window.__MF_NAME__&&n.push("window.__MF_NAME__"),sessionStorage.getItem("mf-config")&&n.push("sessionStorage.mf-config")),fe()&&n.push("import.meta.env.VITE_MFE_NAME"),n}_.ErrorBoundary=kt,_.NotificationProvider=Rt,_.VersionInfo=Tt,_.api=X,_.apiLogger=Wt,_.authLogger=Bt,_.createApiClient=je,_.createMfLogger=Z,_.del=Vt,_.dispatchNotification=It,_.errorLogger=zt,_.get=Dt,_.getAccessToken=lt,_.getAllMfeNameSources=Zt,_.getAuthState=we,_.getMfeName=Fe,_.getMfeNameSource=De,_.getShellAuth=U,_.hasMfeName=Kt,_.infoLogger=Ht,_.isAuthenticated=ft,_.logout=dt,_.post=Lt,_.put=Ut,_.redirectToLogin=be,_.requireMfeName=Jt,_.resetMfeNameCache=Xt,_.useApi=_t,_.useFeatureAdmin=wt,_.useFeatures=yt,_.useInfoData=xe,_.useMicrofrontendsFeatures=bt,_.useNotification=Mt,_.usePermissions=Et,_.useShellAuth=Y,_.useV1Config=gt,Object.defineProperty(_,Symbol.toStringTag,{value:"Module"})}));
|
|
18
|
+
${a}`]})]}),v.jsxs("div",{style:{marginTop:"12px",display:"flex",gap:"8px",justifyContent:"center"},children:[v.jsx("button",{onClick:this.handleCopy,style:{padding:"8px 12px",background:"#666",color:"white",border:"none",borderRadius:"4px",cursor:"pointer"},children:"📋 Копировать"}),v.jsx("button",{onClick:this.handleRetry,style:{padding:"8px 12px",background:"#d32f2f",color:"white",border:"none",borderRadius:"4px",cursor:"pointer"},children:"🔄 Обновить"}),v.jsx("button",{onClick:this.handleGoHome,style:{padding:"8px 12px",background:"#1976d2",color:"white",border:"none",borderRadius:"4px",cursor:"pointer"},children:"🏠 На главную"})]})]})}return this.props.children==null?null:this.props.children}}const D={info:"ℹ️",code:"💻",link:"🔗",user:"👤",clock:"🕐",apps:"📦",storage:"💾",tags:"🏷️",spreadsheet:"📊"};function Bt({mfeName:t}){const{data:n,isLoading:a,error:o}=Ae({mfeName:t}),[i,p]=u.useState(!1);if(a)return v.jsxs("span",{className:"text-muted small me-2",children:[v.jsx("span",{className:"me-1",children:"⏳"}),"Загрузка..."]});if(o||!n)return v.jsxs("span",{className:"text-muted small me-2",title:`Ошибка: ${o||"нет данных"}`,children:[v.jsx("span",{className:"me-1",children:"ℹ️"}),"N/A"]});const r=n,h=r.BUILD_VERSION||r.IMAGE_VERSION||r.APP_NAME||"N/A",f=[];return r.APP_NAME&&f.push({key:"APP_NAME",value:r.APP_NAME,label:"Приложение",icon:D.apps}),r.BUILD_VERSION&&f.push({key:"BUILD_VERSION",value:r.BUILD_VERSION,label:"Версия",icon:D.tags}),r.IMAGE_VERSION&&f.push({key:"IMAGE_VERSION",value:r.IMAGE_VERSION,label:"Образ",icon:D.storage}),r.GIT_COMMIT&&f.push({key:"GIT_COMMIT",value:r.GIT_COMMIT,label:"Commit",icon:D.spreadsheet}),r.GIT_BRANCH&&f.push({key:"GIT_BRANCH",value:r.GIT_BRANCH,label:"Ветка",icon:D.spreadsheet}),r.CI_COMMIT_AUTHOR&&f.push({key:"CI_COMMIT_AUTHOR",value:r.CI_COMMIT_AUTHOR,label:"Автор",icon:D.user}),r.CI_COMMIT_TIMESTAMP&&f.push({key:"CI_COMMIT_TIMESTAMP",value:r.CI_COMMIT_TIMESTAMP,label:"Дата",icon:D.clock}),r.CI_JOB_URL&&f.push({key:"CI_JOB_URL",value:r.CI_JOB_URL,label:"CI Job",icon:D.link}),r.CI_PIPELINE_URL&&f.push({key:"CI_PIPELINE_URL",value:r.CI_PIPELINE_URL,label:"Pipeline",icon:D.link}),r.CI_COMMIT_MESSAGE&&(r.CI_COMMIT_MESSAGE.length>60?r.CI_COMMIT_MESSAGE.substring(0,57)+"":r.CI_COMMIT_MESSAGE,f.push({key:"CI_COMMIT_MESSAGE",value:r.CI_COMMIT_MESSAGE,label:"Сообщение",icon:D.code})),v.jsxs("div",{style:{display:"inline-block",position:"relative"},children:[v.jsxs("button",{onClick:()=>p(!i),style:{background:"transparent",border:"none",cursor:"pointer",padding:"4px 8px",fontSize:"14px",display:"inline-flex",alignItems:"center"},title:"Информация о версии",children:[v.jsx("span",{className:"me-1",children:D.info}),v.jsx("span",{className:"text-dark",children:h})]}),i&&v.jsxs("div",{style:{position:"absolute",top:"100%",right:0,zIndex:1e3,minWidth:"300px",background:"white",border:"1px solid #dee2e6",borderRadius:"8px",boxShadow:"0 4px 12px rgba(0,0,0,0.15)",padding:"16px",marginTop:"4px"},children:[v.jsxs("div",{style:{marginBottom:"12px",paddingBottom:"8px",borderBottom:"1px solid #dee2e6",display:"flex",alignItems:"center"},children:[v.jsx("span",{className:"me-2",children:D.apps}),v.jsx("strong",{children:r.APP_NAME||t})]}),v.jsxs("div",{style:{marginBottom:"12px"},children:[v.jsx("span",{className:"text-muted",children:"Версия: "}),v.jsx("strong",{children:h})]}),f.length>0&&v.jsx("div",{style:{fontSize:"13px"},children:f.map(({key:E,value:l,label:_,icon:d})=>{const b=l.length>40&&(E.includes("URL")||E.includes("MESSAGE"))?`${l.substring(0,37)}...`:l;return v.jsxs("div",{style:{marginBottom:"8px",display:"flex",alignItems:"flex-start"},children:[v.jsx("span",{className:"me-2",style:{flexShrink:0},children:d}),v.jsxs("div",{style:{flex:1,minWidth:0},children:[v.jsx("div",{className:"small text-muted",children:_}),v.jsx("div",{className:"font-monospace small text-truncate",style:{maxWidth:"100%"},title:l,children:E.includes("URL")?v.jsx("a",{href:l,target:"_blank",rel:"noopener noreferrer",style:{color:"#007bff"},children:b}):b})]})]},E)})}),f.length===0&&v.jsx("div",{className:"text-center text-muted py-2 small",children:"Нет информации о версии"}),v.jsx("div",{style:{marginTop:"12px",paddingTop:"8px",borderTop:"1px solid #dee2e6",textAlign:"center",fontSize:"12px",color:"#6c757d"},children:"IngoBank DevOps Platform"}),v.jsx("button",{onClick:()=>p(!1),style:{position:"absolute",top:"8px",right:"8px",background:"transparent",border:"none",cursor:"pointer",fontSize:"16px",color:"#6c757d"},children:"×"})]}),i&&v.jsx("div",{onClick:()=>p(!1),style:{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:999}})]})}const le="platform-kit",Pe=u.createContext(null);function Wt({children:t}){const[n,a]=u.useState([]),o=typeof window<"u"&&window.__MF_NAME__||le,i=u.useCallback((d,b,w,N)=>({id:`${Date.now()}-${Math.random().toString(36).substr(2,9)}`,type:d,title:b,message:w,mfeName:o,timestamp:Date.now(),duration:N}),[o]),p=u.useCallback(d=>{a(w=>[...w,d].slice(0,5));const b=d.duration||5e3;b>0&&setTimeout(()=>{a(w=>w.filter(N=>N.id!==d.id))},b)},[]),r=u.useCallback(d=>{const b=i(d.type,d.title,d.message,d.duration);p(b),typeof window<"u"&&window.dispatchEvent(new CustomEvent("mfe-notification",{detail:b,bubbles:!0}))},[i,p]),h=u.useCallback((d,b="Успешно")=>{r({type:"success",title:b,message:d})},[r]),f=u.useCallback((d,b="Ошибка")=>{r({type:"error",title:b,message:d})},[r]),E=u.useCallback((d,b="Предупреждение")=>{r({type:"warning",title:b,message:d})},[r]),l=u.useCallback((d,b="Информация")=>{r({type:"info",title:b,message:d})},[r]),_=u.useCallback(d=>{a(b=>b.filter(w=>w.id!==d))},[]);return u.useEffect(()=>{if(typeof window>"u")return;const d=b=>{const w=b.detail;if(w&&w.type&&w.title&&w.message){const N={...w,id:`${Date.now()}-${Math.random().toString(36).substr(2,9)}`};p(N)}};return window.addEventListener("mfe-notification",d),()=>{window.removeEventListener("mfe-notification",d)}},[p]),v.jsxs(Pe.Provider,{value:{notify:r,notifySuccess:h,notifyError:f,notifyWarning:E,notifyInfo:l,removeNotification:_},children:[t,n.length>0&&v.jsx("div",{style:{position:"fixed",top:"80px",right:"20px",zIndex:9998,maxWidth:"400px",width:"100%",display:"flex",flexDirection:"column",gap:"8px",pointerEvents:"none"},children:n.map(d=>v.jsxs("div",{className:`notification notification-${d.type}`,style:{pointerEvents:"auto",padding:"12px 16px",borderRadius:"8px",background:d.type==="success"?"#d4edda":d.type==="error"?"#f8d7da":d.type==="warning"?"#fff3cd":"#d1ecf1",color:d.type==="success"?"#155724":d.type==="error"?"#721c24":d.type==="warning"?"#856404":"#0c5460",boxShadow:"0 4px 12px rgba(0,0,0,0.15)",display:"flex",alignItems:"flex-start",gap:"12px"},children:[v.jsxs("div",{style:{flex:1},children:[v.jsx("strong",{style:{display:"block",marginBottom:"4px"},children:d.title}),v.jsx("p",{style:{margin:0,fontSize:"14px"},children:d.message}),v.jsx("small",{style:{opacity:.7,fontSize:"12px"},children:d.mfeName})]}),v.jsx("button",{onClick:()=>_(d.id),style:{background:"transparent",border:"none",cursor:"pointer",fontSize:"18px",lineHeight:1,opacity:.5},children:"×"})]},d.id))})]})}function zt(){const t=u.useContext(Pe);return t||{notify:()=>{},notifySuccess:()=>{},notifyError:()=>{},notifyWarning:()=>{},notifyInfo:()=>{},removeNotification:()=>{}}}function Ht(t){if(typeof window>"u")return;const n=window.__MF_NAME__||le,a={...t,mfeName:n,timestamp:Date.now()};window.dispatchEvent(new CustomEvent("mfe-notification",{detail:a,bubbles:!0}))}function Q(t,n){const a=n?.prefix?`[${n.prefix}]`:`[${t}]`;return{log:(...o)=>{},warn:(...o)=>{},error:(...o)=>{console.error(a,...o)},info:(...o)=>{}}}const Gt=Q("platform-kit",{prefix:"AUTH"}),Yt=Q("platform-kit",{prefix:"API"}),Jt=Q("platform-kit",{prefix:"ERROR"}),Kt=Q("platform-kit",{prefix:"INFO"}),Xt={},Zt={log:(...t)=>{},warn:(...t)=>{},error:(...t)=>{console.error("[getMfeName]",...t)}};function fe(t){return t?t.mfeName?t.mfeName:t.name?t.name.replace("@ib-dop/",""):null:null}function Oe(){if(typeof window>"u")return null;const t=window;return t.__MF_NAME__?t.__MF_NAME__:null}function Fe(){if(typeof window>"u")return null;try{const t=sessionStorage.getItem("mf-config");if(t){const n=JSON.parse(t);if(n.mfeName)return n.mfeName;if(n.name)return n.name;if(n.appName)return n.appName}}catch{}return null}function de(){const t=Xt;return t.VITE_MFE_NAME?String(t.VITE_MFE_NAME):t.MFE_NAME?String(t.MFE_NAME):null}let re=null,pe=!1;function De(t,n){const a=fe(t);if(a)return a;if(pe&&re)return re;const o=[{source:"window.__MF_NAME__",value:Oe()},{source:"sessionStorage.mf-config",value:Fe()},{source:"import.meta.env.VITE_MFE_NAME",value:de()}];for(const{source:p,value:r}of o)if(r)return re=r,pe=!0,r;if(n)return n;const i="Cannot determine MFE name. Please pass mfeName in props, set window.__MF_NAME__, sessionStorage.mf-config, or VITE_MFE_NAME";throw Zt.error(i),new Error(i)}function Qt(t){return De(t)}function Le(t){return fe(t)?"props.mfeName":Oe()?"window.__MF_NAME__":Fe()?"sessionStorage.mf-config":de()?"import.meta.env.VITE_MFE_NAME":null}function qt(t){return Le(t)!==null}function $t(){re=null,pe=!1}function en(t){const n=[];return fe(t)&&n.push("props.mfeName"),typeof window<"u"&&(window.__MF_NAME__&&n.push("window.__MF_NAME__"),sessionStorage.getItem("mf-config")&&n.push("sessionStorage.mf-config")),de()&&n.push("import.meta.env.VITE_MFE_NAME"),n}g.ErrorBoundary=Vt,g.NotificationProvider=Wt,g.VersionInfo=Bt,g.api=V,g.apiLogger=Yt,g.authLogger=Gt,g.createApiClient=xe,g.createMfLogger=Q,g.del=At,g.dispatchNotification=Ht,g.errorLogger=Jt,g.get=bt,g.getAccessToken=ft,g.getAllMfeNameSources=en,g.getAuthState=be,g.getMfeName=De,g.getMfeNameSource=Le,g.getShellAuth=U,g.hasMfeName=qt,g.infoLogger=Kt,g.isAuthenticated=dt,g.logout=pt,g.post=St,g.put=kt,g.redirectToLogin=Se,g.requireMfeName=Qt,g.resetMfeNameCache=$t,g.useApi=K,g.useDel=Mt,g.useFeatureAdmin=Pt,g.useFeatures=jt,g.useGet=xt,g.useInfoData=Ae,g.useMicrofrontendsFeatures=Ot,g.useNotification=zt,g.usePermissions=Nt,g.usePost=Tt,g.usePut=Rt,g.useShellAuth=J,g.useV1Config=mt,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})}));
|
package/dist/services/api.d.ts
CHANGED
|
File without changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/services/api.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAc,EAAE,aAAa,EAA0C,MAAM,OAAO,CAAA;AACpF,OAAO,KAAK,EAAY,WAAW,EAAE,MAAM,UAAU,CAAA;AASrD;;GAEG;AACH,QAAA,MAAM,MAAM;mBACK,OAAO,EAAE;oBAGR,OAAO,EAAE;qBAGR,OAAO,EAAE;oBAGV,OAAO,EAAE;CAG1B,CAAA;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAgED;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,MAAM,GAAE,SAAc,GAAG,aAAa,
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/services/api.ts"],"names":[],"mappings":"AAA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,GAAE,aAAmB,GAC1B,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAOzB;AAED;;GAEG;AACH,wBAAsB,GAAG,CAAC,CAAC,EACzB,GAAG,EAAE,MAAM,EACX,MAAM,GAAE,aAAmB,GAC1B,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAOzB;AAGD,OAAO,EAAE,MAAM,EAAE,CAAA"}
|
package/dist/services/index.d.ts
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/types/index.d.ts
CHANGED
|
@@ -56,29 +56,6 @@ export interface ApiResponse<T> {
|
|
|
56
56
|
status: number;
|
|
57
57
|
ok: boolean;
|
|
58
58
|
}
|
|
59
|
-
/**
|
|
60
|
-
* Interface для конфигурации useApi
|
|
61
|
-
*/
|
|
62
|
-
export interface UseApiConfig<T = never> {
|
|
63
|
-
notifyOnError?: boolean;
|
|
64
|
-
notifyOnSuccess?: boolean;
|
|
65
|
-
successMessage?: string;
|
|
66
|
-
errorContext?: string;
|
|
67
|
-
onSuccess?: (data: T) => void;
|
|
68
|
-
onError?: (error: ApiError) => void;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Interface для результата useApi
|
|
72
|
-
*/
|
|
73
|
-
export interface UseApiResult<T> {
|
|
74
|
-
data: T | null;
|
|
75
|
-
error: ApiError | null;
|
|
76
|
-
isLoading: boolean;
|
|
77
|
-
isError: boolean;
|
|
78
|
-
isSuccess: boolean;
|
|
79
|
-
execute: () => Promise<T | null>;
|
|
80
|
-
reset: () => void;
|
|
81
|
-
}
|
|
82
59
|
/**
|
|
83
60
|
* MF Info Data from info.json
|
|
84
61
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CA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AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,cAAc,EAAE,kBAAkB,EAAE,CAAA;IACpC,OAAO,EAAE,OAAO,CAAA;IAChB,cAAc,EAAE,MAAM,EAAE,CAAA;IACxB,UAAU,EAAE,MAAM,CAAA;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;IAChB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAA;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;IAChB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAA;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,cAAc,EAAE,MAAM,EAAE,CAAA;IACxB,QAAQ,EAAE,WAAW,EAAE,CAAA;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,OAAO,CAAA;IAChB,MAAM,EAAE,OAAO,CAAA;IACf,QAAQ,EAAE,OAAO,CAAA;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC7C,cAAc,EAAE,yBAAyB,EAAE,CAAA;IAC3C,UAAU,EAAE,MAAM,CAAA;CACnB"}
|
package/dist/utils/index.d.ts
CHANGED
|
File without changes
|
|
File without changes
|
package/dist/utils/mfeName.d.ts
CHANGED
|
File without changes
|
|
File without changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shellAuth.d.ts","sourceRoot":"","sources":["../../src/utils/shellAuth.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAEzC;;;;;;;;GAQG;AACH,wBAAgB,YAAY,IAAI,SAAS,GAAG,IAAI,CAgB/C;AAED;;;;GAIG;AACH,wBAAgB,YAAY,IAAI;IAC9B,eAAe,EAAE,OAAO,CAAA;IACxB,IAAI,CAAC,EAAE;QACL,OAAO,CAAC,EAAE;YACR,YAAY,CAAC,EAAE,MAAM,CAAA;SACtB,CAAA;KACF,CAAA;CACF,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"shellAuth.d.ts","sourceRoot":"","sources":["../../src/utils/shellAuth.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAEzC;;;;;;;;GAQG;AACH,wBAAgB,YAAY,IAAI,SAAS,GAAG,IAAI,CAgB/C;AAED;;;;GAIG;AACH,wBAAgB,YAAY,IAAI;IAC9B,eAAe,EAAE,OAAO,CAAA;IACxB,IAAI,CAAC,EAAE;QACL,YAAY,CAAC,EAAE,MAAM,CAAA;QACrB,OAAO,CAAC,EAAE;YACR,YAAY,CAAC,EAAE,MAAM,CAAA;SACtB,CAAA;KACF,CAAA;CACF,GAAG,IAAI,CAwCP;AAED;;;;GAIG;AACH,wBAAgB,cAAc,IAAI,MAAM,GAAG,IAAI,CAQ9C;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,OAAO,CAGzC;AAED;;GAEG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC,CAQrD;AAED;;GAEG;AACH,wBAAsB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAM5C"}
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/src/components/index.ts
CHANGED
|
File without changes
|
package/src/global.d.ts
CHANGED
|
File without changes
|
package/src/hooks/index.ts
CHANGED
|
@@ -8,7 +8,8 @@ export { useInfoData } from './useInfoData'
|
|
|
8
8
|
|
|
9
9
|
export { useV1Config } from './useV1Config'
|
|
10
10
|
|
|
11
|
-
export { useApi } from './useApi'
|
|
11
|
+
export { useApi, useGet, usePost, usePut, useDel } from './useApi'
|
|
12
|
+
export type { UseApiConfig, UseApiResult, UseGetConfig } from './useApi'
|
|
12
13
|
|
|
13
14
|
export { usePermissions } from './usePermissions'
|
|
14
15
|
|
package/src/hooks/useApi.ts
CHANGED
|
@@ -5,8 +5,9 @@
|
|
|
5
5
|
* обработкой ошибок и уведомлениями.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import { useState, useCallback, useRef, useEffect } from 'react'
|
|
8
|
+
import { useState, useCallback, useRef, useEffect, useMemo } from 'react'
|
|
9
9
|
import type { ApiError, ApiResponse, NotificationPayload } from '../types'
|
|
10
|
+
import { api } from '../services/api'
|
|
10
11
|
|
|
11
12
|
// Development mode flag
|
|
12
13
|
const isDev = import.meta.env?.DEV === true || import.meta.env?.MODE === 'development'
|
|
@@ -283,25 +284,49 @@ export function useApi<T>(
|
|
|
283
284
|
// Convenience hooks for common HTTP methods
|
|
284
285
|
|
|
285
286
|
/**
|
|
286
|
-
* GET
|
|
287
|
+
* GET request config with auto-execute support
|
|
288
|
+
*/
|
|
289
|
+
export interface UseGetConfig<T> extends UseApiConfig<T> {
|
|
290
|
+
/** Skip request (don't execute) */
|
|
291
|
+
skip?: boolean
|
|
292
|
+
/** Dynamic headers function */
|
|
293
|
+
headers?: () => Record<string, string>
|
|
294
|
+
/** Auto-execute on mount (default: true for useGet) */
|
|
295
|
+
immediate?: boolean
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* GET request with AbortController and auto-execute
|
|
287
300
|
*/
|
|
288
301
|
export function useGet<T>(
|
|
289
302
|
url: string,
|
|
290
|
-
|
|
291
|
-
config: UseApiConfig<T> = {}
|
|
303
|
+
config: UseGetConfig<T> = {}
|
|
292
304
|
): UseApiResult<T> {
|
|
293
|
-
const
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
return { data, status: response.status, ok: response.ok } as ApiResponse<T>
|
|
305
|
+
const { skip = false, headers, immediate = true, ...apiConfig } = config
|
|
306
|
+
|
|
307
|
+
const request = useMemo(() => {
|
|
308
|
+
return (signal?: AbortSignal) => {
|
|
309
|
+
const headersObj = headers ? headers() : {}
|
|
310
|
+
return api.get(url, {
|
|
311
|
+
headers: { 'Content-Type': 'application/json', ...headersObj },
|
|
312
|
+
signal,
|
|
302
313
|
})
|
|
314
|
+
.then((response) => {
|
|
315
|
+
return { data: response.data, status: response.status, ok: response.status >= 200 && response.status < 300 } as ApiResponse<T>
|
|
316
|
+
})
|
|
317
|
+
}
|
|
318
|
+
}, [url, headers])
|
|
303
319
|
|
|
304
|
-
|
|
320
|
+
const result = useApi(request, { ...apiConfig, immediate: false })
|
|
321
|
+
|
|
322
|
+
// Auto-execute on mount if not skipped
|
|
323
|
+
useEffect(() => {
|
|
324
|
+
if (immediate && !skip) {
|
|
325
|
+
result.execute()
|
|
326
|
+
}
|
|
327
|
+
}, [immediate, skip, url])
|
|
328
|
+
|
|
329
|
+
return result
|
|
305
330
|
}
|
|
306
331
|
|
|
307
332
|
/**
|
|
@@ -313,15 +338,9 @@ export function usePost<T>(
|
|
|
313
338
|
config: UseApiConfig<T> = {}
|
|
314
339
|
): UseApiResult<T> {
|
|
315
340
|
const request = (signal?: AbortSignal) =>
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
body: data ? JSON.stringify(data) : undefined,
|
|
320
|
-
signal,
|
|
321
|
-
})
|
|
322
|
-
.then(async (response) => {
|
|
323
|
-
const responseData = await response.json()
|
|
324
|
-
return { data: responseData, status: response.status, ok: response.ok } as ApiResponse<T>
|
|
341
|
+
api.post(url, data, { signal })
|
|
342
|
+
.then((response) => {
|
|
343
|
+
return { data: response.data, status: response.status, ok: response.status >= 200 && response.status < 300 } as ApiResponse<T>
|
|
325
344
|
})
|
|
326
345
|
|
|
327
346
|
return useApi(request, config)
|
|
@@ -336,15 +355,9 @@ export function usePut<T>(
|
|
|
336
355
|
config: UseApiConfig<T> = {}
|
|
337
356
|
): UseApiResult<T> {
|
|
338
357
|
const request = (signal?: AbortSignal) =>
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
body: data ? JSON.stringify(data) : undefined,
|
|
343
|
-
signal,
|
|
344
|
-
})
|
|
345
|
-
.then(async (response) => {
|
|
346
|
-
const responseData = await response.json()
|
|
347
|
-
return { data: responseData, status: response.status, ok: response.ok } as ApiResponse<T>
|
|
358
|
+
api.put(url, data, { signal })
|
|
359
|
+
.then((response) => {
|
|
360
|
+
return { data: response.data, status: response.status, ok: response.status >= 200 && response.status < 300 } as ApiResponse<T>
|
|
348
361
|
})
|
|
349
362
|
|
|
350
363
|
return useApi(request, config)
|
|
@@ -358,14 +371,9 @@ export function useDel<T>(
|
|
|
358
371
|
config: UseApiConfig<T> = {}
|
|
359
372
|
): UseApiResult<T> {
|
|
360
373
|
const request = (signal?: AbortSignal) =>
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
signal,
|
|
365
|
-
})
|
|
366
|
-
.then(async (response) => {
|
|
367
|
-
const responseData = await response.json()
|
|
368
|
-
return { data: responseData, status: response.status, ok: response.ok } as ApiResponse<T>
|
|
374
|
+
api.delete(url, { signal })
|
|
375
|
+
.then((response) => {
|
|
376
|
+
return { data: response.data, status: response.status, ok: response.status >= 200 && response.status < 300 } as ApiResponse<T>
|
|
369
377
|
})
|
|
370
378
|
|
|
371
379
|
return useApi(request, config)
|
package/src/hooks/useFeatures.ts
CHANGED
|
File without changes
|
package/src/hooks/useInfoData.ts
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/src/hooks/useV1Config.ts
CHANGED
|
File without changes
|
package/src/index.ts
CHANGED
|
File without changes
|
package/src/services/api.ts
CHANGED
|
@@ -151,12 +151,23 @@ export function createApiClient(config: ApiConfig = {}): AxiosInstance {
|
|
|
151
151
|
(config: InternalAxiosRequestConfig) => {
|
|
152
152
|
const authState = getAuthState()
|
|
153
153
|
|
|
154
|
+
// Debug logging
|
|
155
|
+
clientLogger.info('Auth state check:', {
|
|
156
|
+
isAuthenticated: authState?.isAuthenticated,
|
|
157
|
+
hasUser: !!authState?.user,
|
|
158
|
+
userKeys: authState?.user ? Object.keys(authState.user) : [],
|
|
159
|
+
token: authState?.user?.access_token ? '(present)' : '(missing)',
|
|
160
|
+
})
|
|
161
|
+
|
|
154
162
|
// Attach token ONLY if user is authenticated
|
|
155
163
|
if (authState?.isAuthenticated) {
|
|
156
|
-
|
|
164
|
+
// Try user.access_token first (from react-oidc-context), then user.profile.access_token
|
|
165
|
+
const token = authState.user?.access_token || authState.user?.profile?.access_token
|
|
157
166
|
if (token && config.headers) {
|
|
158
167
|
config.headers.Authorization = `Bearer ${token}`
|
|
159
168
|
clientLogger.info('Auth token attached')
|
|
169
|
+
} else {
|
|
170
|
+
clientLogger.warn('User is authenticated but no token found in authState.user or authState.user.profile')
|
|
160
171
|
}
|
|
161
172
|
} else {
|
|
162
173
|
clientLogger.info('User not authenticated - request without token')
|
package/src/services/index.ts
CHANGED
|
File without changes
|
package/src/services/logger.ts
CHANGED
|
File without changes
|
package/src/types/index.ts
CHANGED
|
@@ -75,30 +75,7 @@ export interface ApiResponse<T> {
|
|
|
75
75
|
ok: boolean
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
|
|
79
|
-
* Interface для конфигурации useApi
|
|
80
|
-
*/
|
|
81
|
-
export interface UseApiConfig<T = never> {
|
|
82
|
-
notifyOnError?: boolean
|
|
83
|
-
notifyOnSuccess?: boolean
|
|
84
|
-
successMessage?: string
|
|
85
|
-
errorContext?: string
|
|
86
|
-
onSuccess?: (data: T) => void
|
|
87
|
-
onError?: (error: ApiError) => void
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Interface для результата useApi
|
|
92
|
-
*/
|
|
93
|
-
export interface UseApiResult<T> {
|
|
94
|
-
data: T | null
|
|
95
|
-
error: ApiError | null
|
|
96
|
-
isLoading: boolean
|
|
97
|
-
isError: boolean
|
|
98
|
-
isSuccess: boolean
|
|
99
|
-
execute: () => Promise<T | null>
|
|
100
|
-
reset: () => void
|
|
101
|
-
}
|
|
78
|
+
// Note: UseApiConfig and UseApiResult are exported from hooks/useApi.ts
|
|
102
79
|
|
|
103
80
|
// ==================== Info Types ====================
|
|
104
81
|
|
package/src/utils/index.ts
CHANGED
|
File without changes
|
package/src/utils/mfeName.ts
CHANGED
|
File without changes
|