@tbox.cn/app-sdk-client 1.0.0-alpha.7 → 1.0.0-alpha.9
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/app/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactNode, ComponentType } from 'react';
|
|
2
2
|
import { CardComponent } from '@tbox.cn/app-contracts';
|
|
3
3
|
import { A as AppClientModule } from '../app-module-dEGAU6l2.js';
|
|
4
4
|
|
|
@@ -9,6 +9,8 @@ interface AppConfig {
|
|
|
9
9
|
setup?: () => void | Promise<void>;
|
|
10
10
|
/** 默认 true;false 关闭 ErrorBoundary(应用自带边界时)。 */
|
|
11
11
|
errorBoundary?: boolean;
|
|
12
|
+
/** 卡片预览面的装配根(预览页渲染 kit 卡片需要 provider);缺省不包。 */
|
|
13
|
+
wrapPreview?: (page: ReactNode) => ReactNode;
|
|
12
14
|
}
|
|
13
15
|
interface StartAppOptions {
|
|
14
16
|
config?: AppConfig;
|
package/dist/app/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as s,e as
|
|
1
|
+
import{d as s,e as c,f as l,s as p,t as d}from"../chunk-S3Y64FNZ.js";import{StrictMode as w}from"react";import{createRoot as m}from"react-dom/client";import{createLogger as h}from"@tbox.cn/app-sdk-core";import{jsx as t,jsxs as P}from"react/jsx-runtime";var a=h("APP"),f=!1,i=null;function g(){return typeof document>"u"?null:document.getElementById("root")}function R(e){let r=g();if(r)try{i??=m(r),i.render(t(y,{message:e}))}catch(o){a.error("render startup fallback failed:",o)}}function y({message:e}){return P("main",{style:{padding:24,fontFamily:"system-ui, sans-serif"},children:[t("h1",{style:{fontSize:18},children:"页面暂时不可用"}),t("p",{style:{color:"#666"},children:e}),t("button",{type:"button",onClick:()=>window.location.reload(),children:"重新加载"})]})}var C=/^(code|token|auth_code|visitortoken|session)$/i;function u(e){let r={};return new URLSearchParams(e).forEach((o,n)=>{r[n]=C.test(n)?`${o.slice(0,6)}…(len=${o.length})`:o}),r}function A(){if(typeof window>"u")return;let e=window.location.hash.includes("?")?window.location.hash.slice(window.location.hash.indexOf("?")+1):"";a.info(`url params: ${JSON.stringify({search:u(window.location.search),hash:u(e)})}`)}async function v(e){if(f){a.warn("startApp 重复调用(已启动,忽略)");return}f=!0;try{l({apiBaseUrl:e.config?.apiBaseUrl}),s(),A(),await e.config?.setup?.(),p(e.cards),await d(e.modules??[]);let{default:r}=await e.page(),o=g();if(!o){a.error("未找到 #root,跳过挂载");return}i??=m(o);let n=e.wrap?e.wrap(t(r,{})):t(r,{});i.render(t(w,{children:e.config?.errorBoundary===!1?n:t(c,{fallback:t(y,{message:"页面渲染失败,请刷新重试"}),children:n})}))}catch(r){a.error("startup failed:",r),R(r instanceof Error?r.message:String(r))}}export{v as startApp};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createCoreLogger as S,resolveLevel as x,setLogContextProvider as I}from"@tbox.cn/app-sdk-core";var l=null;I(()=>l??void 0);function _(t){l=t?{requestId:t.runId,conversationId:t.conversationId}:null}function M(){try{if(typeof localStorage<"u")return x(localStorage.getItem("tbox:logLevel")??void 0,"info")}catch{}try{if(typeof location<"u"){let t=new URLSearchParams(location.search).get("logLevel");if(t)return x(t,"info")}}catch{}return"info"}function i(t){return S({tag:t,getLevel:M,getContext:()=>l??void 0})}var
|
|
1
|
+
import{createCoreLogger as S,resolveLevel as x,setLogContextProvider as I}from"@tbox.cn/app-sdk-core";var l=null;I(()=>l??void 0);function _(t){l=t?{requestId:t.runId,conversationId:t.conversationId}:null}function M(){try{if(typeof localStorage<"u")return x(localStorage.getItem("tbox:logLevel")??void 0,"info")}catch{}try{if(typeof location<"u"){let t=new URLSearchParams(location.search).get("logLevel");if(t)return x(t,"info")}}catch{}return"info"}function i(t){return S({tag:t,getLevel:M,getContext:()=>l??void 0})}var h;function j(t){h=t}function D(t){if(typeof window>"u"||typeof window.addEventListener!="function")return()=>{};let e=t??i("GLOBAL"),r=new Map,o=1e4,C=n=>{let s=Date.now();for(let[R,E]of r)s-E>=o&&r.delete(R);r.has(n)||(r.set(n,s),e.error(n),h?.send("error",n))},f=n=>{C(`uncaught: ${n.message} @ ${n.filename}:${n.lineno}`)},m=n=>{let s=n.reason instanceof Error?n.reason.message:String(n.reason);C(`unhandledrejection: ${s}`)};return window.addEventListener("error",f),window.addEventListener("unhandledrejection",m),()=>{window.removeEventListener("error",f),window.removeEventListener("unhandledrejection",m)}}import{Component as P}from"react";var O=i("ErrorBoundary"),w=class extends P{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e){O.error("render error:",e)}render(){return this.state.hasError?this.props.fallback:this.props.children}};var v="";function V(t){v=(t.apiBaseUrl??"").trim().replace(/\/$/,"")}function T(){return v}function $(){let t=T();return t||(typeof window<"u"?`${window.location.protocol}//${window.location.host}`:"")}function Q(t="/ws"){return $().replace(/^http/,"ws")+t}var c=null;function k(){if(c)return c;let t={};return typeof window<"u"&&new URLSearchParams(window.location.search).forEach((r,o)=>{t[o]=r}),c=t,t}function F(t){return k()[t]}function N(){let t=F("container");return t==="alipay-miniapp"||t==="alipay"}function G(){if(typeof window>"u")return!1;let t=window.my;return!!(t&&typeof t.postMessage=="function")}function q(){return N()?"alipay-miniapp":"browser"}import{KNOWN_CLIENT_SLOT_IDS as A}from"@tbox.cn/app-contracts";var a=i("ClientCardRegistry"),y=i("ClientSlotRegistry"),p=class{cards=new Map;overrides=new Map;inlineFilters=[];register(e,r){if(!e){a.warn("register without cardType skipped");return}this.cards.get(e)!==r&&(this.cards.has(e)&&a.warn(`overwriting existing cardType: ${e}`),this.cards.set(e,r))}registerMap(e){for(let[r,o]of Object.entries(e))this.register(r,o)}registerOverride(e,r){if(!e){a.warn("registerOverride without cardType skipped");return}this.overrides.has(e)&&a.warn(`overwriting existing override: ${e}`),this.overrides.set(e,r)}getOverrides(){return Object.fromEntries(this.overrides)}registerInlineFilter(e){this.inlineFilters.push(e)}applyInlineFilters(e){return this.inlineFilters.length===0?[...e]:this.inlineFilters.reduce((r,o)=>o(r),[...e])}resolve(e){return this.cards.get(e)}getAll(){return Object.fromEntries(this.cards)}has(e){return this.cards.has(e)}get size(){return this.cards.size}},u=class{slots=new Map;register(e,r){A.includes(e)||y.warn(`unknown slot id: ${e}(KNOWN_CLIENT_SLOT_IDS 未含——版本偏斜?照常注册)`),this.slots.has(e)&&y.warn(`overwriting existing slot: ${e}`),this.slots.set(e,r)}resolve(e){return this.slots.get(e)}has(e){return this.slots.has(e)}get size(){return this.slots.size}};function L(){return{cards:new p,slots:new u}}var b,g;function d(){return b??=L(),b}function ee(t){t&&d().cards.registerMap(t)}function te(t){return g??=(async()=>{for(let e of t)e.cards&&d().cards.registerMap(e.cards),await e.register(d())})().catch(e=>{throw g=void 0,e}),g}function re(){return d().cards.getAll()}export{_ as a,i as b,j as c,D as d,w as e,V as f,T as g,$ as h,Q as i,k as j,F as k,N as l,G as m,q as n,p as o,u as p,L as q,d as r,ee as s,te as t,re as u};
|
package/dist/client/index.d.ts
CHANGED
|
@@ -65,6 +65,8 @@ declare function CardCarousel({ cards, renderItem, className, }: {
|
|
|
65
65
|
type CardComponentWithFlag = CardComponent & {
|
|
66
66
|
/** 置位后 CardRenderer 不渲染 payload.actions 按钮条(卡内自行处理动作) */
|
|
67
67
|
selfRendersActions?: boolean;
|
|
68
|
+
/** 动作所有权来源(defineCard 写入;default 表示未显式声明) */
|
|
69
|
+
actionsMode?: 'default' | 'auto' | 'self';
|
|
68
70
|
};
|
|
69
71
|
/**
|
|
70
72
|
* 标记卡片为自渲染动作(富卡范式:卡内写按钮 + 交互状态,禁用 SDK 默认按钮条)。
|
package/dist/client/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as ye,b as R,c as me,d as be,e as L,f as xe,g as v,h as Re,i as he,j as Te,k as Ae,l as N,m as we,n as ve,o as Ce,p as Pe,q as Se,r as Ee,s as ke,t as Ie,u as qe}from"../chunk-DXL2GZRD.js";import{createLogger as Wt}from"@tbox.cn/app-sdk-core";import{jsx as h,jsxs as Me}from"react/jsx-runtime";var k={info:{bg:"rgba(22,119,255,0.08)",color:"#1677ff"},warning:{bg:"rgba(250,140,22,0.10)",color:"#d46b08"},error:{bg:"rgba(255,77,79,0.08)",color:"#ff4d4f"}};function Oe({notices:e}){return e.length?h("div",{style:{display:"flex",flexDirection:"column",gap:4,marginBottom:8},children:e.map(t=>h("div",{style:{fontSize:12,lineHeight:"18px",padding:"4px 10px",borderRadius:8,background:k[t.level]?.bg??k.info.bg,color:k[t.level]?.color??k.info.color},children:t.message},`${t.code}:${t.message}`))}):null}function Be({card:e,registry:t,onAction:r}){let n=e.status!=="error"?t[e.cardType]:void 0,s=e.status==="error"||!n,a=n?.selfRendersActions===!0,l=!e.isHistory&&!a&&e.actions?.length?e.actions:[],c=typeof e.expiresAt=="number"&&Date.now()>=e.expiresAt;return Me("div",{className:`tbox-card${s?" tbox-card--fallback":""}${c?" tbox-card--stale":""}`,style:c?{opacity:.55,filter:"grayscale(1)"}:void 0,children:[h(Oe,{notices:e.notices??[]}),e.status==="error"?`卡片渲染失败${e.error?`:${e.error}`:""}`:n?h(L,{fallback:"卡片渲染出错",children:h(n,{data:e.data,cardId:e.id,isHistory:!!e.isHistory,actionTokens:e.actionTokens})}):`未知卡片类型:${e.cardType}`,l.length>0&&h("div",{style:{display:"flex",gap:8,marginTop:8,flexWrap:"wrap"},children:l.map(i=>{let p=!i.kind||i.kind==="moduleAction",u=p?e.actionTokens?.[i.actionId]:void 0,o=i.enabled===!1,d=o||!r||p&&!u,f=()=>i.kind==="sendMessage"?{type:"sendMessage",value:i.value??i.label??i.actionId,visible:i.visible??!0}:i.kind==="openLink"?{type:"openLink",url:i.url??""}:{type:"moduleAction",actionId:i.actionId,contextToken:u??""},g=()=>i.style==="primary"?{fontSize:13,padding:"6px 14px",borderRadius:18,border:"1px solid var(--tbox-primary, #1677ff)",color:"#fff",background:"var(--tbox-primary, #1677ff)"}:i.style==="link"?{fontSize:13,padding:"6px 4px",borderRadius:4,border:"none",color:"var(--tbox-primary, #1677ff)",background:"transparent",textDecoration:"underline"}:{fontSize:13,padding:"6px 14px",borderRadius:18,border:"1px solid var(--tbox-primary, #1677ff)",color:"var(--tbox-primary, #1677ff)",background:"transparent"};return h("button",{type:"button",disabled:d,title:o?i.disabledReason:void 0,onClick:()=>!d&&r?.(f()),style:{...g(),cursor:d?"not-allowed":"pointer",opacity:d?.5:1},children:i.label??i.actionId},i.actionId)})})]})}import{Fragment as Ne,jsx as $}from"react/jsx-runtime";function Le({cards:e,renderItem:t,className:r}){if(e.length<=1)return $(Ne,{children:e.length===1?t(e[0]):null});let n=["tbox-card-stack",r].filter(Boolean).join(" ");return $("div",{className:n,style:{display:"flex",flexDirection:"column"},children:e.map(s=>$("div",{children:t(s)},s.id))})}import{jsx as C,jsxs as _}from"react/jsx-runtime";var T=(e,t)=>`var(--${e}, ${t})`;function $e(e){return e.selfRendersActions=!0,e}function _e(e){return _("div",{style:{borderRadius:12,background:T("tbox-card-bg","#ffffff"),padding:"12px 16px",boxShadow:`0 1px 4px ${T("tbox-shadow","rgba(0,0,0,0.06)")}`,...e.style},children:[(e.title||e.subtitle)&&_("div",{style:{marginBottom:8},children:[e.title&&C("div",{style:{fontSize:15,fontWeight:600,color:T("tbox-text-primary","#1a1a1a"),lineHeight:"20px"},children:e.title}),e.subtitle&&C("div",{style:{fontSize:12,color:T("tbox-text-secondary","#888888"),marginTop:2},children:e.subtitle})]}),e.children]})}function De(e){return _("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"4px 0",gap:12},children:[C("span",{style:{fontSize:13,color:T("tbox-text-secondary","#888888"),flexShrink:0},children:e.label}),C("span",{style:{fontSize:13,color:T("tbox-text-primary","#1a1a1a"),textAlign:"right",wordBreak:"break-all",...e.valueStyle},children:e.value})]})}var He={success:{fg:"#0f8a5f",bg:"#e6f7f0"},warning:{fg:"#b26a00",bg:"#fff4e0"},neutral:{fg:"#666666",bg:"#f2f3f5"}};function Ue(e){let t=He[e.tone];return C("span",{style:{display:"inline-block",fontSize:11,lineHeight:"18px",padding:"0 8px",borderRadius:9,color:t.fg,background:t.bg,whiteSpace:"nowrap"},children:e.text})}var Z=R("bridge"),D="https://appx/web-view.min.js",A=null;function ee(){return typeof window>"u"?null:window.my&&typeof window.my.postMessage=="function"?window.my:null}function H(){if(typeof window>"u")return Promise.resolve(null);let e=ee();return e?Promise.resolve(e):N()?A||(A=new Promise(t=>{let r=!1,n=null,s=null,a=()=>{n&&clearInterval(n),s&&clearTimeout(s),document.removeEventListener("AlipayJSBridgeReady",c)},l=p=>{r||(r=!0,a(),t(p))},c=()=>{let p=ee();p&&l(p)};document.addEventListener("AlipayJSBridgeReady",c);let i=document.querySelector(`script[src="${D}"]`);i||(i=document.createElement("script"),i.src=D,document.head.appendChild(i)),i.addEventListener("load",c,{once:!0}),i.addEventListener("error",()=>{Z.warn("加载支付宝 JSSDK 失败:",D),i?.remove(),l(null)},{once:!0}),n=setInterval(c,50),s=setTimeout(()=>{Z.warn("支付宝 JSSDK 已加载,但 my.postMessage 未就绪"),l(null)},5e3),c()}),A.then(t=>{t||(A=null)}),A):Promise.resolve(null)}import{detailForLog as W}from"@tbox.cn/app-sdk-core";var I="open-mini-webview-bridge",Ge="1.0.0",U="my",G="my.call",V="tbox";function q(e){return!!e&&typeof e=="object"&&e.bridge===I&&typeof e.requestId=="string"}var w=R("bridge"),O=new Map,te=0,re=!1,oe=300*1e3;function Ve(){return te+=1,`h5_${Date.now()}_${te}`}function We(e){if(q(e)){ne(e);return}let t=e,r=e;if(r&&typeof r=="object"&&(r.detail!==void 0?t=r.detail:r.data!==void 0&&(t=r.data)),typeof t=="string")try{t=JSON.parse(t)}catch{return}q(t)&&ne(t)}function ne(e){let t=O.get(e.requestId);if(!t){w.debug(`收到无 pending 回执 req=${e.requestId} action=${e.action}`);return}clearTimeout(t.timer),O.delete(e.requestId);let r=Date.now()-t.startedAt;e.success?(w.info(`← ${t.apiName} ok ${r}ms req=${e.requestId}`),t.resolve(e.data)):(w.warn(`← ${t.apiName} fail code=${e.code||"BRIDGE_ERROR"} ${r}ms params=${W(t.params)} req=${e.requestId}`),t.reject({code:e.code||"BRIDGE_ERROR",errorMessage:e.errorMessage||"桥调用失败"}))}async function ie(){let e=await H();return e&&!re&&(e.onMessage=We,re=!0),e}function ae(e,t,r,n,s){let a=Ve();return new Promise((l,c)=>{let i=setTimeout(()=>{O.delete(a),w.warn(`← ${r} fail code=BRIDGE_TIMEOUT ${s}ms params=${W(n)} req=${a}`),c({code:"BRIDGE_TIMEOUT",errorMessage:`桥调用超时: ${r}`})},s);O.set(a,{resolve:l,reject:c,timer:i,apiName:r,params:n,startedAt:Date.now()}),w.info(`→ ${t} ${r} req=${a}`),w.debug(`params=${W(n)} req=${a}`),e.postMessage({bridge:I,action:t,apiName:r,params:n,requestId:a})})}async function y(e,t={},r="invoke",n=oe){let s=await ie();if(!s)throw{code:"BRIDGE_UNAVAILABLE",errorMessage:"支付宝 WebView 桥未就绪"};return ae(s,r==="call"?G:"my",e,t,n)}async function P(e,t={},r=oe){let n=await ie();if(!n)throw{code:"BRIDGE_UNAVAILABLE",errorMessage:"支付宝 WebView 桥未就绪"};return ae(n,V,e,t,r)}var F=/^[A-Za-z0-9._-]{1,80}$/u,se=/[\u0000-\u001F\u007F]/u,ue=/^[A-Za-z][A-Za-z0-9+.-]*:/u;function Je(e,t){if(!t||!F.test(t))return;let r;try{r=le(e)}catch{return}if(r.protocol!=="alipays"&&r.protocol!=="alipayrisk"||r.host!=="platformapi"||r.path!=="/startapp")return;let n=(r.appId||r.query.appId||"").trim(),s=(r.query.page||"").trim(),a=(r.query.query||"").trim()||void 0,l=s.replace(/^\/+/,"");if(!(!F.test(n)||!l||se.test(l)||ue.test(l)||l.split("/").includes(".."))){if(n===t){let c=l.includes("?")?"&":"?";return{apiName:"navigateTo",params:{url:`/${l}${a?`${c}${a}`:""}`}}}return{apiName:"navigateToMiniProgram",params:{appId:n,path:l,...a?{query:a}:{}}}}}function J(e){try{return decodeURIComponent(e)}catch{return e}}function le(e){if(!e||typeof e!="string")throw new Error("Invalid URL");let t={protocol:"",host:"",path:"",query:{page:"",appId:""},appId:"",page:{path:"",query:{}}},r=e.match(/^([a-zA-Z]+):\/\//),n=e;r&&(t.protocol=r[1],n=n.slice(r[0].length));let s=n.indexOf("?"),a=s===-1?n:n.slice(0,s),l=s===-1?"":n.slice(s+1),c=a.indexOf("/");if(c>0?(t.host=a.slice(0,c),t.path=a.slice(c)):t.host=a,l){let i="",p={};for(let u of l.split("&")){if(u.startsWith("page=")){i=u.slice(5);continue}let o=u.indexOf("="),d=o>=0?u.slice(0,o):u;if(!d)continue;let f=o>=0?u.slice(o+1):"";p[d]=J(f)}if(t.query=p,i){t.query.page=J(i),t.query.appId&&(t.appId=t.query.appId);let u=i.indexOf("?"),o=u>=0?i.slice(0,u):i;t.page.path=J(o)}}return t}function de(e){if(typeof e!="string")return;let t;try{t=le(e)}catch{return}if(t.protocol!=="alipays"&&t.protocol!=="alipayrisk"||t.host!=="platformapi"||t.path!=="/startapp")return;let r=(t.appId||t.query.appId||"").trim(),n=(t.query.page||"").trim(),s=(t.query.query||"").trim()||void 0,a=n.replace(/^\/+/,"");if(!F.test(r)||!a||se.test(a)||ue.test(a)||a.split("/").includes(".."))return;let l=a.includes("?")?"&":"?";return{appId:r,url:`/${a}${s?`${l}${s}`:""}`}}function Fe(e=9,t){return y("chooseImage",t?{count:e,sourceType:t}:{count:e},"invoke")}function Ke(){return y("chooseVideo",{},"invoke")}async function ze(){let e=await y("getLocation",{type:0});return{...e,longitude:Number(e.longitude),latitude:Number(e.latitude)}}function Qe(e=["auth_base"]){return y("getAuthCode",{scopes:e})}function je(e){return y("tradePay",{tradeNO:e,orderStr:e})}function Ye(e){let t=de(e);return t?y("navigateTo",{url:t.url}):Promise.reject({code:"INVALID_PARAMS",errorMessage:"支付宝小程序跳转链接无效"})}function Xe(e,t=300*1e3){return P("getLoginState",e??{},t)}function Ze(e={}){return P("openPlateKeyboard",{...e})}function et(){return P("closePlateKeyboard")}var m=class extends Error{status;code;body;constructor(t,r,n,s){super(n),this.name="RequestError",this.status=t,this.code=r,this.body=s}},K=null,z=null;function B(e){e.getToken&&(K=e.getToken),e.refresh&&(z=e.refresh)}function tt(e,t){if(!t)return e;let r=new URLSearchParams;for(let[s,a]of Object.entries(t))if(a!=null)if(Array.isArray(a))for(let l of a)l!=null&&r.append(s,String(l));else r.append(s,String(a));let n=r.toString();return n?`${e}${e.includes("?")?"&":"?"}${n}`:e}function rt(e){return/^https?:\/\//.test(e)?e:`${v().replace(/\/$/,"")}${e.startsWith("/")?e:`/${e}`}`}async function nt(e,t){if(e.status===204)return;if(t==="response")return e;if(t==="text")return e.text();let r=await e.text();if(r)try{return JSON.parse(r)}catch{return r}}async function ot(e,t={}){let r=t.method??"GET";if((r==="GET"||r==="DELETE")&&t.body!==void 0)throw new m(0,"REQUEST_BODY_NOT_ALLOWED",`${r} 请求不能携带 body`);let n={...t.headers},s=t.body===void 0?void 0:JSON.stringify(t.body);s!==void 0&&!n["Content-Type"]&&(n["Content-Type"]="application/json");let a=t.auth??!0;if(a&&K){let o=K();o&&!n.Authorization&&(n.Authorization=`Bearer ${o}`)}let l=new AbortController,c=t.timeoutMs??3e4,i=c>0?setTimeout(()=>l.abort(new Error("REQUEST_TIMEOUT")),c):void 0,p=()=>l.abort(t.signal?.reason);t.signal?.addEventListener("abort",p,{once:!0});let u=async()=>fetch(tt(rt(e),t.query),{method:r,headers:n,body:s,signal:l.signal,credentials:a?"include":"same-origin",cache:t.cache});try{let o=await u();if(o.status===401&&a&&z){try{await z()}catch{}o=await u()}let d=t.responseType??"json",f=await nt(o,d);if(!o.ok){let g=f&&typeof f=="object"?f.error:void 0;throw new m(o.status,g?.code??`HTTP_${o.status}`,g?.message??`请求失败(HTTP ${o.status})`,f)}return f}catch(o){throw o instanceof m?o:o.name==="AbortError"?new m(0,"REQUEST_ABORTED","请求已取消",o):new m(0,"REQUEST_FAILED",o.message,o)}finally{i&&clearTimeout(i),t.signal?.removeEventListener("abort",p)}}var it=R("HTTP"),Q=null;function at(e){Q=e,B({getToken:e})}var j=null;function st(e){j=e,B({refresh:e})}function ut(e,t){if(e!==401)return!1;let r=t?.code;return r==="AUTH_UNAUTHORIZED"||r==="AUTH_TOKEN_EXPIRED"}function lt(e){return e.startsWith("/api/auth/")}function ce(e="",t,r={}){let n=e.replace(/\/$/,""),s=r.auth??!1,a=r.dynamicBase??!1,l=u=>({...t?.headers,...u?.headers});function c(){return a?v():n}function i(u){let o=l(u);if(s){let d=Q?Q():null;d&&!o.Authorization&&(o.Authorization=`Bearer ${d}`)}return o}async function p(u,o,d,f,g=0){let E=u==="POST"&&d instanceof Blob?i(f):u==="POST"?{"Content-Type":"application/json",...i(f)}:i(f),b=await fetch(c()+o,{method:u,headers:E,body:u==="POST"&&d!==void 0?d instanceof Blob?d:JSON.stringify(d):void 0,signal:f?.signal,cache:f?.cache}),x=await b.json().catch(()=>null);if(s&&g===0&&!lt(o)&&ut(b.status,x)&&j){try{await j()}catch(ge){it.warn("401 refresh failed:",ge.message)}return p(u,o,d,f,1)}return{status:b.status,data:x}}return{get:(u,o)=>p("GET",u,void 0,o),post:(u,o,d)=>p("POST",u,o,d),postBinary:(u,o,d)=>p("POST",u,o,d)}}var M=ce("",void 0,{auth:!0,dynamicBase:!0}),dt=M.get,ct=M.post,pt=M.postBinary;import{useCallback as pe,useEffect as fe,useRef as S,useState as Y}from"react";function ft(e,t=[],r={}){let[n,s]=Y(void 0),[a,l]=Y(void 0),[c,i]=Y(!1),p=S(void 0),u=S(!1),o=S(!0),d=S(0),f=S(e);f.current=e,fe(()=>(o.current=!0,()=>{o.current=!1,d.current+=1}),[]);let g=pe(async E=>{p.current=E,u.current=!0;let b=++d.current;i(!0),l(void 0);try{let x=await f.current(E);return o.current&&d.current===b&&s(x),x}catch(x){o.current&&d.current===b&&l(x);return}finally{o.current&&d.current===b&&i(!1)}},[]),X=pe(async()=>{if(u.current)return g(p.current)},[g]);return fe(()=>{r.immediate===!1||u.current||g(void 0)},t),{data:n,error:a,loading:c,run:g,refresh:X}}import{sanitizeForLog as lr,detailForLog as dr,truncateForLog as cr}from"@tbox.cn/app-sdk-core";export{I as BRIDGE_NAME,Ge as BRIDGE_VERSION,Le as CardCarousel,_e as CardFrame,Be as CardRenderer,Ce as ClientCardRegistry,Pe as ClientSlotRegistry,L as ErrorBoundary,U as MY_ACTION,G as MY_CALL_ACTION,m as RequestError,Ue as StatusPill,V as TBOX_ACTION,De as ValueText,P as callCapability,y as callJsapi,Fe as chooseImage,Ke as chooseVideo,et as closePlateKeyboard,st as configureAuthErrorHandler,at as configureAuthToken,B as configureRequestAuth,xe as configureRuntime,Se as createClientContext,R as createClientLogger,Wt as createLogger,ce as createService,M as defaultService,dr as detailForLog,H as ensureAlipayJSSDK,v as getApiBaseUrl,Re as getApiOrigin,Qe as getAuthCode,Ee as getClientContext,ve as getContainer,ze as getLocation,Xe as getLoginState,Ae as getQueryParam,qe as getRegisteredClientCards,Te as getRuntimeQuery,he as getWsUrl,we as hasAlipayBridge,dt as httpGet,ct as httpPost,pt as httpPostBinary,be as installGlobalErrorReporting,q as isBridgeReceipt,N as isInAlipayShell,$e as markSelfRendering,Ye as navigateToAlipayPage,Ze as openPlateKeyboard,ke as registerClientCards,Ie as registerClientModules,ot as request,je as requestPayment,Je as resolveAlipayNavigation,lr as sanitizeForLog,me as setClientLogTransport,ye as setClientRunContext,cr as truncateForLog,ft as useRequest};
|
|
1
|
+
import{a as me,b as h,c as be,d as xe,e as N,f as he,g as A,h as Te,i as Re,j as ve,k as we,l as L,m as Ae,n as Ce,o as Pe,p as Se,q as Ee,r as ke,s as Ie,t as qe,u as Oe}from"../chunk-S3Y64FNZ.js";import{createLogger as Ft}from"@tbox.cn/app-sdk-core";import{jsx as T,jsxs as Ne}from"react/jsx-runtime";var Z=new Set,k={info:{bg:"color-mix(in srgb, var(--tbox-primary, #1677ff) 8%, var(--tbox-bg-card, #ffffff))",color:"var(--tbox-primary, #1677ff)"},warning:{bg:"color-mix(in srgb, var(--tbox-warning, #fa8c16) 12%, var(--tbox-bg-card, #ffffff))",color:"var(--tbox-warning, #d46b08)"},error:{bg:"color-mix(in srgb, var(--tbox-error, #ff4d4f) 8%, var(--tbox-bg-card, #ffffff))",color:"var(--tbox-error, #ff4d4f)"}};function Be({notices:e}){return e.length?T("div",{style:{display:"flex",flexDirection:"column",gap:4,marginBottom:8},children:e.map(t=>T("div",{style:{fontSize:12,lineHeight:"18px",padding:"4px 10px",borderRadius:8,background:k[t.level]?.bg??k.info.bg,color:k[t.level]?.color??k.info.color},children:t.message},`${t.code}:${t.message}`))}):null}function Me({card:e,registry:t,onAction:r}){let n=e.status!=="error"?t[e.cardType]:void 0,s=e.status==="error"||!n,a=n?.selfRendersActions===!0,u=!e.isHistory&&!a&&e.actions?.length?e.actions:[];u.length>0&&n?.actionsMode==="default"&&globalThis.process?.env?.NODE_ENV==="development"&&!Z.has(e.cardType)&&(Z.add(e.cardType),console.warn('[tbox] 卡片 "'+e.cardType+`" 未显式声明动作所有权,按 SDK 默认条渲染;若卡内已用 ActionList,请写 defineCard({ type, actions: 'self' }),否则会出现两条动作。`));let c=typeof e.expiresAt=="number"&&Date.now()>=e.expiresAt;return Ne("div",{className:`tbox-card${s?" tbox-card--fallback":""}${c?" tbox-card--stale":""}`,style:c?{opacity:.55}:void 0,children:[T(Be,{notices:e.notices??[]}),e.status==="error"?`卡片渲染失败${e.error?`:${e.error}`:""}`:n?T(N,{fallback:"卡片渲染出错",children:T(n,{data:e.data,cardId:e.id,isHistory:!!e.isHistory,actionTokens:e.actionTokens})}):`未知卡片类型:${e.cardType}`,u.length>0&&T("div",{style:{display:"flex",gap:8,marginTop:8,flexWrap:"wrap"},children:u.map(i=>{let p=!i.kind||i.kind==="moduleAction",l=p?e.actionTokens?.[i.actionId]:void 0,o=i.enabled===!1,d=o||!r||p&&!l,f=()=>i.kind==="sendMessage"?{type:"sendMessage",value:i.value??i.label??i.actionId,visible:i.visible??!0}:i.kind==="openLink"?{type:"openLink",url:i.url??""}:{type:"moduleAction",actionId:i.actionId,contextToken:l??""},g=()=>i.style==="primary"?{fontSize:14,minHeight:44,padding:"0 18px",borderRadius:22,border:"1px solid var(--tbox-primary, #1677ff)",color:"var(--tbox-primary-foreground, #fff)",background:"var(--tbox-primary, #1677ff)",cursor:d?"not-allowed":"pointer"}:i.style==="link"?{fontSize:14,minHeight:44,padding:"0 4px",borderRadius:4,border:"none",color:"var(--tbox-primary, #1677ff)",background:"transparent",textDecoration:"underline"}:{fontSize:13,padding:"6px 14px",borderRadius:18,border:"1px solid var(--tbox-primary, #1677ff)",color:"var(--tbox-primary, #1677ff)",background:"transparent"};return T("button",{type:"button",disabled:d,title:o?i.disabledReason:void 0,onClick:()=>!d&&r?.(f()),style:{...g(),cursor:d?"not-allowed":"pointer",opacity:d?.5:1},children:i.label??i.actionId},i.actionId)})})]})}import{Fragment as _e,jsx as _}from"react/jsx-runtime";function Le({cards:e,renderItem:t,className:r}){if(e.length<=1)return _(_e,{children:e.length===1?t(e[0]):null});let n=["tbox-card-stack",r].filter(Boolean).join(" ");return _("div",{className:n,style:{display:"flex",flexDirection:"column"},children:e.map(s=>_("div",{children:t(s)},s.id))})}import{jsx as C,jsxs as $}from"react/jsx-runtime";var R=(e,t)=>`var(--${e}, ${t})`;function $e(e){return e.selfRendersActions=!0,e}function De(e){return $("div",{style:{borderRadius:12,background:R("tbox-card-bg","#ffffff"),padding:"12px 16px",boxShadow:`0 1px 4px ${R("tbox-shadow","rgba(0,0,0,0.06)")}`,...e.style},children:[(e.title||e.subtitle)&&$("div",{style:{marginBottom:8},children:[e.title&&C("div",{style:{fontSize:15,fontWeight:600,color:R("tbox-text-primary","#1a1a1a"),lineHeight:"20px"},children:e.title}),e.subtitle&&C("div",{style:{fontSize:12,color:R("tbox-text-secondary","#888888"),marginTop:2},children:e.subtitle})]}),e.children]})}function He(e){return $("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"4px 0",gap:12},children:[C("span",{style:{fontSize:13,color:R("tbox-text-secondary","#888888"),flexShrink:0},children:e.label}),C("span",{style:{fontSize:13,color:R("tbox-text-primary","#1a1a1a"),textAlign:"right",wordBreak:"break-all",...e.valueStyle},children:e.value})]})}var Ue={success:{fg:"#0f8a5f",bg:"#e6f7f0"},warning:{fg:"#b26a00",bg:"#fff4e0"},neutral:{fg:"#666666",bg:"#f2f3f5"}};function Ve(e){let t=Ue[e.tone];return C("span",{style:{display:"inline-block",fontSize:11,lineHeight:"18px",padding:"0 8px",borderRadius:9,color:t.fg,background:t.bg,whiteSpace:"nowrap"},children:e.text})}var ee=h("bridge"),D="https://appx/web-view.min.js",v=null;function te(){return typeof window>"u"?null:window.my&&typeof window.my.postMessage=="function"?window.my:null}function H(){if(typeof window>"u")return Promise.resolve(null);let e=te();return e?Promise.resolve(e):L()?v||(v=new Promise(t=>{let r=!1,n=null,s=null,a=()=>{n&&clearInterval(n),s&&clearTimeout(s),document.removeEventListener("AlipayJSBridgeReady",c)},u=p=>{r||(r=!0,a(),t(p))},c=()=>{let p=te();p&&u(p)};document.addEventListener("AlipayJSBridgeReady",c);let i=document.querySelector(`script[src="${D}"]`);i||(i=document.createElement("script"),i.src=D,document.head.appendChild(i)),i.addEventListener("load",c,{once:!0}),i.addEventListener("error",()=>{ee.warn("加载支付宝 JSSDK 失败:",D),i?.remove(),u(null)},{once:!0}),n=setInterval(c,50),s=setTimeout(()=>{ee.warn("支付宝 JSSDK 已加载,但 my.postMessage 未就绪"),u(null)},5e3),c()}),v.then(t=>{t||(v=null)}),v):Promise.resolve(null)}import{detailForLog as W}from"@tbox.cn/app-sdk-core";var I="open-mini-webview-bridge",Ge="1.0.0",U="my",V="my.call",G="tbox";function q(e){return!!e&&typeof e=="object"&&e.bridge===I&&typeof e.requestId=="string"}var w=h("bridge"),O=new Map,re=0,ne=!1,ie=300*1e3;function We(){return re+=1,`h5_${Date.now()}_${re}`}function Fe(e){if(q(e)){oe(e);return}let t=e,r=e;if(r&&typeof r=="object"&&(r.detail!==void 0?t=r.detail:r.data!==void 0&&(t=r.data)),typeof t=="string")try{t=JSON.parse(t)}catch{return}q(t)&&oe(t)}function oe(e){let t=O.get(e.requestId);if(!t){w.debug(`收到无 pending 回执 req=${e.requestId} action=${e.action}`);return}clearTimeout(t.timer),O.delete(e.requestId);let r=Date.now()-t.startedAt;e.success?(w.info(`← ${t.apiName} ok ${r}ms req=${e.requestId}`),t.resolve(e.data)):(w.warn(`← ${t.apiName} fail code=${e.code||"BRIDGE_ERROR"} ${r}ms params=${W(t.params)} req=${e.requestId}`),t.reject({code:e.code||"BRIDGE_ERROR",errorMessage:e.errorMessage||"桥调用失败"}))}async function ae(){let e=await H();return e&&!ne&&(e.onMessage=Fe,ne=!0),e}function se(e,t,r,n,s){let a=We();return new Promise((u,c)=>{let i=setTimeout(()=>{O.delete(a),w.warn(`← ${r} fail code=BRIDGE_TIMEOUT ${s}ms params=${W(n)} req=${a}`),c({code:"BRIDGE_TIMEOUT",errorMessage:`桥调用超时: ${r}`})},s);O.set(a,{resolve:u,reject:c,timer:i,apiName:r,params:n,startedAt:Date.now()}),w.info(`→ ${t} ${r} req=${a}`),w.debug(`params=${W(n)} req=${a}`),e.postMessage({bridge:I,action:t,apiName:r,params:n,requestId:a})})}async function y(e,t={},r="invoke",n=ie){let s=await ae();if(!s)throw{code:"BRIDGE_UNAVAILABLE",errorMessage:"支付宝 WebView 桥未就绪"};return se(s,r==="call"?V:"my",e,t,n)}async function P(e,t={},r=ie){let n=await ae();if(!n)throw{code:"BRIDGE_UNAVAILABLE",errorMessage:"支付宝 WebView 桥未就绪"};return se(n,G,e,t,r)}var J=/^[A-Za-z0-9._-]{1,80}$/u,ue=/[\u0000-\u001F\u007F]/u,le=/^[A-Za-z][A-Za-z0-9+.-]*:/u;function Je(e,t){if(!t||!J.test(t))return;let r;try{r=de(e)}catch{return}if(r.protocol!=="alipays"&&r.protocol!=="alipayrisk"||r.host!=="platformapi"||r.path!=="/startapp")return;let n=(r.appId||r.query.appId||"").trim(),s=(r.query.page||"").trim(),a=(r.query.query||"").trim()||void 0,u=s.replace(/^\/+/,"");if(!(!J.test(n)||!u||ue.test(u)||le.test(u)||u.split("/").includes(".."))){if(n===t){let c=u.includes("?")?"&":"?";return{apiName:"navigateTo",params:{url:`/${u}${a?`${c}${a}`:""}`}}}return{apiName:"navigateToMiniProgram",params:{appId:n,path:u,...a?{query:a}:{}}}}}function F(e){try{return decodeURIComponent(e)}catch{return e}}function de(e){if(!e||typeof e!="string")throw new Error("Invalid URL");let t={protocol:"",host:"",path:"",query:{page:"",appId:""},appId:"",page:{path:"",query:{}}},r=e.match(/^([a-zA-Z]+):\/\//),n=e;r&&(t.protocol=r[1],n=n.slice(r[0].length));let s=n.indexOf("?"),a=s===-1?n:n.slice(0,s),u=s===-1?"":n.slice(s+1),c=a.indexOf("/");if(c>0?(t.host=a.slice(0,c),t.path=a.slice(c)):t.host=a,u){let i="",p={};for(let l of u.split("&")){if(l.startsWith("page=")){i=l.slice(5);continue}let o=l.indexOf("="),d=o>=0?l.slice(0,o):l;if(!d)continue;let f=o>=0?l.slice(o+1):"";p[d]=F(f)}if(t.query=p,i){t.query.page=F(i),t.query.appId&&(t.appId=t.query.appId);let l=i.indexOf("?"),o=l>=0?i.slice(0,l):i;t.page.path=F(o)}}return t}function ce(e){if(typeof e!="string")return;let t;try{t=de(e)}catch{return}if(t.protocol!=="alipays"&&t.protocol!=="alipayrisk"||t.host!=="platformapi"||t.path!=="/startapp")return;let r=(t.appId||t.query.appId||"").trim(),n=(t.query.page||"").trim(),s=(t.query.query||"").trim()||void 0,a=n.replace(/^\/+/,"");if(!J.test(r)||!a||ue.test(a)||le.test(a)||a.split("/").includes(".."))return;let u=a.includes("?")?"&":"?";return{appId:r,url:`/${a}${s?`${u}${s}`:""}`}}function Ke(e=9,t){return y("chooseImage",t?{count:e,sourceType:t}:{count:e},"invoke")}function ze(){return y("chooseVideo",{},"invoke")}async function Qe(){let e=await y("getLocation",{type:0});return{...e,longitude:Number(e.longitude),latitude:Number(e.latitude)}}function je(e=["auth_base"]){return y("getAuthCode",{scopes:e})}function Ye(e){return y("tradePay",{tradeNO:e,orderStr:e})}function Xe(e){let t=ce(e);return t?y("navigateTo",{url:t.url}):Promise.reject({code:"INVALID_PARAMS",errorMessage:"支付宝小程序跳转链接无效"})}function Ze(e,t=300*1e3){return P("getLoginState",e??{},t)}function et(e={}){return P("openPlateKeyboard",{...e})}function tt(){return P("closePlateKeyboard")}var m=class extends Error{status;code;body;constructor(t,r,n,s){super(n),this.name="RequestError",this.status=t,this.code=r,this.body=s}},K=null,z=null;function B(e){e.getToken&&(K=e.getToken),e.refresh&&(z=e.refresh)}function rt(e,t){if(!t)return e;let r=new URLSearchParams;for(let[s,a]of Object.entries(t))if(a!=null)if(Array.isArray(a))for(let u of a)u!=null&&r.append(s,String(u));else r.append(s,String(a));let n=r.toString();return n?`${e}${e.includes("?")?"&":"?"}${n}`:e}function nt(e){return/^https?:\/\//.test(e)?e:`${A().replace(/\/$/,"")}${e.startsWith("/")?e:`/${e}`}`}async function ot(e,t){if(e.status===204)return;if(t==="response")return e;if(t==="text")return e.text();let r=await e.text();if(r)try{return JSON.parse(r)}catch{return r}}async function it(e,t={}){let r=t.method??"GET";if((r==="GET"||r==="DELETE")&&t.body!==void 0)throw new m(0,"REQUEST_BODY_NOT_ALLOWED",`${r} 请求不能携带 body`);let n={...t.headers},s=t.body===void 0?void 0:JSON.stringify(t.body);s!==void 0&&!n["Content-Type"]&&(n["Content-Type"]="application/json");let a=t.auth??!0;if(a&&K){let o=K();o&&!n.Authorization&&(n.Authorization=`Bearer ${o}`)}let u=new AbortController,c=t.timeoutMs??3e4,i=c>0?setTimeout(()=>u.abort(new Error("REQUEST_TIMEOUT")),c):void 0,p=()=>u.abort(t.signal?.reason);t.signal?.addEventListener("abort",p,{once:!0});let l=async()=>fetch(rt(nt(e),t.query),{method:r,headers:n,body:s,signal:u.signal,credentials:a?"include":"same-origin",cache:t.cache});try{let o=await l();if(o.status===401&&a&&z){try{await z()}catch{}o=await l()}let d=t.responseType??"json",f=await ot(o,d);if(!o.ok){let g=f&&typeof f=="object"?f.error:void 0;throw new m(o.status,g?.code??`HTTP_${o.status}`,g?.message??`请求失败(HTTP ${o.status})`,f)}return f}catch(o){throw o instanceof m?o:o.name==="AbortError"?new m(0,"REQUEST_ABORTED","请求已取消",o):new m(0,"REQUEST_FAILED",o.message,o)}finally{i&&clearTimeout(i),t.signal?.removeEventListener("abort",p)}}var at=h("HTTP"),Q=null;function st(e){Q=e,B({getToken:e})}var j=null;function ut(e){j=e,B({refresh:e})}function lt(e,t){if(e!==401)return!1;let r=t?.code;return r==="AUTH_UNAUTHORIZED"||r==="AUTH_TOKEN_EXPIRED"}function dt(e){return e.startsWith("/api/auth/")}function pe(e="",t,r={}){let n=e.replace(/\/$/,""),s=r.auth??!1,a=r.dynamicBase??!1,u=l=>({...t?.headers,...l?.headers});function c(){return a?A():n}function i(l){let o=u(l);if(s){let d=Q?Q():null;d&&!o.Authorization&&(o.Authorization=`Bearer ${d}`)}return o}async function p(l,o,d,f,g=0){let E=l==="POST"&&d instanceof Blob?i(f):l==="POST"?{"Content-Type":"application/json",...i(f)}:i(f),b=await fetch(c()+o,{method:l,headers:E,body:l==="POST"&&d!==void 0?d instanceof Blob?d:JSON.stringify(d):void 0,signal:f?.signal,cache:f?.cache}),x=await b.json().catch(()=>null);if(s&&g===0&&!dt(o)&<(b.status,x)&&j){try{await j()}catch(ye){at.warn("401 refresh failed:",ye.message)}return p(l,o,d,f,1)}return{status:b.status,data:x}}return{get:(l,o)=>p("GET",l,void 0,o),post:(l,o,d)=>p("POST",l,o,d),postBinary:(l,o,d)=>p("POST",l,o,d)}}var M=pe("",void 0,{auth:!0,dynamicBase:!0}),ct=M.get,pt=M.post,ft=M.postBinary;import{useCallback as fe,useEffect as ge,useRef as S,useState as Y}from"react";function gt(e,t=[],r={}){let[n,s]=Y(void 0),[a,u]=Y(void 0),[c,i]=Y(!1),p=S(void 0),l=S(!1),o=S(!0),d=S(0),f=S(e);f.current=e,ge(()=>(o.current=!0,()=>{o.current=!1,d.current+=1}),[]);let g=fe(async E=>{p.current=E,l.current=!0;let b=++d.current;i(!0),u(void 0);try{let x=await f.current(E);return o.current&&d.current===b&&s(x),x}catch(x){o.current&&d.current===b&&u(x);return}finally{o.current&&d.current===b&&i(!1)}},[]),X=fe(async()=>{if(l.current)return g(p.current)},[g]);return ge(()=>{r.immediate===!1||l.current||g(void 0)},t),{data:n,error:a,loading:c,run:g,refresh:X}}import{sanitizeForLog as dr,detailForLog as cr,truncateForLog as pr}from"@tbox.cn/app-sdk-core";export{I as BRIDGE_NAME,Ge as BRIDGE_VERSION,Le as CardCarousel,De as CardFrame,Me as CardRenderer,Pe as ClientCardRegistry,Se as ClientSlotRegistry,N as ErrorBoundary,U as MY_ACTION,V as MY_CALL_ACTION,m as RequestError,Ve as StatusPill,G as TBOX_ACTION,He as ValueText,P as callCapability,y as callJsapi,Ke as chooseImage,ze as chooseVideo,tt as closePlateKeyboard,ut as configureAuthErrorHandler,st as configureAuthToken,B as configureRequestAuth,he as configureRuntime,Ee as createClientContext,h as createClientLogger,Ft as createLogger,pe as createService,M as defaultService,cr as detailForLog,H as ensureAlipayJSSDK,A as getApiBaseUrl,Te as getApiOrigin,je as getAuthCode,ke as getClientContext,Ce as getContainer,Qe as getLocation,Ze as getLoginState,we as getQueryParam,Oe as getRegisteredClientCards,ve as getRuntimeQuery,Re as getWsUrl,Ae as hasAlipayBridge,ct as httpGet,pt as httpPost,ft as httpPostBinary,xe as installGlobalErrorReporting,q as isBridgeReceipt,L as isInAlipayShell,$e as markSelfRendering,Xe as navigateToAlipayPage,et as openPlateKeyboard,Ie as registerClientCards,qe as registerClientModules,it as request,Ye as requestPayment,Je as resolveAlipayNavigation,dr as sanitizeForLog,be as setClientLogTransport,me as setClientRunContext,pr as truncateForLog,gt as useRequest};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tbox.cn/app-sdk-client",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "tbox 应用平台 SDK client 轴:runtime/http/logger/error-boundary、桥接(支付宝 web-view)、client-context、卡片渲染基元。agent 前端运行时在 @tbox.cn/app-agent-sdk-client。",
|
|
6
6
|
"exports": {
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"react": "18.3.1",
|
|
38
38
|
"react-dom": "18.3.1",
|
|
39
|
-
"@tbox.cn/app-
|
|
40
|
-
"@tbox.cn/app-
|
|
39
|
+
"@tbox.cn/app-contracts": "1.0.0-alpha.9",
|
|
40
|
+
"@tbox.cn/app-sdk-core": "1.0.0-alpha.9"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/node": "24.13.3",
|