mtxuilib 0.0.516 → 0.0.518
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/esm/lib/trpc/TrpcAppProvider.d.ts +1 -1
- package/dist/esm/lib/trpc/TrpcAppProvider.js +1 -1
- package/dist/tsconfig.type.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/esm/form/MtFormPopupHolder.d.ts +0 -11
- package/dist/esm/form/MtFormPopupHolder.js +0 -1
- package/dist/esm/store/commands.d.ts +0 -9
- package/dist/esm/store/commands.js +0 -1
|
@@ -18,7 +18,7 @@ export declare const useMtmBackendUrl: () => string | null | undefined;
|
|
|
18
18
|
export declare const useHostname: () => string;
|
|
19
19
|
export declare const useExtInfo: () => (key: string) => string | null | undefined;
|
|
20
20
|
export declare const useToken: () => {
|
|
21
|
-
token:
|
|
21
|
+
token: string;
|
|
22
22
|
setToken: (newToken: string) => void;
|
|
23
23
|
};
|
|
24
24
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{Fragment as
|
|
1
|
+
"use client";import{Fragment as h,jsx as c}from"react/jsx-runtime";import{createContext as p,useCallback as u,useContext as d,useState as a}from"react";import{ExtKey_Hostname as l,ExtKey_SelfBackend as f,ExtKey_mtmaccessToken as x,MtM_TOKEN_NAME as i}from"../../consts";import{getCookie as k}from"../clientlib/clientlib";const s=p(void 0);function A(t){const{children:e,initExtKv:o}=t;return c(h,{children:c(s.Provider,{value:{extKv:o},children:e})})}function n(){const t=d(s);if(t===void 0)throw new Error("useTrpcApp must be used within a TrpcAppProvider");return t}const E=()=>{const{backendUrl:t}=n();return t},m=()=>{const{hostname:t}=n();return t||window.location.host},y=()=>{const t=m(),{token:e}=n();return u(r=>{switch(r){case l:return t;case x:return e;case f:return;default:throw new Error(`extinfo key error: ${r}`)}},[t,e])},K=()=>{const[t]=a(typeof window!="undefined"?k(i):"");return{token:t||"",setToken:e=>{typeof window!="undefined"&&(document.cookie=`${i}=${e}`)}}};export{A as TrpcAppProvider,y as useExtInfo,m as useHostname,E as useMtmBackendUrl,K as useToken,n as useTrpcApp};
|