@lark-apaas/client-toolkit-lite 1.1.7-alpha.25 → 1.1.7-alpha.26
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 +77 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +77 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1473,6 +1473,11 @@ __name(useLogout, "useLogout");
|
|
|
1473
1473
|
|
|
1474
1474
|
// src/locales/messages.ts
|
|
1475
1475
|
var messages = {
|
|
1476
|
+
// ── Index / 通用 ──────────────────────────────────────────────
|
|
1477
|
+
"index.rateLimitError": {
|
|
1478
|
+
zh: "\u5E94\u7528\u989D\u5EA6\u5DF2\u8017\u5C3D\uFF0C\u8BF7\u8054\u7CFB\u5E94\u7528\u5F00\u53D1\u8005",
|
|
1479
|
+
en: "Application quota exhausted, please contact the app developer"
|
|
1480
|
+
},
|
|
1476
1481
|
// ── Safety 组件 ──────────────────────────────────────────────
|
|
1477
1482
|
"safety.badge.label": {
|
|
1478
1483
|
zh: "\u5999\u642D",
|
|
@@ -2841,23 +2846,86 @@ var axiosForBackend = getAxiosForBackend();
|
|
|
2841
2846
|
|
|
2842
2847
|
// src/integrations/capabilityClient.ts
|
|
2843
2848
|
var import_client_capability = require("@lark-apaas/client-capability");
|
|
2849
|
+
|
|
2850
|
+
// src/components/ui/toast.tsx
|
|
2851
|
+
function showToast2(message, duration = 3e3) {
|
|
2852
|
+
return new Promise((resolve) => {
|
|
2853
|
+
const toast = document.createElement("div");
|
|
2854
|
+
const iconSvg = `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2855
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M8 1.333a6.667 6.667 0 1 1 0 13.334A6.667 6.667 0 0 1 8 1.333ZM8 10a.667.667 0 1 0 0 1.333A.667.667 0 0 0 8 10Zm0-5.333a.667.667 0 0 0-.667.666v3.334a.667.667 0 0 0 1.334 0V5.333A.667.667 0 0 0 8 4.667Z" fill="#ff811a"/>
|
|
2856
|
+
</svg>`;
|
|
2857
|
+
const iconWrapper = document.createElement("span");
|
|
2858
|
+
iconWrapper.innerHTML = iconSvg;
|
|
2859
|
+
Object.assign(iconWrapper.style, {
|
|
2860
|
+
display: "flex",
|
|
2861
|
+
alignItems: "center",
|
|
2862
|
+
marginRight: "8px",
|
|
2863
|
+
flexShrink: "0"
|
|
2864
|
+
});
|
|
2865
|
+
const textWrapper = document.createElement("span");
|
|
2866
|
+
textWrapper.textContent = message;
|
|
2867
|
+
toast.appendChild(iconWrapper);
|
|
2868
|
+
toast.appendChild(textWrapper);
|
|
2869
|
+
Object.assign(toast.style, {
|
|
2870
|
+
position: "fixed",
|
|
2871
|
+
top: "32px",
|
|
2872
|
+
left: "50%",
|
|
2873
|
+
transform: "translate(-50%, -50%)",
|
|
2874
|
+
display: "flex",
|
|
2875
|
+
alignItems: "center",
|
|
2876
|
+
padding: "12px 16px",
|
|
2877
|
+
backgroundColor: "#fff",
|
|
2878
|
+
color: "#1f2329",
|
|
2879
|
+
border: "1px solid #dee0e3",
|
|
2880
|
+
borderRadius: "6px",
|
|
2881
|
+
fontSize: "14px",
|
|
2882
|
+
lineHeight: "1.5",
|
|
2883
|
+
zIndex: "99999",
|
|
2884
|
+
maxWidth: "80vw",
|
|
2885
|
+
wordBreak: "break-word",
|
|
2886
|
+
boxShadow: "0 4px 8px rgba(0, 0, 0, 0.03), 0 3px 6px rgba(0, 0, 0, 0.05), 0 6px 18px rgba(0, 0, 0, 0.03)",
|
|
2887
|
+
opacity: "0",
|
|
2888
|
+
transition: "opacity 0.3s ease"
|
|
2889
|
+
});
|
|
2890
|
+
document.body.appendChild(toast);
|
|
2891
|
+
requestAnimationFrame(() => {
|
|
2892
|
+
toast.style.opacity = "1";
|
|
2893
|
+
});
|
|
2894
|
+
setTimeout(() => {
|
|
2895
|
+
toast.style.opacity = "0";
|
|
2896
|
+
setTimeout(() => {
|
|
2897
|
+
document.body.removeChild(toast);
|
|
2898
|
+
resolve();
|
|
2899
|
+
}, 300);
|
|
2900
|
+
}, duration);
|
|
2901
|
+
});
|
|
2902
|
+
}
|
|
2903
|
+
__name(showToast2, "showToast");
|
|
2904
|
+
|
|
2905
|
+
// src/integrations/capabilityClient.ts
|
|
2844
2906
|
var _appId = getAppId();
|
|
2845
|
-
var
|
|
2846
|
-
var
|
|
2907
|
+
var _archType = process.env.MIAODA_APP_ARCH_TYPE;
|
|
2908
|
+
var _isFrontendOnly = _archType === "2" || _archType === "3" || _archType === "4";
|
|
2847
2909
|
var capabilityClient = (0, import_client_capability.createClient)({
|
|
2848
2910
|
baseURL: normalizeBasePath(process.env.CLIENT_BASE_PATH ?? "/"),
|
|
2849
|
-
acquireUploadUrl:
|
|
2850
|
-
acquireDownloadUrl:
|
|
2911
|
+
acquireUploadUrl: `/app/${_appId}/__runtime__/api/v1/studio/plugins/tmp_files/acquire_upload_url`,
|
|
2912
|
+
acquireDownloadUrl: `/app/${_appId}/__runtime__/api/v1/studio/plugins/tmp_files/acquire_download_url`,
|
|
2851
2913
|
fetchOptions: {
|
|
2852
2914
|
headers: {
|
|
2853
2915
|
"X-Suda-Csrf-Token": window.csrfToken ?? ""
|
|
2854
2916
|
}
|
|
2855
2917
|
},
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2918
|
+
logger,
|
|
2919
|
+
onRateLimitError: /* @__PURE__ */ __name(() => {
|
|
2920
|
+
showToast2(t("index.rateLimitError"));
|
|
2921
|
+
}, "onRateLimitError"),
|
|
2922
|
+
..._isFrontendOnly ? {
|
|
2923
|
+
central: {
|
|
2924
|
+
enabled: true,
|
|
2925
|
+
// window.appId 由妙搭沙箱 / 线上环境注入;非妙搭场景下 capability 调用本身不可用
|
|
2926
|
+
appId: _appId ?? ""
|
|
2927
|
+
}
|
|
2928
|
+
} : {}
|
|
2861
2929
|
});
|
|
2862
2930
|
|
|
2863
2931
|
// src/constants/img-resources/avatar.ts
|