@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.js
CHANGED
|
@@ -6,7 +6,7 @@ var __export = (target, all) => {
|
|
|
6
6
|
};
|
|
7
7
|
|
|
8
8
|
// src/components/AppContainer/index.tsx
|
|
9
|
-
import
|
|
9
|
+
import React4, { useEffect as useEffect5 } from "react";
|
|
10
10
|
import { MiaodaInspector } from "@lark-apaas/miaoda-inspector";
|
|
11
11
|
|
|
12
12
|
// src/runtime/react-devtools-hook.ts
|
|
@@ -82,8 +82,45 @@ function initAxiosConfig(axiosInstance2) {
|
|
|
82
82
|
}
|
|
83
83
|
__name(initAxiosConfig, "initAxiosConfig");
|
|
84
84
|
|
|
85
|
+
// src/runtime/observable.ts
|
|
86
|
+
import { observable, AppEnv } from "@lark-apaas/observable-web";
|
|
87
|
+
|
|
88
|
+
// src/utils/apiPath.ts
|
|
89
|
+
function isNewPathEnabled() {
|
|
90
|
+
const basePath = process.env.CLIENT_BASE_PATH || "/";
|
|
91
|
+
return /^\/app\/[^/]/.test(basePath);
|
|
92
|
+
}
|
|
93
|
+
__name(isNewPathEnabled, "isNewPathEnabled");
|
|
94
|
+
|
|
95
|
+
// src/runtime/observable.ts
|
|
96
|
+
var initObservable = /* @__PURE__ */ __name(() => {
|
|
97
|
+
try {
|
|
98
|
+
const appId = window.appId;
|
|
99
|
+
observable.start({
|
|
100
|
+
serviceName: "app",
|
|
101
|
+
env: process.env.NODE_ENV === "development" ? AppEnv.Dev : AppEnv.Prod,
|
|
102
|
+
collectorUrl: isNewPathEnabled() ? {
|
|
103
|
+
log: `/app/${appId}/__runtime__/api/v1/observability/logs/collect`,
|
|
104
|
+
trace: `/app/${appId}/__runtime__/api/v1/observability/traces/collect`,
|
|
105
|
+
metric: `/app/${appId}/__runtime__/api/v1/observability/metrics/collect`,
|
|
106
|
+
time: `/app/${appId}/__runtime__/api/v1/observability/current_server_timestamp`
|
|
107
|
+
} : {
|
|
108
|
+
log: `/spark/app/${appId}/runtime/api/v1/observability/logs/collect`,
|
|
109
|
+
trace: `/spark/app/${appId}/runtime/api/v1/observability/traces/collect`,
|
|
110
|
+
metric: `/spark/app/${appId}/runtime/api/v1/observability/metrics/collect`,
|
|
111
|
+
time: `/spark/api/v1/observability/app/${appId}/current_server_timestamp`
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
} catch (error) {
|
|
115
|
+
console.error("Failed to start WebObservableSdk:", error);
|
|
116
|
+
}
|
|
117
|
+
}, "initObservable");
|
|
118
|
+
|
|
85
119
|
// src/logger/logger.ts
|
|
86
|
-
import { observable } from "@lark-apaas/observable-web";
|
|
120
|
+
import { observable as observable2 } from "@lark-apaas/observable-web";
|
|
121
|
+
|
|
122
|
+
// src/logger/intercept-global-error.ts
|
|
123
|
+
import { slardar } from "@lark-apaas/internal-slardar";
|
|
87
124
|
|
|
88
125
|
// src/utils/hmr-api.ts
|
|
89
126
|
function createWebpackHmrApi(hot) {
|
|
@@ -231,12 +268,32 @@ function processDevServerLog(log) {
|
|
|
231
268
|
status: "disconnected"
|
|
232
269
|
}
|
|
233
270
|
});
|
|
271
|
+
slardar.sendEvent({
|
|
272
|
+
name: "sandbox-devServer",
|
|
273
|
+
metrics: {
|
|
274
|
+
time
|
|
275
|
+
},
|
|
276
|
+
categories: {
|
|
277
|
+
type: "disconnected"
|
|
278
|
+
}
|
|
279
|
+
});
|
|
234
280
|
return;
|
|
235
281
|
}
|
|
236
282
|
if (!devServerDisconnectInfo) {
|
|
237
283
|
return;
|
|
238
284
|
}
|
|
239
285
|
if (devFlag && log.includes("Trying to reconnect")) {
|
|
286
|
+
if (retryCount) {
|
|
287
|
+
slardar.sendEvent({
|
|
288
|
+
name: "sandbox-devServer",
|
|
289
|
+
metrics: {
|
|
290
|
+
retryCount: retryCount + 1
|
|
291
|
+
},
|
|
292
|
+
categories: {
|
|
293
|
+
type: "reconnect-failed"
|
|
294
|
+
}
|
|
295
|
+
});
|
|
296
|
+
}
|
|
240
297
|
retryCount++;
|
|
241
298
|
return;
|
|
242
299
|
}
|
|
@@ -249,6 +306,18 @@ function processDevServerLog(log) {
|
|
|
249
306
|
status: "connected"
|
|
250
307
|
}
|
|
251
308
|
});
|
|
309
|
+
const startTime = devServerDisconnectInfo.time;
|
|
310
|
+
const duration = Date.now() - startTime;
|
|
311
|
+
slardar.sendEvent({
|
|
312
|
+
name: "sandbox-devServer",
|
|
313
|
+
metrics: {
|
|
314
|
+
startTime,
|
|
315
|
+
duration
|
|
316
|
+
},
|
|
317
|
+
categories: {
|
|
318
|
+
type: "devServer-reconnected"
|
|
319
|
+
}
|
|
320
|
+
});
|
|
252
321
|
devServerDisconnectInfo = null;
|
|
253
322
|
retryCount = 0;
|
|
254
323
|
}
|
|
@@ -268,6 +337,13 @@ function listenModuleHmr() {
|
|
|
268
337
|
});
|
|
269
338
|
hmr.onError((error) => {
|
|
270
339
|
console.warn("hmr apply failed", error);
|
|
340
|
+
slardar.sendEvent({
|
|
341
|
+
name: "sandbox-devServer",
|
|
342
|
+
categories: {
|
|
343
|
+
type: "hmr-apply-failed",
|
|
344
|
+
error: String(error)
|
|
345
|
+
}
|
|
346
|
+
});
|
|
271
347
|
});
|
|
272
348
|
}
|
|
273
349
|
}
|
|
@@ -377,123 +453,8 @@ function mapLogLevel(level) {
|
|
|
377
453
|
}
|
|
378
454
|
__name(mapLogLevel, "mapLogLevel");
|
|
379
455
|
|
|
380
|
-
// src/logger/
|
|
381
|
-
|
|
382
|
-
var ORDERED_LEVELS = [
|
|
383
|
-
"debug",
|
|
384
|
-
"info",
|
|
385
|
-
"warn",
|
|
386
|
-
"error"
|
|
387
|
-
];
|
|
388
|
-
var defaultConfig = {
|
|
389
|
-
showLevel: false,
|
|
390
|
-
showTimestamp: false,
|
|
391
|
-
level: "info",
|
|
392
|
-
prefix: ""
|
|
393
|
-
};
|
|
394
|
-
var config = {
|
|
395
|
-
...defaultConfig
|
|
396
|
-
};
|
|
397
|
-
function configureLogger(options) {
|
|
398
|
-
config = {
|
|
399
|
-
...defaultConfig,
|
|
400
|
-
...options
|
|
401
|
-
};
|
|
402
|
-
}
|
|
403
|
-
__name(configureLogger, "configureLogger");
|
|
404
|
-
function shouldLog(level) {
|
|
405
|
-
return ORDERED_LEVELS.indexOf(level) >= ORDERED_LEVELS.indexOf(config.level);
|
|
406
|
-
}
|
|
407
|
-
__name(shouldLog, "shouldLog");
|
|
408
|
-
function getFormattedPrefix(level) {
|
|
409
|
-
const parts = [];
|
|
410
|
-
if (config.prefix) {
|
|
411
|
-
parts.push(`[${config.prefix}]`);
|
|
412
|
-
}
|
|
413
|
-
if (config.showLevel) {
|
|
414
|
-
parts.push(`[${level.toUpperCase()}]`);
|
|
415
|
-
}
|
|
416
|
-
return parts;
|
|
417
|
-
}
|
|
418
|
-
__name(getFormattedPrefix, "getFormattedPrefix");
|
|
419
|
-
configureLogger({
|
|
420
|
-
showLevel: true,
|
|
421
|
-
showTimestamp: false,
|
|
422
|
-
level: process.env.NODE_ENV === "development" ? "debug" : "error",
|
|
423
|
-
prefix: "MiaoDa"
|
|
424
|
-
});
|
|
425
|
-
var logger = {
|
|
426
|
-
debug(message, ...args) {
|
|
427
|
-
if (shouldLog("debug")) {
|
|
428
|
-
console.log(...getFormattedPrefix("debug"), message, ...args);
|
|
429
|
-
}
|
|
430
|
-
},
|
|
431
|
-
info(message, ...args) {
|
|
432
|
-
if (shouldLog("info")) {
|
|
433
|
-
console.log(...getFormattedPrefix("info"), message, ...args);
|
|
434
|
-
}
|
|
435
|
-
if (shouldReportToObservable) {
|
|
436
|
-
observable.log("INFO", processLogParams([
|
|
437
|
-
message,
|
|
438
|
-
...args
|
|
439
|
-
]).join(" "));
|
|
440
|
-
}
|
|
441
|
-
},
|
|
442
|
-
warn(message, ...args) {
|
|
443
|
-
if (shouldLog("warn")) {
|
|
444
|
-
console.log(...getFormattedPrefix("warn"), message, ...args);
|
|
445
|
-
}
|
|
446
|
-
if (shouldReportToObservable) {
|
|
447
|
-
observable.log("WARN", processLogParams([
|
|
448
|
-
message,
|
|
449
|
-
...args
|
|
450
|
-
]).join(" "));
|
|
451
|
-
}
|
|
452
|
-
},
|
|
453
|
-
error(message, ...args) {
|
|
454
|
-
if (shouldLog("error")) {
|
|
455
|
-
console.error(...getFormattedPrefix("error"), message, ...args);
|
|
456
|
-
}
|
|
457
|
-
if (shouldReportToObservable) {
|
|
458
|
-
observable.log("ERROR", processLogParams([
|
|
459
|
-
message,
|
|
460
|
-
...args
|
|
461
|
-
]).join(" "));
|
|
462
|
-
}
|
|
463
|
-
},
|
|
464
|
-
success(message, ...args) {
|
|
465
|
-
if (shouldLog("info")) {
|
|
466
|
-
console.log(...getFormattedPrefix("success"), message, ...args);
|
|
467
|
-
}
|
|
468
|
-
if (shouldReportToObservable) {
|
|
469
|
-
observable.log("INFO", processLogParams([
|
|
470
|
-
message,
|
|
471
|
-
...args
|
|
472
|
-
]).join(" "));
|
|
473
|
-
}
|
|
474
|
-
},
|
|
475
|
-
log({ level, args }) {
|
|
476
|
-
if (shouldLog(level)) {
|
|
477
|
-
console.log(...getFormattedPrefix(level), ...args);
|
|
478
|
-
}
|
|
479
|
-
if (shouldReportToObservable && level !== "debug") {
|
|
480
|
-
observable.log(mapLogLevel(level), processLogParams(args).join(" "));
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
};
|
|
484
|
-
if (process.env.NODE_ENV !== "production") {
|
|
485
|
-
window.__RUNTIME_LOGGER__ = {
|
|
486
|
-
get() {
|
|
487
|
-
return logger;
|
|
488
|
-
}
|
|
489
|
-
};
|
|
490
|
-
}
|
|
491
|
-
if (process.env.NODE_ENV !== "production") {
|
|
492
|
-
interceptErrors();
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
// src/runtime/iframe-bridge.ts
|
|
496
|
-
import { connectToParent } from "penpal";
|
|
456
|
+
// src/logger/selected-logs.ts
|
|
457
|
+
import StackTrace from "stacktrace-js";
|
|
497
458
|
|
|
498
459
|
// src/logger/batch-logger.ts
|
|
499
460
|
var BatchLogger = class {
|
|
@@ -678,6 +639,368 @@ if (process.env.NODE_ENV !== "production" && typeof window !== "undefined") {
|
|
|
678
639
|
defaultBatchLogger = new BatchLogger(console);
|
|
679
640
|
}
|
|
680
641
|
|
|
642
|
+
// src/logger/selected-logs.ts
|
|
643
|
+
function mapStacktrace(stacktrace) {
|
|
644
|
+
return stacktrace.map((frame) => ({
|
|
645
|
+
functionName: frame.functionName || "",
|
|
646
|
+
fileName: frame.fileName || "",
|
|
647
|
+
lineNumber: frame.lineNumber || 0,
|
|
648
|
+
columnNumber: frame.columnNumber || 0
|
|
649
|
+
}));
|
|
650
|
+
}
|
|
651
|
+
__name(mapStacktrace, "mapStacktrace");
|
|
652
|
+
function reportStacktraceParseError(e, context) {
|
|
653
|
+
if (window.parent === window) return;
|
|
654
|
+
try {
|
|
655
|
+
submitPostMessage({
|
|
656
|
+
type: "STACKTRACE_PARSE_ERROR",
|
|
657
|
+
payload: {
|
|
658
|
+
error: e instanceof Error ? e.message : String(e),
|
|
659
|
+
context
|
|
660
|
+
}
|
|
661
|
+
});
|
|
662
|
+
} catch {
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
__name(reportStacktraceParseError, "reportStacktraceParseError");
|
|
666
|
+
async function getStacktrace() {
|
|
667
|
+
const stacktrace = await StackTrace.get();
|
|
668
|
+
return mapStacktrace(stacktrace);
|
|
669
|
+
}
|
|
670
|
+
__name(getStacktrace, "getStacktrace");
|
|
671
|
+
function errorReplacer(_key, value) {
|
|
672
|
+
if (value instanceof Error) {
|
|
673
|
+
return {
|
|
674
|
+
message: value.message,
|
|
675
|
+
stack: value.stack,
|
|
676
|
+
name: value.name
|
|
677
|
+
};
|
|
678
|
+
}
|
|
679
|
+
return value;
|
|
680
|
+
}
|
|
681
|
+
__name(errorReplacer, "errorReplacer");
|
|
682
|
+
function generateLogId() {
|
|
683
|
+
try {
|
|
684
|
+
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
|
|
685
|
+
return crypto.randomUUID();
|
|
686
|
+
}
|
|
687
|
+
} catch {
|
|
688
|
+
}
|
|
689
|
+
return `${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
690
|
+
}
|
|
691
|
+
__name(generateLogId, "generateLogId");
|
|
692
|
+
var lastLogInfo = null;
|
|
693
|
+
async function sendSelectedLog(logWithoutID) {
|
|
694
|
+
try {
|
|
695
|
+
const log = {
|
|
696
|
+
...logWithoutID,
|
|
697
|
+
id: generateLogId()
|
|
698
|
+
};
|
|
699
|
+
const newParts = [];
|
|
700
|
+
for (let i = 0; i < log.args.length; i++) {
|
|
701
|
+
const item = log.args[i];
|
|
702
|
+
if (item instanceof Error) {
|
|
703
|
+
const newError = {
|
|
704
|
+
message: item.message,
|
|
705
|
+
stack: item.stack,
|
|
706
|
+
name: item.name
|
|
707
|
+
};
|
|
708
|
+
if (!log.meta.stacktrace) {
|
|
709
|
+
try {
|
|
710
|
+
const stacktrace = await StackTrace.fromError(item);
|
|
711
|
+
log.meta.stacktrace = mapStacktrace(stacktrace);
|
|
712
|
+
} catch (e) {
|
|
713
|
+
reportStacktraceParseError(e, "StackTrace.fromError");
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
newParts.push(newError.message, newError);
|
|
717
|
+
} else {
|
|
718
|
+
newParts.push(item);
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
log.args = newParts;
|
|
722
|
+
if (!log.meta.stacktrace) {
|
|
723
|
+
try {
|
|
724
|
+
const frames = await getStacktrace();
|
|
725
|
+
const firstFrameIndex = frames.findIndex((frame) => !frame.fileName.includes("client-toolkit-lite/dist/logger"));
|
|
726
|
+
log.meta.stacktrace = firstFrameIndex === -1 ? [] : frames.slice(firstFrameIndex);
|
|
727
|
+
} catch (e) {
|
|
728
|
+
reportStacktraceParseError(e, "getStacktrace");
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
if (log.meta.skipFrame === void 0) {
|
|
732
|
+
log.meta.skipFrame = 2;
|
|
733
|
+
}
|
|
734
|
+
const logJSON = JSON.stringify(log, errorReplacer);
|
|
735
|
+
const logForDedup = {
|
|
736
|
+
...log
|
|
737
|
+
};
|
|
738
|
+
delete logForDedup.id;
|
|
739
|
+
const logContentForDedup = JSON.stringify(logForDedup, errorReplacer);
|
|
740
|
+
if (lastLogInfo && lastLogInfo.content === logContentForDedup) {
|
|
741
|
+
lastLogInfo.count++;
|
|
742
|
+
log.meta.isDuplicate = true;
|
|
743
|
+
log.meta.duplicateCount = lastLogInfo.count;
|
|
744
|
+
log.meta.duplicateOfId = lastLogInfo.id;
|
|
745
|
+
const updatedJSON = JSON.stringify(log, errorReplacer);
|
|
746
|
+
try {
|
|
747
|
+
batchLogInfo("info", updatedJSON);
|
|
748
|
+
} catch {
|
|
749
|
+
}
|
|
750
|
+
if (window.parent !== window) {
|
|
751
|
+
try {
|
|
752
|
+
submitPostMessage({
|
|
753
|
+
type: "SELECTED_LOG",
|
|
754
|
+
payload: updatedJSON
|
|
755
|
+
});
|
|
756
|
+
} catch {
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
return;
|
|
760
|
+
}
|
|
761
|
+
lastLogInfo = {
|
|
762
|
+
content: logContentForDedup,
|
|
763
|
+
id: log.id,
|
|
764
|
+
count: 1
|
|
765
|
+
};
|
|
766
|
+
try {
|
|
767
|
+
batchLogInfo("info", logJSON);
|
|
768
|
+
} catch {
|
|
769
|
+
}
|
|
770
|
+
if (window.parent !== window) {
|
|
771
|
+
try {
|
|
772
|
+
submitPostMessage({
|
|
773
|
+
type: "SELECTED_LOG",
|
|
774
|
+
payload: logJSON
|
|
775
|
+
});
|
|
776
|
+
} catch {
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
} catch {
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
__name(sendSelectedLog, "sendSelectedLog");
|
|
783
|
+
function sendTypedLogV2(logWithMeta) {
|
|
784
|
+
void sendSelectedLog({
|
|
785
|
+
type: "typedLogV2",
|
|
786
|
+
level: logWithMeta.level,
|
|
787
|
+
args: logWithMeta.args,
|
|
788
|
+
meta: logWithMeta.meta ?? {}
|
|
789
|
+
});
|
|
790
|
+
}
|
|
791
|
+
__name(sendTypedLogV2, "sendTypedLogV2");
|
|
792
|
+
var typedLogInterceptor = /* @__PURE__ */ __name((originLogger) => ({
|
|
793
|
+
debug: /* @__PURE__ */ __name((message, ...args) => {
|
|
794
|
+
try {
|
|
795
|
+
originLogger.debug(message, ...args);
|
|
796
|
+
} catch {
|
|
797
|
+
}
|
|
798
|
+
sendTypedLogV2({
|
|
799
|
+
level: "info",
|
|
800
|
+
args: [
|
|
801
|
+
message,
|
|
802
|
+
...args
|
|
803
|
+
],
|
|
804
|
+
meta: {}
|
|
805
|
+
});
|
|
806
|
+
}, "debug"),
|
|
807
|
+
info: /* @__PURE__ */ __name((message, ...args) => {
|
|
808
|
+
try {
|
|
809
|
+
originLogger.info(message, ...args);
|
|
810
|
+
} catch {
|
|
811
|
+
}
|
|
812
|
+
sendTypedLogV2({
|
|
813
|
+
level: "info",
|
|
814
|
+
args: [
|
|
815
|
+
message,
|
|
816
|
+
...args
|
|
817
|
+
],
|
|
818
|
+
meta: {}
|
|
819
|
+
});
|
|
820
|
+
}, "info"),
|
|
821
|
+
warn: /* @__PURE__ */ __name((message, ...args) => {
|
|
822
|
+
try {
|
|
823
|
+
originLogger.warn(message, ...args);
|
|
824
|
+
} catch {
|
|
825
|
+
}
|
|
826
|
+
sendTypedLogV2({
|
|
827
|
+
level: "warn",
|
|
828
|
+
args: [
|
|
829
|
+
message,
|
|
830
|
+
...args
|
|
831
|
+
],
|
|
832
|
+
meta: {}
|
|
833
|
+
});
|
|
834
|
+
}, "warn"),
|
|
835
|
+
error: /* @__PURE__ */ __name((message, ...args) => {
|
|
836
|
+
try {
|
|
837
|
+
originLogger.error(message, ...args);
|
|
838
|
+
} catch {
|
|
839
|
+
}
|
|
840
|
+
sendTypedLogV2({
|
|
841
|
+
level: "error",
|
|
842
|
+
args: [
|
|
843
|
+
message,
|
|
844
|
+
...args
|
|
845
|
+
],
|
|
846
|
+
meta: {}
|
|
847
|
+
});
|
|
848
|
+
}, "error"),
|
|
849
|
+
success: /* @__PURE__ */ __name((message, ...args) => {
|
|
850
|
+
try {
|
|
851
|
+
originLogger.success(message, ...args);
|
|
852
|
+
} catch {
|
|
853
|
+
}
|
|
854
|
+
sendTypedLogV2({
|
|
855
|
+
level: "success",
|
|
856
|
+
args: [
|
|
857
|
+
message,
|
|
858
|
+
...args
|
|
859
|
+
],
|
|
860
|
+
meta: {}
|
|
861
|
+
});
|
|
862
|
+
}, "success"),
|
|
863
|
+
log: /* @__PURE__ */ __name(({ level, args, meta }) => {
|
|
864
|
+
try {
|
|
865
|
+
originLogger.log({
|
|
866
|
+
level,
|
|
867
|
+
args,
|
|
868
|
+
meta
|
|
869
|
+
});
|
|
870
|
+
} catch {
|
|
871
|
+
}
|
|
872
|
+
sendTypedLogV2({
|
|
873
|
+
level,
|
|
874
|
+
args,
|
|
875
|
+
meta: meta ?? {}
|
|
876
|
+
});
|
|
877
|
+
}, "log")
|
|
878
|
+
}), "typedLogInterceptor");
|
|
879
|
+
var interceptors = [
|
|
880
|
+
typedLogInterceptor
|
|
881
|
+
];
|
|
882
|
+
|
|
883
|
+
// src/logger/logger.ts
|
|
884
|
+
var shouldReportToObservable = process.env.NODE_ENV === "production";
|
|
885
|
+
var ORDERED_LEVELS = [
|
|
886
|
+
"debug",
|
|
887
|
+
"info",
|
|
888
|
+
"warn",
|
|
889
|
+
"error"
|
|
890
|
+
];
|
|
891
|
+
var defaultConfig = {
|
|
892
|
+
showLevel: false,
|
|
893
|
+
showTimestamp: false,
|
|
894
|
+
level: "info",
|
|
895
|
+
prefix: ""
|
|
896
|
+
};
|
|
897
|
+
var config = {
|
|
898
|
+
...defaultConfig
|
|
899
|
+
};
|
|
900
|
+
function configureLogger(options) {
|
|
901
|
+
config = {
|
|
902
|
+
...defaultConfig,
|
|
903
|
+
...options
|
|
904
|
+
};
|
|
905
|
+
}
|
|
906
|
+
__name(configureLogger, "configureLogger");
|
|
907
|
+
function shouldLog(level) {
|
|
908
|
+
return ORDERED_LEVELS.indexOf(level) >= ORDERED_LEVELS.indexOf(config.level);
|
|
909
|
+
}
|
|
910
|
+
__name(shouldLog, "shouldLog");
|
|
911
|
+
function getFormattedPrefix(level) {
|
|
912
|
+
const parts = [];
|
|
913
|
+
if (config.prefix) {
|
|
914
|
+
parts.push(`[${config.prefix}]`);
|
|
915
|
+
}
|
|
916
|
+
if (config.showLevel) {
|
|
917
|
+
parts.push(`[${level.toUpperCase()}]`);
|
|
918
|
+
}
|
|
919
|
+
return parts;
|
|
920
|
+
}
|
|
921
|
+
__name(getFormattedPrefix, "getFormattedPrefix");
|
|
922
|
+
configureLogger({
|
|
923
|
+
showLevel: true,
|
|
924
|
+
showTimestamp: false,
|
|
925
|
+
level: process.env.NODE_ENV === "development" ? "debug" : "error",
|
|
926
|
+
prefix: "MiaoDa"
|
|
927
|
+
});
|
|
928
|
+
var logger = {
|
|
929
|
+
debug(message, ...args) {
|
|
930
|
+
if (shouldLog("debug")) {
|
|
931
|
+
console.log(...getFormattedPrefix("debug"), message, ...args);
|
|
932
|
+
}
|
|
933
|
+
},
|
|
934
|
+
info(message, ...args) {
|
|
935
|
+
if (shouldLog("info")) {
|
|
936
|
+
console.log(...getFormattedPrefix("info"), message, ...args);
|
|
937
|
+
}
|
|
938
|
+
if (shouldReportToObservable) {
|
|
939
|
+
observable2.log("INFO", processLogParams([
|
|
940
|
+
message,
|
|
941
|
+
...args
|
|
942
|
+
]).join(" "));
|
|
943
|
+
}
|
|
944
|
+
},
|
|
945
|
+
warn(message, ...args) {
|
|
946
|
+
if (shouldLog("warn")) {
|
|
947
|
+
console.log(...getFormattedPrefix("warn"), message, ...args);
|
|
948
|
+
}
|
|
949
|
+
if (shouldReportToObservable) {
|
|
950
|
+
observable2.log("WARN", processLogParams([
|
|
951
|
+
message,
|
|
952
|
+
...args
|
|
953
|
+
]).join(" "));
|
|
954
|
+
}
|
|
955
|
+
},
|
|
956
|
+
error(message, ...args) {
|
|
957
|
+
if (shouldLog("error")) {
|
|
958
|
+
console.error(...getFormattedPrefix("error"), message, ...args);
|
|
959
|
+
}
|
|
960
|
+
if (shouldReportToObservable) {
|
|
961
|
+
observable2.log("ERROR", processLogParams([
|
|
962
|
+
message,
|
|
963
|
+
...args
|
|
964
|
+
]).join(" "));
|
|
965
|
+
}
|
|
966
|
+
},
|
|
967
|
+
success(message, ...args) {
|
|
968
|
+
if (shouldLog("info")) {
|
|
969
|
+
console.log(...getFormattedPrefix("success"), message, ...args);
|
|
970
|
+
}
|
|
971
|
+
if (shouldReportToObservable) {
|
|
972
|
+
observable2.log("INFO", processLogParams([
|
|
973
|
+
message,
|
|
974
|
+
...args
|
|
975
|
+
]).join(" "));
|
|
976
|
+
}
|
|
977
|
+
},
|
|
978
|
+
log({ level, args }) {
|
|
979
|
+
if (shouldLog(level)) {
|
|
980
|
+
console.log(...getFormattedPrefix(level), ...args);
|
|
981
|
+
}
|
|
982
|
+
if (shouldReportToObservable && level !== "debug") {
|
|
983
|
+
observable2.log(mapLogLevel(level), processLogParams(args).join(" "));
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
};
|
|
987
|
+
if (process.env.NODE_ENV !== "production") {
|
|
988
|
+
window.__RUNTIME_LOGGER__ = {
|
|
989
|
+
get() {
|
|
990
|
+
return logger;
|
|
991
|
+
}
|
|
992
|
+
};
|
|
993
|
+
}
|
|
994
|
+
for (const interceptor of interceptors) {
|
|
995
|
+
logger = interceptor(logger);
|
|
996
|
+
}
|
|
997
|
+
if (process.env.NODE_ENV !== "production") {
|
|
998
|
+
interceptErrors();
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
// src/runtime/iframe-bridge.ts
|
|
1002
|
+
import { connectToParent } from "penpal";
|
|
1003
|
+
|
|
681
1004
|
// src/utils/utils.ts
|
|
682
1005
|
import { clsx } from "clsx";
|
|
683
1006
|
import { twMerge } from "tailwind-merge";
|
|
@@ -766,13 +1089,14 @@ __name(initIframeBridge, "initIframeBridge");
|
|
|
766
1089
|
if (!window.__FULLSTACK_RUNTIME_INITIALIZED__) {
|
|
767
1090
|
window.__FULLSTACK_RUNTIME_INITIALIZED__ = true;
|
|
768
1091
|
initAxiosConfig();
|
|
1092
|
+
initObservable();
|
|
769
1093
|
if (process.env.NODE_ENV !== "production") {
|
|
770
1094
|
initIframeBridge();
|
|
771
1095
|
}
|
|
772
1096
|
}
|
|
773
1097
|
|
|
774
1098
|
// src/components/AppContainer/safety.tsx
|
|
775
|
-
import
|
|
1099
|
+
import React2, { useEffect as useEffect3, useRef, useState as useState4 } from "react";
|
|
776
1100
|
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
777
1101
|
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
778
1102
|
|
|
@@ -783,16 +1107,6 @@ function getAppId() {
|
|
|
783
1107
|
}
|
|
784
1108
|
__name(getAppId, "getAppId");
|
|
785
1109
|
|
|
786
|
-
// src/utils/apiPath.ts
|
|
787
|
-
function isNewPathEnabled() {
|
|
788
|
-
const basePath = process.env.CLIENT_BASE_PATH || "/";
|
|
789
|
-
return /^\/app\/[^/]/.test(basePath);
|
|
790
|
-
}
|
|
791
|
-
__name(isNewPathEnabled, "isNewPathEnabled");
|
|
792
|
-
|
|
793
|
-
// src/hooks/useAppInfo.tsx
|
|
794
|
-
import { useEffect, useState } from "react";
|
|
795
|
-
|
|
796
1110
|
// src/utils/getInitialInfo.ts
|
|
797
1111
|
async function getAppPublished() {
|
|
798
1112
|
try {
|
|
@@ -843,6 +1157,47 @@ function getInitialInfo(refresh = false) {
|
|
|
843
1157
|
}
|
|
844
1158
|
__name(getInitialInfo, "getInitialInfo");
|
|
845
1159
|
|
|
1160
|
+
// src/utils/getTenantInfo.ts
|
|
1161
|
+
async function fetchTenantInfo() {
|
|
1162
|
+
try {
|
|
1163
|
+
const appId = getAppId();
|
|
1164
|
+
const path = isNewPathEnabled() ? `/app/${appId}/__runtime__/api/v1/studio/tenant_info` : `/spark/b/${appId}/tenant_info`;
|
|
1165
|
+
const response = await fetch(`${window.location.origin}${path}`, {
|
|
1166
|
+
method: "GET",
|
|
1167
|
+
headers: {
|
|
1168
|
+
"X-Suda-Csrf-Token": getCsrfToken() ?? ""
|
|
1169
|
+
},
|
|
1170
|
+
credentials: "include"
|
|
1171
|
+
});
|
|
1172
|
+
const res = await response.json();
|
|
1173
|
+
return res?.data;
|
|
1174
|
+
} catch {
|
|
1175
|
+
return void 0;
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
__name(fetchTenantInfo, "fetchTenantInfo");
|
|
1179
|
+
var tenantInfo;
|
|
1180
|
+
var pendingPromise2 = null;
|
|
1181
|
+
function getTenantInfo() {
|
|
1182
|
+
if (tenantInfo) {
|
|
1183
|
+
return Promise.resolve(tenantInfo);
|
|
1184
|
+
}
|
|
1185
|
+
if (pendingPromise2) {
|
|
1186
|
+
return pendingPromise2;
|
|
1187
|
+
}
|
|
1188
|
+
pendingPromise2 = fetchTenantInfo().then((info) => {
|
|
1189
|
+
tenantInfo = info;
|
|
1190
|
+
return tenantInfo;
|
|
1191
|
+
}).finally(() => {
|
|
1192
|
+
pendingPromise2 = null;
|
|
1193
|
+
});
|
|
1194
|
+
return pendingPromise2;
|
|
1195
|
+
}
|
|
1196
|
+
__name(getTenantInfo, "getTenantInfo");
|
|
1197
|
+
|
|
1198
|
+
// src/hooks/useAppInfo.tsx
|
|
1199
|
+
import { useEffect, useState } from "react";
|
|
1200
|
+
|
|
846
1201
|
// src/integrations/getAppInfo.ts
|
|
847
1202
|
async function getAppInfo(refresh = false) {
|
|
848
1203
|
let appInfo = typeof window !== "undefined" ? window._appInfo : void 0;
|
|
@@ -979,23 +1334,23 @@ var createDataLoomClient = /* @__PURE__ */ __name((url, pat) => {
|
|
|
979
1334
|
});
|
|
980
1335
|
}, "createDataLoomClient");
|
|
981
1336
|
var dataloom = null;
|
|
982
|
-
var
|
|
1337
|
+
var pendingPromise3 = null;
|
|
983
1338
|
function getDataloom() {
|
|
984
1339
|
if (dataloom) {
|
|
985
1340
|
return Promise.resolve(dataloom);
|
|
986
1341
|
}
|
|
987
|
-
if (
|
|
988
|
-
return
|
|
1342
|
+
if (pendingPromise3) {
|
|
1343
|
+
return pendingPromise3;
|
|
989
1344
|
}
|
|
990
|
-
|
|
1345
|
+
pendingPromise3 = getInitialInfo().then((info) => {
|
|
991
1346
|
const DATALOOM_CLIENT_URL = info?.app_runtime_extra?.url;
|
|
992
1347
|
const DATALOOM_PAT = info?.app_runtime_extra?.token;
|
|
993
1348
|
dataloom = createDataLoomClient(DATALOOM_CLIENT_URL, DATALOOM_PAT);
|
|
994
1349
|
return dataloom;
|
|
995
1350
|
}).finally(() => {
|
|
996
|
-
|
|
1351
|
+
pendingPromise3 = null;
|
|
997
1352
|
});
|
|
998
|
-
return
|
|
1353
|
+
return pendingPromise3;
|
|
999
1354
|
}
|
|
1000
1355
|
__name(getDataloom, "getDataloom");
|
|
1001
1356
|
|
|
@@ -1065,12 +1420,12 @@ var useCurrentUserProfile = /* @__PURE__ */ __name(() => {
|
|
|
1065
1420
|
}, "useCurrentUserProfile");
|
|
1066
1421
|
|
|
1067
1422
|
// src/hooks/useIsMobile.ts
|
|
1068
|
-
import
|
|
1423
|
+
import React from "react";
|
|
1069
1424
|
import { debounce } from "lodash";
|
|
1070
1425
|
var MOBILE_BREAKPOINT = 768;
|
|
1071
1426
|
function useIsMobile() {
|
|
1072
|
-
const [isMobile2, setIsMobile] =
|
|
1073
|
-
|
|
1427
|
+
const [isMobile2, setIsMobile] = React.useState(window.innerWidth < MOBILE_BREAKPOINT);
|
|
1428
|
+
React.useEffect(() => {
|
|
1074
1429
|
const handleResize = /* @__PURE__ */ __name(() => {
|
|
1075
1430
|
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
1076
1431
|
}, "handleResize");
|
|
@@ -1115,6 +1470,11 @@ __name(useLogout, "useLogout");
|
|
|
1115
1470
|
|
|
1116
1471
|
// src/locales/messages.ts
|
|
1117
1472
|
var messages = {
|
|
1473
|
+
// ── Index / 通用 ──────────────────────────────────────────────
|
|
1474
|
+
"index.rateLimitError": {
|
|
1475
|
+
zh: "\u5E94\u7528\u989D\u5EA6\u5DF2\u8017\u5C3D\uFF0C\u8BF7\u8054\u7CFB\u5E94\u7528\u5F00\u53D1\u8005",
|
|
1476
|
+
en: "Application quota exhausted, please contact the app developer"
|
|
1477
|
+
},
|
|
1118
1478
|
// ── Safety 组件 ──────────────────────────────────────────────
|
|
1119
1479
|
"safety.badge.label": {
|
|
1120
1480
|
zh: "\u5999\u642D",
|
|
@@ -1455,7 +1815,7 @@ var mobileBtnFilled = {
|
|
|
1455
1815
|
};
|
|
1456
1816
|
var HoverButton = /* @__PURE__ */ __name(({ style, onClick, children, ...rest }) => {
|
|
1457
1817
|
const [hovered, setHovered] = useState4(false);
|
|
1458
|
-
return /* @__PURE__ */
|
|
1818
|
+
return /* @__PURE__ */ React2.createElement("div", {
|
|
1459
1819
|
style: {
|
|
1460
1820
|
...style,
|
|
1461
1821
|
...hovered ? btnHovered : {}
|
|
@@ -1466,7 +1826,7 @@ var HoverButton = /* @__PURE__ */ __name(({ style, onClick, children, ...rest })
|
|
|
1466
1826
|
...rest
|
|
1467
1827
|
}, children);
|
|
1468
1828
|
}, "HoverButton");
|
|
1469
|
-
var XIcon = /* @__PURE__ */ __name(({ style, onClick }) => /* @__PURE__ */
|
|
1829
|
+
var XIcon = /* @__PURE__ */ __name(({ style, onClick }) => /* @__PURE__ */ React2.createElement("svg", {
|
|
1470
1830
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1471
1831
|
width: "24",
|
|
1472
1832
|
height: "24",
|
|
@@ -1478,9 +1838,9 @@ var XIcon = /* @__PURE__ */ __name(({ style, onClick }) => /* @__PURE__ */ React
|
|
|
1478
1838
|
strokeLinejoin: "round",
|
|
1479
1839
|
style,
|
|
1480
1840
|
onClick
|
|
1481
|
-
}, /* @__PURE__ */
|
|
1841
|
+
}, /* @__PURE__ */ React2.createElement("path", {
|
|
1482
1842
|
d: "M18 6 6 18"
|
|
1483
|
-
}), /* @__PURE__ */
|
|
1843
|
+
}), /* @__PURE__ */ React2.createElement("path", {
|
|
1484
1844
|
d: "m6 6 12 12"
|
|
1485
1845
|
})), "XIcon");
|
|
1486
1846
|
var Safety = /* @__PURE__ */ __name(() => {
|
|
@@ -1494,24 +1854,14 @@ var Safety = /* @__PURE__ */ __name(() => {
|
|
|
1494
1854
|
const [badgeLoaded, setBadgeLoaded] = useState4(false);
|
|
1495
1855
|
const timeoutRef = useRef(null);
|
|
1496
1856
|
useEffect3(() => {
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
};
|
|
1502
|
-
const tenantInfoUrl = isNewPathEnabled() ? `/app/${appId}/__runtime__/api/v1/studio/tenant_info` : `/spark/b/${appId}/tenant_info`;
|
|
1503
|
-
fetch(tenantInfoUrl, {
|
|
1504
|
-
headers: csrfHeaders
|
|
1505
|
-
}).then((res) => res.json()).then((data) => {
|
|
1506
|
-
setUserinfo(data?.data?.tenant_info);
|
|
1507
|
-
setIsInternetVisible(data?.data?.is_internet_visible);
|
|
1857
|
+
if (process.env.NODE_ENV !== "production") return;
|
|
1858
|
+
getTenantInfo().then((data) => {
|
|
1859
|
+
setUserinfo(data?.tenant_info ?? null);
|
|
1860
|
+
setIsInternetVisible(!!data?.is_internet_visible);
|
|
1508
1861
|
}).catch(() => {
|
|
1509
1862
|
});
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
headers: csrfHeaders
|
|
1513
|
-
}).then((res) => res.json()).then((data) => {
|
|
1514
|
-
const badge = data?.data?.app_info?.show_badge;
|
|
1863
|
+
getInitialInfo().then((info) => {
|
|
1864
|
+
const badge = info?.app_info?.show_badge;
|
|
1515
1865
|
setShowBadge(badge !== false);
|
|
1516
1866
|
}).catch(() => {
|
|
1517
1867
|
setShowBadge(true);
|
|
@@ -1535,70 +1885,70 @@ var Safety = /* @__PURE__ */ __name(() => {
|
|
|
1535
1885
|
if (!showBadge) return null;
|
|
1536
1886
|
if (!visible) return null;
|
|
1537
1887
|
if (isMobile2) {
|
|
1538
|
-
return /* @__PURE__ */
|
|
1888
|
+
return /* @__PURE__ */ React2.createElement(DialogPrimitive.Root, {
|
|
1539
1889
|
open,
|
|
1540
1890
|
onOpenChange: setOpen
|
|
1541
|
-
}, /* @__PURE__ */
|
|
1891
|
+
}, /* @__PURE__ */ React2.createElement(DialogPrimitive.Trigger, {
|
|
1542
1892
|
asChild: true
|
|
1543
|
-
}, /* @__PURE__ */
|
|
1893
|
+
}, /* @__PURE__ */ React2.createElement("div", {
|
|
1544
1894
|
style: badgeMobile,
|
|
1545
1895
|
onClick: /* @__PURE__ */ __name(() => setOpen(true), "onClick")
|
|
1546
|
-
}, /* @__PURE__ */
|
|
1896
|
+
}, /* @__PURE__ */ React2.createElement("img", {
|
|
1547
1897
|
src: LOGO_URL,
|
|
1548
1898
|
style: logoStyle
|
|
1549
|
-
}), /* @__PURE__ */
|
|
1899
|
+
}), /* @__PURE__ */ React2.createElement("p", {
|
|
1550
1900
|
style: {
|
|
1551
1901
|
...badgeTextStyle,
|
|
1552
1902
|
minWidth: 28
|
|
1553
1903
|
}
|
|
1554
|
-
}, t("safety.badge.label")))), /* @__PURE__ */
|
|
1904
|
+
}, t("safety.badge.label")))), /* @__PURE__ */ React2.createElement(DialogPrimitive.Portal, null, /* @__PURE__ */ React2.createElement(DialogPrimitive.Overlay, {
|
|
1555
1905
|
style: overlayStyle
|
|
1556
|
-
}), /* @__PURE__ */
|
|
1906
|
+
}), /* @__PURE__ */ React2.createElement(DialogPrimitive.Content, {
|
|
1557
1907
|
style: sheetContent,
|
|
1558
1908
|
"aria-describedby": void 0
|
|
1559
|
-
}, /* @__PURE__ */
|
|
1909
|
+
}, /* @__PURE__ */ React2.createElement(DialogPrimitive.Title, {
|
|
1560
1910
|
style: {
|
|
1561
1911
|
position: "absolute",
|
|
1562
1912
|
clip: "rect(0 0 0 0)"
|
|
1563
1913
|
}
|
|
1564
|
-
}, t("safety.badge.builtWith")), /* @__PURE__ */
|
|
1914
|
+
}, t("safety.badge.builtWith")), /* @__PURE__ */ React2.createElement("div", {
|
|
1565
1915
|
style: sheetInner
|
|
1566
|
-
}, /* @__PURE__ */
|
|
1916
|
+
}, /* @__PURE__ */ React2.createElement(XIcon, {
|
|
1567
1917
|
style: sheetCloseBtn,
|
|
1568
1918
|
onClick: /* @__PURE__ */ __name(() => setOpen(false), "onClick")
|
|
1569
|
-
}), /* @__PURE__ */
|
|
1919
|
+
}), /* @__PURE__ */ React2.createElement("img", {
|
|
1570
1920
|
src: getCoverMobileUrl(),
|
|
1571
1921
|
alt: "",
|
|
1572
1922
|
style: sheetCover,
|
|
1573
1923
|
onClick: /* @__PURE__ */ __name(() => window.open(LANDING_URL, "_blank"), "onClick")
|
|
1574
|
-
}), /* @__PURE__ */
|
|
1924
|
+
}), /* @__PURE__ */ React2.createElement("div", {
|
|
1575
1925
|
style: sheetBody
|
|
1576
|
-
}, /* @__PURE__ */
|
|
1926
|
+
}, /* @__PURE__ */ React2.createElement("div", {
|
|
1577
1927
|
style: {
|
|
1578
1928
|
display: "flex",
|
|
1579
1929
|
flexDirection: "column",
|
|
1580
1930
|
gap: 4,
|
|
1581
1931
|
alignSelf: "stretch"
|
|
1582
1932
|
}
|
|
1583
|
-
}, isInternetVisible && /* @__PURE__ */
|
|
1933
|
+
}, isInternetVisible && /* @__PURE__ */ React2.createElement("div", {
|
|
1584
1934
|
style: infoRow
|
|
1585
|
-
}, /* @__PURE__ */
|
|
1935
|
+
}, /* @__PURE__ */ React2.createElement("img", {
|
|
1586
1936
|
src: ICON_COMPANY_URL,
|
|
1587
1937
|
style: infoIconMobile
|
|
1588
|
-
}), /* @__PURE__ */
|
|
1938
|
+
}), /* @__PURE__ */ React2.createElement("p", {
|
|
1589
1939
|
style: sheetInfoText
|
|
1590
1940
|
}, t("safety.tenant.operated", {
|
|
1591
1941
|
name: userinfo?.name ?? ""
|
|
1592
|
-
}))), /* @__PURE__ */
|
|
1942
|
+
}))), /* @__PURE__ */ React2.createElement("div", {
|
|
1593
1943
|
style: infoRow
|
|
1594
|
-
}, /* @__PURE__ */
|
|
1944
|
+
}, /* @__PURE__ */ React2.createElement("img", {
|
|
1595
1945
|
src: ICON_AI_URL,
|
|
1596
1946
|
style: infoIconMobile
|
|
1597
|
-
}), /* @__PURE__ */
|
|
1947
|
+
}), /* @__PURE__ */ React2.createElement("p", {
|
|
1598
1948
|
style: sheetInfoText
|
|
1599
|
-
}, t("safety.ai.disclaimer")))), /* @__PURE__ */
|
|
1949
|
+
}, t("safety.ai.disclaimer")))), /* @__PURE__ */ React2.createElement("div", {
|
|
1600
1950
|
style: mobileBtnRow
|
|
1601
|
-
}, /* @__PURE__ */
|
|
1951
|
+
}, /* @__PURE__ */ React2.createElement("div", {
|
|
1602
1952
|
style: mobileBtnOutline,
|
|
1603
1953
|
onClick: /* @__PURE__ */ __name((e) => {
|
|
1604
1954
|
e.stopPropagation();
|
|
@@ -1607,17 +1957,17 @@ var Safety = /* @__PURE__ */ __name(() => {
|
|
|
1607
1957
|
setTimeout(() => setVisible(false), 200);
|
|
1608
1958
|
window.localStorage?.setItem(HasClosedKey, "true");
|
|
1609
1959
|
}, "onClick")
|
|
1610
|
-
}, t("safety.button.dontShowAgain")), /* @__PURE__ */
|
|
1960
|
+
}, t("safety.button.dontShowAgain")), /* @__PURE__ */ React2.createElement("div", {
|
|
1611
1961
|
style: mobileBtnFilled,
|
|
1612
1962
|
onClick: /* @__PURE__ */ __name(() => window.open(LANDING_URL, "_blank"), "onClick")
|
|
1613
1963
|
}, t("safety.button.learnMore"))))))));
|
|
1614
1964
|
}
|
|
1615
|
-
return /* @__PURE__ */
|
|
1965
|
+
return /* @__PURE__ */ React2.createElement(PopoverPrimitive.Root, {
|
|
1616
1966
|
open,
|
|
1617
1967
|
onOpenChange: setOpen
|
|
1618
|
-
}, /* @__PURE__ */
|
|
1968
|
+
}, /* @__PURE__ */ React2.createElement(PopoverPrimitive.Trigger, {
|
|
1619
1969
|
asChild: true
|
|
1620
|
-
}, /* @__PURE__ */
|
|
1970
|
+
}, /* @__PURE__ */ React2.createElement("div", {
|
|
1621
1971
|
style: badgeDesktop,
|
|
1622
1972
|
onMouseEnter: /* @__PURE__ */ __name(() => {
|
|
1623
1973
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
@@ -1626,15 +1976,15 @@ var Safety = /* @__PURE__ */ __name(() => {
|
|
|
1626
1976
|
onMouseLeave: /* @__PURE__ */ __name(() => {
|
|
1627
1977
|
timeoutRef.current = setTimeout(() => setOpen(false), 100);
|
|
1628
1978
|
}, "onMouseLeave")
|
|
1629
|
-
}, /* @__PURE__ */
|
|
1979
|
+
}, /* @__PURE__ */ React2.createElement("img", {
|
|
1630
1980
|
src: LOGO_URL,
|
|
1631
1981
|
style: logoStyle
|
|
1632
|
-
}), /* @__PURE__ */
|
|
1982
|
+
}), /* @__PURE__ */ React2.createElement("p", {
|
|
1633
1983
|
style: {
|
|
1634
1984
|
...badgeTextStyle,
|
|
1635
1985
|
minWidth: 60
|
|
1636
1986
|
}
|
|
1637
|
-
}, t("safety.badge.builtWith")))), /* @__PURE__ */
|
|
1987
|
+
}, t("safety.badge.builtWith")))), /* @__PURE__ */ React2.createElement(PopoverPrimitive.Portal, null, /* @__PURE__ */ React2.createElement(PopoverPrimitive.Content, {
|
|
1638
1988
|
style: popoverContent,
|
|
1639
1989
|
side: "top",
|
|
1640
1990
|
align: "end",
|
|
@@ -1646,41 +1996,41 @@ var Safety = /* @__PURE__ */ __name(() => {
|
|
|
1646
1996
|
onMouseLeave: /* @__PURE__ */ __name(() => {
|
|
1647
1997
|
timeoutRef.current = setTimeout(() => setOpen(false), 100);
|
|
1648
1998
|
}, "onMouseLeave")
|
|
1649
|
-
}, /* @__PURE__ */
|
|
1999
|
+
}, /* @__PURE__ */ React2.createElement("div", {
|
|
1650
2000
|
style: popoverInner
|
|
1651
|
-
}, /* @__PURE__ */
|
|
2001
|
+
}, /* @__PURE__ */ React2.createElement("img", {
|
|
1652
2002
|
src: getCoverUrl(),
|
|
1653
2003
|
alt: "",
|
|
1654
2004
|
style: popoverCover,
|
|
1655
2005
|
onClick: /* @__PURE__ */ __name(() => window.open(LANDING_URL, "_blank"), "onClick")
|
|
1656
|
-
}), /* @__PURE__ */
|
|
2006
|
+
}), /* @__PURE__ */ React2.createElement("div", {
|
|
1657
2007
|
style: popoverBody
|
|
1658
|
-
}, /* @__PURE__ */
|
|
2008
|
+
}, /* @__PURE__ */ React2.createElement("div", {
|
|
1659
2009
|
style: {
|
|
1660
2010
|
display: "flex",
|
|
1661
2011
|
flexDirection: "column",
|
|
1662
2012
|
gap: 4,
|
|
1663
2013
|
alignSelf: "stretch"
|
|
1664
2014
|
}
|
|
1665
|
-
}, isInternetVisible && /* @__PURE__ */
|
|
2015
|
+
}, isInternetVisible && /* @__PURE__ */ React2.createElement("div", {
|
|
1666
2016
|
style: infoRow
|
|
1667
|
-
}, /* @__PURE__ */
|
|
2017
|
+
}, /* @__PURE__ */ React2.createElement("img", {
|
|
1668
2018
|
src: ICON_COMPANY_URL,
|
|
1669
2019
|
style: infoIcon
|
|
1670
|
-
}), /* @__PURE__ */
|
|
2020
|
+
}), /* @__PURE__ */ React2.createElement("p", {
|
|
1671
2021
|
style: infoText
|
|
1672
2022
|
}, t("safety.tenant.operated", {
|
|
1673
2023
|
name: userinfo?.name ?? ""
|
|
1674
|
-
}))), /* @__PURE__ */
|
|
2024
|
+
}))), /* @__PURE__ */ React2.createElement("div", {
|
|
1675
2025
|
style: infoRow
|
|
1676
|
-
}, /* @__PURE__ */
|
|
2026
|
+
}, /* @__PURE__ */ React2.createElement("img", {
|
|
1677
2027
|
src: ICON_AI_URL,
|
|
1678
2028
|
style: infoIcon
|
|
1679
|
-
}), /* @__PURE__ */
|
|
2029
|
+
}), /* @__PURE__ */ React2.createElement("p", {
|
|
1680
2030
|
style: infoText
|
|
1681
|
-
}, t("safety.ai.disclaimer")))), /* @__PURE__ */
|
|
2031
|
+
}, t("safety.ai.disclaimer")))), /* @__PURE__ */ React2.createElement("div", {
|
|
1682
2032
|
style: btnRow
|
|
1683
|
-
}, /* @__PURE__ */
|
|
2033
|
+
}, /* @__PURE__ */ React2.createElement(HoverButton, {
|
|
1684
2034
|
style: btnBase,
|
|
1685
2035
|
"data-custom-element": "safety-close",
|
|
1686
2036
|
onClick: /* @__PURE__ */ __name((e) => {
|
|
@@ -1689,7 +2039,7 @@ var Safety = /* @__PURE__ */ __name(() => {
|
|
|
1689
2039
|
setVisible(false);
|
|
1690
2040
|
window.localStorage?.setItem(HasClosedKey, "true");
|
|
1691
2041
|
}, "onClick")
|
|
1692
|
-
}, t("safety.button.dontShowAgain")), /* @__PURE__ */
|
|
2042
|
+
}, t("safety.button.dontShowAgain")), /* @__PURE__ */ React2.createElement(HoverButton, {
|
|
1693
2043
|
style: btnBase,
|
|
1694
2044
|
"data-custom-element": "safety-more",
|
|
1695
2045
|
onClick: /* @__PURE__ */ __name(() => window.open(LANDING_URL, "_blank"), "onClick")
|
|
@@ -1698,7 +2048,7 @@ var Safety = /* @__PURE__ */ __name(() => {
|
|
|
1698
2048
|
var safety_default = Safety;
|
|
1699
2049
|
|
|
1700
2050
|
// src/components/QueryProvider/index.tsx
|
|
1701
|
-
import
|
|
2051
|
+
import React3 from "react";
|
|
1702
2052
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
1703
2053
|
var defaultQueryClient = null;
|
|
1704
2054
|
var getDefaultQueryClient = /* @__PURE__ */ __name(() => {
|
|
@@ -1719,14 +2069,14 @@ var getDefaultQueryClient = /* @__PURE__ */ __name(() => {
|
|
|
1719
2069
|
}, "getDefaultQueryClient");
|
|
1720
2070
|
var QueryProvider = /* @__PURE__ */ __name(({ children, client }) => {
|
|
1721
2071
|
const qc = client ?? getDefaultQueryClient();
|
|
1722
|
-
return /* @__PURE__ */
|
|
2072
|
+
return /* @__PURE__ */ React3.createElement(QueryClientProvider, {
|
|
1723
2073
|
client: qc
|
|
1724
2074
|
}, children);
|
|
1725
2075
|
}, "QueryProvider");
|
|
1726
2076
|
var QueryProvider_default = QueryProvider;
|
|
1727
2077
|
|
|
1728
2078
|
// src/components/AppContainer/IframeBridge.tsx
|
|
1729
|
-
import { useEffect as useEffect4, useCallback, useRef as useRef3, useMemo } from "react";
|
|
2079
|
+
import { useEffect as useEffect4, useCallback, useRef as useRef3, useMemo, createElement } from "react";
|
|
1730
2080
|
import { useLocation, useNavigate } from "react-router-dom";
|
|
1731
2081
|
|
|
1732
2082
|
// src/hooks/useUpdatingRef.ts
|
|
@@ -1803,7 +2153,7 @@ function IframeBridge() {
|
|
|
1803
2153
|
}, [
|
|
1804
2154
|
handleMessage
|
|
1805
2155
|
]);
|
|
1806
|
-
return /* @__PURE__ */
|
|
2156
|
+
return /* @__PURE__ */ createElement("div", {
|
|
1807
2157
|
style: {
|
|
1808
2158
|
display: "none"
|
|
1809
2159
|
}
|
|
@@ -1922,31 +2272,6 @@ var reportTeaEvent = /* @__PURE__ */ __name(async ({ trackKey, trackParams = {}
|
|
|
1922
2272
|
}
|
|
1923
2273
|
}, "reportTeaEvent");
|
|
1924
2274
|
|
|
1925
|
-
// src/components/AppContainer/utils/observable.ts
|
|
1926
|
-
import { observable as observable2, AppEnv } from "@lark-apaas/observable-web";
|
|
1927
|
-
var initObservable = /* @__PURE__ */ __name(() => {
|
|
1928
|
-
try {
|
|
1929
|
-
const appId = window.appId;
|
|
1930
|
-
observable2.start({
|
|
1931
|
-
serviceName: "app",
|
|
1932
|
-
env: process.env.NODE_ENV === "development" ? AppEnv.Dev : AppEnv.Prod,
|
|
1933
|
-
collectorUrl: isNewPathEnabled() ? {
|
|
1934
|
-
log: `/app/${appId}/__runtime__/api/v1/observability/logs/collect`,
|
|
1935
|
-
trace: `/app/${appId}/__runtime__/api/v1/observability/traces/collect`,
|
|
1936
|
-
metric: `/app/${appId}/__runtime__/api/v1/observability/metrics/collect`,
|
|
1937
|
-
time: `/app/${appId}/__runtime__/api/v1/observability/current_server_timestamp`
|
|
1938
|
-
} : {
|
|
1939
|
-
log: `/spark/app/${appId}/runtime/api/v1/observability/logs/collect`,
|
|
1940
|
-
trace: `/spark/app/${appId}/runtime/api/v1/observability/traces/collect`,
|
|
1941
|
-
metric: `/spark/app/${appId}/runtime/api/v1/observability/metrics/collect`,
|
|
1942
|
-
time: `/spark/api/v1/observability/app/${appId}/current_server_timestamp`
|
|
1943
|
-
}
|
|
1944
|
-
});
|
|
1945
|
-
} catch (error) {
|
|
1946
|
-
console.error("Failed to start WebObservableSdk:", error);
|
|
1947
|
-
}
|
|
1948
|
-
}, "initObservable");
|
|
1949
|
-
|
|
1950
2275
|
// src/types/tea.ts
|
|
1951
2276
|
var TrackKey = /* @__PURE__ */ (function(TrackKey2) {
|
|
1952
2277
|
TrackKey2["VIEW"] = "aily_agent_artifact_page_view";
|
|
@@ -1956,9 +2281,6 @@ var TrackKey = /* @__PURE__ */ (function(TrackKey2) {
|
|
|
1956
2281
|
// src/components/AppContainer/index.tsx
|
|
1957
2282
|
var AppContainer = /* @__PURE__ */ __name(({ children }) => {
|
|
1958
2283
|
useAppInfo();
|
|
1959
|
-
useEffect5(() => {
|
|
1960
|
-
initObservable();
|
|
1961
|
-
}, []);
|
|
1962
2284
|
useEffect5(() => {
|
|
1963
2285
|
if (process.env.NODE_ENV === "production") {
|
|
1964
2286
|
reportTeaEvent({
|
|
@@ -1971,14 +2293,14 @@ var AppContainer = /* @__PURE__ */ __name(({ children }) => {
|
|
|
1971
2293
|
});
|
|
1972
2294
|
}
|
|
1973
2295
|
}, []);
|
|
1974
|
-
return /* @__PURE__ */
|
|
2296
|
+
return /* @__PURE__ */ React4.createElement(React4.Fragment, null, String(process.env.MIAODA_APP_TYPE) !== "7" && /* @__PURE__ */ React4.createElement(safety_default, null), process.env.NODE_ENV !== "production" && /* @__PURE__ */ React4.createElement(MiaodaInspector, null), process.env.NODE_ENV !== "production" && /* @__PURE__ */ React4.createElement(IframeBridge, null), /* @__PURE__ */ React4.createElement(QueryProvider_default, null, children));
|
|
1975
2297
|
}, "AppContainer");
|
|
1976
2298
|
var AppContainer_default = AppContainer;
|
|
1977
2299
|
|
|
1978
2300
|
// src/components/Welcome/index.tsx
|
|
1979
|
-
import
|
|
2301
|
+
import React5 from "react";
|
|
1980
2302
|
var Welcome = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F00\u53D1", description = "\u9875\u9762\u6682\u672A\u5F00\u53D1\uFF0C\u8BF7\u8010\u5FC3\u7B49\u5F85..." }) => {
|
|
1981
|
-
return /* @__PURE__ */
|
|
2303
|
+
return /* @__PURE__ */ React5.createElement("div", {
|
|
1982
2304
|
style: {
|
|
1983
2305
|
display: "flex",
|
|
1984
2306
|
flexDirection: "column",
|
|
@@ -1989,7 +2311,7 @@ var Welcome = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F00\u53D1"
|
|
|
1989
2311
|
padding: "0 24px",
|
|
1990
2312
|
textAlign: "center"
|
|
1991
2313
|
}
|
|
1992
|
-
}, /* @__PURE__ */
|
|
2314
|
+
}, /* @__PURE__ */ React5.createElement("img", {
|
|
1993
2315
|
style: {
|
|
1994
2316
|
borderRadius: 6,
|
|
1995
2317
|
marginBottom: 24
|
|
@@ -1998,7 +2320,7 @@ var Welcome = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F00\u53D1"
|
|
|
1998
2320
|
height: "200",
|
|
1999
2321
|
src: "https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/miao/welcome.svg",
|
|
2000
2322
|
alt: "Welcome"
|
|
2001
|
-
}), /* @__PURE__ */
|
|
2323
|
+
}), /* @__PURE__ */ React5.createElement("div", {
|
|
2002
2324
|
style: {
|
|
2003
2325
|
fontSize: 16,
|
|
2004
2326
|
fontWeight: 500,
|
|
@@ -2006,7 +2328,7 @@ var Welcome = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F00\u53D1"
|
|
|
2006
2328
|
marginBottom: 4,
|
|
2007
2329
|
color: "#1f2329"
|
|
2008
2330
|
}
|
|
2009
|
-
}, title), /* @__PURE__ */
|
|
2331
|
+
}, title), /* @__PURE__ */ React5.createElement("div", {
|
|
2010
2332
|
style: {
|
|
2011
2333
|
fontSize: 16,
|
|
2012
2334
|
lineHeight: "24px",
|
|
@@ -2018,9 +2340,9 @@ var Welcome = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F00\u53D1"
|
|
|
2018
2340
|
var Welcome_default = Welcome;
|
|
2019
2341
|
|
|
2020
2342
|
// src/components/PagePlaceholder/index.tsx
|
|
2021
|
-
import
|
|
2343
|
+
import React6 from "react";
|
|
2022
2344
|
var PagePlaceholder = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F00\u53D1", description = "\u9875\u9762\u6682\u672A\u5F00\u53D1\uFF0C\u8BF7\u8010\u5FC3\u7B49\u5F85..." }) => {
|
|
2023
|
-
return /* @__PURE__ */
|
|
2345
|
+
return /* @__PURE__ */ React6.createElement("div", {
|
|
2024
2346
|
style: {
|
|
2025
2347
|
display: "flex",
|
|
2026
2348
|
flexDirection: "column",
|
|
@@ -2031,7 +2353,7 @@ var PagePlaceholder = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F0
|
|
|
2031
2353
|
height: "calc(100vh - 64px)",
|
|
2032
2354
|
textAlign: "center"
|
|
2033
2355
|
}
|
|
2034
|
-
}, /* @__PURE__ */
|
|
2356
|
+
}, /* @__PURE__ */ React6.createElement("img", {
|
|
2035
2357
|
style: {
|
|
2036
2358
|
borderRadius: "6px",
|
|
2037
2359
|
marginBottom: "24px"
|
|
@@ -2040,14 +2362,14 @@ var PagePlaceholder = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F0
|
|
|
2040
2362
|
height: "200",
|
|
2041
2363
|
src: "https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/miao/welcome.svg",
|
|
2042
2364
|
alt: "Welcome"
|
|
2043
|
-
}), /* @__PURE__ */
|
|
2365
|
+
}), /* @__PURE__ */ React6.createElement("div", {
|
|
2044
2366
|
style: {
|
|
2045
2367
|
fontSize: "16px",
|
|
2046
2368
|
fontWeight: 500,
|
|
2047
2369
|
marginBottom: "4px",
|
|
2048
2370
|
lineHeight: "24px"
|
|
2049
2371
|
}
|
|
2050
|
-
}, title), /* @__PURE__ */
|
|
2372
|
+
}, title), /* @__PURE__ */ React6.createElement("div", {
|
|
2051
2373
|
style: {
|
|
2052
2374
|
color: "#6b7280",
|
|
2053
2375
|
fontSize: "16px",
|
|
@@ -2063,7 +2385,7 @@ var PagePlaceholder = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F0
|
|
|
2063
2385
|
var PagePlaceholder_default = PagePlaceholder;
|
|
2064
2386
|
|
|
2065
2387
|
// src/components/ErrorRender/index.tsx
|
|
2066
|
-
import
|
|
2388
|
+
import React7, { useEffect as useEffect6 } from "react";
|
|
2067
2389
|
var ErrorRender = /* @__PURE__ */ __name((props) => {
|
|
2068
2390
|
const { error, resetErrorBoundary } = props;
|
|
2069
2391
|
useEffect6(() => {
|
|
@@ -2079,7 +2401,8 @@ var ErrorRender = /* @__PURE__ */ __name((props) => {
|
|
|
2079
2401
|
error
|
|
2080
2402
|
],
|
|
2081
2403
|
meta: {
|
|
2082
|
-
type: "render-error"
|
|
2404
|
+
type: "render-error",
|
|
2405
|
+
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"
|
|
2083
2406
|
}
|
|
2084
2407
|
});
|
|
2085
2408
|
}
|
|
@@ -2089,30 +2412,34 @@ var ErrorRender = /* @__PURE__ */ __name((props) => {
|
|
|
2089
2412
|
useEffect6(() => {
|
|
2090
2413
|
if (!resetErrorBoundary) return;
|
|
2091
2414
|
const hmr = getHmrApi();
|
|
2092
|
-
if (hmr)
|
|
2093
|
-
|
|
2415
|
+
if (!hmr) return;
|
|
2416
|
+
return hmr.onSuccess(() => {
|
|
2417
|
+
const isVite = typeof window !== "undefined" && Boolean(window.__VITE_HMR__);
|
|
2418
|
+
if (isVite) {
|
|
2419
|
+
window.location.reload();
|
|
2420
|
+
} else {
|
|
2094
2421
|
resetErrorBoundary();
|
|
2095
|
-
}
|
|
2096
|
-
}
|
|
2422
|
+
}
|
|
2423
|
+
});
|
|
2097
2424
|
}, [
|
|
2098
2425
|
resetErrorBoundary
|
|
2099
2426
|
]);
|
|
2100
|
-
return /* @__PURE__ */
|
|
2427
|
+
return /* @__PURE__ */ React7.createElement("div", {
|
|
2101
2428
|
className: "min-h-screen flex items-center justify-center bg-white"
|
|
2102
|
-
}, /* @__PURE__ */
|
|
2429
|
+
}, /* @__PURE__ */ React7.createElement("div", {
|
|
2103
2430
|
className: "flex flex-col justify-center items-center text-center"
|
|
2104
|
-
}, /* @__PURE__ */
|
|
2431
|
+
}, /* @__PURE__ */ React7.createElement("img", {
|
|
2105
2432
|
src: "https://lf3-static.bytednsdoc.com/obj/eden-cn/ylcylz_fsph_ryhs/ljhwZthlaukjlkulzlp/feisuda/template/illustration_empty_negative_error.svg",
|
|
2106
2433
|
alt: "render error",
|
|
2107
2434
|
className: "mb-3 w-[100px]"
|
|
2108
|
-
}), /* @__PURE__ */
|
|
2435
|
+
}), /* @__PURE__ */ React7.createElement("p", {
|
|
2109
2436
|
className: "text-l/[22px] text-[14px] text-[#1F2329] font-medium"
|
|
2110
2437
|
}, "\u9875\u9762\u51FA\u9519\u4E86")));
|
|
2111
2438
|
}, "ErrorRender");
|
|
2112
2439
|
var ErrorRender_default = ErrorRender;
|
|
2113
2440
|
|
|
2114
2441
|
// src/route-components/ActiveLink.tsx
|
|
2115
|
-
import
|
|
2442
|
+
import React8, { forwardRef, useEffect as useEffect7, useState as useState5 } from "react";
|
|
2116
2443
|
import { NavLink } from "react-router-dom";
|
|
2117
2444
|
var ActiveLink = /* @__PURE__ */ forwardRef(({ to, onClick, className, style, children, ...rest }, ref) => {
|
|
2118
2445
|
const [currentHash, setCurrentHash] = useState5(() => typeof window !== "undefined" ? window.location.hash : "");
|
|
@@ -2129,7 +2456,7 @@ var ActiveLink = /* @__PURE__ */ forwardRef(({ to, onClick, className, style, ch
|
|
|
2129
2456
|
]);
|
|
2130
2457
|
const isActive = isHashRoute && currentHash === to;
|
|
2131
2458
|
if (!isHashRoute) {
|
|
2132
|
-
return /* @__PURE__ */
|
|
2459
|
+
return /* @__PURE__ */ React8.createElement(NavLink, {
|
|
2133
2460
|
ref,
|
|
2134
2461
|
to,
|
|
2135
2462
|
onClick,
|
|
@@ -2170,7 +2497,7 @@ var ActiveLink = /* @__PURE__ */ forwardRef(({ to, onClick, className, style, ch
|
|
|
2170
2497
|
isPending: false,
|
|
2171
2498
|
isTransitioning: false
|
|
2172
2499
|
}) : children;
|
|
2173
|
-
return /* @__PURE__ */
|
|
2500
|
+
return /* @__PURE__ */ React8.createElement("a", {
|
|
2174
2501
|
ref,
|
|
2175
2502
|
href: to,
|
|
2176
2503
|
onClick: handleHashClick,
|
|
@@ -2182,9 +2509,9 @@ var ActiveLink = /* @__PURE__ */ forwardRef(({ to, onClick, className, style, ch
|
|
|
2182
2509
|
ActiveLink.displayName = "ActiveLink";
|
|
2183
2510
|
|
|
2184
2511
|
// src/route-components/NavLink.tsx
|
|
2185
|
-
import * as
|
|
2512
|
+
import * as React9 from "react";
|
|
2186
2513
|
import { NavLink as OriginalNavLink, useLocation as useLocation2, useNavigate as useNavigate2 } from "react-router-dom";
|
|
2187
|
-
var NavLink2 = /* @__PURE__ */
|
|
2514
|
+
var NavLink2 = /* @__PURE__ */ React9.forwardRef(({ to, children, className, style, ...props }, ref) => {
|
|
2188
2515
|
const isHashLink = typeof to === "string" && to.startsWith("#");
|
|
2189
2516
|
const location = useLocation2();
|
|
2190
2517
|
const navigate = useNavigate2();
|
|
@@ -2208,7 +2535,7 @@ var NavLink2 = /* @__PURE__ */ React10.forwardRef(({ to, children, className, st
|
|
|
2208
2535
|
const resolvedClassName = typeof className === "function" ? className(renderProps) : className;
|
|
2209
2536
|
const resolvedStyle = typeof style === "function" ? style(renderProps) : style;
|
|
2210
2537
|
const { caseSensitive, end, replace, state, preventScrollReset, relative, viewTransition, ...restProps } = props;
|
|
2211
|
-
return /* @__PURE__ */
|
|
2538
|
+
return /* @__PURE__ */ React9.createElement("a", {
|
|
2212
2539
|
href: to,
|
|
2213
2540
|
onClick: handleClick,
|
|
2214
2541
|
ref,
|
|
@@ -2217,7 +2544,7 @@ var NavLink2 = /* @__PURE__ */ React10.forwardRef(({ to, children, className, st
|
|
|
2217
2544
|
...restProps
|
|
2218
2545
|
}, typeof children === "function" ? children(renderProps) : children);
|
|
2219
2546
|
}
|
|
2220
|
-
return /* @__PURE__ */
|
|
2547
|
+
return /* @__PURE__ */ React9.createElement(OriginalNavLink, {
|
|
2221
2548
|
to,
|
|
2222
2549
|
ref,
|
|
2223
2550
|
className,
|
|
@@ -2232,7 +2559,7 @@ var NavLink2 = /* @__PURE__ */ React10.forwardRef(({ to, children, className, st
|
|
|
2232
2559
|
NavLink2.displayName = "NavLink";
|
|
2233
2560
|
|
|
2234
2561
|
// src/route-components/UniversalLink.tsx
|
|
2235
|
-
import
|
|
2562
|
+
import React10 from "react";
|
|
2236
2563
|
import { Link as RouterLink } from "react-router-dom";
|
|
2237
2564
|
function isInternalRoute(to) {
|
|
2238
2565
|
return !to.startsWith("#") && !to.startsWith("http://") && !to.startsWith("https://") && !to.startsWith("//");
|
|
@@ -2242,15 +2569,15 @@ function isExternalLink(to) {
|
|
|
2242
2569
|
return to.startsWith("http://") || to.startsWith("https://") || to.startsWith("//");
|
|
2243
2570
|
}
|
|
2244
2571
|
__name(isExternalLink, "isExternalLink");
|
|
2245
|
-
var UniversalLink = /* @__PURE__ */
|
|
2572
|
+
var UniversalLink = /* @__PURE__ */ React10.forwardRef(/* @__PURE__ */ __name(function UniversalLink2({ to, ...props }, ref) {
|
|
2246
2573
|
if (isInternalRoute(to)) {
|
|
2247
|
-
return /* @__PURE__ */
|
|
2574
|
+
return /* @__PURE__ */ React10.createElement(RouterLink, {
|
|
2248
2575
|
to,
|
|
2249
2576
|
ref,
|
|
2250
2577
|
...props
|
|
2251
2578
|
});
|
|
2252
2579
|
}
|
|
2253
|
-
return /* @__PURE__ */
|
|
2580
|
+
return /* @__PURE__ */ React10.createElement("a", {
|
|
2254
2581
|
href: to,
|
|
2255
2582
|
ref,
|
|
2256
2583
|
...props,
|
|
@@ -2477,20 +2804,92 @@ var axiosForBackend = getAxiosForBackend();
|
|
|
2477
2804
|
|
|
2478
2805
|
// src/integrations/capabilityClient.ts
|
|
2479
2806
|
import { createClient as createClient2 } from "@lark-apaas/client-capability";
|
|
2807
|
+
|
|
2808
|
+
// src/components/ui/toast.tsx
|
|
2809
|
+
function showToast2(message, duration = 3e3) {
|
|
2810
|
+
return new Promise((resolve) => {
|
|
2811
|
+
const toast = document.createElement("div");
|
|
2812
|
+
const iconSvg = `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2813
|
+
<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"/>
|
|
2814
|
+
</svg>`;
|
|
2815
|
+
const iconWrapper = document.createElement("span");
|
|
2816
|
+
iconWrapper.innerHTML = iconSvg;
|
|
2817
|
+
Object.assign(iconWrapper.style, {
|
|
2818
|
+
display: "flex",
|
|
2819
|
+
alignItems: "center",
|
|
2820
|
+
marginRight: "8px",
|
|
2821
|
+
flexShrink: "0"
|
|
2822
|
+
});
|
|
2823
|
+
const textWrapper = document.createElement("span");
|
|
2824
|
+
textWrapper.textContent = message;
|
|
2825
|
+
toast.appendChild(iconWrapper);
|
|
2826
|
+
toast.appendChild(textWrapper);
|
|
2827
|
+
Object.assign(toast.style, {
|
|
2828
|
+
position: "fixed",
|
|
2829
|
+
top: "32px",
|
|
2830
|
+
left: "50%",
|
|
2831
|
+
transform: "translate(-50%, -50%)",
|
|
2832
|
+
display: "flex",
|
|
2833
|
+
alignItems: "center",
|
|
2834
|
+
padding: "12px 16px",
|
|
2835
|
+
backgroundColor: "#fff",
|
|
2836
|
+
color: "#1f2329",
|
|
2837
|
+
border: "1px solid #dee0e3",
|
|
2838
|
+
borderRadius: "6px",
|
|
2839
|
+
fontSize: "14px",
|
|
2840
|
+
lineHeight: "1.5",
|
|
2841
|
+
zIndex: "99999",
|
|
2842
|
+
maxWidth: "80vw",
|
|
2843
|
+
wordBreak: "break-word",
|
|
2844
|
+
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)",
|
|
2845
|
+
opacity: "0",
|
|
2846
|
+
transition: "opacity 0.3s ease"
|
|
2847
|
+
});
|
|
2848
|
+
document.body.appendChild(toast);
|
|
2849
|
+
requestAnimationFrame(() => {
|
|
2850
|
+
toast.style.opacity = "1";
|
|
2851
|
+
});
|
|
2852
|
+
setTimeout(() => {
|
|
2853
|
+
toast.style.opacity = "0";
|
|
2854
|
+
setTimeout(() => {
|
|
2855
|
+
document.body.removeChild(toast);
|
|
2856
|
+
resolve();
|
|
2857
|
+
}, 300);
|
|
2858
|
+
}, duration);
|
|
2859
|
+
});
|
|
2860
|
+
}
|
|
2861
|
+
__name(showToast2, "showToast");
|
|
2862
|
+
|
|
2863
|
+
// src/integrations/capabilityClient.ts
|
|
2480
2864
|
var _appId = getAppId();
|
|
2481
|
-
var
|
|
2482
|
-
var
|
|
2865
|
+
var _archType = process.env.MIAODA_APP_ARCH_TYPE;
|
|
2866
|
+
var _isFrontendOnly = _archType === "2" || _archType === "3" || _archType === "4";
|
|
2483
2867
|
var capabilityClient = createClient2({
|
|
2484
2868
|
baseURL: normalizeBasePath(process.env.CLIENT_BASE_PATH ?? "/"),
|
|
2485
|
-
acquireUploadUrl:
|
|
2486
|
-
acquireDownloadUrl:
|
|
2869
|
+
acquireUploadUrl: `/app/${_appId}/__runtime__/api/v1/studio/plugins/tmp_files/acquire_upload_url`,
|
|
2870
|
+
acquireDownloadUrl: `/app/${_appId}/__runtime__/api/v1/studio/plugins/tmp_files/acquire_download_url`,
|
|
2487
2871
|
fetchOptions: {
|
|
2488
2872
|
headers: {
|
|
2489
2873
|
"X-Suda-Csrf-Token": window.csrfToken ?? ""
|
|
2490
2874
|
}
|
|
2491
|
-
}
|
|
2875
|
+
},
|
|
2876
|
+
logger,
|
|
2877
|
+
onRateLimitError: /* @__PURE__ */ __name(() => {
|
|
2878
|
+
showToast2(t("index.rateLimitError"));
|
|
2879
|
+
}, "onRateLimitError"),
|
|
2880
|
+
..._isFrontendOnly ? {
|
|
2881
|
+
central: {
|
|
2882
|
+
enabled: true,
|
|
2883
|
+
// window.appId 由妙搭沙箱 / 线上环境注入;非妙搭场景下 capability 调用本身不可用
|
|
2884
|
+
appId: _appId ?? ""
|
|
2885
|
+
}
|
|
2886
|
+
} : {}
|
|
2492
2887
|
});
|
|
2493
2888
|
|
|
2889
|
+
// src/trace/index.ts
|
|
2890
|
+
import { observable as observable3 } from "@lark-apaas/observable-web";
|
|
2891
|
+
var trace = /* @__PURE__ */ __name((...args) => observable3.trace(...args), "trace");
|
|
2892
|
+
|
|
2494
2893
|
// src/constants/img-resources/avatar.ts
|
|
2495
2894
|
var avatar_exports = {};
|
|
2496
2895
|
__export(avatar_exports, {
|
|
@@ -2673,6 +3072,7 @@ export {
|
|
|
2673
3072
|
getEnvPath,
|
|
2674
3073
|
getWsPath,
|
|
2675
3074
|
initAxiosConfig,
|
|
3075
|
+
initObservable,
|
|
2676
3076
|
isIOS,
|
|
2677
3077
|
isIpad,
|
|
2678
3078
|
isMobile,
|
|
@@ -2683,6 +3083,7 @@ export {
|
|
|
2683
3083
|
resolveAppUrl,
|
|
2684
3084
|
safeStringify,
|
|
2685
3085
|
scopedStorage,
|
|
3086
|
+
trace,
|
|
2686
3087
|
useAppInfo,
|
|
2687
3088
|
useCurrentUserProfile,
|
|
2688
3089
|
useIsMobile,
|