@ibdop/platform-kit 1.0.0 → 1.0.2

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/dist/index.cjs.js CHANGED
@@ -1,18 +1,18 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("react"),kt=require("axios"),Le={log:(...n)=>{},warn:(...n)=>{}};function Q(){if(typeof window>"u")return null;const n=window;if(n.__SHELL_AUTH_INSTANCE__)return n.__SHELL_AUTH_INSTANCE__;const r=window;return r.__SHELL_AUTH__?.authInstance?r.__SHELL_AUTH__.authInstance:null}function Be(){const[n,r]=h.useState(null),[a,l]=h.useState(!0),s=h.useRef(0),d=20,i=h.useCallback(()=>Q(),[]);h.useEffect(()=>{const E=i();if(E){r(E),l(!1);return}const g=u=>{r(u.detail),l(!1)},S=setInterval(()=>{s.current++;const u=i();u?(Le.log("Auth found via polling, attempts:",s.current),r(u),l(!1),clearInterval(S)):s.current>=d&&(l(!1),clearInterval(S))},500);return window.addEventListener("shell-auth-ready",g),()=>{clearInterval(S),window.removeEventListener("shell-auth-ready",g)}},[i]);const p=n||{user:null,isAuthenticated:!1,isLoading:a,signinRedirect:async()=>{const E=Q();E?.signinRedirect?await E.signinRedirect():typeof window<"u"&&(window.location.href="/")},removeUser:async()=>{const E=Q();E?.removeUser&&await E.removeUser()}};return Le.log("Auth result:",{isAuthenticated:p.isAuthenticated,isLoading:p.isLoading}),p}const Tt={log:(...n)=>{},warn:(...n)=>{},error:(...n)=>{console.error("[useInfoData]",...n)}};function Ot(n){if(n)return n;if(typeof window<"u"){const r=window;if(r.__MF_NAME__)return r.__MF_NAME__}return"unknown-mfe"}function We(n){const[r,a]=h.useState(null),[l,s]=h.useState(!0),[d,i]=h.useState(null),x=h.useCallback(()=>{const E=Ot(n?.mfeName).replace("@ib-dop/","");s(!0),i(null),fetch(`/svc/${E}/info.json`).then(g=>{if(!g.ok)throw new Error(`HTTP ${g.status}: ${g.statusText}`);return g.json()}).then(g=>{a(g)}).catch(g=>{Tt.error("Failed to load info:",g),i(g instanceof Error?g.message:String(g))}).finally(()=>{s(!1)})},[n?.mfeName]);return h.useEffect(()=>{x()},[x]),{data:r,isLoading:l,error:d,refetch:x}}const ue={log:(...n)=>{},warn:(...n)=>{},error:(...n)=>{console.error("[useV1Config]",...n)}},X={authority:"",client_id:"",environment:"development"};function Mt(){const[n,r]=h.useState(null),[a,l]=h.useState(!0),[s,d]=h.useState(null);return h.useEffect(()=>{(()=>{if(typeof sessionStorage>"u"){d("sessionStorage not available"),r(X),l(!1);return}try{const x=sessionStorage.getItem("config");if(x){const p=JSON.parse(x);r({...X,...p}),d(null),ue.log("Config loaded successfully")}else r(X),d("Config not found in sessionStorage"),ue.warn("Config not found in sessionStorage")}catch(x){ue.error("Error parsing config:",x),r(X),d("Error parsing config")}finally{l(!1)}})()},[]),{data:n,isLoading:a,error:s}}function He(n){if(typeof window>"u")return;const r=window.__MF_NAME__||"unknown",a={...n,mfeName:r,timestamp:Date.now()};window.dispatchEvent(new CustomEvent("mfe-notification",{detail:a,bubbles:!0}))}function $e(n,r){const a={network:{title:"Нет подключения",message:"Сервер недоступен. Проверьте подключение к интернету."},unauthorized:{title:"Требуется вход",message:"Ваша сессия истекла. Войдите в систему снова."},forbidden:{title:"Доступ запрещён",message:"У вас нет прав для выполнения этого действия."},not_found:{title:"Не найдено",message:"Запрошенный ресурс не найден."},server:{title:"Ошибка сервера",message:"Произошла ошибка на сервере. Попробуйте позже."},client:{title:"Ошибка",message:n.message||"Произошла ошибка при выполнении запроса."},unknown:{title:"Неизвестная ошибка",message:n.message||"Произошла неизвестная ошибка."}},l=a[n.type]||a.unknown;He({type:n.type==="network"?"warning":"error",title:l.title,message:r?`${l.message} (${r})`:l.message})}function Nt(n,r={}){const{notifyOnError:a=!0,notifyOnSuccess:l=!1,successMessage:s,errorContext:d,onSuccess:i,onError:x}=r,[p,E]=h.useState(null),[g,S]=h.useState(null),[u,_]=h.useState(!1),A=g!==null,M=p!==null&&!u&&!A,ee=h.useCallback(async()=>{_(!0),S(null);try{const w=await n();if(w.ok)return E(w.data),l&&s&&He({type:"success",title:"Успешно",message:s}),i?.(w.data),w.data;{const N={message:w.data||"Request failed",status:w.status,type:"client",timestamp:Date.now()};return S(N),a&&$e(N,d),x?.(N),null}}catch(w){const N=w;return S(N),a&&$e(N,d),x?.(N),null}finally{_(!1)}},[n,a,l,s,d,i,x]),j=h.useCallback(()=>{E(null),S(null),_(!1)},[]);return{data:p,error:g,isLoading:u,isError:A,isSuccess:M,execute:ee,reset:j}}const jt={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 Pt(n={}){const r=Be(),a=h.useMemo(()=>({...jt,...n}),[n]),l=h.useMemo(()=>{const d=r.user?.profile?.realm_roles||r.user?.profile?.roles||[];return Array.isArray(d)?d:[d]},[r.user]),s=d=>d.includes("all")?!0:d.some(i=>l.includes(i));return{canView:s(a.canView),canEdit:s(a.canEdit),canDelete:s(a.canDelete),canAdmin:s(a.canAdmin),canViewSensitiveData:s(a.canViewSensitiveData),canExportData:s(a.canExportData),canManageUsers:s(a.canManageUsers)}}var Z={exports:{}},B={};var Fe;function Dt(){if(Fe)return B;Fe=1;var n=h,r=Symbol.for("react.element"),a=Symbol.for("react.fragment"),l=Object.prototype.hasOwnProperty,s=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,d={key:!0,ref:!0,__self:!0,__source:!0};function i(x,p,E){var g,S={},u=null,_=null;E!==void 0&&(u=""+E),p.key!==void 0&&(u=""+p.key),p.ref!==void 0&&(_=p.ref);for(g in p)l.call(p,g)&&!d.hasOwnProperty(g)&&(S[g]=p[g]);if(x&&x.defaultProps)for(g in p=x.defaultProps,p)S[g]===void 0&&(S[g]=p[g]);return{$$typeof:r,type:x,key:u,ref:_,props:S,_owner:s.current}}return B.Fragment=a,B.jsx=i,B.jsxs=i,B}var W={};var Ue;function Lt(){return Ue||(Ue=1,process.env.NODE_ENV!=="production"&&(function(){var n=h,r=Symbol.for("react.element"),a=Symbol.for("react.portal"),l=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),d=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),x=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),E=Symbol.for("react.suspense"),g=Symbol.for("react.suspense_list"),S=Symbol.for("react.memo"),u=Symbol.for("react.lazy"),_=Symbol.for("react.offscreen"),A=Symbol.iterator,M="@@iterator";function ee(e){if(e===null||typeof e!="object")return null;var t=A&&e[A]||e[M];return typeof t=="function"?t:null}var j=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function w(e){{for(var t=arguments.length,o=new Array(t>1?t-1:0),c=1;c<t;c++)o[c-1]=arguments[c];N("error",e,o)}}function N(e,t,o){{var c=j.ReactDebugCurrentFrame,y=c.getStackAddendum();y!==""&&(t+="%s",o=o.concat([y]));var b=o.map(function(v){return String(v)});b.unshift("Warning: "+t),Function.prototype.apply.call(console[e],console,b)}}var qe=!1,Ke=!1,Xe=!1,Ze=!1,Qe=!1,de;de=Symbol.for("react.module.reference");function et(e){return!!(typeof e=="string"||typeof e=="function"||e===l||e===d||Qe||e===s||e===E||e===g||Ze||e===_||qe||Ke||Xe||typeof e=="object"&&e!==null&&(e.$$typeof===u||e.$$typeof===S||e.$$typeof===i||e.$$typeof===x||e.$$typeof===p||e.$$typeof===de||e.getModuleId!==void 0))}function tt(e,t,o){var c=e.displayName;if(c)return c;var y=t.displayName||t.name||"";return y!==""?o+"("+y+")":o}function pe(e){return e.displayName||"Context"}function P(e){if(e==null)return null;if(typeof e.tag=="number"&&w("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 l:return"Fragment";case a:return"Portal";case d:return"Profiler";case s:return"StrictMode";case E:return"Suspense";case g:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case x:var t=e;return pe(t)+".Consumer";case i:var o=e;return pe(o._context)+".Provider";case p:return tt(e,e.render,"ForwardRef");case S:var c=e.displayName||null;return c!==null?c:P(e.type)||"Memo";case u:{var y=e,b=y._payload,v=y._init;try{return P(v(b))}catch{return null}}}return null}var D=Object.assign,U=0,ge,he,me,ve,_e,ye,Ee;function be(){}be.__reactDisabledLog=!0;function rt(){{if(U===0){ge=console.log,he=console.info,me=console.warn,ve=console.error,_e=console.group,ye=console.groupCollapsed,Ee=console.groupEnd;var e={configurable:!0,enumerable:!0,value:be,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}U++}}function nt(){{if(U--,U===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:D({},e,{value:ge}),info:D({},e,{value:he}),warn:D({},e,{value:me}),error:D({},e,{value:ve}),group:D({},e,{value:_e}),groupCollapsed:D({},e,{value:ye}),groupEnd:D({},e,{value:Ee})})}U<0&&w("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var te=j.ReactCurrentDispatcher,re;function Y(e,t,o){{if(re===void 0)try{throw Error()}catch(y){var c=y.stack.trim().match(/\n( *(at )?)/);re=c&&c[1]||""}return`
2
- `+re+e}}var ne=!1,J;{var at=typeof WeakMap=="function"?WeakMap:Map;J=new at}function xe(e,t){if(!e||ne)return"";{var o=J.get(e);if(o!==void 0)return o}var c;ne=!0;var y=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var b;b=te.current,te.current=null,rt();try{if(t){var v=function(){throw Error()};if(Object.defineProperty(v.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(v,[])}catch(k){c=k}Reflect.construct(e,[],v)}else{try{v.call()}catch(k){c=k}e.call(v.prototype)}}else{try{throw Error()}catch(k){c=k}e()}}catch(k){if(k&&c&&typeof k.stack=="string"){for(var m=k.stack.split(`
3
- `),I=c.stack.split(`
4
- `),R=m.length-1,C=I.length-1;R>=1&&C>=0&&m[R]!==I[C];)C--;for(;R>=1&&C>=0;R--,C--)if(m[R]!==I[C]){if(R!==1||C!==1)do if(R--,C--,C<0||m[R]!==I[C]){var T=`
5
- `+m[R].replace(" at new "," at ");return e.displayName&&T.includes("<anonymous>")&&(T=T.replace("<anonymous>",e.displayName)),typeof e=="function"&&J.set(e,T),T}while(R>=1&&C>=0);break}}}finally{ne=!1,te.current=b,nt(),Error.prepareStackTrace=y}var F=e?e.displayName||e.name:"",L=F?Y(F):"";return typeof e=="function"&&J.set(e,L),L}function ot(e,t,o){return xe(e,!1)}function st(e){var t=e.prototype;return!!(t&&t.isReactComponent)}function q(e,t,o){if(e==null)return"";if(typeof e=="function")return xe(e,st(e));if(typeof e=="string")return Y(e);switch(e){case E:return Y("Suspense");case g:return Y("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case p:return ot(e.render);case S:return q(e.type,t,o);case u:{var c=e,y=c._payload,b=c._init;try{return q(b(y),t,o)}catch{}}}return""}var V=Object.prototype.hasOwnProperty,we={},Se=j.ReactDebugCurrentFrame;function K(e){if(e){var t=e._owner,o=q(e.type,e._source,t?t.type:null);Se.setExtraStackFrame(o)}else Se.setExtraStackFrame(null)}function it(e,t,o,c,y){{var b=Function.call.bind(V);for(var v in e)if(b(e,v)){var m=void 0;try{if(typeof e[v]!="function"){var I=Error((c||"React class")+": "+o+" type `"+v+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[v]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw I.name="Invariant Violation",I}m=e[v](t,v,c,o,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(R){m=R}m&&!(m instanceof Error)&&(K(y),w("%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).",c||"React class",o,v,typeof m),K(null)),m instanceof Error&&!(m.message in we)&&(we[m.message]=!0,K(y),w("Failed %s type: %s",o,m.message),K(null))}}}var lt=Array.isArray;function ae(e){return lt(e)}function ut(e){{var t=typeof Symbol=="function"&&Symbol.toStringTag,o=t&&e[Symbol.toStringTag]||e.constructor.name||"Object";return o}}function ct(e){try{return Re(e),!1}catch{return!0}}function Re(e){return""+e}function Ce(e){if(ct(e))return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",ut(e)),Re(e)}var Ae=j.ReactCurrentOwner,ft={key:!0,ref:!0,__self:!0,__source:!0},Ie,ke;function dt(e){if(V.call(e,"ref")){var t=Object.getOwnPropertyDescriptor(e,"ref").get;if(t&&t.isReactWarning)return!1}return e.ref!==void 0}function pt(e){if(V.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return e.key!==void 0}function gt(e,t){typeof e.ref=="string"&&Ae.current}function ht(e,t){{var o=function(){Ie||(Ie=!0,w("%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)",t))};o.isReactWarning=!0,Object.defineProperty(e,"key",{get:o,configurable:!0})}}function mt(e,t){{var o=function(){ke||(ke=!0,w("%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)",t))};o.isReactWarning=!0,Object.defineProperty(e,"ref",{get:o,configurable:!0})}}var vt=function(e,t,o,c,y,b,v){var m={$$typeof:r,type:e,key:t,ref:o,props:v,_owner:b};return m._store={},Object.defineProperty(m._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(m,"_self",{configurable:!1,enumerable:!1,writable:!1,value:c}),Object.defineProperty(m,"_source",{configurable:!1,enumerable:!1,writable:!1,value:y}),Object.freeze&&(Object.freeze(m.props),Object.freeze(m)),m};function _t(e,t,o,c,y){{var b,v={},m=null,I=null;o!==void 0&&(Ce(o),m=""+o),pt(t)&&(Ce(t.key),m=""+t.key),dt(t)&&(I=t.ref,gt(t,y));for(b in t)V.call(t,b)&&!ft.hasOwnProperty(b)&&(v[b]=t[b]);if(e&&e.defaultProps){var R=e.defaultProps;for(b in R)v[b]===void 0&&(v[b]=R[b])}if(m||I){var C=typeof e=="function"?e.displayName||e.name||"Unknown":e;m&&ht(v,C),I&&mt(v,C)}return vt(e,m,I,y,c,Ae.current,v)}}var oe=j.ReactCurrentOwner,Te=j.ReactDebugCurrentFrame;function $(e){if(e){var t=e._owner,o=q(e.type,e._source,t?t.type:null);Te.setExtraStackFrame(o)}else Te.setExtraStackFrame(null)}var se;se=!1;function ie(e){return typeof e=="object"&&e!==null&&e.$$typeof===r}function Oe(){{if(oe.current){var e=P(oe.current.type);if(e)return`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("react"),Ft=require("axios"),Ve={log:(...t)=>{},warn:(...t)=>{}};function Q(){if(typeof window>"u")return null;const t=window;if(t.__SHELL_AUTH_INSTANCE__)return t.__SHELL_AUTH_INSTANCE__;const r=window;return r.__SHELL_AUTH__?.authInstance?r.__SHELL_AUTH__.authInstance:null}function ze(){const[t,r]=m.useState(null),[o,u]=m.useState(!0),s=m.useRef(0),f=20,i=m.useCallback(()=>Q(),[]);m.useEffect(()=>{const y=i();if(y){r(y),u(!1);return}const g=l=>{r(l.detail),u(!1)},S=setInterval(()=>{s.current++;const l=i();l?(Ve.log("Auth found via polling, attempts:",s.current),r(l),u(!1),clearInterval(S)):s.current>=f&&(u(!1),clearInterval(S))},500);return window.addEventListener("shell-auth-ready",g),()=>{clearInterval(S),window.removeEventListener("shell-auth-ready",g)}},[i]);const p=t||{user:null,isAuthenticated:!1,isLoading:o,signinRedirect:async()=>{const y=Q();y?.signinRedirect?await y.signinRedirect():typeof window<"u"&&(window.location.href="/")},removeUser:async()=>{const y=Q();y?.removeUser&&await y.removeUser()}};return Ve.log("Auth result:",{isAuthenticated:p.isAuthenticated,isLoading:p.isLoading}),p}const Lt={log:(...t)=>{},warn:(...t)=>{},error:(...t)=>{console.error("[useInfoData]",...t)}};function $t(t){if(t)return t;if(typeof window<"u"){const r=window;if(r.__MF_NAME__)return r.__MF_NAME__}return"unknown-mfe"}function Ye(t){const[r,o]=m.useState(null),[u,s]=m.useState(!0),[f,i]=m.useState(null),b=m.useCallback(()=>{const y=$t(t?.mfeName).replace("@ib-dop/","");s(!0),i(null),fetch(`/svc/${y}/info.json`).then(g=>{if(!g.ok)throw new Error(`HTTP ${g.status}: ${g.statusText}`);return g.json()}).then(g=>{o(g)}).catch(g=>{Lt.error("Failed to load info:",g),i(g instanceof Error?g.message:String(g))}).finally(()=>{s(!1)})},[t?.mfeName]);return m.useEffect(()=>{b()},[b]),{data:r,isLoading:u,error:f,refetch:b}}const ce={log:(...t)=>{},warn:(...t)=>{},error:(...t)=>{console.error("[useV1Config]",...t)}},X={authority:"",client_id:"",environment:"development"};function Ut(){const[t,r]=m.useState(null),[o,u]=m.useState(!0),[s,f]=m.useState(null);return m.useEffect(()=>{(()=>{if(typeof sessionStorage>"u"){f("sessionStorage not available"),r(X),u(!1);return}try{const b=sessionStorage.getItem("config");if(b){const p=JSON.parse(b);r({...X,...p}),f(null),ce.log("Config loaded successfully")}else r(X),f("Config not found in sessionStorage"),ce.warn("Config not found in sessionStorage")}catch(b){ce.error("Error parsing config:",b),r(X),f("Error parsing config")}finally{u(!1)}})()},[]),{data:t,isLoading:o,error:s}}function Je(t){if(typeof window>"u")return;const r=window.__MF_NAME__||"unknown",o={...t,mfeName:r,timestamp:Date.now()};window.dispatchEvent(new CustomEvent("mfe-notification",{detail:o,bubbles:!0}))}function We(t,r){const o={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||"Произошла неизвестная ошибка."}},u=o[t.type]||o.unknown;Je({type:t.type==="network"?"warning":"error",title:u.title,message:r?`${u.message} (${r})`:u.message})}function Vt(t,r={}){const{notifyOnError:o=!0,notifyOnSuccess:u=!1,successMessage:s,errorContext:f,onSuccess:i,onError:b}=r,[p,y]=m.useState(null),[g,S]=m.useState(null),[l,v]=m.useState(!1),C=g!==null,k=p!==null&&!l&&!C,te=m.useCallback(async()=>{v(!0),S(null);try{const x=await t();if(x.ok)return y(x.data),u&&s&&Je({type:"success",title:"Успешно",message:s}),i?.(x.data),x.data;{const O={message:x.data||"Request failed",status:x.status,type:"client",timestamp:Date.now()};return S(O),o&&We(O,f),b?.(O),null}}catch(x){const O=x;return S(O),o&&We(O,f),b?.(O),null}finally{v(!1)}},[t,o,u,s,f,i,b]),j=m.useCallback(()=>{y(null),S(null),v(!1)},[]);return{data:p,error:g,isLoading:l,isError:C,isSuccess:k,execute:te,reset:j}}const Wt={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 Bt(t={}){const r=ze(),o=m.useMemo(()=>({...Wt,...t}),[t]),u=m.useMemo(()=>{const f=r.user?.profile?.realm_roles||r.user?.profile?.roles||[];return Array.isArray(f)?f:[f]},[r.user]),s=f=>f.includes("all")?!0:f.some(i=>u.includes(i));return{canView:s(o.canView),canEdit:s(o.canEdit),canDelete:s(o.canDelete),canAdmin:s(o.canAdmin),canViewSensitiveData:s(o.canViewSensitiveData),canExportData:s(o.canExportData),canManageUsers:s(o.canManageUsers)}}var Z={exports:{}},W={};var Be;function Ht(){if(Be)return W;Be=1;var t=m,r=Symbol.for("react.element"),o=Symbol.for("react.fragment"),u=Object.prototype.hasOwnProperty,s=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,f={key:!0,ref:!0,__self:!0,__source:!0};function i(b,p,y){var g,S={},l=null,v=null;y!==void 0&&(l=""+y),p.key!==void 0&&(l=""+p.key),p.ref!==void 0&&(v=p.ref);for(g in p)u.call(p,g)&&!f.hasOwnProperty(g)&&(S[g]=p[g]);if(b&&b.defaultProps)for(g in p=b.defaultProps,p)S[g]===void 0&&(S[g]=p[g]);return{$$typeof:r,type:b,key:l,ref:v,props:S,_owner:s.current}}return W.Fragment=o,W.jsx=i,W.jsxs=i,W}var B={};var He;function Gt(){return He||(He=1,process.env.NODE_ENV!=="production"&&(function(){var t=m,r=Symbol.for("react.element"),o=Symbol.for("react.portal"),u=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),b=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),y=Symbol.for("react.suspense"),g=Symbol.for("react.suspense_list"),S=Symbol.for("react.memo"),l=Symbol.for("react.lazy"),v=Symbol.for("react.offscreen"),C=Symbol.iterator,k="@@iterator";function te(e){if(e===null||typeof e!="object")return null;var n=C&&e[C]||e[k];return typeof n=="function"?n:null}var j=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function x(e){{for(var n=arguments.length,a=new Array(n>1?n-1:0),c=1;c<n;c++)a[c-1]=arguments[c];O("error",e,a)}}function O(e,n,a){{var c=j.ReactDebugCurrentFrame,E=c.getStackAddendum();E!==""&&(n+="%s",a=a.concat([E]));var w=a.map(function(_){return String(_)});w.unshift("Warning: "+n),Function.prototype.apply.call(console[e],console,w)}}var nt=!1,ot=!1,at=!1,it=!1,st=!1,he;he=Symbol.for("react.module.reference");function ut(e){return!!(typeof e=="string"||typeof e=="function"||e===u||e===f||st||e===s||e===y||e===g||it||e===v||nt||ot||at||typeof e=="object"&&e!==null&&(e.$$typeof===l||e.$$typeof===S||e.$$typeof===i||e.$$typeof===b||e.$$typeof===p||e.$$typeof===he||e.getModuleId!==void 0))}function lt(e,n,a){var c=e.displayName;if(c)return c;var E=n.displayName||n.name||"";return E!==""?a+"("+E+")":a}function _e(e){return e.displayName||"Context"}function P(e){if(e==null)return null;if(typeof e.tag=="number"&&x("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 u:return"Fragment";case o:return"Portal";case f:return"Profiler";case s:return"StrictMode";case y:return"Suspense";case g:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case b:var n=e;return _e(n)+".Consumer";case i:var a=e;return _e(a._context)+".Provider";case p:return lt(e,e.render,"ForwardRef");case S:var c=e.displayName||null;return c!==null?c:P(e.type)||"Memo";case l:{var E=e,w=E._payload,_=E._init;try{return P(_(w))}catch{return null}}}return null}var D=Object.assign,U=0,ve,Ee,ye,we,be,xe,Se;function Re(){}Re.__reactDisabledLog=!0;function ct(){{if(U===0){ve=console.log,Ee=console.info,ye=console.warn,we=console.error,be=console.group,xe=console.groupCollapsed,Se=console.groupEnd;var e={configurable:!0,enumerable:!0,value:Re,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}U++}}function ft(){{if(U--,U===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:D({},e,{value:ve}),info:D({},e,{value:Ee}),warn:D({},e,{value:ye}),error:D({},e,{value:we}),group:D({},e,{value:be}),groupCollapsed:D({},e,{value:xe}),groupEnd:D({},e,{value:Se})})}U<0&&x("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var re=j.ReactCurrentDispatcher,ne;function Y(e,n,a){{if(ne===void 0)try{throw Error()}catch(E){var c=E.stack.trim().match(/\n( *(at )?)/);ne=c&&c[1]||""}return`
2
+ `+ne+e}}var oe=!1,J;{var dt=typeof WeakMap=="function"?WeakMap:Map;J=new dt}function Ae(e,n){if(!e||oe)return"";{var a=J.get(e);if(a!==void 0)return a}var c;oe=!0;var E=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var w;w=re.current,re.current=null,ct();try{if(n){var _=function(){throw Error()};if(Object.defineProperty(_.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(_,[])}catch(I){c=I}Reflect.construct(e,[],_)}else{try{_.call()}catch(I){c=I}e.call(_.prototype)}}else{try{throw Error()}catch(I){c=I}e()}}catch(I){if(I&&c&&typeof I.stack=="string"){for(var h=I.stack.split(`
3
+ `),M=c.stack.split(`
4
+ `),R=h.length-1,A=M.length-1;R>=1&&A>=0&&h[R]!==M[A];)A--;for(;R>=1&&A>=0;R--,A--)if(h[R]!==M[A]){if(R!==1||A!==1)do if(R--,A--,A<0||h[R]!==M[A]){var N=`
5
+ `+h[R].replace(" at new "," at ");return e.displayName&&N.includes("<anonymous>")&&(N=N.replace("<anonymous>",e.displayName)),typeof e=="function"&&J.set(e,N),N}while(R>=1&&A>=0);break}}}finally{oe=!1,re.current=w,ft(),Error.prepareStackTrace=E}var $=e?e.displayName||e.name:"",F=$?Y($):"";return typeof e=="function"&&J.set(e,F),F}function pt(e,n,a){return Ae(e,!1)}function gt(e){var n=e.prototype;return!!(n&&n.isReactComponent)}function q(e,n,a){if(e==null)return"";if(typeof e=="function")return Ae(e,gt(e));if(typeof e=="string")return Y(e);switch(e){case y:return Y("Suspense");case g:return Y("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case p:return pt(e.render);case S:return q(e.type,n,a);case l:{var c=e,E=c._payload,w=c._init;try{return q(w(E),n,a)}catch{}}}return""}var V=Object.prototype.hasOwnProperty,Ce={},Me=j.ReactDebugCurrentFrame;function K(e){if(e){var n=e._owner,a=q(e.type,e._source,n?n.type:null);Me.setExtraStackFrame(a)}else Me.setExtraStackFrame(null)}function mt(e,n,a,c,E){{var w=Function.call.bind(V);for(var _ in e)if(w(e,_)){var h=void 0;try{if(typeof e[_]!="function"){var M=Error((c||"React class")+": "+a+" type `"+_+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[_]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw M.name="Invariant Violation",M}h=e[_](n,_,c,a,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(R){h=R}h&&!(h instanceof Error)&&(K(E),x("%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).",c||"React class",a,_,typeof h),K(null)),h instanceof Error&&!(h.message in Ce)&&(Ce[h.message]=!0,K(E),x("Failed %s type: %s",a,h.message),K(null))}}}var ht=Array.isArray;function ae(e){return ht(e)}function _t(e){{var n=typeof Symbol=="function"&&Symbol.toStringTag,a=n&&e[Symbol.toStringTag]||e.constructor.name||"Object";return a}}function vt(e){try{return Ie(e),!1}catch{return!0}}function Ie(e){return""+e}function Ne(e){if(vt(e))return x("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",_t(e)),Ie(e)}var Te=j.ReactCurrentOwner,Et={key:!0,ref:!0,__self:!0,__source:!0},ke,Oe;function yt(e){if(V.call(e,"ref")){var n=Object.getOwnPropertyDescriptor(e,"ref").get;if(n&&n.isReactWarning)return!1}return e.ref!==void 0}function wt(e){if(V.call(e,"key")){var n=Object.getOwnPropertyDescriptor(e,"key").get;if(n&&n.isReactWarning)return!1}return e.key!==void 0}function bt(e,n){typeof e.ref=="string"&&Te.current}function xt(e,n){{var a=function(){ke||(ke=!0,x("%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)",n))};a.isReactWarning=!0,Object.defineProperty(e,"key",{get:a,configurable:!0})}}function St(e,n){{var a=function(){Oe||(Oe=!0,x("%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)",n))};a.isReactWarning=!0,Object.defineProperty(e,"ref",{get:a,configurable:!0})}}var Rt=function(e,n,a,c,E,w,_){var h={$$typeof:r,type:e,key:n,ref:a,props:_,_owner:w};return h._store={},Object.defineProperty(h._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(h,"_self",{configurable:!1,enumerable:!1,writable:!1,value:c}),Object.defineProperty(h,"_source",{configurable:!1,enumerable:!1,writable:!1,value:E}),Object.freeze&&(Object.freeze(h.props),Object.freeze(h)),h};function At(e,n,a,c,E){{var w,_={},h=null,M=null;a!==void 0&&(Ne(a),h=""+a),wt(n)&&(Ne(n.key),h=""+n.key),yt(n)&&(M=n.ref,bt(n,E));for(w in n)V.call(n,w)&&!Et.hasOwnProperty(w)&&(_[w]=n[w]);if(e&&e.defaultProps){var R=e.defaultProps;for(w in R)_[w]===void 0&&(_[w]=R[w])}if(h||M){var A=typeof e=="function"?e.displayName||e.name||"Unknown":e;h&&xt(_,A),M&&St(_,A)}return Rt(e,h,M,E,c,Te.current,_)}}var ie=j.ReactCurrentOwner,je=j.ReactDebugCurrentFrame;function L(e){if(e){var n=e._owner,a=q(e.type,e._source,n?n.type:null);je.setExtraStackFrame(a)}else je.setExtraStackFrame(null)}var se;se=!1;function ue(e){return typeof e=="object"&&e!==null&&e.$$typeof===r}function Pe(){{if(ie.current){var e=P(ie.current.type);if(e)return`
6
6
 
7
- Check the render method of \``+e+"`."}return""}}function yt(e){return""}var Me={};function Et(e){{var t=Oe();if(!t){var o=typeof e=="string"?e:e.displayName||e.name;o&&(t=`
7
+ Check the render method of \``+e+"`."}return""}}function Ct(e){return""}var De={};function Mt(e){{var n=Pe();if(!n){var a=typeof e=="string"?e:e.displayName||e.name;a&&(n=`
8
8
 
9
- Check the top-level render call using <`+o+">.")}return t}}function Ne(e,t){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var o=Et(t);if(Me[o])return;Me[o]=!0;var c="";e&&e._owner&&e._owner!==oe.current&&(c=" It was passed a child from "+P(e._owner.type)+"."),$(e),w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',o,c),$(null)}}function je(e,t){{if(typeof e!="object")return;if(ae(e))for(var o=0;o<e.length;o++){var c=e[o];ie(c)&&Ne(c,t)}else if(ie(e))e._store&&(e._store.validated=!0);else if(e){var y=ee(e);if(typeof y=="function"&&y!==e.entries)for(var b=y.call(e),v;!(v=b.next()).done;)ie(v.value)&&Ne(v.value,t)}}}function bt(e){{var t=e.type;if(t==null||typeof t=="string")return;var o;if(typeof t=="function")o=t.propTypes;else if(typeof t=="object"&&(t.$$typeof===p||t.$$typeof===S))o=t.propTypes;else return;if(o){var c=P(t);it(o,e.props,"prop",c,e)}else if(t.PropTypes!==void 0&&!se){se=!0;var y=P(t);w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",y||"Unknown")}typeof t.getDefaultProps=="function"&&!t.getDefaultProps.isReactClassApproved&&w("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function xt(e){{for(var t=Object.keys(e.props),o=0;o<t.length;o++){var c=t[o];if(c!=="children"&&c!=="key"){$(e),w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",c),$(null);break}}e.ref!==null&&($(e),w("Invalid attribute `ref` supplied to `React.Fragment`."),$(null))}}var Pe={};function De(e,t,o,c,y,b){{var v=et(e);if(!v){var m="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(m+=" 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 I=yt();I?m+=I:m+=Oe();var R;e===null?R="null":ae(e)?R="array":e!==void 0&&e.$$typeof===r?(R="<"+(P(e.type)||"Unknown")+" />",m=" Did you accidentally export a JSX literal instead of a component?"):R=typeof e,w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",R,m)}var C=_t(e,t,o,y,b);if(C==null)return C;if(v){var T=t.children;if(T!==void 0)if(c)if(ae(T)){for(var F=0;F<T.length;F++)je(T[F],e);Object.freeze&&Object.freeze(T)}else w("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 je(T,e)}if(V.call(t,"key")){var L=P(e),k=Object.keys(t).filter(function(It){return It!=="key"}),le=k.length>0?"{key: someKey, "+k.join(": ..., ")+": ...}":"{key: someKey}";if(!Pe[L+le]){var At=k.length>0?"{"+k.join(": ..., ")+": ...}":"{}";w(`A props object containing a "key" prop is being spread into JSX:
9
+ Check the top-level render call using <`+a+">.")}return n}}function Fe(e,n){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var a=Mt(n);if(De[a])return;De[a]=!0;var c="";e&&e._owner&&e._owner!==ie.current&&(c=" It was passed a child from "+P(e._owner.type)+"."),L(e),x('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',a,c),L(null)}}function Le(e,n){{if(typeof e!="object")return;if(ae(e))for(var a=0;a<e.length;a++){var c=e[a];ue(c)&&Fe(c,n)}else if(ue(e))e._store&&(e._store.validated=!0);else if(e){var E=te(e);if(typeof E=="function"&&E!==e.entries)for(var w=E.call(e),_;!(_=w.next()).done;)ue(_.value)&&Fe(_.value,n)}}}function It(e){{var n=e.type;if(n==null||typeof n=="string")return;var a;if(typeof n=="function")a=n.propTypes;else if(typeof n=="object"&&(n.$$typeof===p||n.$$typeof===S))a=n.propTypes;else return;if(a){var c=P(n);mt(a,e.props,"prop",c,e)}else if(n.PropTypes!==void 0&&!se){se=!0;var E=P(n);x("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",E||"Unknown")}typeof n.getDefaultProps=="function"&&!n.getDefaultProps.isReactClassApproved&&x("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Nt(e){{for(var n=Object.keys(e.props),a=0;a<n.length;a++){var c=n[a];if(c!=="children"&&c!=="key"){L(e),x("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",c),L(null);break}}e.ref!==null&&(L(e),x("Invalid attribute `ref` supplied to `React.Fragment`."),L(null))}}var $e={};function Ue(e,n,a,c,E,w){{var _=ut(e);if(!_){var h="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(h+=" 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 M=Ct();M?h+=M:h+=Pe();var R;e===null?R="null":ae(e)?R="array":e!==void 0&&e.$$typeof===r?(R="<"+(P(e.type)||"Unknown")+" />",h=" Did you accidentally export a JSX literal instead of a component?"):R=typeof e,x("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",R,h)}var A=At(e,n,a,E,w);if(A==null)return A;if(_){var N=n.children;if(N!==void 0)if(c)if(ae(N)){for(var $=0;$<N.length;$++)Le(N[$],e);Object.freeze&&Object.freeze(N)}else x("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 Le(N,e)}if(V.call(n,"key")){var F=P(e),I=Object.keys(n).filter(function(Dt){return Dt!=="key"}),le=I.length>0?"{key: someKey, "+I.join(": ..., ")+": ...}":"{key: someKey}";if(!$e[F+le]){var Pt=I.length>0?"{"+I.join(": ..., ")+": ...}":"{}";x(`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} />`,le,L,At,L),Pe[L+le]=!0}}return e===l?xt(C):bt(C),C}}function wt(e,t,o){return De(e,t,o,!0)}function St(e,t,o){return De(e,t,o,!1)}var Rt=St,Ct=wt;W.Fragment=l,W.jsx=Rt,W.jsxs=Ct})()),W}var Ve;function $t(){return Ve||(Ve=1,process.env.NODE_ENV==="production"?Z.exports=Dt():Z.exports=Lt()),Z.exports}var f=$t();const Ge="platform-kit",Ft=!1,ce={log:(...n)=>{},warn:(...n)=>{},error:(...n)=>{console.error(`[${Ge}]`,...n)}};class Ut extends h.Component{hasDispatched=!1;constructor(r){super(r),this.state={hasError:!1}}getMfeName(){if(this.props.mfeName)return this.props.mfeName;if(typeof window<"u"){const r=window;if(r.__MF_NAME__)return r.__MF_NAME__}return Ge}shouldShowDetails(){if(this.props.showDetails!==void 0)return this.props.showDetails;if(typeof sessionStorage<"u")try{const r=sessionStorage.getItem("config");if(r){const a=JSON.parse(r);if(a.showErrorDetails!==void 0)return a.showErrorDetails}}catch{}return Ft}dispatchError(r,a){if(this.hasDispatched||typeof window>"u")return;this.hasDispatched=!0;const l=this.getMfeName();ce.error("ErrorBoundary caught:",r);try{window.dispatchEvent(new CustomEvent("mfe-error",{detail:{mfeName:l,error:r.message||String(r),stack:r.stack,componentStack:a?.componentStack,timestamp:Date.now()},bubbles:!0}))}catch(s){ce.error("Failed to dispatch mfe-error event:",s)}}static getDerivedStateFromError(r){return{hasError:!0,error:r}}componentDidCatch(r,a){this.dispatchError(r,a),ce.error("Error info:",a.componentStack)}handleCopy=()=>{const r=`Error in ${this.getMfeName()}:
14
+ <%s key={someKey} {...props} />`,le,F,Pt,F),$e[F+le]=!0}}return e===u?Nt(A):It(A),A}}function Tt(e,n,a){return Ue(e,n,a,!0)}function kt(e,n,a){return Ue(e,n,a,!1)}var Ot=kt,jt=Tt;B.Fragment=u,B.jsx=Ot,B.jsxs=jt})()),B}var Ge;function zt(){return Ge||(Ge=1,process.env.NODE_ENV==="production"?Z.exports=Ht():Z.exports=Gt()),Z.exports}var d=zt();const qe="platform-kit",Yt=!1,fe={log:(...t)=>{},warn:(...t)=>{},error:(...t)=>{console.error(`[${qe}]`,...t)}};class Jt extends m.Component{hasDispatched=!1;constructor(r){super(r),this.state={hasError:!1}}getMfeName(){if(this.props.mfeName)return this.props.mfeName;if(typeof window<"u"){const r=window;if(r.__MF_NAME__)return r.__MF_NAME__}return qe}shouldShowDetails(){if(this.props.showDetails!==void 0)return this.props.showDetails;if(typeof sessionStorage<"u")try{const r=sessionStorage.getItem("config");if(r){const o=JSON.parse(r);if(o.showErrorDetails!==void 0)return o.showErrorDetails}}catch{}return Yt}dispatchError(r,o){if(this.hasDispatched||typeof window>"u")return;this.hasDispatched=!0;const u=this.getMfeName();fe.error("ErrorBoundary caught:",r);try{window.dispatchEvent(new CustomEvent("mfe-error",{detail:{mfeName:u,error:r.message||String(r),stack:r.stack,componentStack:o?.componentStack,timestamp:Date.now()},bubbles:!0}))}catch(s){fe.error("Failed to dispatch mfe-error event:",s)}}static getDerivedStateFromError(r){return{hasError:!0,error:r}}componentDidCatch(r,o){this.dispatchError(r,o),fe.error("Error info:",o.componentStack)}handleCopy=()=>{const r=`Error in ${this.getMfeName()}:
15
15
  ${this.state.error?.message}
16
- ${this.state.error?.stack}`;typeof navigator<"u"&&navigator.clipboard&&navigator.clipboard.writeText(r).then(()=>{alert("Ошибка скопирована в буфер обмена")}).catch(()=>{prompt("Скопируйте ошибку:",r)})};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 r=this.state.error?.message||"Unknown error",a=this.state.error?.stack||"",l=this.shouldShowDetails(),s=this.getMfeName();return f.jsxs("div",{style:{padding:"20px",textAlign:"center",color:"#d32f2f",fontFamily:"monospace",background:"#ffebee",border:"1px solid #ef5350",borderRadius:"4px",margin:"10px"},children:[f.jsxs("h2",{style:{fontSize:"16px",margin:"0 0 8px 0"},children:["⚠️ Ошибка в ",s]}),f.jsx("p",{style:{fontSize:"12px",margin:0},children:"Произошла ошибка в микрофронтенде. Сообщение отправлено в shell."}),l&&f.jsxs("details",{style:{whiteSpace:"pre-wrap",textAlign:"left",marginTop:"10px",background:"#fff",padding:"8px",borderRadius:"4px"},children:[f.jsx("summary",{style:{cursor:"pointer",fontWeight:"bold"},children:"Детали ошибки"}),f.jsxs("pre",{style:{fontSize:"11px",overflow:"auto",maxHeight:"150px",margin:"8px 0 0 0",padding:"8px",background:"#f5f5f5",borderRadius:"4px"},children:[r,a&&`
16
+ ${this.state.error?.stack}`;typeof navigator<"u"&&navigator.clipboard&&navigator.clipboard.writeText(r).then(()=>{alert("Ошибка скопирована в буфер обмена")}).catch(()=>{prompt("Скопируйте ошибку:",r)})};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 r=this.state.error?.message||"Unknown error",o=this.state.error?.stack||"",u=this.shouldShowDetails(),s=this.getMfeName();return d.jsxs("div",{style:{padding:"20px",textAlign:"center",color:"#d32f2f",fontFamily:"monospace",background:"#ffebee",border:"1px solid #ef5350",borderRadius:"4px",margin:"10px"},children:[d.jsxs("h2",{style:{fontSize:"16px",margin:"0 0 8px 0"},children:["⚠️ Ошибка в ",s]}),d.jsx("p",{style:{fontSize:"12px",margin:0},children:"Произошла ошибка в микрофронтенде. Сообщение отправлено в shell."}),u&&d.jsxs("details",{style:{whiteSpace:"pre-wrap",textAlign:"left",marginTop:"10px",background:"#fff",padding:"8px",borderRadius:"4px"},children:[d.jsx("summary",{style:{cursor:"pointer",fontWeight:"bold"},children:"Детали ошибки"}),d.jsxs("pre",{style:{fontSize:"11px",overflow:"auto",maxHeight:"150px",margin:"8px 0 0 0",padding:"8px",background:"#f5f5f5",borderRadius:"4px"},children:[r,o&&`
17
17
 
18
- ${a}`]})]}),f.jsxs("div",{style:{marginTop:"12px",display:"flex",gap:"8px",justifyContent:"center"},children:[f.jsx("button",{onClick:this.handleCopy,style:{padding:"8px 12px",background:"#666",color:"white",border:"none",borderRadius:"4px",cursor:"pointer"},children:"📋 Копировать"}),f.jsx("button",{onClick:this.handleRetry,style:{padding:"8px 12px",background:"#d32f2f",color:"white",border:"none",borderRadius:"4px",cursor:"pointer"},children:"🔄 Обновить"}),f.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 O={info:"ℹ️",code:"💻",link:"🔗",user:"👤",clock:"🕐",apps:"📦",storage:"💾",tags:"🏷️",spreadsheet:"📊"};function Vt({mfeName:n}){const{data:r,isLoading:a,error:l}=We({mfeName:n}),[s,d]=h.useState(!1);if(a)return f.jsxs("span",{className:"text-muted small me-2",children:[f.jsx("span",{className:"me-1",children:"⏳"}),"Загрузка..."]});if(l||!r)return f.jsxs("span",{className:"text-muted small me-2",title:`Ошибка: ${l||"нет данных"}`,children:[f.jsx("span",{className:"me-1",children:"ℹ️"}),"N/A"]});const i=r,x=i.BUILD_VERSION||i.IMAGE_VERSION||i.APP_NAME||"N/A",p=[];return i.APP_NAME&&p.push({key:"APP_NAME",value:i.APP_NAME,label:"Приложение",icon:O.apps}),i.BUILD_VERSION&&p.push({key:"BUILD_VERSION",value:i.BUILD_VERSION,label:"Версия",icon:O.tags}),i.IMAGE_VERSION&&p.push({key:"IMAGE_VERSION",value:i.IMAGE_VERSION,label:"Образ",icon:O.storage}),i.GIT_COMMIT&&p.push({key:"GIT_COMMIT",value:i.GIT_COMMIT,label:"Commit",icon:O.spreadsheet}),i.GIT_BRANCH&&p.push({key:"GIT_BRANCH",value:i.GIT_BRANCH,label:"Ветка",icon:O.spreadsheet}),i.CI_COMMIT_AUTHOR&&p.push({key:"CI_COMMIT_AUTHOR",value:i.CI_COMMIT_AUTHOR,label:"Автор",icon:O.user}),i.CI_COMMIT_TIMESTAMP&&p.push({key:"CI_COMMIT_TIMESTAMP",value:i.CI_COMMIT_TIMESTAMP,label:"Дата",icon:O.clock}),i.CI_JOB_URL&&p.push({key:"CI_JOB_URL",value:i.CI_JOB_URL,label:"CI Job",icon:O.link}),i.CI_PIPELINE_URL&&p.push({key:"CI_PIPELINE_URL",value:i.CI_PIPELINE_URL,label:"Pipeline",icon:O.link}),i.CI_COMMIT_MESSAGE&&(i.CI_COMMIT_MESSAGE.length>60?i.CI_COMMIT_MESSAGE.substring(0,57)+"":i.CI_COMMIT_MESSAGE,p.push({key:"CI_COMMIT_MESSAGE",value:i.CI_COMMIT_MESSAGE,label:"Сообщение",icon:O.code})),f.jsxs("div",{style:{display:"inline-block",position:"relative"},children:[f.jsxs("button",{onClick:()=>d(!s),style:{background:"transparent",border:"none",cursor:"pointer",padding:"4px 8px",fontSize:"14px",display:"inline-flex",alignItems:"center"},title:"Информация о версии",children:[f.jsx("span",{className:"me-1",children:O.info}),f.jsx("span",{className:"text-dark",children:x})]}),s&&f.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:[f.jsxs("div",{style:{marginBottom:"12px",paddingBottom:"8px",borderBottom:"1px solid #dee2e6",display:"flex",alignItems:"center"},children:[f.jsx("span",{className:"me-2",children:O.apps}),f.jsx("strong",{children:i.APP_NAME||n})]}),f.jsxs("div",{style:{marginBottom:"12px"},children:[f.jsx("span",{className:"text-muted",children:"Версия: "}),f.jsx("strong",{children:x})]}),p.length>0&&f.jsx("div",{style:{fontSize:"13px"},children:p.map(({key:E,value:g,label:S,icon:u})=>{const _=g.length>40&&(E.includes("URL")||E.includes("MESSAGE"))?`${g.substring(0,37)}...`:g;return f.jsxs("div",{style:{marginBottom:"8px",display:"flex",alignItems:"flex-start"},children:[f.jsx("span",{className:"me-2",style:{flexShrink:0},children:u}),f.jsxs("div",{style:{flex:1,minWidth:0},children:[f.jsx("div",{className:"small text-muted",children:S}),f.jsx("div",{className:"font-monospace small text-truncate",style:{maxWidth:"100%"},title:g,children:E.includes("URL")?f.jsx("a",{href:g,target:"_blank",rel:"noopener noreferrer",style:{color:"#007bff"},children:_}):_})]})]},E)})}),p.length===0&&f.jsx("div",{className:"text-center text-muted py-2 small",children:"Нет информации о версии"}),f.jsx("div",{style:{marginTop:"12px",paddingTop:"8px",borderTop:"1px solid #dee2e6",textAlign:"center",fontSize:"12px",color:"#6c757d"},children:"IngoBank DevOps Platform"}),f.jsx("button",{onClick:()=>d(!1),style:{position:"absolute",top:"8px",right:"8px",background:"transparent",border:"none",cursor:"pointer",fontSize:"16px",color:"#6c757d"},children:"×"})]}),s&&f.jsx("div",{onClick:()=>d(!1),style:{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:999}})]})}const fe="platform-kit",ze=h.createContext(null);function Bt({children:n}){const[r,a]=h.useState([]),l=typeof window<"u"&&window.__MF_NAME__||fe,s=h.useCallback((u,_,A,M)=>({id:`${Date.now()}-${Math.random().toString(36).substr(2,9)}`,type:u,title:_,message:A,mfeName:l,timestamp:Date.now(),duration:M}),[l]),d=h.useCallback(u=>{a(A=>[...A,u].slice(0,5));const _=u.duration||5e3;_>0&&setTimeout(()=>{a(A=>A.filter(M=>M.id!==u.id))},_)},[]),i=h.useCallback(u=>{const _=s(u.type,u.title,u.message,u.duration);d(_),typeof window<"u"&&window.dispatchEvent(new CustomEvent("mfe-notification",{detail:_,bubbles:!0}))},[s,d]),x=h.useCallback((u,_="Успешно")=>{i({type:"success",title:_,message:u})},[i]),p=h.useCallback((u,_="Ошибка")=>{i({type:"error",title:_,message:u})},[i]),E=h.useCallback((u,_="Предупреждение")=>{i({type:"warning",title:_,message:u})},[i]),g=h.useCallback((u,_="Информация")=>{i({type:"info",title:_,message:u})},[i]),S=h.useCallback(u=>{a(_=>_.filter(A=>A.id!==u))},[]);return h.useEffect(()=>{if(typeof window>"u")return;const u=_=>{const A=_.detail;if(A&&A.type&&A.title&&A.message){const M={...A,id:`${Date.now()}-${Math.random().toString(36).substr(2,9)}`};d(M)}};return window.addEventListener("mfe-notification",u),()=>{window.removeEventListener("mfe-notification",u)}},[d]),f.jsxs(ze.Provider,{value:{notify:i,notifySuccess:x,notifyError:p,notifyWarning:E,notifyInfo:g,removeNotification:S},children:[n,r.length>0&&f.jsx("div",{style:{position:"fixed",top:"80px",right:"20px",zIndex:9998,maxWidth:"400px",width:"100%",display:"flex",flexDirection:"column",gap:"8px",pointerEvents:"none"},children:r.map(u=>f.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:[f.jsxs("div",{style:{flex:1},children:[f.jsx("strong",{style:{display:"block",marginBottom:"4px"},children:u.title}),f.jsx("p",{style:{margin:0,fontSize:"14px"},children:u.message}),f.jsx("small",{style:{opacity:.7,fontSize:"12px"},children:u.mfeName})]}),f.jsx("button",{onClick:()=>S(u.id),style:{background:"transparent",border:"none",cursor:"pointer",fontSize:"18px",lineHeight:1,opacity:.5},children:"×"})]},u.id))})]})}function Wt(){const n=h.useContext(ze);return n||{notify:()=>{},notifySuccess:()=>{},notifyError:()=>{},notifyWarning:()=>{},notifyInfo:()=>{},removeNotification:()=>{}}}function Ht(n){if(typeof window>"u")return;const r=window.__MF_NAME__||fe,a={...n,mfeName:r,timestamp:Date.now()};window.dispatchEvent(new CustomEvent("mfe-notification",{detail:a,bubbles:!0}))}const Ye="platform-kit",H={log:(...n)=>{},warn:(...n)=>{},error:(...n)=>{console.error(`[${Ye}]`,...n)},info:(...n)=>{}};function Gt(){if(typeof window>"u")return{isAuthenticated:!1};const n=window.__SHELL_AUTH_INSTANCE__;if(n)return n;const r=window.__SHELL_AUTH__;return r?.authInstance?r.authInstance:{isAuthenticated:!1}}function zt(){if(typeof window>"u")return;const n=window.__SHELL_AUTH_INSTANCE__;n?.signinRedirect?n.signinRedirect().catch(r=>{H.error("Failed to redirect to login:",r)}):window.location.href="/"}function Yt(n){const r=n.response;let a="unknown";return r?r.status===401?a="unauthorized":r.status===403?a="forbidden":r.status===404?a="not_found":r.status>=500&&(a="server"):a="network",{message:r?.data?.message??n.message??"Unknown error",code:r?.data?.code,status:r?.status,type:a,timestamp:Date.now(),url:n.config?.url}}function Je(n={}){const r=n.name||Ye,a={log:(...s)=>H.log(`[API:${r}]`,...s),warn:(...s)=>H.warn(`[API:${r}]`,...s),error:(...s)=>H.error(`[API:${r}]`,...s),info:(...s)=>H.info(`[API:${r}]`,...s)},l=kt.create({timeout:n.timeout??1e4,baseURL:n.baseURL??"",headers:{"Content-Type":"application/json"}});return l.interceptors.request.use(s=>{const d=Gt();if(d?.isAuthenticated){const i=d.user?.profile?.access_token;i&&s.headers&&(s.headers.Authorization=`Bearer ${i}`,a.info("Auth token attached"))}else a.info("User not authenticated - request without token");return a.log(`${s.method?.toUpperCase()} ${s.url}`),s},s=>(a.error("Request interceptor error:",s.message),Promise.reject(s))),l.interceptors.response.use(s=>(a.log(`Response ${s.status}:`,s.config.url),s),s=>{const d=s.response?.status,i=s.config?.url;return d===401?(a.warn("401 Unauthorized - triggering re-auth"),zt()):d===403?a.warn("403 Forbidden - insufficient permissions"):d===404?a.warn("404 Not found:",i):d===429?a.warn("429 Rate limited"):d===500?a.error("500 Server error:",i):s.response?a.warn(`Error ${d}:`,s.message):a.error("Network error - backend may be unavailable:",i),Promise.reject(Yt(s))}),l}const G=Je();async function Jt(n,r,a=G){const l=await a.get(n,{params:r});return{data:l.data,status:l.status,ok:l.status>=200&&l.status<300}}async function qt(n,r,a=G){const l=await a.post(n,r);return{data:l.data,status:l.status,ok:l.status>=200&&l.status<300}}async function Kt(n,r,a=G){const l=await a.put(n,r);return{data:l.data,status:l.status,ok:l.status>=200&&l.status<300}}async function Xt(n,r=G){const a=await r.delete(n);return{data:a.data,status:a.status,ok:a.status>=200&&a.status<300}}function z(n,r){const a=r?.prefix?`[${r.prefix}]`:`[${n}]`;return{log:(...l)=>{},warn:(...l)=>{},error:(...l)=>{console.error(a,...l)},info:(...l)=>{}}}const Zt=z("platform-kit",{prefix:"AUTH"}),Qt=z("platform-kit",{prefix:"API"}),er=z("platform-kit",{prefix:"ERROR"}),tr=z("platform-kit",{prefix:"INFO"});exports.ErrorBoundary=Ut;exports.NotificationProvider=Bt;exports.VersionInfo=Vt;exports.api=G;exports.apiLogger=Qt;exports.authLogger=Zt;exports.createApiClient=Je;exports.createMfLogger=z;exports.del=Xt;exports.dispatchNotification=Ht;exports.errorLogger=er;exports.get=Jt;exports.getAuth=Q;exports.infoLogger=tr;exports.post=qt;exports.put=Kt;exports.useApi=Nt;exports.useInfoData=We;exports.useNotification=Wt;exports.usePermissions=Pt;exports.useShellAuth=Be;exports.useV1Config=Mt;
18
+ ${o}`]})]}),d.jsxs("div",{style:{marginTop:"12px",display:"flex",gap:"8px",justifyContent:"center"},children:[d.jsx("button",{onClick:this.handleCopy,style:{padding:"8px 12px",background:"#666",color:"white",border:"none",borderRadius:"4px",cursor:"pointer"},children:"📋 Копировать"}),d.jsx("button",{onClick:this.handleRetry,style:{padding:"8px 12px",background:"#d32f2f",color:"white",border:"none",borderRadius:"4px",cursor:"pointer"},children:"🔄 Обновить"}),d.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 T={info:"ℹ️",code:"💻",link:"🔗",user:"👤",clock:"🕐",apps:"📦",storage:"💾",tags:"🏷️",spreadsheet:"📊"};function qt({mfeName:t}){const{data:r,isLoading:o,error:u}=Ye({mfeName:t}),[s,f]=m.useState(!1);if(o)return d.jsxs("span",{className:"text-muted small me-2",children:[d.jsx("span",{className:"me-1",children:"⏳"}),"Загрузка..."]});if(u||!r)return d.jsxs("span",{className:"text-muted small me-2",title:`Ошибка: ${u||"нет данных"}`,children:[d.jsx("span",{className:"me-1",children:"ℹ️"}),"N/A"]});const i=r,b=i.BUILD_VERSION||i.IMAGE_VERSION||i.APP_NAME||"N/A",p=[];return i.APP_NAME&&p.push({key:"APP_NAME",value:i.APP_NAME,label:"Приложение",icon:T.apps}),i.BUILD_VERSION&&p.push({key:"BUILD_VERSION",value:i.BUILD_VERSION,label:"Версия",icon:T.tags}),i.IMAGE_VERSION&&p.push({key:"IMAGE_VERSION",value:i.IMAGE_VERSION,label:"Образ",icon:T.storage}),i.GIT_COMMIT&&p.push({key:"GIT_COMMIT",value:i.GIT_COMMIT,label:"Commit",icon:T.spreadsheet}),i.GIT_BRANCH&&p.push({key:"GIT_BRANCH",value:i.GIT_BRANCH,label:"Ветка",icon:T.spreadsheet}),i.CI_COMMIT_AUTHOR&&p.push({key:"CI_COMMIT_AUTHOR",value:i.CI_COMMIT_AUTHOR,label:"Автор",icon:T.user}),i.CI_COMMIT_TIMESTAMP&&p.push({key:"CI_COMMIT_TIMESTAMP",value:i.CI_COMMIT_TIMESTAMP,label:"Дата",icon:T.clock}),i.CI_JOB_URL&&p.push({key:"CI_JOB_URL",value:i.CI_JOB_URL,label:"CI Job",icon:T.link}),i.CI_PIPELINE_URL&&p.push({key:"CI_PIPELINE_URL",value:i.CI_PIPELINE_URL,label:"Pipeline",icon:T.link}),i.CI_COMMIT_MESSAGE&&(i.CI_COMMIT_MESSAGE.length>60?i.CI_COMMIT_MESSAGE.substring(0,57)+"":i.CI_COMMIT_MESSAGE,p.push({key:"CI_COMMIT_MESSAGE",value:i.CI_COMMIT_MESSAGE,label:"Сообщение",icon:T.code})),d.jsxs("div",{style:{display:"inline-block",position:"relative"},children:[d.jsxs("button",{onClick:()=>f(!s),style:{background:"transparent",border:"none",cursor:"pointer",padding:"4px 8px",fontSize:"14px",display:"inline-flex",alignItems:"center"},title:"Информация о версии",children:[d.jsx("span",{className:"me-1",children:T.info}),d.jsx("span",{className:"text-dark",children:b})]}),s&&d.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:[d.jsxs("div",{style:{marginBottom:"12px",paddingBottom:"8px",borderBottom:"1px solid #dee2e6",display:"flex",alignItems:"center"},children:[d.jsx("span",{className:"me-2",children:T.apps}),d.jsx("strong",{children:i.APP_NAME||t})]}),d.jsxs("div",{style:{marginBottom:"12px"},children:[d.jsx("span",{className:"text-muted",children:"Версия: "}),d.jsx("strong",{children:b})]}),p.length>0&&d.jsx("div",{style:{fontSize:"13px"},children:p.map(({key:y,value:g,label:S,icon:l})=>{const v=g.length>40&&(y.includes("URL")||y.includes("MESSAGE"))?`${g.substring(0,37)}...`:g;return d.jsxs("div",{style:{marginBottom:"8px",display:"flex",alignItems:"flex-start"},children:[d.jsx("span",{className:"me-2",style:{flexShrink:0},children:l}),d.jsxs("div",{style:{flex:1,minWidth:0},children:[d.jsx("div",{className:"small text-muted",children:S}),d.jsx("div",{className:"font-monospace small text-truncate",style:{maxWidth:"100%"},title:g,children:y.includes("URL")?d.jsx("a",{href:g,target:"_blank",rel:"noopener noreferrer",style:{color:"#007bff"},children:v}):v})]})]},y)})}),p.length===0&&d.jsx("div",{className:"text-center text-muted py-2 small",children:"Нет информации о версии"}),d.jsx("div",{style:{marginTop:"12px",paddingTop:"8px",borderTop:"1px solid #dee2e6",textAlign:"center",fontSize:"12px",color:"#6c757d"},children:"IngoBank DevOps Platform"}),d.jsx("button",{onClick:()=>f(!1),style:{position:"absolute",top:"8px",right:"8px",background:"transparent",border:"none",cursor:"pointer",fontSize:"16px",color:"#6c757d"},children:"×"})]}),s&&d.jsx("div",{onClick:()=>f(!1),style:{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:999}})]})}const de="platform-kit",Ke=m.createContext(null);function Kt({children:t}){const[r,o]=m.useState([]),u=typeof window<"u"&&window.__MF_NAME__||de,s=m.useCallback((l,v,C,k)=>({id:`${Date.now()}-${Math.random().toString(36).substr(2,9)}`,type:l,title:v,message:C,mfeName:u,timestamp:Date.now(),duration:k}),[u]),f=m.useCallback(l=>{o(C=>[...C,l].slice(0,5));const v=l.duration||5e3;v>0&&setTimeout(()=>{o(C=>C.filter(k=>k.id!==l.id))},v)},[]),i=m.useCallback(l=>{const v=s(l.type,l.title,l.message,l.duration);f(v),typeof window<"u"&&window.dispatchEvent(new CustomEvent("mfe-notification",{detail:v,bubbles:!0}))},[s,f]),b=m.useCallback((l,v="Успешно")=>{i({type:"success",title:v,message:l})},[i]),p=m.useCallback((l,v="Ошибка")=>{i({type:"error",title:v,message:l})},[i]),y=m.useCallback((l,v="Предупреждение")=>{i({type:"warning",title:v,message:l})},[i]),g=m.useCallback((l,v="Информация")=>{i({type:"info",title:v,message:l})},[i]),S=m.useCallback(l=>{o(v=>v.filter(C=>C.id!==l))},[]);return m.useEffect(()=>{if(typeof window>"u")return;const l=v=>{const C=v.detail;if(C&&C.type&&C.title&&C.message){const k={...C,id:`${Date.now()}-${Math.random().toString(36).substr(2,9)}`};f(k)}};return window.addEventListener("mfe-notification",l),()=>{window.removeEventListener("mfe-notification",l)}},[f]),d.jsxs(Ke.Provider,{value:{notify:i,notifySuccess:b,notifyError:p,notifyWarning:y,notifyInfo:g,removeNotification:S},children:[t,r.length>0&&d.jsx("div",{style:{position:"fixed",top:"80px",right:"20px",zIndex:9998,maxWidth:"400px",width:"100%",display:"flex",flexDirection:"column",gap:"8px",pointerEvents:"none"},children:r.map(l=>d.jsxs("div",{className:`notification notification-${l.type}`,style:{pointerEvents:"auto",padding:"12px 16px",borderRadius:"8px",background:l.type==="success"?"#d4edda":l.type==="error"?"#f8d7da":l.type==="warning"?"#fff3cd":"#d1ecf1",color:l.type==="success"?"#155724":l.type==="error"?"#721c24":l.type==="warning"?"#856404":"#0c5460",boxShadow:"0 4px 12px rgba(0,0,0,0.15)",display:"flex",alignItems:"flex-start",gap:"12px"},children:[d.jsxs("div",{style:{flex:1},children:[d.jsx("strong",{style:{display:"block",marginBottom:"4px"},children:l.title}),d.jsx("p",{style:{margin:0,fontSize:"14px"},children:l.message}),d.jsx("small",{style:{opacity:.7,fontSize:"12px"},children:l.mfeName})]}),d.jsx("button",{onClick:()=>S(l.id),style:{background:"transparent",border:"none",cursor:"pointer",fontSize:"18px",lineHeight:1,opacity:.5},children:"×"})]},l.id))})]})}function Xt(){const t=m.useContext(Ke);return t||{notify:()=>{},notifySuccess:()=>{},notifyError:()=>{},notifyWarning:()=>{},notifyInfo:()=>{},removeNotification:()=>{}}}function Zt(t){if(typeof window>"u")return;const r=window.__MF_NAME__||de,o={...t,mfeName:r,timestamp:Date.now()};window.dispatchEvent(new CustomEvent("mfe-notification",{detail:o,bubbles:!0}))}const Xe="platform-kit",H={log:(...t)=>{},warn:(...t)=>{},error:(...t)=>{console.error(`[${Xe}]`,...t)},info:(...t)=>{}};function Qt(){if(typeof window>"u")return{isAuthenticated:!1};const t=window.__SHELL_AUTH_INSTANCE__;if(t)return t;const r=window.__SHELL_AUTH__;return r?.authInstance?r.authInstance:{isAuthenticated:!1}}function er(){if(typeof window>"u")return;const t=window.__SHELL_AUTH_INSTANCE__;t?.signinRedirect?t.signinRedirect().catch(r=>{H.error("Failed to redirect to login:",r)}):window.location.href="/"}function tr(t){const r=t.response;let o="unknown";return r?r.status===401?o="unauthorized":r.status===403?o="forbidden":r.status===404?o="not_found":r.status>=500&&(o="server"):o="network",{message:r?.data?.message??t.message??"Unknown error",code:r?.data?.code,status:r?.status,type:o,timestamp:Date.now(),url:t.config?.url}}function Ze(t={}){const r=t.name||Xe,o={log:(...s)=>H.log(`[API:${r}]`,...s),warn:(...s)=>H.warn(`[API:${r}]`,...s),error:(...s)=>H.error(`[API:${r}]`,...s),info:(...s)=>H.info(`[API:${r}]`,...s)},u=Ft.create({timeout:t.timeout??1e4,baseURL:t.baseURL??"",headers:{"Content-Type":"application/json"}});return u.interceptors.request.use(s=>{const f=Qt();if(f?.isAuthenticated){const i=f.user?.profile?.access_token;i&&s.headers&&(s.headers.Authorization=`Bearer ${i}`,o.info("Auth token attached"))}else o.info("User not authenticated - request without token");return o.log(`${s.method?.toUpperCase()} ${s.url}`),s},s=>(o.error("Request interceptor error:",s.message),Promise.reject(s))),u.interceptors.response.use(s=>(o.log(`Response ${s.status}:`,s.config.url),s),s=>{const f=s.response?.status,i=s.config?.url;return f===401?(o.warn("401 Unauthorized - triggering re-auth"),er()):f===403?o.warn("403 Forbidden - insufficient permissions"):f===404?o.warn("404 Not found:",i):f===429?o.warn("429 Rate limited"):f===500?o.error("500 Server error:",i):s.response?o.warn(`Error ${f}:`,s.message):o.error("Network error - backend may be unavailable:",i),Promise.reject(tr(s))}),u}const G=Ze();async function rr(t,r,o=G){const u=await o.get(t,{params:r});return{data:u.data,status:u.status,ok:u.status>=200&&u.status<300}}async function nr(t,r,o=G){const u=await o.post(t,r);return{data:u.data,status:u.status,ok:u.status>=200&&u.status<300}}async function or(t,r,o=G){const u=await o.put(t,r);return{data:u.data,status:u.status,ok:u.status>=200&&u.status<300}}async function ar(t,r=G){const o=await r.delete(t);return{data:o.data,status:o.status,ok:o.status>=200&&o.status<300}}function z(t,r){const o=r?.prefix?`[${r.prefix}]`:`[${t}]`;return{log:(...u)=>{},warn:(...u)=>{},error:(...u)=>{console.error(o,...u)},info:(...u)=>{}}}const ir=z("platform-kit",{prefix:"AUTH"}),sr=z("platform-kit",{prefix:"API"}),ur=z("platform-kit",{prefix:"ERROR"}),lr=z("platform-kit",{prefix:"INFO"}),cr={},fr={log:(...t)=>{},warn:(...t)=>{},error:(...t)=>{console.error("[getMfeName]",...t)}};function ge(t){return t?t.mfeName?t.mfeName:t.name?t.name.replace("@ib-dop/",""):null:null}function Qe(){if(typeof window>"u")return null;const t=window;return t.__MF_NAME__?t.__MF_NAME__:null}function et(){if(typeof window>"u")return null;try{const t=sessionStorage.getItem("mf-config");if(t){const r=JSON.parse(t);if(r.mfeName)return r.mfeName;if(r.name)return r.name;if(r.appName)return r.appName}}catch{}return null}function me(){const t=cr;return t.VITE_MFE_NAME?String(t.VITE_MFE_NAME):t.MFE_NAME?String(t.MFE_NAME):null}let ee=null,pe=!1;function tt(t,r){const o=ge(t);if(o)return o;if(pe&&ee)return ee;const u=[{source:"window.__MF_NAME__",value:Qe()},{source:"sessionStorage.mf-config",value:et()},{source:"import.meta.env.VITE_MFE_NAME",value:me()}];for(const{source:f,value:i}of u)if(i)return ee=i,pe=!0,i;if(r)return r;const s="Cannot determine MFE name. Please pass mfeName in props, set window.__MF_NAME__, sessionStorage.mf-config, or VITE_MFE_NAME";throw fr.error(s),new Error(s)}function dr(t){return tt(t)}function rt(t){return ge(t)?"props.mfeName":Qe()?"window.__MF_NAME__":et()?"sessionStorage.mf-config":me()?"import.meta.env.VITE_MFE_NAME":null}function pr(t){return rt(t)!==null}function gr(){ee=null,pe=!1}function mr(t){const r=[];return ge(t)&&r.push("props.mfeName"),typeof window<"u"&&(window.__MF_NAME__&&r.push("window.__MF_NAME__"),sessionStorage.getItem("mf-config")&&r.push("sessionStorage.mf-config")),me()&&r.push("import.meta.env.VITE_MFE_NAME"),r}exports.ErrorBoundary=Jt;exports.NotificationProvider=Kt;exports.VersionInfo=qt;exports.api=G;exports.apiLogger=sr;exports.authLogger=ir;exports.createApiClient=Ze;exports.createMfLogger=z;exports.del=ar;exports.dispatchNotification=Zt;exports.errorLogger=ur;exports.get=rr;exports.getAllMfeNameSources=mr;exports.getAuth=Q;exports.getMfeName=tt;exports.getMfeNameSource=rt;exports.hasMfeName=pr;exports.infoLogger=lr;exports.post=nr;exports.put=or;exports.requireMfeName=dr;exports.resetMfeNameCache=gr;exports.useApi=Vt;exports.useInfoData=Ye;exports.useNotification=Xt;exports.usePermissions=Bt;exports.useShellAuth=ze;exports.useV1Config=Ut;
package/dist/index.d.ts CHANGED
@@ -7,4 +7,5 @@ export * from './types';
7
7
  export * from './hooks';
8
8
  export * from './components';
9
9
  export * from './services';
10
+ export * from './utils';
10
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,cAAc,SAAS,CAAA;AAGvB,cAAc,SAAS,CAAA;AAGvB,cAAc,cAAc,CAAA;AAG5B,cAAc,YAAY,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,cAAc,SAAS,CAAA;AAGvB,cAAc,SAAS,CAAA;AAGvB,cAAc,cAAc,CAAA;AAG5B,cAAc,YAAY,CAAA;AAG1B,cAAc,SAAS,CAAA"}