@lark-apaas/client-toolkit-lite 1.1.7-alpha.9 → 1.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +49 -1
- package/dist/index.cjs +597 -194
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +31 -9
- package/dist/index.d.ts +31 -9
- package/dist/index.js +670 -269
- package/dist/index.js.map +1 -1
- package/dist/styles/font-family.css +39 -0
- package/dist/styles/index.css +4 -0
- package/dist/styles/inspector.dev.css +5 -0
- package/dist/styles/override.css +18 -0
- package/dist/styles/tailwind-theme.css +361 -0
- package/dist/styles/theme-layer.css +8 -0
- package/package.json +14 -7
package/dist/index.cjs
CHANGED
|
@@ -56,6 +56,7 @@ __export(index_exports, {
|
|
|
56
56
|
getEnvPath: () => getEnvPath,
|
|
57
57
|
getWsPath: () => getWsPath,
|
|
58
58
|
initAxiosConfig: () => initAxiosConfig,
|
|
59
|
+
initObservable: () => initObservable,
|
|
59
60
|
isIOS: () => isIOS,
|
|
60
61
|
isIpad: () => isIpad,
|
|
61
62
|
isMobile: () => isMobile,
|
|
@@ -66,6 +67,7 @@ __export(index_exports, {
|
|
|
66
67
|
resolveAppUrl: () => resolveAppUrl,
|
|
67
68
|
safeStringify: () => safeStringify,
|
|
68
69
|
scopedStorage: () => scopedStorage,
|
|
70
|
+
trace: () => trace,
|
|
69
71
|
useAppInfo: () => useAppInfo,
|
|
70
72
|
useCurrentUserProfile: () => useCurrentUserProfile,
|
|
71
73
|
useIsMobile: () => useIsMobile,
|
|
@@ -150,9 +152,46 @@ function initAxiosConfig(axiosInstance2) {
|
|
|
150
152
|
}
|
|
151
153
|
__name(initAxiosConfig, "initAxiosConfig");
|
|
152
154
|
|
|
153
|
-
// src/
|
|
155
|
+
// src/runtime/observable.ts
|
|
154
156
|
var import_observable_web = require("@lark-apaas/observable-web");
|
|
155
157
|
|
|
158
|
+
// src/utils/apiPath.ts
|
|
159
|
+
function isNewPathEnabled() {
|
|
160
|
+
const basePath = process.env.CLIENT_BASE_PATH || "/";
|
|
161
|
+
return /^\/app\/[^/]/.test(basePath);
|
|
162
|
+
}
|
|
163
|
+
__name(isNewPathEnabled, "isNewPathEnabled");
|
|
164
|
+
|
|
165
|
+
// src/runtime/observable.ts
|
|
166
|
+
var initObservable = /* @__PURE__ */ __name(() => {
|
|
167
|
+
try {
|
|
168
|
+
const appId = window.appId;
|
|
169
|
+
import_observable_web.observable.start({
|
|
170
|
+
serviceName: "app",
|
|
171
|
+
env: process.env.NODE_ENV === "development" ? import_observable_web.AppEnv.Dev : import_observable_web.AppEnv.Prod,
|
|
172
|
+
collectorUrl: isNewPathEnabled() ? {
|
|
173
|
+
log: `/app/${appId}/__runtime__/api/v1/observability/logs/collect`,
|
|
174
|
+
trace: `/app/${appId}/__runtime__/api/v1/observability/traces/collect`,
|
|
175
|
+
metric: `/app/${appId}/__runtime__/api/v1/observability/metrics/collect`,
|
|
176
|
+
time: `/app/${appId}/__runtime__/api/v1/observability/current_server_timestamp`
|
|
177
|
+
} : {
|
|
178
|
+
log: `/spark/app/${appId}/runtime/api/v1/observability/logs/collect`,
|
|
179
|
+
trace: `/spark/app/${appId}/runtime/api/v1/observability/traces/collect`,
|
|
180
|
+
metric: `/spark/app/${appId}/runtime/api/v1/observability/metrics/collect`,
|
|
181
|
+
time: `/spark/api/v1/observability/app/${appId}/current_server_timestamp`
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
} catch (error) {
|
|
185
|
+
console.error("Failed to start WebObservableSdk:", error);
|
|
186
|
+
}
|
|
187
|
+
}, "initObservable");
|
|
188
|
+
|
|
189
|
+
// src/logger/logger.ts
|
|
190
|
+
var import_observable_web2 = require("@lark-apaas/observable-web");
|
|
191
|
+
|
|
192
|
+
// src/logger/intercept-global-error.ts
|
|
193
|
+
var import_internal_slardar = require("@lark-apaas/internal-slardar");
|
|
194
|
+
|
|
156
195
|
// src/utils/hmr-api.ts
|
|
157
196
|
var import_meta = {};
|
|
158
197
|
function createWebpackHmrApi(hot) {
|
|
@@ -300,12 +339,32 @@ function processDevServerLog(log) {
|
|
|
300
339
|
status: "disconnected"
|
|
301
340
|
}
|
|
302
341
|
});
|
|
342
|
+
import_internal_slardar.slardar.sendEvent({
|
|
343
|
+
name: "sandbox-devServer",
|
|
344
|
+
metrics: {
|
|
345
|
+
time
|
|
346
|
+
},
|
|
347
|
+
categories: {
|
|
348
|
+
type: "disconnected"
|
|
349
|
+
}
|
|
350
|
+
});
|
|
303
351
|
return;
|
|
304
352
|
}
|
|
305
353
|
if (!devServerDisconnectInfo) {
|
|
306
354
|
return;
|
|
307
355
|
}
|
|
308
356
|
if (devFlag && log.includes("Trying to reconnect")) {
|
|
357
|
+
if (retryCount) {
|
|
358
|
+
import_internal_slardar.slardar.sendEvent({
|
|
359
|
+
name: "sandbox-devServer",
|
|
360
|
+
metrics: {
|
|
361
|
+
retryCount: retryCount + 1
|
|
362
|
+
},
|
|
363
|
+
categories: {
|
|
364
|
+
type: "reconnect-failed"
|
|
365
|
+
}
|
|
366
|
+
});
|
|
367
|
+
}
|
|
309
368
|
retryCount++;
|
|
310
369
|
return;
|
|
311
370
|
}
|
|
@@ -318,6 +377,18 @@ function processDevServerLog(log) {
|
|
|
318
377
|
status: "connected"
|
|
319
378
|
}
|
|
320
379
|
});
|
|
380
|
+
const startTime = devServerDisconnectInfo.time;
|
|
381
|
+
const duration = Date.now() - startTime;
|
|
382
|
+
import_internal_slardar.slardar.sendEvent({
|
|
383
|
+
name: "sandbox-devServer",
|
|
384
|
+
metrics: {
|
|
385
|
+
startTime,
|
|
386
|
+
duration
|
|
387
|
+
},
|
|
388
|
+
categories: {
|
|
389
|
+
type: "devServer-reconnected"
|
|
390
|
+
}
|
|
391
|
+
});
|
|
321
392
|
devServerDisconnectInfo = null;
|
|
322
393
|
retryCount = 0;
|
|
323
394
|
}
|
|
@@ -337,6 +408,13 @@ function listenModuleHmr() {
|
|
|
337
408
|
});
|
|
338
409
|
hmr.onError((error) => {
|
|
339
410
|
console.warn("hmr apply failed", error);
|
|
411
|
+
import_internal_slardar.slardar.sendEvent({
|
|
412
|
+
name: "sandbox-devServer",
|
|
413
|
+
categories: {
|
|
414
|
+
type: "hmr-apply-failed",
|
|
415
|
+
error: String(error)
|
|
416
|
+
}
|
|
417
|
+
});
|
|
340
418
|
});
|
|
341
419
|
}
|
|
342
420
|
}
|
|
@@ -446,123 +524,8 @@ function mapLogLevel(level) {
|
|
|
446
524
|
}
|
|
447
525
|
__name(mapLogLevel, "mapLogLevel");
|
|
448
526
|
|
|
449
|
-
// src/logger/
|
|
450
|
-
var
|
|
451
|
-
var ORDERED_LEVELS = [
|
|
452
|
-
"debug",
|
|
453
|
-
"info",
|
|
454
|
-
"warn",
|
|
455
|
-
"error"
|
|
456
|
-
];
|
|
457
|
-
var defaultConfig = {
|
|
458
|
-
showLevel: false,
|
|
459
|
-
showTimestamp: false,
|
|
460
|
-
level: "info",
|
|
461
|
-
prefix: ""
|
|
462
|
-
};
|
|
463
|
-
var config = {
|
|
464
|
-
...defaultConfig
|
|
465
|
-
};
|
|
466
|
-
function configureLogger(options) {
|
|
467
|
-
config = {
|
|
468
|
-
...defaultConfig,
|
|
469
|
-
...options
|
|
470
|
-
};
|
|
471
|
-
}
|
|
472
|
-
__name(configureLogger, "configureLogger");
|
|
473
|
-
function shouldLog(level) {
|
|
474
|
-
return ORDERED_LEVELS.indexOf(level) >= ORDERED_LEVELS.indexOf(config.level);
|
|
475
|
-
}
|
|
476
|
-
__name(shouldLog, "shouldLog");
|
|
477
|
-
function getFormattedPrefix(level) {
|
|
478
|
-
const parts = [];
|
|
479
|
-
if (config.prefix) {
|
|
480
|
-
parts.push(`[${config.prefix}]`);
|
|
481
|
-
}
|
|
482
|
-
if (config.showLevel) {
|
|
483
|
-
parts.push(`[${level.toUpperCase()}]`);
|
|
484
|
-
}
|
|
485
|
-
return parts;
|
|
486
|
-
}
|
|
487
|
-
__name(getFormattedPrefix, "getFormattedPrefix");
|
|
488
|
-
configureLogger({
|
|
489
|
-
showLevel: true,
|
|
490
|
-
showTimestamp: false,
|
|
491
|
-
level: process.env.NODE_ENV === "development" ? "debug" : "error",
|
|
492
|
-
prefix: "MiaoDa"
|
|
493
|
-
});
|
|
494
|
-
var logger = {
|
|
495
|
-
debug(message, ...args) {
|
|
496
|
-
if (shouldLog("debug")) {
|
|
497
|
-
console.log(...getFormattedPrefix("debug"), message, ...args);
|
|
498
|
-
}
|
|
499
|
-
},
|
|
500
|
-
info(message, ...args) {
|
|
501
|
-
if (shouldLog("info")) {
|
|
502
|
-
console.log(...getFormattedPrefix("info"), message, ...args);
|
|
503
|
-
}
|
|
504
|
-
if (shouldReportToObservable) {
|
|
505
|
-
import_observable_web.observable.log("INFO", processLogParams([
|
|
506
|
-
message,
|
|
507
|
-
...args
|
|
508
|
-
]).join(" "));
|
|
509
|
-
}
|
|
510
|
-
},
|
|
511
|
-
warn(message, ...args) {
|
|
512
|
-
if (shouldLog("warn")) {
|
|
513
|
-
console.log(...getFormattedPrefix("warn"), message, ...args);
|
|
514
|
-
}
|
|
515
|
-
if (shouldReportToObservable) {
|
|
516
|
-
import_observable_web.observable.log("WARN", processLogParams([
|
|
517
|
-
message,
|
|
518
|
-
...args
|
|
519
|
-
]).join(" "));
|
|
520
|
-
}
|
|
521
|
-
},
|
|
522
|
-
error(message, ...args) {
|
|
523
|
-
if (shouldLog("error")) {
|
|
524
|
-
console.error(...getFormattedPrefix("error"), message, ...args);
|
|
525
|
-
}
|
|
526
|
-
if (shouldReportToObservable) {
|
|
527
|
-
import_observable_web.observable.log("ERROR", processLogParams([
|
|
528
|
-
message,
|
|
529
|
-
...args
|
|
530
|
-
]).join(" "));
|
|
531
|
-
}
|
|
532
|
-
},
|
|
533
|
-
success(message, ...args) {
|
|
534
|
-
if (shouldLog("info")) {
|
|
535
|
-
console.log(...getFormattedPrefix("success"), message, ...args);
|
|
536
|
-
}
|
|
537
|
-
if (shouldReportToObservable) {
|
|
538
|
-
import_observable_web.observable.log("INFO", processLogParams([
|
|
539
|
-
message,
|
|
540
|
-
...args
|
|
541
|
-
]).join(" "));
|
|
542
|
-
}
|
|
543
|
-
},
|
|
544
|
-
log({ level, args }) {
|
|
545
|
-
if (shouldLog(level)) {
|
|
546
|
-
console.log(...getFormattedPrefix(level), ...args);
|
|
547
|
-
}
|
|
548
|
-
if (shouldReportToObservable && level !== "debug") {
|
|
549
|
-
import_observable_web.observable.log(mapLogLevel(level), processLogParams(args).join(" "));
|
|
550
|
-
}
|
|
551
|
-
}
|
|
552
|
-
};
|
|
553
|
-
if (process.env.NODE_ENV !== "production") {
|
|
554
|
-
window.__RUNTIME_LOGGER__ = {
|
|
555
|
-
get() {
|
|
556
|
-
return logger;
|
|
557
|
-
}
|
|
558
|
-
};
|
|
559
|
-
}
|
|
560
|
-
if (process.env.NODE_ENV !== "production") {
|
|
561
|
-
interceptErrors();
|
|
562
|
-
}
|
|
563
|
-
|
|
564
|
-
// src/runtime/iframe-bridge.ts
|
|
565
|
-
var import_penpal = require("penpal");
|
|
527
|
+
// src/logger/selected-logs.ts
|
|
528
|
+
var import_stacktrace_js = __toESM(require("stacktrace-js"), 1);
|
|
566
529
|
|
|
567
530
|
// src/logger/batch-logger.ts
|
|
568
531
|
var BatchLogger = class {
|
|
@@ -747,6 +710,368 @@ if (process.env.NODE_ENV !== "production" && typeof window !== "undefined") {
|
|
|
747
710
|
defaultBatchLogger = new BatchLogger(console);
|
|
748
711
|
}
|
|
749
712
|
|
|
713
|
+
// src/logger/selected-logs.ts
|
|
714
|
+
function mapStacktrace(stacktrace) {
|
|
715
|
+
return stacktrace.map((frame) => ({
|
|
716
|
+
functionName: frame.functionName || "",
|
|
717
|
+
fileName: frame.fileName || "",
|
|
718
|
+
lineNumber: frame.lineNumber || 0,
|
|
719
|
+
columnNumber: frame.columnNumber || 0
|
|
720
|
+
}));
|
|
721
|
+
}
|
|
722
|
+
__name(mapStacktrace, "mapStacktrace");
|
|
723
|
+
function reportStacktraceParseError(e, context) {
|
|
724
|
+
if (window.parent === window) return;
|
|
725
|
+
try {
|
|
726
|
+
submitPostMessage({
|
|
727
|
+
type: "STACKTRACE_PARSE_ERROR",
|
|
728
|
+
payload: {
|
|
729
|
+
error: e instanceof Error ? e.message : String(e),
|
|
730
|
+
context
|
|
731
|
+
}
|
|
732
|
+
});
|
|
733
|
+
} catch {
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
__name(reportStacktraceParseError, "reportStacktraceParseError");
|
|
737
|
+
async function getStacktrace() {
|
|
738
|
+
const stacktrace = await import_stacktrace_js.default.get();
|
|
739
|
+
return mapStacktrace(stacktrace);
|
|
740
|
+
}
|
|
741
|
+
__name(getStacktrace, "getStacktrace");
|
|
742
|
+
function errorReplacer(_key, value) {
|
|
743
|
+
if (value instanceof Error) {
|
|
744
|
+
return {
|
|
745
|
+
message: value.message,
|
|
746
|
+
stack: value.stack,
|
|
747
|
+
name: value.name
|
|
748
|
+
};
|
|
749
|
+
}
|
|
750
|
+
return value;
|
|
751
|
+
}
|
|
752
|
+
__name(errorReplacer, "errorReplacer");
|
|
753
|
+
function generateLogId() {
|
|
754
|
+
try {
|
|
755
|
+
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
|
|
756
|
+
return crypto.randomUUID();
|
|
757
|
+
}
|
|
758
|
+
} catch {
|
|
759
|
+
}
|
|
760
|
+
return `${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
761
|
+
}
|
|
762
|
+
__name(generateLogId, "generateLogId");
|
|
763
|
+
var lastLogInfo = null;
|
|
764
|
+
async function sendSelectedLog(logWithoutID) {
|
|
765
|
+
try {
|
|
766
|
+
const log = {
|
|
767
|
+
...logWithoutID,
|
|
768
|
+
id: generateLogId()
|
|
769
|
+
};
|
|
770
|
+
const newParts = [];
|
|
771
|
+
for (let i = 0; i < log.args.length; i++) {
|
|
772
|
+
const item = log.args[i];
|
|
773
|
+
if (item instanceof Error) {
|
|
774
|
+
const newError = {
|
|
775
|
+
message: item.message,
|
|
776
|
+
stack: item.stack,
|
|
777
|
+
name: item.name
|
|
778
|
+
};
|
|
779
|
+
if (!log.meta.stacktrace) {
|
|
780
|
+
try {
|
|
781
|
+
const stacktrace = await import_stacktrace_js.default.fromError(item);
|
|
782
|
+
log.meta.stacktrace = mapStacktrace(stacktrace);
|
|
783
|
+
} catch (e) {
|
|
784
|
+
reportStacktraceParseError(e, "StackTrace.fromError");
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
newParts.push(newError.message, newError);
|
|
788
|
+
} else {
|
|
789
|
+
newParts.push(item);
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
log.args = newParts;
|
|
793
|
+
if (!log.meta.stacktrace) {
|
|
794
|
+
try {
|
|
795
|
+
const frames = await getStacktrace();
|
|
796
|
+
const firstFrameIndex = frames.findIndex((frame) => !frame.fileName.includes("client-toolkit-lite/dist/logger"));
|
|
797
|
+
log.meta.stacktrace = firstFrameIndex === -1 ? [] : frames.slice(firstFrameIndex);
|
|
798
|
+
} catch (e) {
|
|
799
|
+
reportStacktraceParseError(e, "getStacktrace");
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
if (log.meta.skipFrame === void 0) {
|
|
803
|
+
log.meta.skipFrame = 2;
|
|
804
|
+
}
|
|
805
|
+
const logJSON = JSON.stringify(log, errorReplacer);
|
|
806
|
+
const logForDedup = {
|
|
807
|
+
...log
|
|
808
|
+
};
|
|
809
|
+
delete logForDedup.id;
|
|
810
|
+
const logContentForDedup = JSON.stringify(logForDedup, errorReplacer);
|
|
811
|
+
if (lastLogInfo && lastLogInfo.content === logContentForDedup) {
|
|
812
|
+
lastLogInfo.count++;
|
|
813
|
+
log.meta.isDuplicate = true;
|
|
814
|
+
log.meta.duplicateCount = lastLogInfo.count;
|
|
815
|
+
log.meta.duplicateOfId = lastLogInfo.id;
|
|
816
|
+
const updatedJSON = JSON.stringify(log, errorReplacer);
|
|
817
|
+
try {
|
|
818
|
+
batchLogInfo("info", updatedJSON);
|
|
819
|
+
} catch {
|
|
820
|
+
}
|
|
821
|
+
if (window.parent !== window) {
|
|
822
|
+
try {
|
|
823
|
+
submitPostMessage({
|
|
824
|
+
type: "SELECTED_LOG",
|
|
825
|
+
payload: updatedJSON
|
|
826
|
+
});
|
|
827
|
+
} catch {
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
return;
|
|
831
|
+
}
|
|
832
|
+
lastLogInfo = {
|
|
833
|
+
content: logContentForDedup,
|
|
834
|
+
id: log.id,
|
|
835
|
+
count: 1
|
|
836
|
+
};
|
|
837
|
+
try {
|
|
838
|
+
batchLogInfo("info", logJSON);
|
|
839
|
+
} catch {
|
|
840
|
+
}
|
|
841
|
+
if (window.parent !== window) {
|
|
842
|
+
try {
|
|
843
|
+
submitPostMessage({
|
|
844
|
+
type: "SELECTED_LOG",
|
|
845
|
+
payload: logJSON
|
|
846
|
+
});
|
|
847
|
+
} catch {
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
} catch {
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
__name(sendSelectedLog, "sendSelectedLog");
|
|
854
|
+
function sendTypedLogV2(logWithMeta) {
|
|
855
|
+
void sendSelectedLog({
|
|
856
|
+
type: "typedLogV2",
|
|
857
|
+
level: logWithMeta.level,
|
|
858
|
+
args: logWithMeta.args,
|
|
859
|
+
meta: logWithMeta.meta ?? {}
|
|
860
|
+
});
|
|
861
|
+
}
|
|
862
|
+
__name(sendTypedLogV2, "sendTypedLogV2");
|
|
863
|
+
var typedLogInterceptor = /* @__PURE__ */ __name((originLogger) => ({
|
|
864
|
+
debug: /* @__PURE__ */ __name((message, ...args) => {
|
|
865
|
+
try {
|
|
866
|
+
originLogger.debug(message, ...args);
|
|
867
|
+
} catch {
|
|
868
|
+
}
|
|
869
|
+
sendTypedLogV2({
|
|
870
|
+
level: "info",
|
|
871
|
+
args: [
|
|
872
|
+
message,
|
|
873
|
+
...args
|
|
874
|
+
],
|
|
875
|
+
meta: {}
|
|
876
|
+
});
|
|
877
|
+
}, "debug"),
|
|
878
|
+
info: /* @__PURE__ */ __name((message, ...args) => {
|
|
879
|
+
try {
|
|
880
|
+
originLogger.info(message, ...args);
|
|
881
|
+
} catch {
|
|
882
|
+
}
|
|
883
|
+
sendTypedLogV2({
|
|
884
|
+
level: "info",
|
|
885
|
+
args: [
|
|
886
|
+
message,
|
|
887
|
+
...args
|
|
888
|
+
],
|
|
889
|
+
meta: {}
|
|
890
|
+
});
|
|
891
|
+
}, "info"),
|
|
892
|
+
warn: /* @__PURE__ */ __name((message, ...args) => {
|
|
893
|
+
try {
|
|
894
|
+
originLogger.warn(message, ...args);
|
|
895
|
+
} catch {
|
|
896
|
+
}
|
|
897
|
+
sendTypedLogV2({
|
|
898
|
+
level: "warn",
|
|
899
|
+
args: [
|
|
900
|
+
message,
|
|
901
|
+
...args
|
|
902
|
+
],
|
|
903
|
+
meta: {}
|
|
904
|
+
});
|
|
905
|
+
}, "warn"),
|
|
906
|
+
error: /* @__PURE__ */ __name((message, ...args) => {
|
|
907
|
+
try {
|
|
908
|
+
originLogger.error(message, ...args);
|
|
909
|
+
} catch {
|
|
910
|
+
}
|
|
911
|
+
sendTypedLogV2({
|
|
912
|
+
level: "error",
|
|
913
|
+
args: [
|
|
914
|
+
message,
|
|
915
|
+
...args
|
|
916
|
+
],
|
|
917
|
+
meta: {}
|
|
918
|
+
});
|
|
919
|
+
}, "error"),
|
|
920
|
+
success: /* @__PURE__ */ __name((message, ...args) => {
|
|
921
|
+
try {
|
|
922
|
+
originLogger.success(message, ...args);
|
|
923
|
+
} catch {
|
|
924
|
+
}
|
|
925
|
+
sendTypedLogV2({
|
|
926
|
+
level: "success",
|
|
927
|
+
args: [
|
|
928
|
+
message,
|
|
929
|
+
...args
|
|
930
|
+
],
|
|
931
|
+
meta: {}
|
|
932
|
+
});
|
|
933
|
+
}, "success"),
|
|
934
|
+
log: /* @__PURE__ */ __name(({ level, args, meta }) => {
|
|
935
|
+
try {
|
|
936
|
+
originLogger.log({
|
|
937
|
+
level,
|
|
938
|
+
args,
|
|
939
|
+
meta
|
|
940
|
+
});
|
|
941
|
+
} catch {
|
|
942
|
+
}
|
|
943
|
+
sendTypedLogV2({
|
|
944
|
+
level,
|
|
945
|
+
args,
|
|
946
|
+
meta: meta ?? {}
|
|
947
|
+
});
|
|
948
|
+
}, "log")
|
|
949
|
+
}), "typedLogInterceptor");
|
|
950
|
+
var interceptors = [
|
|
951
|
+
typedLogInterceptor
|
|
952
|
+
];
|
|
953
|
+
|
|
954
|
+
// src/logger/logger.ts
|
|
955
|
+
var shouldReportToObservable = process.env.NODE_ENV === "production";
|
|
956
|
+
var ORDERED_LEVELS = [
|
|
957
|
+
"debug",
|
|
958
|
+
"info",
|
|
959
|
+
"warn",
|
|
960
|
+
"error"
|
|
961
|
+
];
|
|
962
|
+
var defaultConfig = {
|
|
963
|
+
showLevel: false,
|
|
964
|
+
showTimestamp: false,
|
|
965
|
+
level: "info",
|
|
966
|
+
prefix: ""
|
|
967
|
+
};
|
|
968
|
+
var config = {
|
|
969
|
+
...defaultConfig
|
|
970
|
+
};
|
|
971
|
+
function configureLogger(options) {
|
|
972
|
+
config = {
|
|
973
|
+
...defaultConfig,
|
|
974
|
+
...options
|
|
975
|
+
};
|
|
976
|
+
}
|
|
977
|
+
__name(configureLogger, "configureLogger");
|
|
978
|
+
function shouldLog(level) {
|
|
979
|
+
return ORDERED_LEVELS.indexOf(level) >= ORDERED_LEVELS.indexOf(config.level);
|
|
980
|
+
}
|
|
981
|
+
__name(shouldLog, "shouldLog");
|
|
982
|
+
function getFormattedPrefix(level) {
|
|
983
|
+
const parts = [];
|
|
984
|
+
if (config.prefix) {
|
|
985
|
+
parts.push(`[${config.prefix}]`);
|
|
986
|
+
}
|
|
987
|
+
if (config.showLevel) {
|
|
988
|
+
parts.push(`[${level.toUpperCase()}]`);
|
|
989
|
+
}
|
|
990
|
+
return parts;
|
|
991
|
+
}
|
|
992
|
+
__name(getFormattedPrefix, "getFormattedPrefix");
|
|
993
|
+
configureLogger({
|
|
994
|
+
showLevel: true,
|
|
995
|
+
showTimestamp: false,
|
|
996
|
+
level: process.env.NODE_ENV === "development" ? "debug" : "error",
|
|
997
|
+
prefix: "MiaoDa"
|
|
998
|
+
});
|
|
999
|
+
var logger = {
|
|
1000
|
+
debug(message, ...args) {
|
|
1001
|
+
if (shouldLog("debug")) {
|
|
1002
|
+
console.log(...getFormattedPrefix("debug"), message, ...args);
|
|
1003
|
+
}
|
|
1004
|
+
},
|
|
1005
|
+
info(message, ...args) {
|
|
1006
|
+
if (shouldLog("info")) {
|
|
1007
|
+
console.log(...getFormattedPrefix("info"), message, ...args);
|
|
1008
|
+
}
|
|
1009
|
+
if (shouldReportToObservable) {
|
|
1010
|
+
import_observable_web2.observable.log("INFO", processLogParams([
|
|
1011
|
+
message,
|
|
1012
|
+
...args
|
|
1013
|
+
]).join(" "));
|
|
1014
|
+
}
|
|
1015
|
+
},
|
|
1016
|
+
warn(message, ...args) {
|
|
1017
|
+
if (shouldLog("warn")) {
|
|
1018
|
+
console.log(...getFormattedPrefix("warn"), message, ...args);
|
|
1019
|
+
}
|
|
1020
|
+
if (shouldReportToObservable) {
|
|
1021
|
+
import_observable_web2.observable.log("WARN", processLogParams([
|
|
1022
|
+
message,
|
|
1023
|
+
...args
|
|
1024
|
+
]).join(" "));
|
|
1025
|
+
}
|
|
1026
|
+
},
|
|
1027
|
+
error(message, ...args) {
|
|
1028
|
+
if (shouldLog("error")) {
|
|
1029
|
+
console.error(...getFormattedPrefix("error"), message, ...args);
|
|
1030
|
+
}
|
|
1031
|
+
if (shouldReportToObservable) {
|
|
1032
|
+
import_observable_web2.observable.log("ERROR", processLogParams([
|
|
1033
|
+
message,
|
|
1034
|
+
...args
|
|
1035
|
+
]).join(" "));
|
|
1036
|
+
}
|
|
1037
|
+
},
|
|
1038
|
+
success(message, ...args) {
|
|
1039
|
+
if (shouldLog("info")) {
|
|
1040
|
+
console.log(...getFormattedPrefix("success"), message, ...args);
|
|
1041
|
+
}
|
|
1042
|
+
if (shouldReportToObservable) {
|
|
1043
|
+
import_observable_web2.observable.log("INFO", processLogParams([
|
|
1044
|
+
message,
|
|
1045
|
+
...args
|
|
1046
|
+
]).join(" "));
|
|
1047
|
+
}
|
|
1048
|
+
},
|
|
1049
|
+
log({ level, args }) {
|
|
1050
|
+
if (shouldLog(level)) {
|
|
1051
|
+
console.log(...getFormattedPrefix(level), ...args);
|
|
1052
|
+
}
|
|
1053
|
+
if (shouldReportToObservable && level !== "debug") {
|
|
1054
|
+
import_observable_web2.observable.log(mapLogLevel(level), processLogParams(args).join(" "));
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
};
|
|
1058
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1059
|
+
window.__RUNTIME_LOGGER__ = {
|
|
1060
|
+
get() {
|
|
1061
|
+
return logger;
|
|
1062
|
+
}
|
|
1063
|
+
};
|
|
1064
|
+
}
|
|
1065
|
+
for (const interceptor of interceptors) {
|
|
1066
|
+
logger = interceptor(logger);
|
|
1067
|
+
}
|
|
1068
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1069
|
+
interceptErrors();
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
// src/runtime/iframe-bridge.ts
|
|
1073
|
+
var import_penpal = require("penpal");
|
|
1074
|
+
|
|
750
1075
|
// src/utils/utils.ts
|
|
751
1076
|
var import_clsx = require("clsx");
|
|
752
1077
|
var import_tailwind_merge = require("tailwind-merge");
|
|
@@ -835,6 +1160,7 @@ __name(initIframeBridge, "initIframeBridge");
|
|
|
835
1160
|
if (!window.__FULLSTACK_RUNTIME_INITIALIZED__) {
|
|
836
1161
|
window.__FULLSTACK_RUNTIME_INITIALIZED__ = true;
|
|
837
1162
|
initAxiosConfig();
|
|
1163
|
+
initObservable();
|
|
838
1164
|
if (process.env.NODE_ENV !== "production") {
|
|
839
1165
|
initIframeBridge();
|
|
840
1166
|
}
|
|
@@ -852,16 +1178,6 @@ function getAppId() {
|
|
|
852
1178
|
}
|
|
853
1179
|
__name(getAppId, "getAppId");
|
|
854
1180
|
|
|
855
|
-
// src/utils/apiPath.ts
|
|
856
|
-
function isNewPathEnabled() {
|
|
857
|
-
const basePath = process.env.CLIENT_BASE_PATH || "/";
|
|
858
|
-
return /^\/app\/[^/]/.test(basePath);
|
|
859
|
-
}
|
|
860
|
-
__name(isNewPathEnabled, "isNewPathEnabled");
|
|
861
|
-
|
|
862
|
-
// src/hooks/useAppInfo.tsx
|
|
863
|
-
var import_react = require("react");
|
|
864
|
-
|
|
865
1181
|
// src/utils/getInitialInfo.ts
|
|
866
1182
|
async function getAppPublished() {
|
|
867
1183
|
try {
|
|
@@ -912,6 +1228,47 @@ function getInitialInfo(refresh = false) {
|
|
|
912
1228
|
}
|
|
913
1229
|
__name(getInitialInfo, "getInitialInfo");
|
|
914
1230
|
|
|
1231
|
+
// src/utils/getTenantInfo.ts
|
|
1232
|
+
async function fetchTenantInfo() {
|
|
1233
|
+
try {
|
|
1234
|
+
const appId = getAppId();
|
|
1235
|
+
const path = isNewPathEnabled() ? `/app/${appId}/__runtime__/api/v1/studio/tenant_info` : `/spark/b/${appId}/tenant_info`;
|
|
1236
|
+
const response = await fetch(`${window.location.origin}${path}`, {
|
|
1237
|
+
method: "GET",
|
|
1238
|
+
headers: {
|
|
1239
|
+
"X-Suda-Csrf-Token": getCsrfToken() ?? ""
|
|
1240
|
+
},
|
|
1241
|
+
credentials: "include"
|
|
1242
|
+
});
|
|
1243
|
+
const res = await response.json();
|
|
1244
|
+
return res?.data;
|
|
1245
|
+
} catch {
|
|
1246
|
+
return void 0;
|
|
1247
|
+
}
|
|
1248
|
+
}
|
|
1249
|
+
__name(fetchTenantInfo, "fetchTenantInfo");
|
|
1250
|
+
var tenantInfo;
|
|
1251
|
+
var pendingPromise2 = null;
|
|
1252
|
+
function getTenantInfo() {
|
|
1253
|
+
if (tenantInfo) {
|
|
1254
|
+
return Promise.resolve(tenantInfo);
|
|
1255
|
+
}
|
|
1256
|
+
if (pendingPromise2) {
|
|
1257
|
+
return pendingPromise2;
|
|
1258
|
+
}
|
|
1259
|
+
pendingPromise2 = fetchTenantInfo().then((info) => {
|
|
1260
|
+
tenantInfo = info;
|
|
1261
|
+
return tenantInfo;
|
|
1262
|
+
}).finally(() => {
|
|
1263
|
+
pendingPromise2 = null;
|
|
1264
|
+
});
|
|
1265
|
+
return pendingPromise2;
|
|
1266
|
+
}
|
|
1267
|
+
__name(getTenantInfo, "getTenantInfo");
|
|
1268
|
+
|
|
1269
|
+
// src/hooks/useAppInfo.tsx
|
|
1270
|
+
var import_react = require("react");
|
|
1271
|
+
|
|
915
1272
|
// src/integrations/getAppInfo.ts
|
|
916
1273
|
async function getAppInfo(refresh = false) {
|
|
917
1274
|
let appInfo = typeof window !== "undefined" ? window._appInfo : void 0;
|
|
@@ -1048,23 +1405,23 @@ var createDataLoomClient = /* @__PURE__ */ __name((url, pat) => {
|
|
|
1048
1405
|
});
|
|
1049
1406
|
}, "createDataLoomClient");
|
|
1050
1407
|
var dataloom = null;
|
|
1051
|
-
var
|
|
1408
|
+
var pendingPromise3 = null;
|
|
1052
1409
|
function getDataloom() {
|
|
1053
1410
|
if (dataloom) {
|
|
1054
1411
|
return Promise.resolve(dataloom);
|
|
1055
1412
|
}
|
|
1056
|
-
if (
|
|
1057
|
-
return
|
|
1413
|
+
if (pendingPromise3) {
|
|
1414
|
+
return pendingPromise3;
|
|
1058
1415
|
}
|
|
1059
|
-
|
|
1416
|
+
pendingPromise3 = getInitialInfo().then((info) => {
|
|
1060
1417
|
const DATALOOM_CLIENT_URL = info?.app_runtime_extra?.url;
|
|
1061
1418
|
const DATALOOM_PAT = info?.app_runtime_extra?.token;
|
|
1062
1419
|
dataloom = createDataLoomClient(DATALOOM_CLIENT_URL, DATALOOM_PAT);
|
|
1063
1420
|
return dataloom;
|
|
1064
1421
|
}).finally(() => {
|
|
1065
|
-
|
|
1422
|
+
pendingPromise3 = null;
|
|
1066
1423
|
});
|
|
1067
|
-
return
|
|
1424
|
+
return pendingPromise3;
|
|
1068
1425
|
}
|
|
1069
1426
|
__name(getDataloom, "getDataloom");
|
|
1070
1427
|
|
|
@@ -1184,6 +1541,11 @@ __name(useLogout, "useLogout");
|
|
|
1184
1541
|
|
|
1185
1542
|
// src/locales/messages.ts
|
|
1186
1543
|
var messages = {
|
|
1544
|
+
// ── Index / 通用 ──────────────────────────────────────────────
|
|
1545
|
+
"index.rateLimitError": {
|
|
1546
|
+
zh: "\u5E94\u7528\u989D\u5EA6\u5DF2\u8017\u5C3D\uFF0C\u8BF7\u8054\u7CFB\u5E94\u7528\u5F00\u53D1\u8005",
|
|
1547
|
+
en: "Application quota exhausted, please contact the app developer"
|
|
1548
|
+
},
|
|
1187
1549
|
// ── Safety 组件 ──────────────────────────────────────────────
|
|
1188
1550
|
"safety.badge.label": {
|
|
1189
1551
|
zh: "\u5999\u642D",
|
|
@@ -1563,24 +1925,14 @@ var Safety = /* @__PURE__ */ __name(() => {
|
|
|
1563
1925
|
const [badgeLoaded, setBadgeLoaded] = (0, import_react5.useState)(false);
|
|
1564
1926
|
const timeoutRef = (0, import_react5.useRef)(null);
|
|
1565
1927
|
(0, import_react5.useEffect)(() => {
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
};
|
|
1571
|
-
const tenantInfoUrl = isNewPathEnabled() ? `/app/${appId}/__runtime__/api/v1/studio/tenant_info` : `/spark/b/${appId}/tenant_info`;
|
|
1572
|
-
fetch(tenantInfoUrl, {
|
|
1573
|
-
headers: csrfHeaders
|
|
1574
|
-
}).then((res) => res.json()).then((data) => {
|
|
1575
|
-
setUserinfo(data?.data?.tenant_info);
|
|
1576
|
-
setIsInternetVisible(data?.data?.is_internet_visible);
|
|
1928
|
+
if (process.env.NODE_ENV !== "production") return;
|
|
1929
|
+
getTenantInfo().then((data) => {
|
|
1930
|
+
setUserinfo(data?.tenant_info ?? null);
|
|
1931
|
+
setIsInternetVisible(!!data?.is_internet_visible);
|
|
1577
1932
|
}).catch(() => {
|
|
1578
1933
|
});
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
headers: csrfHeaders
|
|
1582
|
-
}).then((res) => res.json()).then((data) => {
|
|
1583
|
-
const badge = data?.data?.app_info?.show_badge;
|
|
1934
|
+
getInitialInfo().then((info) => {
|
|
1935
|
+
const badge = info?.app_info?.show_badge;
|
|
1584
1936
|
setShowBadge(badge !== false);
|
|
1585
1937
|
}).catch(() => {
|
|
1586
1938
|
setShowBadge(true);
|
|
@@ -1872,7 +2224,7 @@ function IframeBridge() {
|
|
|
1872
2224
|
}, [
|
|
1873
2225
|
handleMessage
|
|
1874
2226
|
]);
|
|
1875
|
-
return /* @__PURE__ */
|
|
2227
|
+
return /* @__PURE__ */ (0, import_react8.createElement)("div", {
|
|
1876
2228
|
style: {
|
|
1877
2229
|
display: "none"
|
|
1878
2230
|
}
|
|
@@ -1991,31 +2343,6 @@ var reportTeaEvent = /* @__PURE__ */ __name(async ({ trackKey, trackParams = {}
|
|
|
1991
2343
|
}
|
|
1992
2344
|
}, "reportTeaEvent");
|
|
1993
2345
|
|
|
1994
|
-
// src/components/AppContainer/utils/observable.ts
|
|
1995
|
-
var import_observable_web2 = require("@lark-apaas/observable-web");
|
|
1996
|
-
var initObservable = /* @__PURE__ */ __name(() => {
|
|
1997
|
-
try {
|
|
1998
|
-
const appId = window.appId;
|
|
1999
|
-
import_observable_web2.observable.start({
|
|
2000
|
-
serviceName: "app",
|
|
2001
|
-
env: process.env.NODE_ENV === "development" ? import_observable_web2.AppEnv.Dev : import_observable_web2.AppEnv.Prod,
|
|
2002
|
-
collectorUrl: isNewPathEnabled() ? {
|
|
2003
|
-
log: `/app/${appId}/__runtime__/api/v1/observability/logs/collect`,
|
|
2004
|
-
trace: `/app/${appId}/__runtime__/api/v1/observability/traces/collect`,
|
|
2005
|
-
metric: `/app/${appId}/__runtime__/api/v1/observability/metrics/collect`,
|
|
2006
|
-
time: `/app/${appId}/__runtime__/api/v1/observability/current_server_timestamp`
|
|
2007
|
-
} : {
|
|
2008
|
-
log: `/spark/app/${appId}/runtime/api/v1/observability/logs/collect`,
|
|
2009
|
-
trace: `/spark/app/${appId}/runtime/api/v1/observability/traces/collect`,
|
|
2010
|
-
metric: `/spark/app/${appId}/runtime/api/v1/observability/metrics/collect`,
|
|
2011
|
-
time: `/spark/api/v1/observability/app/${appId}/current_server_timestamp`
|
|
2012
|
-
}
|
|
2013
|
-
});
|
|
2014
|
-
} catch (error) {
|
|
2015
|
-
console.error("Failed to start WebObservableSdk:", error);
|
|
2016
|
-
}
|
|
2017
|
-
}, "initObservable");
|
|
2018
|
-
|
|
2019
2346
|
// src/types/tea.ts
|
|
2020
2347
|
var TrackKey = /* @__PURE__ */ (function(TrackKey2) {
|
|
2021
2348
|
TrackKey2["VIEW"] = "aily_agent_artifact_page_view";
|
|
@@ -2025,9 +2352,6 @@ var TrackKey = /* @__PURE__ */ (function(TrackKey2) {
|
|
|
2025
2352
|
// src/components/AppContainer/index.tsx
|
|
2026
2353
|
var AppContainer = /* @__PURE__ */ __name(({ children }) => {
|
|
2027
2354
|
useAppInfo();
|
|
2028
|
-
(0, import_react9.useEffect)(() => {
|
|
2029
|
-
initObservable();
|
|
2030
|
-
}, []);
|
|
2031
2355
|
(0, import_react9.useEffect)(() => {
|
|
2032
2356
|
if (process.env.NODE_ENV === "production") {
|
|
2033
2357
|
reportTeaEvent({
|
|
@@ -2040,7 +2364,7 @@ var AppContainer = /* @__PURE__ */ __name(({ children }) => {
|
|
|
2040
2364
|
});
|
|
2041
2365
|
}
|
|
2042
2366
|
}, []);
|
|
2043
|
-
return /* @__PURE__ */ import_react9.default.createElement(import_react9.default.Fragment, null, /* @__PURE__ */ import_react9.default.createElement(safety_default, null), process.env.NODE_ENV !== "production" && /* @__PURE__ */ import_react9.default.createElement(import_miaoda_inspector.MiaodaInspector, null), process.env.NODE_ENV !== "production" && /* @__PURE__ */ import_react9.default.createElement(IframeBridge, null), /* @__PURE__ */ import_react9.default.createElement(QueryProvider_default, null, children));
|
|
2367
|
+
return /* @__PURE__ */ import_react9.default.createElement(import_react9.default.Fragment, null, String(process.env.MIAODA_APP_TYPE) !== "7" && /* @__PURE__ */ import_react9.default.createElement(safety_default, null), process.env.NODE_ENV !== "production" && /* @__PURE__ */ import_react9.default.createElement(import_miaoda_inspector.MiaodaInspector, null), process.env.NODE_ENV !== "production" && /* @__PURE__ */ import_react9.default.createElement(IframeBridge, null), /* @__PURE__ */ import_react9.default.createElement(QueryProvider_default, null, children));
|
|
2044
2368
|
}, "AppContainer");
|
|
2045
2369
|
var AppContainer_default = AppContainer;
|
|
2046
2370
|
|
|
@@ -2148,7 +2472,8 @@ var ErrorRender = /* @__PURE__ */ __name((props) => {
|
|
|
2148
2472
|
error
|
|
2149
2473
|
],
|
|
2150
2474
|
meta: {
|
|
2151
|
-
type: "render-error"
|
|
2475
|
+
type: "render-error",
|
|
2476
|
+
repairMessage: "\u9875\u9762\u6E32\u67D3\u65F6\u62A5\u9519\uFF0C\u8BF7\u6839\u636E\u9519\u8BEF\u4FE1\u606F\u4FEE\u590D\u5BF9\u5E94\u9875\u9762\u7684\u4EE3\u7801"
|
|
2152
2477
|
}
|
|
2153
2478
|
});
|
|
2154
2479
|
}
|
|
@@ -2158,11 +2483,15 @@ var ErrorRender = /* @__PURE__ */ __name((props) => {
|
|
|
2158
2483
|
(0, import_react12.useEffect)(() => {
|
|
2159
2484
|
if (!resetErrorBoundary) return;
|
|
2160
2485
|
const hmr = getHmrApi();
|
|
2161
|
-
if (hmr)
|
|
2162
|
-
|
|
2486
|
+
if (!hmr) return;
|
|
2487
|
+
return hmr.onSuccess(() => {
|
|
2488
|
+
const isVite = typeof window !== "undefined" && Boolean(window.__VITE_HMR__);
|
|
2489
|
+
if (isVite) {
|
|
2490
|
+
window.location.reload();
|
|
2491
|
+
} else {
|
|
2163
2492
|
resetErrorBoundary();
|
|
2164
|
-
}
|
|
2165
|
-
}
|
|
2493
|
+
}
|
|
2494
|
+
});
|
|
2166
2495
|
}, [
|
|
2167
2496
|
resetErrorBoundary
|
|
2168
2497
|
]);
|
|
@@ -2251,9 +2580,9 @@ var ActiveLink = /* @__PURE__ */ (0, import_react13.forwardRef)(({ to, onClick,
|
|
|
2251
2580
|
ActiveLink.displayName = "ActiveLink";
|
|
2252
2581
|
|
|
2253
2582
|
// src/route-components/NavLink.tsx
|
|
2254
|
-
var
|
|
2583
|
+
var React9 = __toESM(require("react"), 1);
|
|
2255
2584
|
var import_react_router_dom3 = require("react-router-dom");
|
|
2256
|
-
var NavLink2 = /* @__PURE__ */
|
|
2585
|
+
var NavLink2 = /* @__PURE__ */ React9.forwardRef(({ to, children, className, style, ...props }, ref) => {
|
|
2257
2586
|
const isHashLink = typeof to === "string" && to.startsWith("#");
|
|
2258
2587
|
const location = (0, import_react_router_dom3.useLocation)();
|
|
2259
2588
|
const navigate = (0, import_react_router_dom3.useNavigate)();
|
|
@@ -2277,7 +2606,7 @@ var NavLink2 = /* @__PURE__ */ React10.forwardRef(({ to, children, className, st
|
|
|
2277
2606
|
const resolvedClassName = typeof className === "function" ? className(renderProps) : className;
|
|
2278
2607
|
const resolvedStyle = typeof style === "function" ? style(renderProps) : style;
|
|
2279
2608
|
const { caseSensitive, end, replace, state, preventScrollReset, relative, viewTransition, ...restProps } = props;
|
|
2280
|
-
return /* @__PURE__ */
|
|
2609
|
+
return /* @__PURE__ */ React9.createElement("a", {
|
|
2281
2610
|
href: to,
|
|
2282
2611
|
onClick: handleClick,
|
|
2283
2612
|
ref,
|
|
@@ -2286,7 +2615,7 @@ var NavLink2 = /* @__PURE__ */ React10.forwardRef(({ to, children, className, st
|
|
|
2286
2615
|
...restProps
|
|
2287
2616
|
}, typeof children === "function" ? children(renderProps) : children);
|
|
2288
2617
|
}
|
|
2289
|
-
return /* @__PURE__ */
|
|
2618
|
+
return /* @__PURE__ */ React9.createElement(import_react_router_dom3.NavLink, {
|
|
2290
2619
|
to,
|
|
2291
2620
|
ref,
|
|
2292
2621
|
className,
|
|
@@ -2546,20 +2875,92 @@ var axiosForBackend = getAxiosForBackend();
|
|
|
2546
2875
|
|
|
2547
2876
|
// src/integrations/capabilityClient.ts
|
|
2548
2877
|
var import_client_capability = require("@lark-apaas/client-capability");
|
|
2878
|
+
|
|
2879
|
+
// src/components/ui/toast.tsx
|
|
2880
|
+
function showToast2(message, duration = 3e3) {
|
|
2881
|
+
return new Promise((resolve) => {
|
|
2882
|
+
const toast = document.createElement("div");
|
|
2883
|
+
const iconSvg = `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2884
|
+
<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"/>
|
|
2885
|
+
</svg>`;
|
|
2886
|
+
const iconWrapper = document.createElement("span");
|
|
2887
|
+
iconWrapper.innerHTML = iconSvg;
|
|
2888
|
+
Object.assign(iconWrapper.style, {
|
|
2889
|
+
display: "flex",
|
|
2890
|
+
alignItems: "center",
|
|
2891
|
+
marginRight: "8px",
|
|
2892
|
+
flexShrink: "0"
|
|
2893
|
+
});
|
|
2894
|
+
const textWrapper = document.createElement("span");
|
|
2895
|
+
textWrapper.textContent = message;
|
|
2896
|
+
toast.appendChild(iconWrapper);
|
|
2897
|
+
toast.appendChild(textWrapper);
|
|
2898
|
+
Object.assign(toast.style, {
|
|
2899
|
+
position: "fixed",
|
|
2900
|
+
top: "32px",
|
|
2901
|
+
left: "50%",
|
|
2902
|
+
transform: "translate(-50%, -50%)",
|
|
2903
|
+
display: "flex",
|
|
2904
|
+
alignItems: "center",
|
|
2905
|
+
padding: "12px 16px",
|
|
2906
|
+
backgroundColor: "#fff",
|
|
2907
|
+
color: "#1f2329",
|
|
2908
|
+
border: "1px solid #dee0e3",
|
|
2909
|
+
borderRadius: "6px",
|
|
2910
|
+
fontSize: "14px",
|
|
2911
|
+
lineHeight: "1.5",
|
|
2912
|
+
zIndex: "99999",
|
|
2913
|
+
maxWidth: "80vw",
|
|
2914
|
+
wordBreak: "break-word",
|
|
2915
|
+
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)",
|
|
2916
|
+
opacity: "0",
|
|
2917
|
+
transition: "opacity 0.3s ease"
|
|
2918
|
+
});
|
|
2919
|
+
document.body.appendChild(toast);
|
|
2920
|
+
requestAnimationFrame(() => {
|
|
2921
|
+
toast.style.opacity = "1";
|
|
2922
|
+
});
|
|
2923
|
+
setTimeout(() => {
|
|
2924
|
+
toast.style.opacity = "0";
|
|
2925
|
+
setTimeout(() => {
|
|
2926
|
+
document.body.removeChild(toast);
|
|
2927
|
+
resolve();
|
|
2928
|
+
}, 300);
|
|
2929
|
+
}, duration);
|
|
2930
|
+
});
|
|
2931
|
+
}
|
|
2932
|
+
__name(showToast2, "showToast");
|
|
2933
|
+
|
|
2934
|
+
// src/integrations/capabilityClient.ts
|
|
2549
2935
|
var _appId = getAppId();
|
|
2550
|
-
var
|
|
2551
|
-
var
|
|
2936
|
+
var _archType = process.env.MIAODA_APP_ARCH_TYPE;
|
|
2937
|
+
var _isFrontendOnly = _archType === "2" || _archType === "3" || _archType === "4";
|
|
2552
2938
|
var capabilityClient = (0, import_client_capability.createClient)({
|
|
2553
2939
|
baseURL: normalizeBasePath(process.env.CLIENT_BASE_PATH ?? "/"),
|
|
2554
|
-
acquireUploadUrl:
|
|
2555
|
-
acquireDownloadUrl:
|
|
2940
|
+
acquireUploadUrl: `/app/${_appId}/__runtime__/api/v1/studio/plugins/tmp_files/acquire_upload_url`,
|
|
2941
|
+
acquireDownloadUrl: `/app/${_appId}/__runtime__/api/v1/studio/plugins/tmp_files/acquire_download_url`,
|
|
2556
2942
|
fetchOptions: {
|
|
2557
2943
|
headers: {
|
|
2558
2944
|
"X-Suda-Csrf-Token": window.csrfToken ?? ""
|
|
2559
2945
|
}
|
|
2560
|
-
}
|
|
2946
|
+
},
|
|
2947
|
+
logger,
|
|
2948
|
+
onRateLimitError: /* @__PURE__ */ __name(() => {
|
|
2949
|
+
showToast2(t("index.rateLimitError"));
|
|
2950
|
+
}, "onRateLimitError"),
|
|
2951
|
+
..._isFrontendOnly ? {
|
|
2952
|
+
central: {
|
|
2953
|
+
enabled: true,
|
|
2954
|
+
// window.appId 由妙搭沙箱 / 线上环境注入;非妙搭场景下 capability 调用本身不可用
|
|
2955
|
+
appId: _appId ?? ""
|
|
2956
|
+
}
|
|
2957
|
+
} : {}
|
|
2561
2958
|
});
|
|
2562
2959
|
|
|
2960
|
+
// src/trace/index.ts
|
|
2961
|
+
var import_observable_web3 = require("@lark-apaas/observable-web");
|
|
2962
|
+
var trace = /* @__PURE__ */ __name((...args) => import_observable_web3.observable.trace(...args), "trace");
|
|
2963
|
+
|
|
2563
2964
|
// src/constants/img-resources/avatar.ts
|
|
2564
2965
|
var avatar_exports = {};
|
|
2565
2966
|
__export(avatar_exports, {
|
|
@@ -2743,6 +3144,7 @@ var abstractArt3dRenderingCoverImg6 = "https://lf3-static.bytednsdoc.com/obj/ede
|
|
|
2743
3144
|
getEnvPath,
|
|
2744
3145
|
getWsPath,
|
|
2745
3146
|
initAxiosConfig,
|
|
3147
|
+
initObservable,
|
|
2746
3148
|
isIOS,
|
|
2747
3149
|
isIpad,
|
|
2748
3150
|
isMobile,
|
|
@@ -2753,6 +3155,7 @@ var abstractArt3dRenderingCoverImg6 = "https://lf3-static.bytednsdoc.com/obj/ede
|
|
|
2753
3155
|
resolveAppUrl,
|
|
2754
3156
|
safeStringify,
|
|
2755
3157
|
scopedStorage,
|
|
3158
|
+
trace,
|
|
2756
3159
|
useAppInfo,
|
|
2757
3160
|
useCurrentUserProfile,
|
|
2758
3161
|
useIsMobile,
|