@wanji_dsh/dsh-sales 0.10.6 → 0.11.1
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.zh.md +3 -1
- package/dist/client.js +508 -169
- package/dist/host.js +1434 -787
- package/dist/types/company/host.d.ts +45 -0
- package/dist/types/company/identity.d.ts +23 -0
- package/dist/types/company/remote.d.ts +36 -0
- package/dist/types/generation-runtime.d.ts +9 -1
- package/dist/types/knowledge-host.d.ts +3 -0
- package/dist/types/wechat/batch.d.ts +2 -0
- package/dist/types/wechat/native.d.ts +6 -0
- package/dist/types/wechat/receiver.d.ts +12 -4
- package/dist/types/wechat/repository-client.d.ts +1 -1
- package/dist/types/wechat/service.d.ts +8 -0
- package/dist/types/wechat/types.d.ts +14 -0
- package/dist/types/wechat-draft-input.d.ts +2 -0
- package/dist/types/weknora-http.d.ts +1 -0
- package/dist/types/weknora-retrieval.d.ts +22 -0
- package/dist/wechat-repository-worker.js +58 -12
- package/docs/wechat-native-implementation.md +1 -1
- package/docs/wechat-sync.md +1 -1
- package/package.json +1 -1
- package/runtime/wechat-manifest.json +16 -16
package/dist/client.js
CHANGED
|
@@ -158,7 +158,7 @@ var import_react3 = __toESM(require("react"), 1);
|
|
|
158
158
|
// src/reply-content.tsx
|
|
159
159
|
var import_react2 = __toESM(require("react"), 1);
|
|
160
160
|
|
|
161
|
-
//
|
|
161
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/mdast-util-to-string/lib/index.js
|
|
162
162
|
var emptyOptions = {};
|
|
163
163
|
function toString(value, options) {
|
|
164
164
|
const settings = options || emptyOptions;
|
|
@@ -195,7 +195,7 @@ function node(value) {
|
|
|
195
195
|
return Boolean(value && typeof value === "object");
|
|
196
196
|
}
|
|
197
197
|
|
|
198
|
-
//
|
|
198
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/decode-named-character-reference/index.dom.js
|
|
199
199
|
var element = document.createElement("i");
|
|
200
200
|
function decodeNamedCharacterReference(value) {
|
|
201
201
|
const characterReference2 = "&" + value + ";";
|
|
@@ -207,7 +207,7 @@ function decodeNamedCharacterReference(value) {
|
|
|
207
207
|
return character === characterReference2 ? false : character;
|
|
208
208
|
}
|
|
209
209
|
|
|
210
|
-
//
|
|
210
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-util-chunked/index.js
|
|
211
211
|
function splice(list2, start, remove, items) {
|
|
212
212
|
const end = list2.length;
|
|
213
213
|
let chunkStart = 0;
|
|
@@ -241,7 +241,7 @@ function push(list2, items) {
|
|
|
241
241
|
return items;
|
|
242
242
|
}
|
|
243
243
|
|
|
244
|
-
//
|
|
244
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-util-combine-extensions/index.js
|
|
245
245
|
var hasOwnProperty = {}.hasOwnProperty;
|
|
246
246
|
function combineExtensions(extensions) {
|
|
247
247
|
const all2 = {};
|
|
@@ -281,7 +281,7 @@ function constructs(existing, list2) {
|
|
|
281
281
|
splice(existing, 0, 0, before);
|
|
282
282
|
}
|
|
283
283
|
|
|
284
|
-
//
|
|
284
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-util-decode-numeric-character-reference/index.js
|
|
285
285
|
function decodeNumericCharacterReference(value, base) {
|
|
286
286
|
const code2 = Number.parseInt(value, base);
|
|
287
287
|
if (
|
|
@@ -299,12 +299,12 @@ function decodeNumericCharacterReference(value, base) {
|
|
|
299
299
|
return String.fromCodePoint(code2);
|
|
300
300
|
}
|
|
301
301
|
|
|
302
|
-
//
|
|
302
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-util-normalize-identifier/index.js
|
|
303
303
|
function normalizeIdentifier(value) {
|
|
304
304
|
return value.replace(/[\t\n\r ]+/g, " ").replace(/^ | $/g, "").toLowerCase().toUpperCase();
|
|
305
305
|
}
|
|
306
306
|
|
|
307
|
-
//
|
|
307
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-util-character/index.js
|
|
308
308
|
var asciiAlpha = regexCheck(/[A-Za-z]/);
|
|
309
309
|
var asciiAlphanumeric = regexCheck(/[\dA-Za-z]/);
|
|
310
310
|
var asciiAtext = regexCheck(/[#-'*+\--9=?A-Z^-~]/);
|
|
@@ -336,7 +336,7 @@ function regexCheck(regex) {
|
|
|
336
336
|
}
|
|
337
337
|
}
|
|
338
338
|
|
|
339
|
-
//
|
|
339
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-factory-space/index.js
|
|
340
340
|
function factorySpace(effects, ok3, type, max) {
|
|
341
341
|
const limit = max ? max - 1 : Infinity;
|
|
342
342
|
let size = 0;
|
|
@@ -381,7 +381,7 @@ function factorySpaceMinMax(effects, ok3, nok, type, min, max) {
|
|
|
381
381
|
}
|
|
382
382
|
}
|
|
383
383
|
|
|
384
|
-
//
|
|
384
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark/lib/initialize/content.js
|
|
385
385
|
var content = {
|
|
386
386
|
tokenize: initializeContent
|
|
387
387
|
};
|
|
@@ -431,7 +431,7 @@ function initializeContent(effects) {
|
|
|
431
431
|
}
|
|
432
432
|
}
|
|
433
433
|
|
|
434
|
-
//
|
|
434
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-util-edit-map/index.js
|
|
435
435
|
var EditMap = class {
|
|
436
436
|
/**
|
|
437
437
|
* Create a new edit map.
|
|
@@ -529,7 +529,7 @@ function addImplementation(editMap, at, remove, add, before) {
|
|
|
529
529
|
editMap.index.set(at, change);
|
|
530
530
|
}
|
|
531
531
|
|
|
532
|
-
//
|
|
532
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark/lib/initialize/document.js
|
|
533
533
|
var document2 = {
|
|
534
534
|
tokenize: initializeDocument
|
|
535
535
|
};
|
|
@@ -723,7 +723,7 @@ function tokenizeContainer(effects, ok3, nok) {
|
|
|
723
723
|
return factorySpace(effects, effects.attempt(this.parser.constructs.document, ok3, nok), "linePrefix", this.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4);
|
|
724
724
|
}
|
|
725
725
|
|
|
726
|
-
//
|
|
726
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-util-classify-character/index.js
|
|
727
727
|
function classifyCharacter(code2) {
|
|
728
728
|
if (code2 === null || markdownLineEndingOrSpace(code2) || unicodeWhitespace(code2)) {
|
|
729
729
|
return 1;
|
|
@@ -733,7 +733,7 @@ function classifyCharacter(code2) {
|
|
|
733
733
|
}
|
|
734
734
|
}
|
|
735
735
|
|
|
736
|
-
//
|
|
736
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-util-resolve-all/index.js
|
|
737
737
|
function resolveAll(constructs2, events, context) {
|
|
738
738
|
const called = [];
|
|
739
739
|
let index2 = -1;
|
|
@@ -747,7 +747,7 @@ function resolveAll(constructs2, events, context) {
|
|
|
747
747
|
return events;
|
|
748
748
|
}
|
|
749
749
|
|
|
750
|
-
//
|
|
750
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/attention.js
|
|
751
751
|
var attention = {
|
|
752
752
|
name: "attention",
|
|
753
753
|
resolveAll: resolveAllAttention,
|
|
@@ -870,7 +870,7 @@ function movePoint(point3, offset) {
|
|
|
870
870
|
point3._bufferIndex += offset;
|
|
871
871
|
}
|
|
872
872
|
|
|
873
|
-
//
|
|
873
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/autolink.js
|
|
874
874
|
var autolink = {
|
|
875
875
|
name: "autolink",
|
|
876
876
|
tokenize: tokenizeAutolink
|
|
@@ -971,7 +971,7 @@ function tokenizeAutolink(effects, ok3, nok) {
|
|
|
971
971
|
}
|
|
972
972
|
}
|
|
973
973
|
|
|
974
|
-
//
|
|
974
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/blank-line.js
|
|
975
975
|
var blankLine = {
|
|
976
976
|
partial: true,
|
|
977
977
|
tokenize: tokenizeBlankLine
|
|
@@ -986,7 +986,7 @@ function tokenizeBlankLine(effects, ok3, nok) {
|
|
|
986
986
|
}
|
|
987
987
|
}
|
|
988
988
|
|
|
989
|
-
//
|
|
989
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/block-quote.js
|
|
990
990
|
var blockQuote = {
|
|
991
991
|
continuation: {
|
|
992
992
|
tokenize: tokenizeBlockQuoteContinuation
|
|
@@ -1044,7 +1044,7 @@ function exit(effects) {
|
|
|
1044
1044
|
effects.exit("blockQuote");
|
|
1045
1045
|
}
|
|
1046
1046
|
|
|
1047
|
-
//
|
|
1047
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/character-escape.js
|
|
1048
1048
|
var characterEscape = {
|
|
1049
1049
|
name: "characterEscape",
|
|
1050
1050
|
tokenize: tokenizeCharacterEscape
|
|
@@ -1070,7 +1070,7 @@ function tokenizeCharacterEscape(effects, ok3, nok) {
|
|
|
1070
1070
|
}
|
|
1071
1071
|
}
|
|
1072
1072
|
|
|
1073
|
-
//
|
|
1073
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/character-reference.js
|
|
1074
1074
|
var characterReference = {
|
|
1075
1075
|
name: "characterReference",
|
|
1076
1076
|
tokenize: tokenizeCharacterReference
|
|
@@ -1135,7 +1135,7 @@ function tokenizeCharacterReference(effects, ok3, nok) {
|
|
|
1135
1135
|
}
|
|
1136
1136
|
}
|
|
1137
1137
|
|
|
1138
|
-
//
|
|
1138
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.js
|
|
1139
1139
|
var nonLazyContinuation = {
|
|
1140
1140
|
partial: true,
|
|
1141
1141
|
tokenize: tokenizeNonLazyContinuation
|
|
@@ -1157,7 +1157,7 @@ function tokenizeNonLazyContinuation(effects, ok3, nok) {
|
|
|
1157
1157
|
}
|
|
1158
1158
|
}
|
|
1159
1159
|
|
|
1160
|
-
//
|
|
1160
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/code-fenced.js
|
|
1161
1161
|
var codeFenced = {
|
|
1162
1162
|
concrete: true,
|
|
1163
1163
|
name: "codeFenced",
|
|
@@ -1320,7 +1320,7 @@ function tokenizeCodeFenced(effects, ok3, nok) {
|
|
|
1320
1320
|
}
|
|
1321
1321
|
}
|
|
1322
1322
|
|
|
1323
|
-
//
|
|
1323
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/code-indented.js
|
|
1324
1324
|
var codeIndented = {
|
|
1325
1325
|
name: "codeIndented",
|
|
1326
1326
|
tokenize: tokenizeCodeIndented
|
|
@@ -1378,7 +1378,7 @@ function tokenizeFurtherStart(effects, ok3, nok) {
|
|
|
1378
1378
|
}
|
|
1379
1379
|
}
|
|
1380
1380
|
|
|
1381
|
-
//
|
|
1381
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/code-text.js
|
|
1382
1382
|
var codeText = {
|
|
1383
1383
|
name: "codeText",
|
|
1384
1384
|
previous,
|
|
@@ -1493,7 +1493,7 @@ function tokenizeCodeText(effects, ok3, nok) {
|
|
|
1493
1493
|
}
|
|
1494
1494
|
}
|
|
1495
1495
|
|
|
1496
|
-
//
|
|
1496
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-util-subtokenize/lib/splice-buffer.js
|
|
1497
1497
|
var SpliceBuffer = class {
|
|
1498
1498
|
/**
|
|
1499
1499
|
* @param {ReadonlyArray<T> | null | undefined} [initial]
|
|
@@ -1686,7 +1686,7 @@ function chunkedPush(list2, right) {
|
|
|
1686
1686
|
}
|
|
1687
1687
|
}
|
|
1688
1688
|
|
|
1689
|
-
//
|
|
1689
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-util-subtokenize/index.js
|
|
1690
1690
|
function subtokenize(eventsArray) {
|
|
1691
1691
|
const jumps = {};
|
|
1692
1692
|
let index2 = -1;
|
|
@@ -1839,7 +1839,7 @@ function subcontent(events, eventIndex) {
|
|
|
1839
1839
|
return gaps;
|
|
1840
1840
|
}
|
|
1841
1841
|
|
|
1842
|
-
//
|
|
1842
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/content.js
|
|
1843
1843
|
var content2 = {
|
|
1844
1844
|
resolve: resolveContent,
|
|
1845
1845
|
tokenize: tokenizeContent
|
|
@@ -1910,7 +1910,7 @@ function tokenizeContinuation(effects, ok3, nok) {
|
|
|
1910
1910
|
}
|
|
1911
1911
|
}
|
|
1912
1912
|
|
|
1913
|
-
//
|
|
1913
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-factory-destination/index.js
|
|
1914
1914
|
function factoryDestination(effects, ok3, nok, type, literalType, literalMarkerType, rawType, stringType, max) {
|
|
1915
1915
|
const limit = max || Number.POSITIVE_INFINITY;
|
|
1916
1916
|
let balance = 0;
|
|
@@ -2002,7 +2002,7 @@ function factoryDestination(effects, ok3, nok, type, literalType, literalMarkerT
|
|
|
2002
2002
|
}
|
|
2003
2003
|
}
|
|
2004
2004
|
|
|
2005
|
-
//
|
|
2005
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-factory-label/index.js
|
|
2006
2006
|
function factoryLabel(effects, ok3, nok, type, markerType, stringType) {
|
|
2007
2007
|
const self = this;
|
|
2008
2008
|
let size = 0;
|
|
@@ -2063,7 +2063,7 @@ function factoryLabel(effects, ok3, nok, type, markerType, stringType) {
|
|
|
2063
2063
|
}
|
|
2064
2064
|
}
|
|
2065
2065
|
|
|
2066
|
-
//
|
|
2066
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-factory-title/index.js
|
|
2067
2067
|
function factoryTitle(effects, ok3, nok, type, markerType, stringType) {
|
|
2068
2068
|
let marker;
|
|
2069
2069
|
return start;
|
|
@@ -2125,7 +2125,7 @@ function factoryTitle(effects, ok3, nok, type, markerType, stringType) {
|
|
|
2125
2125
|
}
|
|
2126
2126
|
}
|
|
2127
2127
|
|
|
2128
|
-
//
|
|
2128
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-factory-whitespace/index.js
|
|
2129
2129
|
function factoryWhitespace(effects, ok3) {
|
|
2130
2130
|
let seen;
|
|
2131
2131
|
return start;
|
|
@@ -2144,7 +2144,7 @@ function factoryWhitespace(effects, ok3) {
|
|
|
2144
2144
|
}
|
|
2145
2145
|
}
|
|
2146
2146
|
|
|
2147
|
-
//
|
|
2147
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/definition.js
|
|
2148
2148
|
var definition = {
|
|
2149
2149
|
name: "definition",
|
|
2150
2150
|
tokenize: tokenizeDefinition
|
|
@@ -2230,7 +2230,7 @@ function tokenizeTitleBefore(effects, ok3, nok) {
|
|
|
2230
2230
|
}
|
|
2231
2231
|
}
|
|
2232
2232
|
|
|
2233
|
-
//
|
|
2233
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/hard-break-escape.js
|
|
2234
2234
|
var hardBreakEscape = {
|
|
2235
2235
|
name: "hardBreakEscape",
|
|
2236
2236
|
tokenize: tokenizeHardBreakEscape
|
|
@@ -2251,7 +2251,7 @@ function tokenizeHardBreakEscape(effects, ok3, nok) {
|
|
|
2251
2251
|
}
|
|
2252
2252
|
}
|
|
2253
2253
|
|
|
2254
|
-
//
|
|
2254
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/heading-atx.js
|
|
2255
2255
|
var headingAtx = {
|
|
2256
2256
|
name: "headingAtx",
|
|
2257
2257
|
resolve: resolveHeadingAtx,
|
|
@@ -2340,7 +2340,7 @@ function tokenizeHeadingAtx(effects, ok3, nok) {
|
|
|
2340
2340
|
}
|
|
2341
2341
|
}
|
|
2342
2342
|
|
|
2343
|
-
//
|
|
2343
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-util-html-tag-name/index.js
|
|
2344
2344
|
var htmlBlockNames = [
|
|
2345
2345
|
"address",
|
|
2346
2346
|
"article",
|
|
@@ -2407,7 +2407,7 @@ var htmlBlockNames = [
|
|
|
2407
2407
|
];
|
|
2408
2408
|
var htmlRawNames = ["pre", "script", "style", "textarea"];
|
|
2409
2409
|
|
|
2410
|
-
//
|
|
2410
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/html-flow.js
|
|
2411
2411
|
var htmlFlow = {
|
|
2412
2412
|
concrete: true,
|
|
2413
2413
|
name: "htmlFlow",
|
|
@@ -2766,7 +2766,7 @@ function tokenizeBlankLineBefore(effects, ok3, nok) {
|
|
|
2766
2766
|
}
|
|
2767
2767
|
}
|
|
2768
2768
|
|
|
2769
|
-
//
|
|
2769
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/html-text.js
|
|
2770
2770
|
var htmlText = {
|
|
2771
2771
|
name: "htmlText",
|
|
2772
2772
|
tokenize: tokenizeHtmlText
|
|
@@ -3072,7 +3072,7 @@ function tokenizeHtmlText(effects, ok3, nok) {
|
|
|
3072
3072
|
}
|
|
3073
3073
|
}
|
|
3074
3074
|
|
|
3075
|
-
//
|
|
3075
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/label-end.js
|
|
3076
3076
|
var labelEnd = {
|
|
3077
3077
|
name: "labelEnd",
|
|
3078
3078
|
resolveAll: resolveAllLabelEnd,
|
|
@@ -3298,7 +3298,7 @@ function tokenizeReferenceCollapsed(effects, ok3, nok) {
|
|
|
3298
3298
|
}
|
|
3299
3299
|
}
|
|
3300
3300
|
|
|
3301
|
-
//
|
|
3301
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/label-start-image.js
|
|
3302
3302
|
var labelStartImage = {
|
|
3303
3303
|
name: "labelStartImage",
|
|
3304
3304
|
resolveAll: labelEnd.resolveAll,
|
|
@@ -3335,7 +3335,7 @@ function tokenizeLabelStartImage(effects, ok3, nok) {
|
|
|
3335
3335
|
}
|
|
3336
3336
|
}
|
|
3337
3337
|
|
|
3338
|
-
//
|
|
3338
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/label-start-link.js
|
|
3339
3339
|
var labelStartLink = {
|
|
3340
3340
|
name: "labelStartLink",
|
|
3341
3341
|
resolveAll: labelEnd.resolveAll,
|
|
@@ -3363,7 +3363,7 @@ function tokenizeLabelStartLink(effects, ok3, nok) {
|
|
|
3363
3363
|
}
|
|
3364
3364
|
}
|
|
3365
3365
|
|
|
3366
|
-
//
|
|
3366
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/line-ending.js
|
|
3367
3367
|
var lineEnding = {
|
|
3368
3368
|
name: "lineEnding",
|
|
3369
3369
|
tokenize: tokenizeLineEnding
|
|
@@ -3378,7 +3378,7 @@ function tokenizeLineEnding(effects, ok3) {
|
|
|
3378
3378
|
}
|
|
3379
3379
|
}
|
|
3380
3380
|
|
|
3381
|
-
//
|
|
3381
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/thematic-break.js
|
|
3382
3382
|
var thematicBreak = {
|
|
3383
3383
|
name: "thematicBreak",
|
|
3384
3384
|
tokenize: tokenizeThematicBreak
|
|
@@ -3417,7 +3417,7 @@ function tokenizeThematicBreak(effects, ok3, nok) {
|
|
|
3417
3417
|
}
|
|
3418
3418
|
}
|
|
3419
3419
|
|
|
3420
|
-
//
|
|
3420
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/list.js
|
|
3421
3421
|
var list = {
|
|
3422
3422
|
continuation: {
|
|
3423
3423
|
tokenize: tokenizeListContinuation
|
|
@@ -3547,7 +3547,7 @@ function tokenizeListItemPrefixWhitespace(effects, ok3, nok) {
|
|
|
3547
3547
|
}
|
|
3548
3548
|
}
|
|
3549
3549
|
|
|
3550
|
-
//
|
|
3550
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/setext-underline.js
|
|
3551
3551
|
var setextUnderline = {
|
|
3552
3552
|
name: "setextUnderline",
|
|
3553
3553
|
resolveTo: resolveToSetextUnderline,
|
|
@@ -3641,7 +3641,7 @@ function tokenizeSetextUnderline(effects, ok3, nok) {
|
|
|
3641
3641
|
}
|
|
3642
3642
|
}
|
|
3643
3643
|
|
|
3644
|
-
//
|
|
3644
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark/lib/initialize/flow.js
|
|
3645
3645
|
var flow = {
|
|
3646
3646
|
tokenize: initializeFlow
|
|
3647
3647
|
};
|
|
@@ -3679,7 +3679,7 @@ function initializeFlow(effects) {
|
|
|
3679
3679
|
}
|
|
3680
3680
|
}
|
|
3681
3681
|
|
|
3682
|
-
//
|
|
3682
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark/lib/initialize/text.js
|
|
3683
3683
|
var resolver = {
|
|
3684
3684
|
resolveAll: createResolver()
|
|
3685
3685
|
};
|
|
@@ -3821,7 +3821,7 @@ function resolveAllLineSuffixes(events, context) {
|
|
|
3821
3821
|
return events;
|
|
3822
3822
|
}
|
|
3823
3823
|
|
|
3824
|
-
//
|
|
3824
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark/lib/constructs.js
|
|
3825
3825
|
var constructs_exports = {};
|
|
3826
3826
|
__export(constructs_exports, {
|
|
3827
3827
|
attentionMarkers: () => attentionMarkers,
|
|
@@ -3896,7 +3896,7 @@ var disable = {
|
|
|
3896
3896
|
null: []
|
|
3897
3897
|
};
|
|
3898
3898
|
|
|
3899
|
-
//
|
|
3899
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark/lib/create-tokenizer.js
|
|
3900
3900
|
function createTokenizer(parser, initialize, from) {
|
|
3901
3901
|
let point3 = {
|
|
3902
3902
|
_bufferIndex: -1,
|
|
@@ -4222,7 +4222,7 @@ function serializeChunks(chunks, expandTabs) {
|
|
|
4222
4222
|
return result.join("");
|
|
4223
4223
|
}
|
|
4224
4224
|
|
|
4225
|
-
//
|
|
4225
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark/lib/parse.js
|
|
4226
4226
|
function parse(options) {
|
|
4227
4227
|
const settings = options || {};
|
|
4228
4228
|
const constructs2 = (
|
|
@@ -4248,14 +4248,14 @@ function parse(options) {
|
|
|
4248
4248
|
}
|
|
4249
4249
|
}
|
|
4250
4250
|
|
|
4251
|
-
//
|
|
4251
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark/lib/postprocess.js
|
|
4252
4252
|
function postprocess(events) {
|
|
4253
4253
|
while (!subtokenize(events)) {
|
|
4254
4254
|
}
|
|
4255
4255
|
return events;
|
|
4256
4256
|
}
|
|
4257
4257
|
|
|
4258
|
-
//
|
|
4258
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark/lib/preprocess.js
|
|
4259
4259
|
var search = /[\0\t\n\r]/g;
|
|
4260
4260
|
function preprocess() {
|
|
4261
4261
|
let column = 1;
|
|
@@ -4335,7 +4335,7 @@ function preprocess() {
|
|
|
4335
4335
|
}
|
|
4336
4336
|
}
|
|
4337
4337
|
|
|
4338
|
-
//
|
|
4338
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-util-decode-string/index.js
|
|
4339
4339
|
var characterEscapeOrReference = /\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;
|
|
4340
4340
|
function decodeString(value) {
|
|
4341
4341
|
return value.replace(characterEscapeOrReference, decode);
|
|
@@ -4353,7 +4353,7 @@ function decode($0, $1, $2) {
|
|
|
4353
4353
|
return decodeNamedCharacterReference($2) || $0;
|
|
4354
4354
|
}
|
|
4355
4355
|
|
|
4356
|
-
//
|
|
4356
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/unist-util-stringify-position/lib/index.js
|
|
4357
4357
|
function stringifyPosition(value) {
|
|
4358
4358
|
if (!value || typeof value !== "object") {
|
|
4359
4359
|
return "";
|
|
@@ -4379,7 +4379,7 @@ function index(value) {
|
|
|
4379
4379
|
return value && typeof value === "number" ? value : 1;
|
|
4380
4380
|
}
|
|
4381
4381
|
|
|
4382
|
-
//
|
|
4382
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/mdast-util-from-markdown/lib/index.js
|
|
4383
4383
|
var own = {}.hasOwnProperty;
|
|
4384
4384
|
function fromMarkdown(value, encoding, options) {
|
|
4385
4385
|
if (encoding && typeof encoding === "object") {
|
|
@@ -5088,7 +5088,7 @@ function defaultOnError(left, right) {
|
|
|
5088
5088
|
}
|
|
5089
5089
|
}
|
|
5090
5090
|
|
|
5091
|
-
//
|
|
5091
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/ccount/index.js
|
|
5092
5092
|
function ccount(value, character) {
|
|
5093
5093
|
const source = String(value);
|
|
5094
5094
|
if (typeof character !== "string") {
|
|
@@ -5103,11 +5103,11 @@ function ccount(value, character) {
|
|
|
5103
5103
|
return count;
|
|
5104
5104
|
}
|
|
5105
5105
|
|
|
5106
|
-
//
|
|
5106
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/devlop/lib/default.js
|
|
5107
5107
|
function ok() {
|
|
5108
5108
|
}
|
|
5109
5109
|
|
|
5110
|
-
//
|
|
5110
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/escape-string-regexp/index.js
|
|
5111
5111
|
function escapeStringRegexp(string5) {
|
|
5112
5112
|
if (typeof string5 !== "string") {
|
|
5113
5113
|
throw new TypeError("Expected a string");
|
|
@@ -5115,7 +5115,7 @@ function escapeStringRegexp(string5) {
|
|
|
5115
5115
|
return string5.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
|
|
5116
5116
|
}
|
|
5117
5117
|
|
|
5118
|
-
//
|
|
5118
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/unist-util-is/lib/index.js
|
|
5119
5119
|
var convert = (
|
|
5120
5120
|
// Note: overloads in JSDoc can’t yet use different `@template`s.
|
|
5121
5121
|
/**
|
|
@@ -5214,12 +5214,12 @@ function looksLikeANode(value) {
|
|
|
5214
5214
|
return value !== null && typeof value === "object" && "type" in value;
|
|
5215
5215
|
}
|
|
5216
5216
|
|
|
5217
|
-
//
|
|
5217
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/unist-util-visit-parents/lib/color.js
|
|
5218
5218
|
function color(d) {
|
|
5219
5219
|
return d;
|
|
5220
5220
|
}
|
|
5221
5221
|
|
|
5222
|
-
//
|
|
5222
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/unist-util-visit-parents/lib/index.js
|
|
5223
5223
|
var empty = [];
|
|
5224
5224
|
var CONTINUE = true;
|
|
5225
5225
|
var EXIT = false;
|
|
@@ -5339,7 +5339,7 @@ function toResult(value) {
|
|
|
5339
5339
|
return value === null || value === void 0 ? empty : [value];
|
|
5340
5340
|
}
|
|
5341
5341
|
|
|
5342
|
-
//
|
|
5342
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/mdast-util-find-and-replace/lib/index.js
|
|
5343
5343
|
function findAndReplace(tree, list2, options) {
|
|
5344
5344
|
const settings = options || {};
|
|
5345
5345
|
const ignored = convert(settings.ignore || []);
|
|
@@ -5440,7 +5440,7 @@ function toFunction(replace2) {
|
|
|
5440
5440
|
};
|
|
5441
5441
|
}
|
|
5442
5442
|
|
|
5443
|
-
//
|
|
5443
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/mdast-util-gfm-autolink-literal/lib/index.js
|
|
5444
5444
|
function gfmAutolinkLiteralFromMarkdown() {
|
|
5445
5445
|
return {
|
|
5446
5446
|
transforms: [transformGfmAutolinkLiterals],
|
|
@@ -5605,7 +5605,7 @@ function previous2(match) {
|
|
|
5605
5605
|
return match.index === 0 || unicodeWhitespace(code2) || unicodePunctuation(code2);
|
|
5606
5606
|
}
|
|
5607
5607
|
|
|
5608
|
-
//
|
|
5608
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/mdast-util-gfm-footnote/lib/index.js
|
|
5609
5609
|
footnoteReference.peek = footnoteReferencePeek;
|
|
5610
5610
|
function enterFootnoteCallString() {
|
|
5611
5611
|
this.buffer();
|
|
@@ -5679,7 +5679,7 @@ function gfmFootnoteFromMarkdown() {
|
|
|
5679
5679
|
};
|
|
5680
5680
|
}
|
|
5681
5681
|
|
|
5682
|
-
//
|
|
5682
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/mdast-util-gfm-strikethrough/lib/index.js
|
|
5683
5683
|
handleDelete.attention = attentionDelete;
|
|
5684
5684
|
handleDelete.peek = peekDelete;
|
|
5685
5685
|
function gfmStrikethroughFromMarkdown() {
|
|
@@ -5716,7 +5716,7 @@ function peekDelete() {
|
|
|
5716
5716
|
return "~";
|
|
5717
5717
|
}
|
|
5718
5718
|
|
|
5719
|
-
//
|
|
5719
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/mdast-util-gfm-table/lib/index.js
|
|
5720
5720
|
function gfmTableFromMarkdown() {
|
|
5721
5721
|
return {
|
|
5722
5722
|
enter: {
|
|
@@ -5777,7 +5777,7 @@ function replace($0, $1) {
|
|
|
5777
5777
|
return $1 === "|" ? $1 : $0;
|
|
5778
5778
|
}
|
|
5779
5779
|
|
|
5780
|
-
//
|
|
5780
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/mdast-util-gfm-task-list-item/lib/index.js
|
|
5781
5781
|
function gfmTaskListItemFromMarkdown() {
|
|
5782
5782
|
return {
|
|
5783
5783
|
exit: {
|
|
@@ -5824,7 +5824,7 @@ function exitParagraphWithTaskListItem(token) {
|
|
|
5824
5824
|
this.exit(token);
|
|
5825
5825
|
}
|
|
5826
5826
|
|
|
5827
|
-
//
|
|
5827
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/mdast-util-gfm/lib/index.js
|
|
5828
5828
|
function gfmFromMarkdown() {
|
|
5829
5829
|
return [
|
|
5830
5830
|
gfmAutolinkLiteralFromMarkdown(),
|
|
@@ -5835,7 +5835,7 @@ function gfmFromMarkdown() {
|
|
|
5835
5835
|
];
|
|
5836
5836
|
}
|
|
5837
5837
|
|
|
5838
|
-
//
|
|
5838
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-extension-gfm-autolink-literal/lib/syntax.js
|
|
5839
5839
|
var wwwPrefix = {
|
|
5840
5840
|
tokenize: tokenizeWwwPrefix,
|
|
5841
5841
|
partial: true
|
|
@@ -6177,7 +6177,7 @@ function previousUnbalanced(events) {
|
|
|
6177
6177
|
return result;
|
|
6178
6178
|
}
|
|
6179
6179
|
|
|
6180
|
-
//
|
|
6180
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-extension-gfm-footnote/lib/syntax.js
|
|
6181
6181
|
var indent = {
|
|
6182
6182
|
tokenize: tokenizeIndent2,
|
|
6183
6183
|
partial: true
|
|
@@ -6452,7 +6452,7 @@ function tokenizeIndent2(effects, ok3, nok) {
|
|
|
6452
6452
|
}
|
|
6453
6453
|
}
|
|
6454
6454
|
|
|
6455
|
-
//
|
|
6455
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-extension-gfm-strikethrough/lib/syntax.js
|
|
6456
6456
|
function gfmStrikethrough(options) {
|
|
6457
6457
|
const options_ = options || {};
|
|
6458
6458
|
let single = options_.singleTilde;
|
|
@@ -6546,7 +6546,7 @@ function gfmStrikethrough(options) {
|
|
|
6546
6546
|
}
|
|
6547
6547
|
}
|
|
6548
6548
|
|
|
6549
|
-
//
|
|
6549
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-extension-gfm-table/lib/edit-map.js
|
|
6550
6550
|
var EditMap2 = class {
|
|
6551
6551
|
/**
|
|
6552
6552
|
* Create a new edit map.
|
|
@@ -6632,7 +6632,7 @@ function addImplementation2(editMap, at, remove, add) {
|
|
|
6632
6632
|
editMap.index.set(at, change);
|
|
6633
6633
|
}
|
|
6634
6634
|
|
|
6635
|
-
//
|
|
6635
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-extension-gfm-table/lib/infer.js
|
|
6636
6636
|
function gfmTableAlign(events, index2) {
|
|
6637
6637
|
let inDelimiterRow = false;
|
|
6638
6638
|
const align = [];
|
|
@@ -6659,7 +6659,7 @@ function gfmTableAlign(events, index2) {
|
|
|
6659
6659
|
return align;
|
|
6660
6660
|
}
|
|
6661
6661
|
|
|
6662
|
-
//
|
|
6662
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-extension-gfm-table/lib/syntax.js
|
|
6663
6663
|
function gfmTable() {
|
|
6664
6664
|
return {
|
|
6665
6665
|
flow: {
|
|
@@ -7050,7 +7050,7 @@ function getPoint(events, index2) {
|
|
|
7050
7050
|
return event[1][side];
|
|
7051
7051
|
}
|
|
7052
7052
|
|
|
7053
|
-
//
|
|
7053
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-extension-gfm-task-list-item/lib/syntax.js
|
|
7054
7054
|
var tasklistCheck = {
|
|
7055
7055
|
name: "tasklistCheck",
|
|
7056
7056
|
tokenize: tokenizeTasklistCheck
|
|
@@ -7124,7 +7124,7 @@ function spaceThenNonSpace(effects, ok3, nok) {
|
|
|
7124
7124
|
}
|
|
7125
7125
|
}
|
|
7126
7126
|
|
|
7127
|
-
//
|
|
7127
|
+
// ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-extension-gfm/index.js
|
|
7128
7128
|
function gfm(options) {
|
|
7129
7129
|
return combineExtensions([
|
|
7130
7130
|
gfmAutolinkLiteral(),
|
|
@@ -7359,6 +7359,9 @@ function canDraftWechat(contact) {
|
|
|
7359
7359
|
if (inbound?.hasText === false) return !!attachmentReply(inbound.kind);
|
|
7360
7360
|
return contact.messages.some((message) => message.direction === "in" && !!message.text.trim());
|
|
7361
7361
|
}
|
|
7362
|
+
function isLegacyMissingDraftKnowledge(error) {
|
|
7363
|
+
return error?.startsWith("\u8FD9\u6B21\u56DE\u590D\u9700\u8981\u7684\u8D44\u6599\u6682\u4E0D\u53EF\u7528\uFF1A\u77E5\u8BC6\u5E93\u5DE5\u5177\u672A\u5C31\u7EEA\uFF0C\u8BF7\u68C0\u67E5\u77E5\u8BC6\u5E93\u63D2\u4EF6\u662F\u5426\u5DF2\u542F\u7528\u3002") === true;
|
|
7364
|
+
}
|
|
7362
7365
|
|
|
7363
7366
|
// src/reply-state.ts
|
|
7364
7367
|
function replyPresentation(state, contact) {
|
|
@@ -7424,9 +7427,146 @@ var updateStyles = `
|
|
|
7424
7427
|
.ws-update-trigger .ws-company-update-dot,.ws-company-update-version{color:#237c3d;color:light-dark(#237c3d,#76d68c)}.ws-update-trigger .ws-company-update-dot{width:7px;height:7px;opacity:1}.ws-company-update-hint{margin-top:14px;border-top:1px solid var(--ws-line);padding-top:12px;font-size:12px;line-height:1.6;color:var(--ws-muted)}.ws-company-update-hint p+p{margin-top:3px}
|
|
7425
7428
|
`;
|
|
7426
7429
|
|
|
7427
|
-
// src/
|
|
7430
|
+
// src/company/panel.tsx
|
|
7428
7431
|
var import_react5 = __toESM(require("react"), 1);
|
|
7429
7432
|
|
|
7433
|
+
// src/company/identity.ts
|
|
7434
|
+
var COMPANY_IDENTITY_ENDPOINT = "wanji-sales-company/identity";
|
|
7435
|
+
|
|
7436
|
+
// src/company/panel.tsx
|
|
7437
|
+
function CompanyIdentityPanel({ rpc, t, disabled }) {
|
|
7438
|
+
const id = (0, import_react5.useId)();
|
|
7439
|
+
const trigger = (0, import_react5.useRef)(null);
|
|
7440
|
+
const request = (0, import_react5.useRef)(void 0);
|
|
7441
|
+
const [open, setOpen] = (0, import_react5.useState)(false);
|
|
7442
|
+
const [view, setView] = (0, import_react5.useState)();
|
|
7443
|
+
const [busy, setBusy] = (0, import_react5.useState)(false);
|
|
7444
|
+
const [failed, setFailed] = (0, import_react5.useState)(false);
|
|
7445
|
+
const [bindFailed, setBindFailed] = (0, import_react5.useState)(false);
|
|
7446
|
+
const [alias, setAlias] = (0, import_react5.useState)("");
|
|
7447
|
+
const [phone, setPhone] = (0, import_react5.useState)("");
|
|
7448
|
+
const perform = (0, import_react5.useCallback)(async (payload) => {
|
|
7449
|
+
if (request.current) return;
|
|
7450
|
+
const controller = new AbortController();
|
|
7451
|
+
request.current = controller;
|
|
7452
|
+
setBusy(true);
|
|
7453
|
+
if (payload.operation !== "status") setFailed(false);
|
|
7454
|
+
if (payload.operation === "bind") setBindFailed(false);
|
|
7455
|
+
try {
|
|
7456
|
+
const res = await rpc.call("/api", COMPANY_IDENTITY_ENDPOINT, payload, controller.signal);
|
|
7457
|
+
if (controller.signal.aborted) return;
|
|
7458
|
+
if (!res.ok || !res.value || typeof res.value !== "object" || !("status" in res.value)) throw Error("company identity unavailable");
|
|
7459
|
+
setView(res.value);
|
|
7460
|
+
setFailed(false);
|
|
7461
|
+
if (payload.operation === "bind") {
|
|
7462
|
+
setAlias("");
|
|
7463
|
+
setPhone("");
|
|
7464
|
+
}
|
|
7465
|
+
} catch {
|
|
7466
|
+
if (!controller.signal.aborted) {
|
|
7467
|
+
if (payload.operation === "bind") setBindFailed(true);
|
|
7468
|
+
else {
|
|
7469
|
+
setView(void 0);
|
|
7470
|
+
setFailed(true);
|
|
7471
|
+
}
|
|
7472
|
+
}
|
|
7473
|
+
} finally {
|
|
7474
|
+
if (request.current === controller) {
|
|
7475
|
+
request.current = void 0;
|
|
7476
|
+
setBusy(false);
|
|
7477
|
+
}
|
|
7478
|
+
}
|
|
7479
|
+
}, [rpc]);
|
|
7480
|
+
(0, import_react5.useEffect)(() => {
|
|
7481
|
+
const refresh = () => void perform({ operation: "status" });
|
|
7482
|
+
refresh();
|
|
7483
|
+
window.addEventListener("focus", refresh);
|
|
7484
|
+
return () => {
|
|
7485
|
+
window.removeEventListener("focus", refresh);
|
|
7486
|
+
request.current?.abort();
|
|
7487
|
+
request.current = void 0;
|
|
7488
|
+
};
|
|
7489
|
+
}, [perform]);
|
|
7490
|
+
const awaiting = view?.status === "awaiting";
|
|
7491
|
+
(0, import_react5.useEffect)(() => {
|
|
7492
|
+
if (!open || !awaiting) return;
|
|
7493
|
+
const timer = window.setInterval(() => void perform({ operation: "status" }), 3e3);
|
|
7494
|
+
return () => window.clearInterval(timer);
|
|
7495
|
+
}, [open, awaiting, perform]);
|
|
7496
|
+
const close = () => {
|
|
7497
|
+
setOpen(false);
|
|
7498
|
+
setBindFailed(false);
|
|
7499
|
+
setAlias("");
|
|
7500
|
+
setPhone("");
|
|
7501
|
+
trigger.current?.focus();
|
|
7502
|
+
};
|
|
7503
|
+
const bound = view?.status === "bound" ? view : void 0;
|
|
7504
|
+
const label2 = bound ? [bound.alias, bound.position].filter(Boolean).join(" \xB7 ") : t("companyBind");
|
|
7505
|
+
const unavailable = !view || view.status === "unavailable";
|
|
7506
|
+
const bindable = view?.status === "unbound" || view?.status === "ineligible";
|
|
7507
|
+
const connectDisabled = busy || disabled;
|
|
7508
|
+
(0, import_react5.useEffect)(() => {
|
|
7509
|
+
if (!open || !bindable) return;
|
|
7510
|
+
const controller = new AbortController();
|
|
7511
|
+
void rpc.call("/api", COMPANY_IDENTITY_ENDPOINT, { operation: "account-phone" }, controller.signal).then((result) => {
|
|
7512
|
+
if (controller.signal.aborted || !result.ok || !result.value || typeof result.value !== "object" || !("phone" in result.value)) return;
|
|
7513
|
+
const hint = result.value.phone;
|
|
7514
|
+
if (typeof hint === "string" && /^1\d{10}$/.test(hint)) setPhone((current) => current || hint);
|
|
7515
|
+
}).catch(() => void 0);
|
|
7516
|
+
return () => controller.abort();
|
|
7517
|
+
}, [rpc, open, bindable]);
|
|
7518
|
+
return /* @__PURE__ */ import_react5.default.createElement("div", { className: "ws-update ws-company-identity", onKeyDown: (event) => {
|
|
7519
|
+
if (open && event.key === "Escape") close();
|
|
7520
|
+
} }, /* @__PURE__ */ import_react5.default.createElement(
|
|
7521
|
+
"button",
|
|
7522
|
+
{
|
|
7523
|
+
ref: trigger,
|
|
7524
|
+
type: "button",
|
|
7525
|
+
className: "ws-button ws-company-identity-trigger",
|
|
7526
|
+
"aria-expanded": open,
|
|
7527
|
+
"aria-controls": id,
|
|
7528
|
+
title: label2,
|
|
7529
|
+
onClick: () => {
|
|
7530
|
+
if (open) close();
|
|
7531
|
+
else {
|
|
7532
|
+
setOpen(true);
|
|
7533
|
+
void perform({ operation: "status" });
|
|
7534
|
+
}
|
|
7535
|
+
}
|
|
7536
|
+
},
|
|
7537
|
+
label2
|
|
7538
|
+
), open && /* @__PURE__ */ import_react5.default.createElement("section", { id, className: "ws-update-card ws-company-identity-card", "aria-label": t("companyIdentity") }, /* @__PURE__ */ import_react5.default.createElement("div", { className: "ws-update-heading" }, /* @__PURE__ */ import_react5.default.createElement("strong", null, t("companyIdentity")), /* @__PURE__ */ import_react5.default.createElement("button", { type: "button", className: "ws-icon-button", "aria-label": t("updateClose"), onClick: close }, "\xD7")), bound && /* @__PURE__ */ import_react5.default.createElement(import_react5.default.Fragment, null, /* @__PURE__ */ import_react5.default.createElement("dl", { className: "ws-company-identity-data" }, /* @__PURE__ */ import_react5.default.createElement("div", null, /* @__PURE__ */ import_react5.default.createElement("dt", null, t("companyAlias")), /* @__PURE__ */ import_react5.default.createElement("dd", null, bound.alias)), bound.position && /* @__PURE__ */ import_react5.default.createElement("div", null, /* @__PURE__ */ import_react5.default.createElement("dt", null, t("companyPosition")), /* @__PURE__ */ import_react5.default.createElement("dd", null, bound.position)), bound.company && /* @__PURE__ */ import_react5.default.createElement("div", null, /* @__PURE__ */ import_react5.default.createElement("dt", null, t("companyOrganization")), /* @__PURE__ */ import_react5.default.createElement("dd", null, bound.company)), bound.department && /* @__PURE__ */ import_react5.default.createElement("div", null, /* @__PURE__ */ import_react5.default.createElement("dt", null, t("companyDepartment")), /* @__PURE__ */ import_react5.default.createElement("dd", null, bound.department))), /* @__PURE__ */ import_react5.default.createElement("p", { role: "status" }, t(bound.modelReady ? "companyModelReady" : "companyModelUnavailable")), /* @__PURE__ */ import_react5.default.createElement("div", { className: "ws-update-actions" }, /* @__PURE__ */ import_react5.default.createElement("button", { type: "button", className: "ws-button", disabled: connectDisabled, onClick: () => void perform({ operation: "unbind" }) }, t("companyUnbind")))), view?.status === "awaiting" && /* @__PURE__ */ import_react5.default.createElement(import_react5.default.Fragment, null, /* @__PURE__ */ import_react5.default.createElement("p", { role: "status" }, t("companyAwaiting")), view.verificationCode && /* @__PURE__ */ import_react5.default.createElement("p", null, t("companyPairingCode"), " ", /* @__PURE__ */ import_react5.default.createElement("strong", null, view.verificationCode)), /* @__PURE__ */ import_react5.default.createElement("div", { className: "ws-update-actions" }, /* @__PURE__ */ import_react5.default.createElement("button", { className: "ws-button", type: "button", disabled: connectDisabled, onClick: () => void perform({ operation: "unbind" }) }, t("companyCancel")), /* @__PURE__ */ import_react5.default.createElement("a", { className: "ws-button ws-primary", href: view.authorizeUrl, target: "_blank", rel: "noopener noreferrer" }, t("companyVerify")))), bindable && /* @__PURE__ */ import_react5.default.createElement("form", { className: "ws-company-identity-form", onSubmit: (event) => {
|
|
7539
|
+
event.preventDefault();
|
|
7540
|
+
void perform({ operation: "bind", ...alias.trim() ? { alias: alias.trim() } : {}, ...phone.trim() ? { phone: phone.trim() } : {} });
|
|
7541
|
+
} }, /* @__PURE__ */ import_react5.default.createElement("p", { role: "status" }, t(view.status === "ineligible" ? "companyIneligible" : "companyHint")), bindFailed && /* @__PURE__ */ import_react5.default.createElement("p", { role: "alert" }, t("companyBindingFailed")), /* @__PURE__ */ import_react5.default.createElement("label", null, t("companyAliasOptional"), /* @__PURE__ */ import_react5.default.createElement("input", { value: alias, maxLength: 96, onChange: (event) => setAlias(event.target.value) })), /* @__PURE__ */ import_react5.default.createElement("label", null, t("companyPhoneOptional"), /* @__PURE__ */ import_react5.default.createElement(
|
|
7542
|
+
"input",
|
|
7543
|
+
{
|
|
7544
|
+
value: phone,
|
|
7545
|
+
type: "tel",
|
|
7546
|
+
inputMode: "tel",
|
|
7547
|
+
maxLength: 14,
|
|
7548
|
+
pattern: "(?:\\+86)?1[0-9]{10}",
|
|
7549
|
+
autoComplete: "off",
|
|
7550
|
+
onChange: (event) => setPhone(event.target.value)
|
|
7551
|
+
}
|
|
7552
|
+
)), /* @__PURE__ */ import_react5.default.createElement("div", { className: "ws-update-actions" }, /* @__PURE__ */ import_react5.default.createElement("button", { type: "submit", className: "ws-button ws-primary", disabled: connectDisabled }, t("companyContinue")))), unavailable && /* @__PURE__ */ import_react5.default.createElement(import_react5.default.Fragment, null, /* @__PURE__ */ import_react5.default.createElement("p", { role: "status" }, t(failed ? "companyRetryHint" : busy ? "companyChecking" : "companyUnavailable")), !busy && /* @__PURE__ */ import_react5.default.createElement("div", { className: "ws-update-actions" }, /* @__PURE__ */ import_react5.default.createElement("button", { type: "button", className: "ws-button", onClick: () => void perform({ operation: "status" }) }, t("companyRetry"))))));
|
|
7553
|
+
}
|
|
7554
|
+
var companyIdentityStyles = `
|
|
7555
|
+
.ws-company-identity-trigger{display:block;max-width:190px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
7556
|
+
.ws-company-identity-card p,.ws-company-identity-form label,.ws-company-identity-data{font-size:13px;line-height:1.6}
|
|
7557
|
+
.ws-company-identity-form,.ws-company-identity-data{display:grid;gap:10px}
|
|
7558
|
+
.ws-company-identity-form label{display:grid;gap:4px;color:var(--ws-muted)}
|
|
7559
|
+
.ws-company-identity-form input{width:100%;min-width:0;padding:7px 9px;border:1px solid var(--ws-line);border-radius:6px;background:var(--ws-bg);color:inherit}
|
|
7560
|
+
.ws-company-identity-card a{text-decoration:none}
|
|
7561
|
+
.ws-company-identity-data>div{display:flex;justify-content:space-between;gap:12px}
|
|
7562
|
+
.ws-company-identity-data dt{color:var(--ws-muted)}
|
|
7563
|
+
.ws-company-identity-data dd{margin:0;text-align:right;overflow-wrap:anywhere}
|
|
7564
|
+
@container(max-width:540px){.ws-company-identity-trigger{max-width:120px}}
|
|
7565
|
+
`;
|
|
7566
|
+
|
|
7567
|
+
// src/wechat/avatar.tsx
|
|
7568
|
+
var import_react6 = __toESM(require("react"), 1);
|
|
7569
|
+
|
|
7430
7570
|
// src/wechat/avatar-cache.ts
|
|
7431
7571
|
function createAvatarCache(load, decode2, now = Date.now, timeoutMs = 15e3) {
|
|
7432
7572
|
const entries = /* @__PURE__ */ new Map(), listeners = /* @__PURE__ */ new Set(), queue = [];
|
|
@@ -7521,12 +7661,12 @@ function cacheFor(client) {
|
|
|
7521
7661
|
return cache;
|
|
7522
7662
|
}
|
|
7523
7663
|
function WechatAvatar({ client, scope, owner, mediaId, fallback, className = "" }) {
|
|
7524
|
-
return client ? /* @__PURE__ */
|
|
7664
|
+
return client ? /* @__PURE__ */ import_react6.default.createElement(LoadedAvatar, { key: JSON.stringify([scope, owner]), client, identity: JSON.stringify([scope, owner]), mediaId, fallback, className }) : /* @__PURE__ */ import_react6.default.createElement("span", { className: `ws-avatar ${className}` }, fallback);
|
|
7525
7665
|
}
|
|
7526
7666
|
function LoadedAvatar({ client, identity, mediaId, fallback, className }) {
|
|
7527
|
-
const cache = cacheFor(client), element2 = (0,
|
|
7528
|
-
const url = (0,
|
|
7529
|
-
(0,
|
|
7667
|
+
const cache = cacheFor(client), element2 = (0, import_react6.useRef)(null);
|
|
7668
|
+
const url = (0, import_react6.useSyncExternalStore)(cache.subscribe, () => cache.peek(identity), () => void 0);
|
|
7669
|
+
(0, import_react6.useEffect)(() => {
|
|
7530
7670
|
if (!mediaId) return;
|
|
7531
7671
|
let visible = false;
|
|
7532
7672
|
const refresh = () => {
|
|
@@ -7547,11 +7687,11 @@ function LoadedAvatar({ client, identity, mediaId, fallback, className }) {
|
|
|
7547
7687
|
clearInterval(timer);
|
|
7548
7688
|
};
|
|
7549
7689
|
}, [cache, identity, mediaId]);
|
|
7550
|
-
return /* @__PURE__ */
|
|
7690
|
+
return /* @__PURE__ */ import_react6.default.createElement("span", { ref: element2, className: `ws-avatar ${className}` }, url ? /* @__PURE__ */ import_react6.default.createElement("img", { className: "ws-avatar-image", src: url, alt: "", draggable: false }) : fallback);
|
|
7551
7691
|
}
|
|
7552
7692
|
|
|
7553
7693
|
// src/wechat/sync-panel.tsx
|
|
7554
|
-
var
|
|
7694
|
+
var import_react9 = __toESM(require("react"), 1);
|
|
7555
7695
|
|
|
7556
7696
|
// src/wechat/types.ts
|
|
7557
7697
|
var WECHAT_METHOD = "wanji-sales-wechat/request";
|
|
@@ -7770,6 +7910,15 @@ function createWechatClient(rpc, snapshot, options = {}) {
|
|
|
7770
7910
|
async conversation(contactId) {
|
|
7771
7911
|
return request("conversation", { contactId });
|
|
7772
7912
|
},
|
|
7913
|
+
async prioritizeMedia(contactId, focusId, messageId) {
|
|
7914
|
+
return request("media-priority", { contactId, focusId, ...messageId ? { messageId } : {} });
|
|
7915
|
+
},
|
|
7916
|
+
async clearMediaFocus(focusId, workspaceId = workspace) {
|
|
7917
|
+
return request("media-unfocus", { focusId, workspaceId });
|
|
7918
|
+
},
|
|
7919
|
+
async transcribeVoice(contactId, messageId, signal) {
|
|
7920
|
+
return request("transcribe-voice", { contactId, messageId }, signal);
|
|
7921
|
+
},
|
|
7773
7922
|
async draftVoice(contactId, messageId, version, signal) {
|
|
7774
7923
|
return request("draft-voice", { contactId, messageId, version }, signal);
|
|
7775
7924
|
},
|
|
@@ -7830,9 +7979,9 @@ function startWechatMediaLoad(mediaId, load, publish) {
|
|
|
7830
7979
|
}
|
|
7831
7980
|
|
|
7832
7981
|
// src/wechat/runtime-panel.tsx
|
|
7833
|
-
var
|
|
7982
|
+
var import_react7 = __toESM(require("react"), 1);
|
|
7834
7983
|
var phases = { idle: "wxRuntimeChecking", checking: "wxRuntimeChecking", waiting: "wxRuntimeWaiting", downloading: "wxRuntimeDownloading", verifying: "wxRuntimeVerifying", extracting: "wxRuntimeExtracting", "self-test": "wxRuntimeTesting", ready: "wxRuntimeReady", error: "wxRuntimeFailed", unsupported: "wxRuntimeUnsupported" };
|
|
7835
|
-
var errors = { WECHAT_RUNTIME_CHECKSUM: "wxRuntimeChecksum", WECHAT_RUNTIME_COMPONENT: "wxRuntimeInvalid", WECHAT_RUNTIME_ARCHIVE: "wxRuntimeInvalid", WECHAT_RUNTIME_SELF_TEST: "wxRuntimeSelfTest", WECHAT_RUNTIME_MANIFEST: "wxRuntimeInvalid", WECHAT_RUNTIME_URL: "wxRuntimeInvalid", WECHAT_RUNTIME_CACHE: "wxRuntimeCache", WECHAT_RUNTIME_TIMEOUT: "wxRuntimeTimeout", WECHAT_RUNTIME_ABORTED: "wxRuntimeAborted" };
|
|
7984
|
+
var errors = { WECHAT_RUNTIME_CHECKSUM: "wxRuntimeChecksum", WECHAT_RUNTIME_COMPONENT: "wxRuntimeInvalid", WECHAT_RUNTIME_ARCHIVE: "wxRuntimeInvalid", WECHAT_RUNTIME_SELF_TEST: "wxRuntimeSelfTest", WECHAT_RUNTIME_SELF_TEST_TIMEOUT: "wxRuntimeSelfTestTimeout", WECHAT_RUNTIME_MANIFEST: "wxRuntimeInvalid", WECHAT_RUNTIME_URL: "wxRuntimeInvalid", WECHAT_RUNTIME_CACHE: "wxRuntimeCache", WECHAT_RUNTIME_TIMEOUT: "wxRuntimeTimeout", WECHAT_RUNTIME_ABORTED: "wxRuntimeAborted" };
|
|
7836
7985
|
function runtimePercent(runtime) {
|
|
7837
7986
|
return runtime.total && runtime.total > 0 ? Math.max(0, Math.min(100, Math.floor(runtime.received / runtime.total * 100))) : void 0;
|
|
7838
7987
|
}
|
|
@@ -7840,11 +7989,11 @@ function RuntimePanel({ runtime, t, retry, disabled }) {
|
|
|
7840
7989
|
const failed = runtime.phase === "error", unsupported = runtime.phase === "unsupported", percent = runtimePercent(runtime);
|
|
7841
7990
|
const number2 = new Intl.NumberFormat(void 0, { minimumFractionDigits: 1, maximumFractionDigits: 1 });
|
|
7842
7991
|
const amount3 = number2.format(runtime.received / 1e6) + (runtime.total ? " / " + number2.format(runtime.total / 1e6) : "") + " " + t("wxRuntimeMB");
|
|
7843
|
-
return /* @__PURE__ */
|
|
7992
|
+
return /* @__PURE__ */ import_react7.default.createElement("div", { className: "ws-runtime-panel", role: failed ? "alert" : "status" }, /* @__PURE__ */ import_react7.default.createElement("div", { className: "ws-runtime-line" }, /* @__PURE__ */ import_react7.default.createElement("span", null, t(phases[runtime.phase])), !failed && !unsupported && runtime.total && /* @__PURE__ */ import_react7.default.createElement("span", null, amount3, percent !== void 0 ? " \xB7 " + percent + "%" : ""), failed && /* @__PURE__ */ import_react7.default.createElement("button", { className: "ws-text-button", disabled, onClick: retry }, t("wxRuntimeRetry"))), failed ? /* @__PURE__ */ import_react7.default.createElement("p", null, t(errors[runtime.errorCode ?? ""] ?? "wxRuntimeNetwork")) : !unsupported && /* @__PURE__ */ import_react7.default.createElement("span", { className: "ws-runtime-track", role: "progressbar", "aria-label": t(phases[runtime.phase]), "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": percent }, /* @__PURE__ */ import_react7.default.createElement("span", { style: { width: (percent ?? 0) + "%" } })));
|
|
7844
7993
|
}
|
|
7845
7994
|
|
|
7846
7995
|
// src/wechat/message-media.tsx
|
|
7847
|
-
var
|
|
7996
|
+
var import_react8 = __toESM(require("react"), 1);
|
|
7848
7997
|
|
|
7849
7998
|
// src/wechat/voice-playback.ts
|
|
7850
7999
|
function voiceDurationLabel(seconds) {
|
|
@@ -7885,19 +8034,35 @@ var VoicePlaybackCoordinator = class {
|
|
|
7885
8034
|
var voicePlayback = new VoicePlaybackCoordinator();
|
|
7886
8035
|
|
|
7887
8036
|
// src/wechat/message-media.tsx
|
|
7888
|
-
function WechatMessageBody({ message, client, revision: revision2, t }) {
|
|
8037
|
+
function WechatMessageBody({ message, client, contactId, revision: revision2, t, onPrioritize }) {
|
|
7889
8038
|
const attachment = message.kind === "image" || message.kind === "voice" || message.kind === "audio" || message.kind === "video";
|
|
7890
8039
|
const text4 = attachment ? /^\[(?:image|图片|video|视频|(?:voice|audio|语音)(?:\s*\d+(?:\.\d+)?\s*(?:秒|s|["″”]))?)\]$/i.test(message.text?.trim() ?? "") ? "" : message.text : message.text || `[${message.kind}]`;
|
|
7891
|
-
|
|
8040
|
+
const transcribe = contactId && message.kind === "voice" ? (signal) => client.transcribeVoice(contactId, message.id, signal) : void 0;
|
|
8041
|
+
return /* @__PURE__ */ import_react8.default.createElement(import_react8.default.Fragment, null, text4 && /* @__PURE__ */ import_react8.default.createElement("div", null, text4), message.mediaId ? /* @__PURE__ */ import_react8.default.createElement(NativeMedia, { client, mediaId: message.mediaId, kind: message.kind, revision: revision2, t, transcribe }) : attachment && /* @__PURE__ */ import_react8.default.createElement(PendingAttachment, { kind: message.kind, t, prioritize: message.kind === "video" ? void 0 : onPrioritize }));
|
|
8042
|
+
}
|
|
8043
|
+
function PendingAttachment({ kind, t, prioritize }) {
|
|
8044
|
+
const [state, setState] = (0, import_react8.useState)("idle");
|
|
8045
|
+
const activate = async () => {
|
|
8046
|
+
if (!prioritize || state === "sending") return;
|
|
8047
|
+
setState("sending");
|
|
8048
|
+
try {
|
|
8049
|
+
const result = await prioritize();
|
|
8050
|
+
setState(result.queued ? "queued" : "idle");
|
|
8051
|
+
} catch {
|
|
8052
|
+
setState("error");
|
|
8053
|
+
}
|
|
8054
|
+
};
|
|
8055
|
+
const pending = kind === "image" || kind === "video" ? /* @__PURE__ */ import_react8.default.createElement("span", { className: "ws-media-placeholder" }, t(kind === "video" ? "wxVideoPending" : "wxImagePending")) : /* @__PURE__ */ import_react8.default.createElement(VoicePlaceholder, { state: "pending", t });
|
|
8056
|
+
return /* @__PURE__ */ import_react8.default.createElement(import_react8.default.Fragment, null, pending, prioritize && /* @__PURE__ */ import_react8.default.createElement("button", { type: "button", className: "ws-text-button", disabled: state === "sending", onClick: () => void activate() }, t("wxPrioritizeMedia")), (state === "queued" || state === "error") && /* @__PURE__ */ import_react8.default.createElement("span", { role: "status" }, t(state === "queued" ? "wxMediaPriorityQueued" : "wxMediaPriorityFailed")));
|
|
7892
8057
|
}
|
|
7893
8058
|
function NativeMedia(props) {
|
|
7894
|
-
return /* @__PURE__ */
|
|
8059
|
+
return /* @__PURE__ */ import_react8.default.createElement(MediaAttachment, { key: props.mediaId, ...props });
|
|
7895
8060
|
}
|
|
7896
|
-
function MediaAttachment({ client, mediaId, kind, revision: revision2, t }) {
|
|
7897
|
-
const [result, setResult] = (0,
|
|
7898
|
-
const [requested, setRequested] = (0,
|
|
7899
|
-
const [retry, setRetry] = (0,
|
|
7900
|
-
(0,
|
|
8061
|
+
function MediaAttachment({ client, mediaId, kind, revision: revision2, t, transcribe }) {
|
|
8062
|
+
const [result, setResult] = (0, import_react8.useState)({ mediaId });
|
|
8063
|
+
const [requested, setRequested] = (0, import_react8.useState)(kind !== "video");
|
|
8064
|
+
const [retry, setRetry] = (0, import_react8.useState)(0), element2 = (0, import_react8.useRef)(null), loaded = (0, import_react8.useRef)(false);
|
|
8065
|
+
(0, import_react8.useEffect)(() => {
|
|
7901
8066
|
if (!requested || loaded.current) return;
|
|
7902
8067
|
let cancel, started = false;
|
|
7903
8068
|
const load = () => {
|
|
@@ -7927,28 +8092,32 @@ function MediaAttachment({ client, mediaId, kind, revision: revision2, t }) {
|
|
|
7927
8092
|
setResult({ mediaId, error: "decode" });
|
|
7928
8093
|
};
|
|
7929
8094
|
if (kind === "video") {
|
|
7930
|
-
return /* @__PURE__ */
|
|
8095
|
+
return /* @__PURE__ */ import_react8.default.createElement("div", { ref: element2, className: "ws-native-media" }, result.url ? /* @__PURE__ */ import_react8.default.createElement("video", { src: result.url, controls: true, playsInline: true, preload: "metadata", "aria-label": t("wxVideoMessage"), onError: failed }) : result.error ? /* @__PURE__ */ import_react8.default.createElement("span", { role: "status" }, t("wxVideoUnavailable"), " ", /* @__PURE__ */ import_react8.default.createElement("button", { type: "button", className: "ws-text-button", onClick: () => setRetry((value) => value + 1) }, t("wxMediaRetry"))) : requested ? /* @__PURE__ */ import_react8.default.createElement("span", { className: "ws-media-placeholder", role: "status" }, t("wxVideoLoading")) : /* @__PURE__ */ import_react8.default.createElement("button", { type: "button", className: "ws-button ws-video-load", onClick: () => setRequested(true) }, t("wxVideoLoad")));
|
|
7931
8096
|
}
|
|
7932
|
-
return /* @__PURE__ */
|
|
8097
|
+
return /* @__PURE__ */ import_react8.default.createElement("div", { ref: element2, className: "ws-native-media" }, result.url ? result.url.startsWith("data:image/") ? /* @__PURE__ */ import_react8.default.createElement(ImageAttachment, { src: result.url, t, onError: failed }) : /* @__PURE__ */ import_react8.default.createElement(VoiceAttachment, { key: result.url, src: result.url, t, onError: failed, transcribe }) : result.error ? kind === "voice" || kind === "audio" ? /* @__PURE__ */ import_react8.default.createElement(VoicePlaceholder, { state: "error", t, retry: () => setRetry((value) => value + 1) }) : /* @__PURE__ */ import_react8.default.createElement("span", { role: "status" }, t(kind === "image" ? "wxImageUnavailable" : "wxAudioUnavailable"), " ", /* @__PURE__ */ import_react8.default.createElement("button", { className: "ws-text-button", onClick: () => setRetry((value) => value + 1) }, t("wxMediaRetry"))) : kind === "voice" || kind === "audio" ? /* @__PURE__ */ import_react8.default.createElement(VoicePlaceholder, { state: "loading", t }) : /* @__PURE__ */ import_react8.default.createElement("span", { className: "ws-media-placeholder", role: "status" }, t("wxImageLoading")));
|
|
7933
8098
|
}
|
|
7934
8099
|
function ImageAttachment({ src, t, onError }) {
|
|
7935
|
-
const [open, setOpen] = (0,
|
|
7936
|
-
return /* @__PURE__ */
|
|
8100
|
+
const [open, setOpen] = (0, import_react8.useState)(false), trigger = (0, import_react8.useRef)(null);
|
|
8101
|
+
return /* @__PURE__ */ import_react8.default.createElement(import_react8.default.Fragment, null, /* @__PURE__ */ import_react8.default.createElement("button", { ref: trigger, type: "button", className: "ws-image-trigger", "aria-label": t("wxImagePreview"), "aria-haspopup": "dialog", onClick: () => setOpen(true) }, /* @__PURE__ */ import_react8.default.createElement("img", { src, alt: t("wxImageAlt"), loading: "lazy", decoding: "async", onError })), open && /* @__PURE__ */ import_react8.default.createElement(ImagePreview, { src, t, onClose: () => setOpen(false), onError, returnFocus: trigger }));
|
|
7937
8102
|
}
|
|
7938
8103
|
function VoiceWaves() {
|
|
7939
|
-
return /* @__PURE__ */
|
|
8104
|
+
return /* @__PURE__ */ import_react8.default.createElement("svg", { className: "ws-voice-waves", width: "24", height: "25", viewBox: "0 0 24 25", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", "aria-hidden": "true" }, /* @__PURE__ */ import_react8.default.createElement("path", { d: "M5 11v3" }), /* @__PURE__ */ import_react8.default.createElement("path", { className: "ws-voice-wave-mid", d: "M10 7.5a9 9 0 0 1 0 10" }), /* @__PURE__ */ import_react8.default.createElement("path", { className: "ws-voice-wave-outer", d: "M15 3.5a15 15 0 0 1 0 18" }));
|
|
7940
8105
|
}
|
|
7941
8106
|
function VoicePlaceholder({ state, t, retry }) {
|
|
7942
|
-
return /* @__PURE__ */
|
|
7943
|
-
}
|
|
7944
|
-
function VoiceAttachment({ src, t, onError }) {
|
|
7945
|
-
const audio = (0,
|
|
7946
|
-
const
|
|
7947
|
-
(0,
|
|
8107
|
+
return /* @__PURE__ */ import_react8.default.createElement("div", { className: `ws-voice-placeholder is-${state}`, role: "status", title: t(state === "pending" ? "wxAudioPending" : state === "loading" ? "wxAudioLoading" : "wxAudioUnavailable") }, /* @__PURE__ */ import_react8.default.createElement(VoiceWaves, null), /* @__PURE__ */ import_react8.default.createElement("span", { className: "ws-voice-status" }, /* @__PURE__ */ import_react8.default.createElement("strong", null, t("wxVoiceMessage")), /* @__PURE__ */ import_react8.default.createElement("span", null, t(state === "pending" ? "wxVoicePending" : state === "loading" ? "wxAudioLoading" : "wxAudioUnavailable"))), retry && /* @__PURE__ */ import_react8.default.createElement("button", { type: "button", className: "ws-text-button ws-voice-retry", onClick: retry }, t("wxMediaRetry")));
|
|
8108
|
+
}
|
|
8109
|
+
function VoiceAttachment({ src, t, onError, transcribe }) {
|
|
8110
|
+
const audio = (0, import_react8.useRef)(null), alive = (0, import_react8.useRef)(true);
|
|
8111
|
+
const trigger = (0, import_react8.useRef)(null), menu = (0, import_react8.useRef)(null);
|
|
8112
|
+
const request = (0, import_react8.useRef)(null);
|
|
8113
|
+
const [playing, setPlaying] = (0, import_react8.useState)(false), [duration, setDuration] = (0, import_react8.useState)(), [playError, setPlayError] = (0, import_react8.useState)(false);
|
|
8114
|
+
const [transcription, setTranscription] = (0, import_react8.useState)();
|
|
8115
|
+
(0, import_react8.useEffect)(() => {
|
|
7948
8116
|
alive.current = true;
|
|
7949
8117
|
const element2 = audio.current;
|
|
7950
8118
|
return () => {
|
|
7951
8119
|
alive.current = false;
|
|
8120
|
+
request.current?.abort();
|
|
7952
8121
|
if (element2) voicePlayback.stop(element2);
|
|
7953
8122
|
};
|
|
7954
8123
|
}, []);
|
|
@@ -7962,44 +8131,111 @@ function VoiceAttachment({ src, t, onError }) {
|
|
|
7962
8131
|
if (alive.current) setPlayError(true);
|
|
7963
8132
|
}
|
|
7964
8133
|
};
|
|
8134
|
+
const showMenu = (x, y) => {
|
|
8135
|
+
const element2 = menu.current;
|
|
8136
|
+
if (!element2) return;
|
|
8137
|
+
element2.showPopover();
|
|
8138
|
+
element2.style.left = Math.max(4, Math.min(x, window.innerWidth - element2.offsetWidth - 4)) + "px";
|
|
8139
|
+
element2.style.top = Math.max(4, Math.min(y, window.innerHeight - element2.offsetHeight - 4)) + "px";
|
|
8140
|
+
element2.querySelector("button")?.focus();
|
|
8141
|
+
};
|
|
8142
|
+
const closeMenu = () => {
|
|
8143
|
+
menu.current?.hidePopover();
|
|
8144
|
+
trigger.current?.focus({ preventScroll: true });
|
|
8145
|
+
};
|
|
8146
|
+
const convert2 = async () => {
|
|
8147
|
+
closeMenu();
|
|
8148
|
+
if (!transcribe || request.current || transcription?.state === "done") return;
|
|
8149
|
+
const controller = new AbortController();
|
|
8150
|
+
request.current = controller;
|
|
8151
|
+
setTranscription({ state: "loading" });
|
|
8152
|
+
try {
|
|
8153
|
+
const { text: text4 } = await transcribe(controller.signal);
|
|
8154
|
+
if (!controller.signal.aborted) setTranscription({ state: "done", text: text4 });
|
|
8155
|
+
} catch {
|
|
8156
|
+
if (!controller.signal.aborted) setTranscription({ state: "error" });
|
|
8157
|
+
} finally {
|
|
8158
|
+
request.current = null;
|
|
8159
|
+
}
|
|
8160
|
+
};
|
|
7965
8161
|
const durationLabel = voiceDurationLabel(duration);
|
|
7966
|
-
return /* @__PURE__ */
|
|
8162
|
+
return /* @__PURE__ */ import_react8.default.createElement("div", { className: "ws-voice-message" }, /* @__PURE__ */ import_react8.default.createElement("audio", { ref: audio, hidden: true, preload: "metadata", src, onLoadedMetadata: (event) => setDuration(event.currentTarget.duration), onDurationChange: (event) => setDuration(event.currentTarget.duration), onPlaying: () => setPlaying(true), onPause: () => setPlaying(false), onEnded: (event) => {
|
|
7967
8163
|
voicePlayback.stop(event.currentTarget);
|
|
7968
8164
|
setPlaying(false);
|
|
7969
|
-
}, onError }), /* @__PURE__ */
|
|
8165
|
+
}, onError }), /* @__PURE__ */ import_react8.default.createElement(
|
|
8166
|
+
"button",
|
|
8167
|
+
{
|
|
8168
|
+
ref: trigger,
|
|
8169
|
+
type: "button",
|
|
8170
|
+
className: `ws-voice-button${playing ? " is-playing" : ""}`,
|
|
8171
|
+
style: { width: Math.min(240, 112 + (duration && Number.isFinite(duration) ? duration : 0) * 2) },
|
|
8172
|
+
onClick: () => void toggle(),
|
|
8173
|
+
"aria-label": `${t(playing ? "wxPauseVoice" : "wxPlayVoice")}${durationLabel ? " \xB7 " + durationLabel : ""}`,
|
|
8174
|
+
"aria-pressed": playing,
|
|
8175
|
+
"aria-haspopup": transcribe ? "menu" : void 0,
|
|
8176
|
+
onContextMenu: transcribe ? (event) => {
|
|
8177
|
+
event.preventDefault();
|
|
8178
|
+
showMenu(event.clientX, event.clientY);
|
|
8179
|
+
} : void 0,
|
|
8180
|
+
onKeyDown: transcribe ? (event) => {
|
|
8181
|
+
if (event.key !== "ContextMenu" && !(event.shiftKey && event.key === "F10")) return;
|
|
8182
|
+
event.preventDefault();
|
|
8183
|
+
const position2 = event.currentTarget.getBoundingClientRect();
|
|
8184
|
+
showMenu(position2.left, position2.bottom);
|
|
8185
|
+
} : void 0
|
|
8186
|
+
},
|
|
8187
|
+
/* @__PURE__ */ import_react8.default.createElement(VoiceWaves, null),
|
|
8188
|
+
/* @__PURE__ */ import_react8.default.createElement("span", { className: "ws-voice-duration", "aria-hidden": "true" }, durationLabel)
|
|
8189
|
+
), transcribe && /* @__PURE__ */ import_react8.default.createElement(
|
|
8190
|
+
"div",
|
|
8191
|
+
{
|
|
8192
|
+
ref: menu,
|
|
8193
|
+
...{ popover: "auto" },
|
|
8194
|
+
className: "ws-voice-menu",
|
|
8195
|
+
role: "menu",
|
|
8196
|
+
onKeyDown: (event) => {
|
|
8197
|
+
if (event.key === "Escape") {
|
|
8198
|
+
event.preventDefault();
|
|
8199
|
+
event.stopPropagation();
|
|
8200
|
+
closeMenu();
|
|
8201
|
+
}
|
|
8202
|
+
}
|
|
8203
|
+
},
|
|
8204
|
+
/* @__PURE__ */ import_react8.default.createElement("button", { type: "button", role: "menuitem", "aria-disabled": transcription?.state === "loading" || transcription?.state === "done", onClick: () => void convert2() }, t("wxTranscribeVoice"))
|
|
8205
|
+
), transcription && /* @__PURE__ */ import_react8.default.createElement("div", { className: "ws-voice-transcript", role: "status" }, transcription.state === "done" ? transcription.text : transcription.state === "loading" ? t("wxTranscribingVoice") : t("wxTranscriptUnavailable")), playError && /* @__PURE__ */ import_react8.default.createElement("span", { className: "ws-voice-error", role: "status" }, t("wxVoicePlaybackFailed")));
|
|
7970
8206
|
}
|
|
7971
8207
|
|
|
7972
8208
|
// src/wechat/sync-panel.tsx
|
|
7973
8209
|
function SyncActivity({ children, compact = false, active = true, percent }) {
|
|
7974
|
-
return /* @__PURE__ */
|
|
8210
|
+
return /* @__PURE__ */ import_react9.default.createElement("span", { className: `ws-sync-activity${compact ? " is-compact" : ""}`, role: "status" }, compact && (active ? /* @__PURE__ */ import_react9.default.createElement("span", { className: "ws-sync-spinner", "aria-hidden": "true" }) : /* @__PURE__ */ import_react9.default.createElement("span", { className: "ws-dot", "aria-hidden": "true" })), /* @__PURE__ */ import_react9.default.createElement("span", { className: active ? "ws-sync-shimmer" : void 0 }, children), percent !== void 0 && /* @__PURE__ */ import_react9.default.createElement("strong", { className: "ws-sync-percent" }, percent, "%"), active && /* @__PURE__ */ import_react9.default.createElement("span", { className: "ws-sync-dots", "aria-hidden": "true" }, /* @__PURE__ */ import_react9.default.createElement("i", null), /* @__PURE__ */ import_react9.default.createElement("i", null), /* @__PURE__ */ import_react9.default.createElement("i", null)));
|
|
7975
8211
|
}
|
|
7976
8212
|
var progressLabels = { preparing: "wxProgressPreparing", collecting: "wxProgressReading", transferring: "wxProgressTransfer", saving: "wxProgressSaving", complete: "wxRoundComplete" };
|
|
7977
8213
|
function SyncProgressTrack({ progress, active, t }) {
|
|
7978
8214
|
const percent = wechatProgressPercent({ progress }), label2 = t(progress ? progressLabels[progress.stage] ?? "wxSyncing" : "wxSyncing");
|
|
7979
|
-
return /* @__PURE__ */
|
|
8215
|
+
return /* @__PURE__ */ import_react9.default.createElement(import_react9.default.Fragment, null, /* @__PURE__ */ import_react9.default.createElement("span", { className: "ws-sync-track", "data-determinate": percent !== void 0, "data-active": active, role: "progressbar", "aria-label": label2, "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": percent }, percent !== void 0 && /* @__PURE__ */ import_react9.default.createElement("span", { className: "ws-sync-fill", style: { width: percent + "%" } })), progress && /* @__PURE__ */ import_react9.default.createElement("small", { className: "ws-sync-phase" }, label2, progress.totalParts !== void 0 && /* @__PURE__ */ import_react9.default.createElement(import_react9.default.Fragment, null, " \xB7 ", t("wxProgressSaved"), " ", progress.completedParts, "/", progress.totalParts, " ", t("wxProgressParts"))));
|
|
7980
8216
|
}
|
|
7981
8217
|
function SyncPanel({ client, view, workspaceId, t }) {
|
|
7982
|
-
const [answered, setAnswered] = (0,
|
|
8218
|
+
const [answered, setAnswered] = (0, import_react9.useState)([]), s = view.status, c = s?.capabilities, consent = s?.consent, key = consent ? consent.requestId + ":" + consent.kind : "";
|
|
7983
8219
|
const authorize = (approved) => {
|
|
7984
8220
|
if (!consent) return;
|
|
7985
8221
|
setAnswered((v) => [...v, key]);
|
|
7986
8222
|
void client.control("authorize", { requestId: consent.requestId, approved });
|
|
7987
8223
|
};
|
|
7988
|
-
if (s?.runtime && s.runtime.phase !== "ready") return /* @__PURE__ */
|
|
8224
|
+
if (s?.runtime && s.runtime.phase !== "ready") return /* @__PURE__ */ import_react9.default.createElement(RuntimePanel, { runtime: s.runtime, t, retry: () => void client.control("runtime-retry"), disabled: !workspaceId });
|
|
7989
8225
|
const presentation = wechatPresentation(view), statusText = t(presentation.statusKey);
|
|
7990
8226
|
const message = view.error || (isWechatSyncActive(s, view.error) ? void 0 : s?.message);
|
|
7991
8227
|
const sipIssue = wechatSipIssue(message);
|
|
7992
8228
|
const detail = message && !/^WECHAT_/.test(message) ? message : presentation.hintKey ? t(presentation.hintKey) : void 0;
|
|
7993
|
-
return /* @__PURE__ */
|
|
8229
|
+
return /* @__PURE__ */ import_react9.default.createElement("div", { className: "ws-sync-status" }, /* @__PURE__ */ import_react9.default.createElement("div", { className: "ws-sync-line" }, /* @__PURE__ */ import_react9.default.createElement("span", { className: "ws-dot" }), /* @__PURE__ */ import_react9.default.createElement("span", { role: "status" }, statusText), s?.lastSyncedAt && /* @__PURE__ */ import_react9.default.createElement("time", null, new Date(s.lastSyncedAt).toLocaleTimeString()), canPauseWechat(s) && /* @__PURE__ */ import_react9.default.createElement("button", { className: "ws-text-button", onClick: () => void client.control("pause") }, t("wxPause")), c && !c.ready ? /* @__PURE__ */ import_react9.default.createElement("button", { className: "ws-text-button", disabled: !workspaceId, onClick: () => void client.refresh() }, t("wxCheckConnection")) : !canPauseWechat(s) && (s?.phase === "paused" || s?.phase === "error" || !!view.error || s?.phase === "disconnected" && !presentation.blocked) && /* @__PURE__ */ import_react9.default.createElement("button", { className: "ws-text-button", disabled: !workspaceId || !c?.ready || s?.running, onClick: () => void client.control("start", { automatic: true }) }, t("wxRetry"))), sipIssue ? /* @__PURE__ */ import_react9.default.createElement("p", { role: "status" }, t(sipIssue), " ", /* @__PURE__ */ import_react9.default.createElement("a", { download: t("wxGuideFilename"), href: "data:text/plain;charset=utf-8," + encodeURIComponent(t("wxGuideText")) }, t("wxGuideDownload"))) : detail && /* @__PURE__ */ import_react9.default.createElement("p", { role: "status" }, detail), consent && !answered.includes(key) && /* @__PURE__ */ import_react9.default.createElement("div", { className: "ws-sync-consent", role: "alert" }, /* @__PURE__ */ import_react9.default.createElement("strong", null, t(consent.kind === "restart" ? "wxRestart" : "wxInitialize")), /* @__PURE__ */ import_react9.default.createElement("p", null, consent.message), /* @__PURE__ */ import_react9.default.createElement("button", { className: "ws-button ws-primary", onClick: () => authorize(true) }, t("wxApprove")), /* @__PURE__ */ import_react9.default.createElement("button", { className: "ws-button", onClick: () => authorize(false) }, t("wxCancel"))));
|
|
7994
8230
|
}
|
|
7995
8231
|
|
|
7996
8232
|
// src/wechat/sync-footer.tsx
|
|
7997
|
-
var
|
|
8233
|
+
var import_react10 = __toESM(require("react"), 1);
|
|
7998
8234
|
function SyncFooter({ view, t }) {
|
|
7999
8235
|
const runtime = view.status?.runtime;
|
|
8000
|
-
if (runtime && runtime.phase !== "ready") return /* @__PURE__ */
|
|
8236
|
+
if (runtime && runtime.phase !== "ready") return /* @__PURE__ */ import_react10.default.createElement("div", { className: "ws-sync-mini", role: "status" }, /* @__PURE__ */ import_react10.default.createElement("span", null, t(runtime.phase === "error" ? "wxRuntimeFailed" : runtime.phase === "unsupported" ? "wxRuntimeUnsupported" : "wxRuntimePreparing")), runtimePercent(runtime) !== void 0 && /* @__PURE__ */ import_react10.default.createElement("strong", { className: "ws-sync-mini-value" }, runtimePercent(runtime), "%"));
|
|
8001
8237
|
const presentation = wechatPresentation(view), s = view.status, phase = s?.phase, failed = !!view.error || phase === "error" || presentation.blocked, paused = phase === "paused", authorizing = phase === "authorizing";
|
|
8002
|
-
if (phase === "awaiting-login" && !view.error && !presentation.blocked) return /* @__PURE__ */
|
|
8238
|
+
if (phase === "awaiting-login" && !view.error && !presentation.blocked) return /* @__PURE__ */ import_react10.default.createElement("div", { className: "ws-sync-mini", role: "status", title: t("wxAwaitLoginHint") }, t("wxAwaitLogin"));
|
|
8003
8239
|
const syncing = isWechatSyncActive(s, view.error), media = !!s?.mediaImporting && !syncing && !failed && !paused && !authorizing;
|
|
8004
8240
|
const active = syncing || media, p = wechatProgressPercent(s);
|
|
8005
8241
|
const percent = presentation.blocked ? void 0 : syncing ? p : (failed || paused) && p !== void 0 && p < 100 ? p : void 0;
|
|
@@ -8010,14 +8246,14 @@ function SyncFooter({ view, t }) {
|
|
|
8010
8246
|
const sipIssue = wechatSipIssue(s?.message);
|
|
8011
8247
|
const message = s?.message === "WECHAT_LOGIN_RETRY_REQUIRED" ? t("wxReconnectAfterLogin") : s?.message;
|
|
8012
8248
|
const detail = [sipIssue ? t(sipIssue) : message, p !== void 0 ? p + "%" : "", parts ? `${t("wxProgressSaved")} ${s?.progress?.completedParts}/${parts} ${t("wxProgressParts")}` : "", t("wxLocalHistory")].filter(Boolean).join(" \xB7 ");
|
|
8013
|
-
return /* @__PURE__ */
|
|
8249
|
+
return /* @__PURE__ */ import_react10.default.createElement("div", { className: "ws-sync-mini", role: "status", title: detail }, active ? /* @__PURE__ */ import_react10.default.createElement("span", { className: "ws-sync-spinner", "aria-hidden": "true" }) : /* @__PURE__ */ import_react10.default.createElement("svg", { width: "13", height: "13", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", "aria-hidden": "true" }, /* @__PURE__ */ import_react10.default.createElement("path", { d: paused ? "M5 3v10M11 3v10" : failed ? "M8 3v6M8 12v1" : authorizing ? "M8 3v5l3 2" : "m3 8 3 3 7-7" })), /* @__PURE__ */ import_react10.default.createElement("span", { className: active ? "ws-sync-shimmer" : void 0 }, t(label2)), percent !== void 0 ? /* @__PURE__ */ import_react10.default.createElement("strong", { className: "ws-sync-mini-value" }, percent, "%") : clock && /* @__PURE__ */ import_react10.default.createElement("time", { className: "ws-sync-mini-value", dateTime: s?.lastSyncedAt }, clock), syncing && percent !== void 0 && /* @__PURE__ */ import_react10.default.createElement("span", { className: "ws-sync-mini-track", role: "progressbar", "aria-label": t("wxFooterSyncing"), "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": percent }, /* @__PURE__ */ import_react10.default.createElement("span", { style: { width: percent + "%" } })));
|
|
8014
8250
|
}
|
|
8015
8251
|
|
|
8016
8252
|
// src/client.tsx
|
|
8017
|
-
var
|
|
8253
|
+
var import_react12 = __toESM(require("react"), 1);
|
|
8018
8254
|
|
|
8019
8255
|
// src/wechat/use-chat-scroll.ts
|
|
8020
|
-
var
|
|
8256
|
+
var import_react11 = require("react");
|
|
8021
8257
|
|
|
8022
8258
|
// src/wechat/reading-position.ts
|
|
8023
8259
|
var nodes = (el) => Array.from(el.querySelectorAll("[data-message-id]"));
|
|
@@ -8042,8 +8278,8 @@ function hasNewMessages(position2, lastId) {
|
|
|
8042
8278
|
|
|
8043
8279
|
// src/wechat/use-chat-scroll.ts
|
|
8044
8280
|
function useChatScroll(scope, messageKey) {
|
|
8045
|
-
const viewport = (0,
|
|
8046
|
-
const position2 = (0,
|
|
8281
|
+
const viewport = (0, import_react11.useRef)(null), content3 = (0, import_react11.useRef)(null);
|
|
8282
|
+
const position2 = (0, import_react11.useRef)(), activeScope = (0, import_react11.useRef)(""), [unseen, setUnseen] = (0, import_react11.useState)(false), [expired, setExpired] = (0, import_react11.useState)(false);
|
|
8047
8283
|
const capture = () => {
|
|
8048
8284
|
const el = viewport.current;
|
|
8049
8285
|
if (!el?.clientHeight) return;
|
|
@@ -8071,7 +8307,7 @@ function useChatScroll(scope, messageKey) {
|
|
|
8071
8307
|
} else el.scrollTop = el.scrollHeight;
|
|
8072
8308
|
capture();
|
|
8073
8309
|
};
|
|
8074
|
-
(0,
|
|
8310
|
+
(0, import_react11.useLayoutEffect)(() => {
|
|
8075
8311
|
if (activeScope.current !== scope) {
|
|
8076
8312
|
activeScope.current = scope;
|
|
8077
8313
|
position2.current = void 0;
|
|
@@ -8080,7 +8316,7 @@ function useChatScroll(scope, messageKey) {
|
|
|
8080
8316
|
}
|
|
8081
8317
|
restore();
|
|
8082
8318
|
}, [scope, messageKey]);
|
|
8083
|
-
(0,
|
|
8319
|
+
(0, import_react11.useLayoutEffect)(() => {
|
|
8084
8320
|
const el = viewport.current, inner = content3.current;
|
|
8085
8321
|
if (!el || !inner || typeof ResizeObserver === "undefined") return;
|
|
8086
8322
|
const observer = new ResizeObserver(restore);
|
|
@@ -9706,6 +9942,29 @@ var knowledgeEn = {
|
|
|
9706
9942
|
|
|
9707
9943
|
// src/locales.ts
|
|
9708
9944
|
var zh = {
|
|
9945
|
+
companyIdentity: "\u516C\u53F8\u8EAB\u4EFD",
|
|
9946
|
+
companyBind: "\u7ED1\u5B9A\u9489\u9489",
|
|
9947
|
+
companyAlias: "\u82B1\u540D",
|
|
9948
|
+
companyPosition: "\u5C97\u4F4D",
|
|
9949
|
+
companyOrganization: "\u516C\u53F8",
|
|
9950
|
+
companyDepartment: "\u90E8\u95E8",
|
|
9951
|
+
companyModelReady: "\u5DF2\u5F00\u901A\u516C\u53F8 DeepSeek Flash",
|
|
9952
|
+
companyModelUnavailable: "\u8EAB\u4EFD\u5DF2\u9A8C\u8BC1\uFF0C\u516C\u53F8\u6A21\u578B\u901A\u9053\u6682\u4E0D\u53EF\u7528",
|
|
9953
|
+
companyUnbind: "\u89E3\u9664\u7ED1\u5B9A",
|
|
9954
|
+
companyCancel: "\u53D6\u6D88\u7ED1\u5B9A",
|
|
9955
|
+
companyAwaiting: "\u6253\u5F00\u9A8C\u8BC1\u9875\u9762\uFF0C\u6309\u63D0\u793A\u5B8C\u6210\u9489\u9489\u672C\u4EBA\u9A8C\u8BC1\u3002",
|
|
9956
|
+
companyPairingCode: "\u914D\u5BF9\u7801",
|
|
9957
|
+
companyVerify: "\u6253\u5F00\u9489\u9489\u9A8C\u8BC1",
|
|
9958
|
+
companyHint: "\u4E07\u673A\u4F01\u4E1A\u6210\u5458\u7ED1\u5B9A\u672C\u4EBA\u7684\u9489\u9489\u8D26\u53F7\u540E\uFF0C\u5373\u53EF\u4F7F\u7528\u516C\u53F8\u6A21\u578B\u3002",
|
|
9959
|
+
companyIneligible: "\u672A\u80FD\u9A8C\u8BC1\u5F53\u524D\u8D26\u53F7\u7684\u4E07\u673A\u4F01\u4E1A\u6210\u5458\u8EAB\u4EFD\u3002",
|
|
9960
|
+
companyAliasOptional: "\u82B1\u540D\uFF08\u9009\u586B\uFF09",
|
|
9961
|
+
companyPhoneOptional: "\u624B\u673A\u53F7\uFF08\u9009\u586B\uFF09",
|
|
9962
|
+
companyContinue: "\u53D1\u8D77\u9489\u9489\u9A8C\u8BC1",
|
|
9963
|
+
companyBindingFailed: "\u5C1A\u672A\u53D6\u5F97\u914D\u5BF9\u7801\u3002\u8BF7\u68C0\u67E5\u516C\u53F8\u7ED1\u5B9A\u670D\u52A1\u540E\u91CD\u8BD5\u3002",
|
|
9964
|
+
companyRetryHint: "\u6682\u65F6\u65E0\u6CD5\u786E\u8BA4\u516C\u53F8\u8EAB\u4EFD\uFF0C\u8BF7\u91CD\u8BD5\u3002",
|
|
9965
|
+
companyChecking: "\u6B63\u5728\u68C0\u67E5\u516C\u53F8\u8EAB\u4EFD\u2026",
|
|
9966
|
+
companyUnavailable: "\u516C\u53F8\u8EAB\u4EFD\u670D\u52A1\u5C1A\u672A\u63A5\u5165\u3002",
|
|
9967
|
+
companyRetry: "\u91CD\u8BD5",
|
|
9709
9968
|
wxImageActualSize: "\u5B9E\u9645\u5927\u5C0F",
|
|
9710
9969
|
wxVideoMessage: "\u5FAE\u4FE1\u89C6\u9891",
|
|
9711
9970
|
wxVideoLoad: "\u52A0\u8F7D\u89C6\u9891",
|
|
@@ -9825,6 +10084,13 @@ var zh = {
|
|
|
9825
10084
|
wxRuntimeTimeout: "\u7EC4\u4EF6\u51C6\u5907\u8D85\u65F6\uFF0C\u53EF\u91CD\u8BD5\u5E76\u7EE7\u7EED\u5DF2\u4E0B\u8F7D\u7684\u5185\u5BB9\u3002",
|
|
9826
10085
|
wxRuntimeAborted: "\u7EC4\u4EF6\u51C6\u5907\u5DF2\u4E2D\u6B62\uFF0C\u53EF\u91CD\u8BD5\u7EE7\u7EED\u4E0B\u8F7D\u3002",
|
|
9827
10086
|
wxRuntimeNetwork: "\u4E0B\u8F7D\u672A\u5B8C\u6210\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u540E\u91CD\u8BD5\uFF1B\u5DF2\u4E0B\u8F7D\u7684\u5185\u5BB9\u4F1A\u4FDD\u7559\u3002",
|
|
10087
|
+
wxRuntimeSelfTestTimeout: "\u7B49\u5F85\u5FAE\u4FE1\u7EC4\u4EF6\u9996\u6B21\u542F\u52A8\u8D85\u65F6\u3002\u8BF7\u7A0D\u5019\uFF0C\u518D\u91CD\u8BD5\u3002",
|
|
10088
|
+
wxTranscribeVoice: "\u8F6C\u4E3A\u6587\u5B57",
|
|
10089
|
+
wxTranscribingVoice: "\u6B63\u5728\u8F6C\u5199\u8BED\u97F3\u2026",
|
|
10090
|
+
wxTranscriptUnavailable: "\u8BED\u97F3\u8F6C\u5199\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u8BED\u97F3\u8BC6\u522B\u670D\u52A1\u540E\u91CD\u8BD5\u3002",
|
|
10091
|
+
wxPrioritizeMedia: "\u4F18\u5148\u540C\u6B65",
|
|
10092
|
+
wxMediaPriorityQueued: "\u5DF2\u5B89\u6392\u4F18\u5148\u540C\u6B65",
|
|
10093
|
+
wxMediaPriorityFailed: "\u6682\u65F6\u65E0\u6CD5\u4F18\u5148\u540C\u6B65\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5",
|
|
9828
10094
|
wxFooterSyncing: "\u540C\u6B65\u4E2D",
|
|
9829
10095
|
wxFooterDone: "\u5DF2\u540C\u6B65",
|
|
9830
10096
|
wxFooterPartial: "\u90E8\u5206\u540C\u6B65",
|
|
@@ -9916,11 +10182,11 @@ var zh = {
|
|
|
9916
10182
|
replyRunning: "\u6B63\u5728\u751F\u6210",
|
|
9917
10183
|
replyFailed: "\u751F\u6210\u672A\u5B8C\u6210",
|
|
9918
10184
|
replyNoSend: "\u672C\u8F6E\u65E0\u9700\u53D1\u9001",
|
|
9919
|
-
replyManual: "\
|
|
10185
|
+
replyManual: "\u5F85\u751F\u6210",
|
|
9920
10186
|
replyNotNeeded: "\u5F53\u524D\u65E0\u9700\u56DE\u590D",
|
|
9921
10187
|
replyNeedsMedia: "\u9700\u5148\u786E\u8BA4\u56FE\u7247\u6216\u8BED\u97F3\u5185\u5BB9",
|
|
9922
10188
|
replyAutoHint: "\u5DF2\u5F00\u542F\u65B0\u6D88\u606F\u8D77\u8349\uFF1A\u6240\u6709\u5DF2\u540C\u6B65\u4F1A\u8BDD\u7684\u65B0\u6587\u5B57\u3001\u8868\u60C5\u3001\u8BED\u97F3\u548C\u9644\u4EF6\u4F1A\u89E6\u53D1\u8349\u7A3F\u3002\u5386\u53F2\u6D88\u606F\u53EF\u624B\u52A8\u751F\u6210\u3002",
|
|
9923
|
-
replyUnboundHint: "\
|
|
10189
|
+
replyUnboundHint: "\u672A\u7ED1\u5B9A CRM\uFF0C\u672C\u8F6E\u6839\u636E\u5FAE\u4FE1\u804A\u5929\u548C\u53EF\u7528\u4EA7\u54C1\u8D44\u6599\u8D77\u8349\u3002",
|
|
9924
10190
|
replyHandledHint: "\u6700\u8FD1\u4E00\u6761\u4E3A\u5DF1\u65B9\u6D88\u606F\uFF0C\u6216\u6B64\u8F6E\u5DF2\u6807\u8BB0\u5904\u7406\u3002\u9700\u8981\u7EE7\u7EED\u8DDF\u8FDB\u65F6\u53EF\u624B\u52A8\u751F\u6210\u3002",
|
|
9925
10191
|
awaitingDraft: "\u5F85\u751F\u6210\u56DE\u590D",
|
|
9926
10192
|
simulateDelivery: "\u8BB0\u5165\u6A21\u62DF\u5BF9\u8BDD",
|
|
@@ -10005,6 +10271,29 @@ var zh = {
|
|
|
10005
10271
|
contextHint: "\u57FA\u4E8E\u5F53\u524D\u793A\u4F8B\u804A\u5929\u6574\u7406"
|
|
10006
10272
|
};
|
|
10007
10273
|
var en = {
|
|
10274
|
+
companyIdentity: "Company identity",
|
|
10275
|
+
companyBind: "Link DingTalk",
|
|
10276
|
+
companyAlias: "Display name",
|
|
10277
|
+
companyPosition: "Job title",
|
|
10278
|
+
companyOrganization: "Company",
|
|
10279
|
+
companyDepartment: "Department",
|
|
10280
|
+
companyModelReady: "Company DeepSeek Flash is available",
|
|
10281
|
+
companyModelUnavailable: "Identity verified. The company model is temporarily unavailable.",
|
|
10282
|
+
companyUnbind: "Unlink account",
|
|
10283
|
+
companyCancel: "Cancel linking",
|
|
10284
|
+
companyAwaiting: "Open the verification page and follow the DingTalk instructions.",
|
|
10285
|
+
companyPairingCode: "Pairing code",
|
|
10286
|
+
companyVerify: "Open DingTalk verification",
|
|
10287
|
+
companyHint: "Wanji employees can link their own DingTalk account to use the company model.",
|
|
10288
|
+
companyIneligible: "We could not verify this account\u2019s Wanji membership.",
|
|
10289
|
+
companyAliasOptional: "Display name (optional)",
|
|
10290
|
+
companyPhoneOptional: "Mobile number (optional)",
|
|
10291
|
+
companyContinue: "Start DingTalk verification",
|
|
10292
|
+
companyBindingFailed: "The company service did not issue a pairing code. Please try again.",
|
|
10293
|
+
companyRetryHint: "Company identity could not be verified. Try again.",
|
|
10294
|
+
companyChecking: "Checking company identity\u2026",
|
|
10295
|
+
companyUnavailable: "The company identity service is not connected.",
|
|
10296
|
+
companyRetry: "Try again",
|
|
10008
10297
|
wxImageActualSize: "Actual size",
|
|
10009
10298
|
wxVideoMessage: "WeChat video",
|
|
10010
10299
|
wxVideoLoad: "Load video",
|
|
@@ -10124,6 +10413,13 @@ var en = {
|
|
|
10124
10413
|
wxRuntimeTimeout: "Component preparation timed out. Retry to resume the download.",
|
|
10125
10414
|
wxRuntimeAborted: "Component preparation stopped. Retry to resume the download.",
|
|
10126
10415
|
wxRuntimeNetwork: "The download did not finish. Check your connection and retry; partial data is retained.",
|
|
10416
|
+
wxRuntimeSelfTestTimeout: "Timed out waiting for the WeChat component to start. Wait a moment and try again.",
|
|
10417
|
+
wxTranscribeVoice: "Transcribe",
|
|
10418
|
+
wxTranscribingVoice: "Transcribing\u2026",
|
|
10419
|
+
wxTranscriptUnavailable: "Could not transcribe. Check the speech recognition service and retry.",
|
|
10420
|
+
wxPrioritizeMedia: "Sync first",
|
|
10421
|
+
wxMediaPriorityQueued: "Marked for priority sync",
|
|
10422
|
+
wxMediaPriorityFailed: "Priority sync unavailable. Try again shortly.",
|
|
10127
10423
|
wxFooterSyncing: "Syncing",
|
|
10128
10424
|
wxFooterDone: "Synced",
|
|
10129
10425
|
wxFooterPartial: "Partial sync",
|
|
@@ -10215,11 +10511,11 @@ var en = {
|
|
|
10215
10511
|
replyRunning: "Generating",
|
|
10216
10512
|
replyFailed: "Generation incomplete",
|
|
10217
10513
|
replyNoSend: "No message needed",
|
|
10218
|
-
replyManual: "
|
|
10514
|
+
replyManual: "Ready to generate",
|
|
10219
10515
|
replyNotNeeded: "No reply needed now",
|
|
10220
10516
|
replyNeedsMedia: "Confirm image or voice content first",
|
|
10221
10517
|
replyAutoHint: "New text, stickers, voice messages and attachments in synced conversations trigger a draft. History remains manual.",
|
|
10222
|
-
replyUnboundHint: "
|
|
10518
|
+
replyUnboundHint: "Drafts use this WeChat conversation and available product references when CRM is unlinked.",
|
|
10223
10519
|
replyHandledHint: "The latest message is outgoing or this turn is handled. Generate manually when further follow-up is needed.",
|
|
10224
10520
|
awaitingDraft: "Ready to draft",
|
|
10225
10521
|
simulateDelivery: "Record as simulated sent message",
|
|
@@ -11913,6 +12209,15 @@ function terminalGenerationFailure(response, afterSeq, throughSeq) {
|
|
|
11913
12209
|
case "QUOTA":
|
|
11914
12210
|
case "ACCOUNT_QUOTA":
|
|
11915
12211
|
return "\u9500\u552E\u6A21\u578B\u989D\u5EA6\u4E0D\u8DB3\uFF0C\u8BF7\u68C0\u67E5\u6A21\u578B\u901A\u9053\u7684\u53EF\u7528\u989D\u5EA6\u540E\u91CD\u8BD5\u3002";
|
|
12212
|
+
case "ACCOUNT_SIGN_IN_REQUIRED":
|
|
12213
|
+
case "ACCOUNT_TOKEN_INVALID":
|
|
12214
|
+
return "\u9500\u552E\u6A21\u578B\u7684\u8D26\u53F7\u9700\u8981\u91CD\u65B0\u767B\u5F55\u3002\u8BF7\u5728\u4E07\u673A\u5927\u8111\u91CD\u65B0\u767B\u5F55\u6A21\u578B\u8D26\u53F7\u540E\u91CD\u8BD5\u3002";
|
|
12215
|
+
case "NO_ADAPTER":
|
|
12216
|
+
case "UNKNOWN_MODEL":
|
|
12217
|
+
case "MODEL_UNSUPPORTED":
|
|
12218
|
+
return "\u9500\u552E\u6A21\u578B\u901A\u9053\u65E0\u6CD5\u4F7F\u7528 DeepSeek Flash\u3002\u8BF7\u68C0\u67E5\u4E07\u673A\u5927\u8111\u4E2D\u8BE5\u6A21\u578B\u548C\u901A\u9053\u7684\u914D\u7F6E\u3002";
|
|
12219
|
+
case "NO_CREDENTIAL_STORE":
|
|
12220
|
+
return "\u5F53\u524D\u4E07\u673A\u5927\u8111\u65E0\u6CD5\u8BFB\u53D6\u6A21\u578B\u51ED\u636E\uFF0C\u8BF7\u68C0\u67E5\u6A21\u578B\u767B\u5F55\u6216 API Key \u8BBE\u7F6E\u3002";
|
|
11916
12221
|
case "MISSING_CREDENTIAL":
|
|
11917
12222
|
return "\u9500\u552E\u6A21\u578B\u901A\u9053\u5C1A\u672A\u914D\u7F6E API Key\uFF0C\u8BF7\u914D\u7F6E\u540E\u91CD\u8BD5\u3002";
|
|
11918
12223
|
case "INVALID_CREDENTIAL":
|
|
@@ -12020,7 +12325,7 @@ async function generateReply(rpc, workspaceId, contact, latest, signal, options
|
|
|
12020
12325
|
} catch (error) {
|
|
12021
12326
|
signal.throwIfAborted();
|
|
12022
12327
|
const reasons = {
|
|
12023
|
-
"missing-tools": "\u77E5\u8BC6\u5E93\u5DE5\u5177\u672A\u5C31\u7EEA\uFF0C\u8BF7\u68C0\u67E5\u77E5\u8BC6\u5E93\
|
|
12328
|
+
"missing-tools": "\u77E5\u8BC6\u5E93\u5DE5\u5177\u672A\u5C31\u7EEA\uFF0C\u8BF7\u68C0\u67E5\u9500\u552E\u52A9\u624B\u7684\u77E5\u8BC6\u5E93\u8FDE\u63A5\u914D\u7F6E\u3002",
|
|
12024
12329
|
"not-configured": "\u5C1A\u672A\u914D\u7F6E\u56DE\u590D\u4F7F\u7528\u7684\u77E5\u8BC6\u5E93\u3002",
|
|
12025
12330
|
disabled: "\u56DE\u590D\u8D44\u6599\u68C0\u7D22\u5F53\u524D\u672A\u542F\u7528\u3002",
|
|
12026
12331
|
timeout: "\u77E5\u8BC6\u68C0\u7D22\u8D85\u65F6\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002",
|
|
@@ -12039,6 +12344,18 @@ async function generateReply(rpc, workspaceId, contact, latest, signal, options
|
|
|
12039
12344
|
let created;
|
|
12040
12345
|
if (knowledge.generationSessionsSupported) {
|
|
12041
12346
|
const result = await invoke("/api", "wanji-sales-generation/session", { operation: "create", workspaceId, title, ...generationLease ? { leaseId: generationLease } : {} });
|
|
12347
|
+
if (object2(result) && result.ok === false && object2(result.error)) {
|
|
12348
|
+
switch (result.error.code) {
|
|
12349
|
+
case "GENERATION_COMPANY_MODEL_UNAVAILABLE":
|
|
12350
|
+
throw Error("\u516C\u53F8\u9500\u552E\u8EAB\u4EFD\u5DF2\u9A8C\u8BC1\uFF0C\u6A21\u578B\u901A\u9053\u6682\u4E0D\u53EF\u7528\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\u6216\u7A0D\u540E\u91CD\u8BD5\u3002");
|
|
12351
|
+
case "GENERATION_MODEL_NOT_CONFIGURED":
|
|
12352
|
+
throw Error("\u9500\u552E\u6A21\u578B\u5C1A\u672A\u914D\u7F6E\u3002\u8BF7\u5728\u4E07\u673A\u5927\u8111\u8BBE\u7F6E\u4E2D\u9009\u7528\u5DF2\u6388\u6743\u7684 DeepSeek Flash\uFF08deepseek-v4.1-flash\uFF09\uFF0C\u518D\u751F\u6210\u56DE\u590D\u3002");
|
|
12353
|
+
case "GENERATION_MODEL_INCOMPATIBLE":
|
|
12354
|
+
throw Error("\u5F53\u524D\u9500\u552E\u6A21\u578B\u65E0\u6CD5\u7528\u4E8E\u8D77\u8349\u3002\u8BF7\u5728\u4E07\u673A\u5927\u8111\u8BBE\u7F6E\u4E2D\u9009\u62E9 DeepSeek Flash\uFF08deepseek-v4.1-flash\uFF09\u3002\u6709\u72EC\u7ACB\u9500\u552E\u6A21\u578B\u914D\u7F6E\u65F6\uFF0C\u8BF7\u7BA1\u7406\u5458\u68C0\u67E5\u8BE5\u914D\u7F6E\u3002");
|
|
12355
|
+
case "GENERATION_WORKSPACE":
|
|
12356
|
+
throw Error("\u9500\u552E\u52A9\u624B\u627E\u4E0D\u5230\u672C\u8F6E\u5DE5\u4F5C\u533A\u3002\u8BF7\u91CD\u65B0\u6253\u5F00\u9500\u552E\u52A9\u624B\uFF0C\u7B49\u5F85\u5DE5\u4F5C\u533A\u8F7D\u5165\u540E\u91CD\u8BD5\u3002");
|
|
12357
|
+
}
|
|
12358
|
+
}
|
|
12042
12359
|
if (!object2(result) || result.ok !== true || !object2(result.value) || typeof result.value.leaseId !== "string" || generationLease && generationLease !== result.value.leaseId) throw Error("\u672C\u8F6E\u4E34\u65F6\u9500\u552E\u4F1A\u8BDD\u6682\u672A\u5C31\u7EEA\uFF0C\u8BF7\u68C0\u67E5\u8FDE\u63A5\u3002");
|
|
12043
12360
|
generationLease = result.value.leaseId;
|
|
12044
12361
|
created = result.value;
|
|
@@ -12573,7 +12890,9 @@ function mountSales(ctx, Page, Icon) {
|
|
|
12573
12890
|
return;
|
|
12574
12891
|
}
|
|
12575
12892
|
const generation = snapshot.generations[contactId];
|
|
12576
|
-
if (generation?.status === "done" || generation?.status === "error"
|
|
12893
|
+
if (generation?.status === "done" || generation?.status === "error" && !isLegacyMissingDraftKnowledge(generation.error)) {
|
|
12894
|
+
return await save(contactId, messageId) ? void 0 : "retry";
|
|
12895
|
+
}
|
|
12577
12896
|
return updates.run(() => generateInner(workspaceId, contactId, { job, conversation }));
|
|
12578
12897
|
};
|
|
12579
12898
|
const locks = globalThis.navigator?.locks;
|
|
@@ -12601,7 +12920,7 @@ function mountSales(ctx, Page, Icon) {
|
|
|
12601
12920
|
name: "main",
|
|
12602
12921
|
key: PANEL_ID,
|
|
12603
12922
|
locale: NS,
|
|
12604
|
-
inject: () => ({ hooks: { sales: store, workspaces, knowledge, wechat, update: updater }, updater, runDelivery, updateFormDirty: (dirty) => updates.form(dirty), knowledge: { refresh: knowledge.refresh, setQuery: knowledge.setQuery, setMaxResults: knowledge.setMaxResults, search: knowledge.search, select: knowledge.select, rate: knowledge.rate, runCases: knowledge.runCases, cancel: knowledge.cancel, loadRuns: knowledge.loadRuns, loadRun: knowledge.loadRun, compareRuns: knowledge.compareRuns, labelRequest: knowledge.labelRequest, loadDatasets: knowledge.loadDatasets, selectDataset: knowledge.selectDataset }, wechat, setMode: (mode, workspaceId) => {
|
|
12923
|
+
inject: () => ({ hooks: { sales: store, workspaces, knowledge, wechat, update: updater }, companyIdentityRpc: ctx.connection.rpc, updater, runDelivery, updateFormDirty: (dirty) => updates.form(dirty), knowledge: { refresh: knowledge.refresh, setQuery: knowledge.setQuery, setMaxResults: knowledge.setMaxResults, search: knowledge.search, select: knowledge.select, rate: knowledge.rate, runCases: knowledge.runCases, cancel: knowledge.cancel, loadRuns: knowledge.loadRuns, loadRun: knowledge.loadRun, compareRuns: knowledge.compareRuns, labelRequest: knowledge.labelRequest, loadDatasets: knowledge.loadDatasets, selectDataset: knowledge.selectDataset }, wechat, setMode: (mode, workspaceId) => {
|
|
12605
12924
|
if (updates.frozen || store.workspace() === workspaceId && store.getSnapshot().mode === mode) return;
|
|
12606
12925
|
cancelWaiting();
|
|
12607
12926
|
autoReply.observe("", []);
|
|
@@ -12723,6 +13042,11 @@ var mediaStyles = `
|
|
|
12723
13042
|
.ws-voice-button.is-playing .ws-voice-wave-mid{animation:ws-voice-pulse 1s steps(1,end) infinite}.ws-voice-button.is-playing .ws-voice-wave-outer{animation:ws-voice-pulse 1s steps(1,end) infinite;animation-delay:.25s}
|
|
12724
13043
|
@keyframes ws-voice-pulse{0%,65%{opacity:1}66%,100%{opacity:.15}}
|
|
12725
13044
|
.ws-page .ws-voice-placeholder{display:flex;align-items:center;gap:12px;width:190px;max-width:100%;min-height:56px;padding:10px 12px;border:1px solid var(--ws-line);border-radius:8px;background:color-mix(in srgb,var(--ws-ink) 5%,var(--ws-bg));color:var(--ws-muted);white-space:normal}.ws-voice-placeholder>.ws-voice-waves{opacity:.6;flex-shrink:0}.ws-voice-status{display:grid;gap:3px;min-width:0;flex:1;text-align:left}.ws-voice-status strong{font-size:12px;line-height:17px;color:var(--ws-ink)}.ws-voice-status>span{font-size:11px;line-height:16px;overflow-wrap:anywhere}.ws-out .ws-voice-placeholder{flex-direction:row-reverse;background:color-mix(in srgb,var(--ws-accent,var(--ws-ink)) 9%,var(--ws-bg))}.ws-page .ws-voice-placeholder.is-error{width:220px}.ws-voice-placeholder .ws-voice-retry{flex-shrink:0;text-decoration:underline;text-underline-offset:3px;font-size:11px!important}
|
|
13045
|
+
.ws-page .ws-voice-menu{position:fixed;inset:auto;margin:0;padding:4px;border:1px solid var(--ws-line);border-radius:7px;background:var(--ws-bg);color:var(--ws-ink);box-shadow:0 5px 18px #0003;-webkit-app-region:no-drag}
|
|
13046
|
+
.ws-voice-menu button{display:block;width:100%;padding:6px 12px;border:0;border-radius:4px;background:transparent;color:inherit;text-align:start;font-size:13px}
|
|
13047
|
+
.ws-voice-menu button:hover,.ws-voice-menu button:focus-visible{background:var(--ws-soft)}
|
|
13048
|
+
.ws-voice-menu button[aria-disabled=true]{color:var(--ws-muted)}
|
|
13049
|
+
.ws-voice-transcript{width:fit-content;max-width:min(360px,100%);margin-top:5px;padding:8px 12px;border:1px solid var(--ws-line);border-radius:6px;background:var(--ws-soft);color:var(--ws-ink);white-space:pre-wrap;overflow-wrap:anywhere;text-align:start}
|
|
12726
13050
|
.ws-voice-error{display:block;max-width:240px;margin-top:5px;font-size:11px;color:var(--ws-muted)}
|
|
12727
13051
|
@media(prefers-reduced-motion:reduce){.ws-voice-button.is-playing .ws-voice-wave-mid,.ws-voice-button.is-playing .ws-voice-wave-outer{animation:none}.ws-voice-button.is-playing{box-shadow:inset 3px 0 0 var(--ws-accent,var(--ws-ink))}}
|
|
12728
13052
|
`;
|
|
@@ -12819,43 +13143,58 @@ function displayTime(value, detailed = false) {
|
|
|
12819
13143
|
return (date.toDateString() === now.toDateString() ? timeFormats.clock : date.getFullYear() === now.getFullYear() ? timeFormats.date : timeFormats.year).format(date);
|
|
12820
13144
|
}
|
|
12821
13145
|
function Glyph({ name, size = 18 }) {
|
|
12822
|
-
return /* @__PURE__ */
|
|
13146
|
+
return /* @__PURE__ */ import_react12.default.createElement("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true" }, /* @__PURE__ */ import_react12.default.createElement("path", { d: paths[name] }));
|
|
12823
13147
|
}
|
|
12824
13148
|
function SalesIcon({ size = 18 }) {
|
|
12825
|
-
return /* @__PURE__ */
|
|
13149
|
+
return /* @__PURE__ */ import_react12.default.createElement(Glyph, { name: "chat", size });
|
|
12826
13150
|
}
|
|
12827
13151
|
var EMPTY_CONTACT = { id: "", name: "", initials: "", segment: "", time: "", preview: "", status: "pending", unread: 0, product: "", budget: "", moneyAmounts: [], tags: [], facts: [], messages: [], candidates: [] };
|
|
12828
|
-
function SalesPage({ t, useSales, useWorkspaces, dispatch, generate, loadConversation, refreshWorkspaces, wechat, useWechat, setMode, bindWechat, useUpdate, updater, updateFormDirty, runDelivery }) {
|
|
13152
|
+
function SalesPage({ t, useSales, useWorkspaces, dispatch, generate, loadConversation, refreshWorkspaces, wechat, useWechat, setMode, bindWechat, useUpdate, updater, updateFormDirty, runDelivery, companyIdentityRpc }) {
|
|
12829
13153
|
const update = useUpdate?.((s) => s);
|
|
12830
13154
|
const frozen = update?.preparing ?? false;
|
|
12831
13155
|
const state = useSales((snapshot) => snapshot);
|
|
12832
13156
|
const view = useWechat ? useWechat((s) => s) : { messages: [], hasMore: false };
|
|
12833
13157
|
const workspaceState = useWorkspaces((snapshot) => snapshot);
|
|
12834
13158
|
const workspaces = workspaceState.items;
|
|
12835
|
-
(0,
|
|
13159
|
+
(0, import_react12.useEffect)(() => {
|
|
12836
13160
|
void refreshWorkspaces();
|
|
12837
13161
|
}, [refreshWorkspaces]);
|
|
12838
13162
|
const selectedWorkspace = selectSalesWorkspace(workspaces, view.status?.workspaceId);
|
|
12839
|
-
(0,
|
|
13163
|
+
(0, import_react12.useEffect)(() => {
|
|
12840
13164
|
if (!frozen) setMode?.("real", selectedWorkspace);
|
|
12841
13165
|
}, [selectedWorkspace, setMode, frozen]);
|
|
12842
|
-
const [query, setQuery] = (0,
|
|
12843
|
-
const [sort, setSort] = (0,
|
|
12844
|
-
const [filter, setFilter] = (0,
|
|
12845
|
-
const [showChat, setShowChat] = (0,
|
|
12846
|
-
const [profileVisibility, setProfileVisibility] = (0,
|
|
12847
|
-
const profileId = (0,
|
|
12848
|
-
const openProfileButton = (0,
|
|
12849
|
-
const closeProfileButton = (0,
|
|
12850
|
-
(0,
|
|
13166
|
+
const [query, setQuery] = (0, import_react12.useState)("");
|
|
13167
|
+
const [sort, setSort] = (0, import_react12.useState)("recent");
|
|
13168
|
+
const [filter, setFilter] = (0, import_react12.useState)("all");
|
|
13169
|
+
const [showChat, setShowChat] = (0, import_react12.useState)(false);
|
|
13170
|
+
const [profileVisibility, setProfileVisibility] = (0, import_react12.useState)("default");
|
|
13171
|
+
const profileId = (0, import_react12.useId)();
|
|
13172
|
+
const openProfileButton = (0, import_react12.useRef)(null);
|
|
13173
|
+
const closeProfileButton = (0, import_react12.useRef)(null);
|
|
13174
|
+
(0, import_react12.useEffect)(() => {
|
|
12851
13175
|
if (profileVisibility === "open") closeProfileButton.current?.focus({ preventScroll: true });
|
|
12852
13176
|
if (profileVisibility === "closed") openProfileButton.current?.focus({ preventScroll: true });
|
|
12853
13177
|
}, [profileVisibility]);
|
|
12854
|
-
const [notice, setNotice] = (0,
|
|
12855
|
-
const [copyResult, setCopyResult] = (0,
|
|
13178
|
+
const [notice, setNotice] = (0, import_react12.useState)("");
|
|
13179
|
+
const [copyResult, setCopyResult] = (0, import_react12.useState)(null);
|
|
12856
13180
|
const contact = state.contacts.find((c) => c.id === state.selectedId) ?? state.contacts[0] ?? EMPTY_CONTACT;
|
|
12857
13181
|
const syncRevision = contact.wechat ? view.status?.revision : void 0;
|
|
12858
|
-
(
|
|
13182
|
+
const mediaPriorityReady = Boolean(contact.wechat && view.status?.automatic && view.status?.capabilities?.mediaPriority && !frozen);
|
|
13183
|
+
(0, import_react12.useEffect)(() => {
|
|
13184
|
+
if (!mediaPriorityReady || !wechat || !contact.id) return;
|
|
13185
|
+
const focus = crypto.randomUUID();
|
|
13186
|
+
let request;
|
|
13187
|
+
const timer = setTimeout(() => {
|
|
13188
|
+
request = wechat.prioritizeMedia(contact.id, focus).catch(() => {
|
|
13189
|
+
});
|
|
13190
|
+
}, 5e3);
|
|
13191
|
+
return () => {
|
|
13192
|
+
clearTimeout(timer);
|
|
13193
|
+
if (request) void request.then(() => wechat.clearMediaFocus(focus, selectedWorkspace)).catch(() => {
|
|
13194
|
+
});
|
|
13195
|
+
};
|
|
13196
|
+
}, [wechat, selectedWorkspace, contact.id, mediaPriorityReady]);
|
|
13197
|
+
(0, import_react12.useEffect)(() => {
|
|
12859
13198
|
if (!frozen && contact.id) void loadConversation(selectedWorkspace, contact.id).catch(() => {
|
|
12860
13199
|
});
|
|
12861
13200
|
}, [loadConversation, selectedWorkspace, contact.id, contact.crm?.conversationId, contact.crm?.customerPhone, contact.crm?.salesName, contact.crm?.salesPhone, contact.wechat?.version, syncRevision, frozen]);
|
|
@@ -12864,16 +13203,16 @@ function SalesPage({ t, useSales, useWorkspaces, dispatch, generate, loadConvers
|
|
|
12864
13203
|
const generation = state.generations[contact.id];
|
|
12865
13204
|
const running = generation?.status === "running";
|
|
12866
13205
|
const canCopy = !frozen && Boolean(draft.trim()) && !generation?.result?.no_send;
|
|
12867
|
-
const [delivery, setDelivery] = (0,
|
|
12868
|
-
const activeChat = (0,
|
|
13206
|
+
const [delivery, setDelivery] = (0, import_react12.useState)({ contactId: "", lease: "", enabled: false, available: false, baseline: "", status: "idle" });
|
|
13207
|
+
const activeChat = (0, import_react12.useRef)("");
|
|
12869
13208
|
activeChat.current = JSON.stringify([selectedWorkspace, contact.id]);
|
|
12870
|
-
const latestMessage = (0,
|
|
13209
|
+
const latestMessage = (0, import_react12.useRef)("");
|
|
12871
13210
|
latestMessage.current = contact.wechat?.latestInbound?.id ?? "";
|
|
12872
|
-
const updateFrozen = (0,
|
|
13211
|
+
const updateFrozen = (0, import_react12.useRef)(frozen);
|
|
12873
13212
|
updateFrozen.current = frozen;
|
|
12874
|
-
const [approval, setApproval] = (0,
|
|
12875
|
-
const [answeringApproval, setAnsweringApproval] = (0,
|
|
12876
|
-
const [checkingSend, setCheckingSend] = (0,
|
|
13213
|
+
const [approval, setApproval] = (0, import_react12.useState)();
|
|
13214
|
+
const [answeringApproval, setAnsweringApproval] = (0, import_react12.useState)(false);
|
|
13215
|
+
const [checkingSend, setCheckingSend] = (0, import_react12.useState)(false);
|
|
12877
13216
|
const checkSendingEnvironment = async () => {
|
|
12878
13217
|
if (!wechatSendingEnabled || frozen || !wechat || !runDelivery || checkingSend) return;
|
|
12879
13218
|
const scope = activeChat.current;
|
|
@@ -12888,8 +13227,8 @@ function SalesPage({ t, useSales, useWorkspaces, dispatch, generate, loadConvers
|
|
|
12888
13227
|
setCheckingSend(false);
|
|
12889
13228
|
}
|
|
12890
13229
|
};
|
|
12891
|
-
const deliveryAttempts = (0,
|
|
12892
|
-
(0,
|
|
13230
|
+
const deliveryAttempts = (0, import_react12.useRef)(/* @__PURE__ */ new Set());
|
|
13231
|
+
(0, import_react12.useEffect)(() => {
|
|
12893
13232
|
if (!wechatSendingEnabled || !wechat || !contact.wechat) return;
|
|
12894
13233
|
let active = true, lease = "", opened = false;
|
|
12895
13234
|
setApproval(void 0);
|
|
@@ -12934,7 +13273,7 @@ function SalesPage({ t, useSales, useWorkspaces, dispatch, generate, loadConvers
|
|
|
12934
13273
|
const result = await wechat.deliveryOpen(contact.id, enabled);
|
|
12935
13274
|
setDelivery({ contactId: contact.id, ...result, enabled, baseline: contact.wechat?.latestInbound?.id ?? "", status: "idle" });
|
|
12936
13275
|
};
|
|
12937
|
-
(0,
|
|
13276
|
+
(0, import_react12.useEffect)(() => {
|
|
12938
13277
|
if (!wechatSendingEnabled || !wechat || !delivery.lease) return;
|
|
12939
13278
|
const timer = setInterval(() => {
|
|
12940
13279
|
void wechat.deliveryTouch(delivery.lease).catch(() => setDelivery((d) => ({ ...d, enabled: false, status: "stopped" })));
|
|
@@ -12979,7 +13318,7 @@ function SalesPage({ t, useSales, useWorkspaces, dispatch, generate, loadConvers
|
|
|
12979
13318
|
setNotice(error instanceof Error ? error.message : String(error));
|
|
12980
13319
|
}
|
|
12981
13320
|
};
|
|
12982
|
-
(0,
|
|
13321
|
+
(0, import_react12.useEffect)(() => {
|
|
12983
13322
|
const messageId = contact.wechat?.latestInbound?.id;
|
|
12984
13323
|
if (!wechatSendingEnabled || frozen || !delivery.enabled || delivery.contactId !== contact.id || !messageId || messageId === delivery.baseline || generation?.status !== "done" || generation.result?.no_send || !draft.trim() || state.draftKinds[contact.id] !== "agent" || draft !== generation.result?.wechat || state.stale?.[contact.id]) return;
|
|
12985
13324
|
const key = JSON.stringify([selectedWorkspace, contact.id, messageId]);
|
|
@@ -12990,7 +13329,7 @@ function SalesPage({ t, useSales, useWorkspaces, dispatch, generate, loadConvers
|
|
|
12990
13329
|
const replyView = replyPresentation(state, contact);
|
|
12991
13330
|
const shownMessages = contact.wechat ? view.contactId === contact.id ? view.messages : [] : contact.messages;
|
|
12992
13331
|
const reading = useChatScroll(JSON.stringify([selectedWorkspace, contact.wechat?.accountId, contact.id]), JSON.stringify(shownMessages.map((message) => message.id)));
|
|
12993
|
-
(0,
|
|
13332
|
+
(0, import_react12.useEffect)(() => {
|
|
12994
13333
|
if (reading.expired) setNotice(t("wxReadingPositionExpired"));
|
|
12995
13334
|
}, [reading.expired, t]);
|
|
12996
13335
|
const select = (id) => {
|
|
@@ -13014,43 +13353,43 @@ function SalesPage({ t, useSales, useWorkspaces, dispatch, generate, loadConvers
|
|
|
13014
13353
|
const syncProgress = presentation.blocked || view.status?.phase === "authorizing" ? void 0 : view.status?.progress;
|
|
13015
13354
|
const syncPercent = wechatProgressPercent({ progress: syncProgress });
|
|
13016
13355
|
const syncLabel = view.error ? "wxProgressUnavailable" : view.status?.phase === "error" ? "wxProgressFailed" : view.status?.phase === "paused" ? "wxPaused" : syncActive ? "wxIncremental" : "wxRoundComplete";
|
|
13017
|
-
return /* @__PURE__ */
|
|
13356
|
+
return /* @__PURE__ */ import_react12.default.createElement("section", { className: "ws-page", "aria-label": t("title") }, /* @__PURE__ */ import_react12.default.createElement("style", null, styles + updateStyles + companyIdentityStyles), /* @__PURE__ */ import_react12.default.createElement("header", { className: "ws-header" }, /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-heading" }, /* @__PURE__ */ import_react12.default.createElement("span", { className: "ws-brand" }, /* @__PURE__ */ import_react12.default.createElement(Glyph, { name: "chat", size: 22 })), /* @__PURE__ */ import_react12.default.createElement("div", null, /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-title-line" }, /* @__PURE__ */ import_react12.default.createElement("h1", null, t("title")), /* @__PURE__ */ import_react12.default.createElement("span", { className: "ws-demo-label" }, t("wxConnected"))), /* @__PURE__ */ import_react12.default.createElement("p", null, t("subtitle")))), (companyIdentityRpc || updater && update) && /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-header-actions" }, companyIdentityRpc && /* @__PURE__ */ import_react12.default.createElement(CompanyIdentityPanel, { rpc: companyIdentityRpc, t, disabled: frozen }), updater && update && /* @__PURE__ */ import_react12.default.createElement(UpdatePanel, { client: updater, view: update, t }))), frozen && /* @__PURE__ */ import_react12.default.createElement("p", { role: "status", className: "ws-update-freeze" }, t("updateFreeze")), /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-inline-sync" }, wechat && /* @__PURE__ */ import_react12.default.createElement(SyncPanel, { client: wechat, t, view, workspaceId: selectedWorkspace }), !contact.id && workspaceState.error && /* @__PURE__ */ import_react12.default.createElement("span", { role: "status" }, workspaceState.error)), /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-body", "data-empty": !contact.id, "data-show-chat": showChat, "data-profile": profileVisibility }, /* @__PURE__ */ import_react12.default.createElement("aside", { className: "ws-contacts", "aria-label": t("customers") }, /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-contacts-head" }, /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-intent-sortline" }, /* @__PURE__ */ import_react12.default.createElement("h2", null, t("customers")), /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-intent-sort-control" }, /* @__PURE__ */ import_react12.default.createElement("select", { className: "ws-intent-sort", "aria-label": t("intentSort"), value: sort, onChange: (event) => setSort(event.currentTarget.value === "intent" ? "intent" : "recent") }, /* @__PURE__ */ import_react12.default.createElement("option", { value: "recent" }, t("intentSortRecent")), /* @__PURE__ */ import_react12.default.createElement("option", { value: "intent" }, t("intentSortHigh"))), /* @__PURE__ */ import_react12.default.createElement(Glyph, { name: "chevron", size: 12 }))), /* @__PURE__ */ import_react12.default.createElement("label", { className: "ws-search" }, /* @__PURE__ */ import_react12.default.createElement(Glyph, { name: "search", size: 15 }), /* @__PURE__ */ import_react12.default.createElement("input", { name: "sales-search", autoComplete: "off", "aria-label": t("search"), placeholder: t("search"), value: query, onChange: (e) => setQuery(e.target.value) })), /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-filters", role: "group", "aria-label": t("customers") }, ["all", "pending", "handled"].map((value) => /* @__PURE__ */ import_react12.default.createElement("button", { key: value, type: "button", "aria-pressed": filter === value, onClick: () => setFilter(value) }, t(value), /* @__PURE__ */ import_react12.default.createElement("span", null, value === "all" ? state.contacts.length : value === "pending" ? pending : state.contacts.length - pending))))), /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-contact-list" }, contacts.map((c) => /* @__PURE__ */ import_react12.default.createElement("button", { key: c.id, className: `ws-contact ${c.id === contact.id ? "is-selected" : ""}`, "aria-pressed": c.id === contact.id, onClick: () => select(c.id) }, /* @__PURE__ */ import_react12.default.createElement(WechatAvatar, { client: wechat, scope: JSON.stringify([selectedWorkspace, c.wechat?.accountId]), owner: c.wechat?.chatKey ?? c.id, mediaId: c.wechat?.avatarId, fallback: c.initials }), /* @__PURE__ */ import_react12.default.createElement("span", { className: "ws-contact-content" }, /* @__PURE__ */ import_react12.default.createElement("span", { className: "ws-contact-line" }, /* @__PURE__ */ import_react12.default.createElement("strong", { title: c.name }, c.name), /* @__PURE__ */ import_react12.default.createElement("time", { dateTime: c.time, title: c.time }, displayTime(c.time))), /* @__PURE__ */ import_react12.default.createElement("span", { className: "ws-preview" }, c.wechat && c.preview === "[image]" ? t("wxImageListPreview") : c.preview), c.wechat && /* @__PURE__ */ import_react12.default.createElement(IntentBadge, { intent: c.intent, t })))), !contacts.length && /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-empty" }, /* @__PURE__ */ import_react12.default.createElement(Glyph, { name: "search", size: 26 }), /* @__PURE__ */ import_react12.default.createElement("p", null, t(state.contacts.length ? "noResults" : presentation.emptyKey)), state.contacts.length > 0 && /* @__PURE__ */ import_react12.default.createElement("button", { className: "ws-text-button", onClick: () => {
|
|
13018
13357
|
setQuery("");
|
|
13019
13358
|
setFilter("all");
|
|
13020
|
-
} }, t("clearSearch")))), /* @__PURE__ */
|
|
13359
|
+
} }, t("clearSearch")))), /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-sync" }, state.contacts.length > 0 ? /* @__PURE__ */ import_react12.default.createElement(SyncFooter, { view, t }) : /* @__PURE__ */ import_react12.default.createElement("span", null, /* @__PURE__ */ import_react12.default.createElement("span", { className: "ws-dot" }), t("wxLocalHistory")))), /* @__PURE__ */ import_react12.default.createElement("main", { className: "ws-conversation" }, !contact.id ? /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-conversation-empty" }, /* @__PURE__ */ import_react12.default.createElement(Glyph, { name: "chat", size: 34 }), /* @__PURE__ */ import_react12.default.createElement("h2", null, t("wxRealTitle")), /* @__PURE__ */ import_react12.default.createElement("p", null, syncActive || syncPercent !== void 0 ? /* @__PURE__ */ import_react12.default.createElement(SyncActivity, { active: syncActive, percent: syncPercent }, t(syncActive ? "wxSyncingHint" : syncLabel)) : t(presentation.blocked ? "wxAwaitConnectionHistory" : presentation.hintKey ?? "wxSelectChat")), (syncActive || syncPercent !== void 0) && /* @__PURE__ */ import_react12.default.createElement(SyncProgressTrack, { progress: syncProgress, active: syncActive, t })) : /* @__PURE__ */ import_react12.default.createElement(import_react12.default.Fragment, null, /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-conversation-head" }, /* @__PURE__ */ import_react12.default.createElement("button", { className: "ws-icon-button ws-mobile-back", "aria-label": t("contactsBack"), onClick: () => setShowChat(false) }, /* @__PURE__ */ import_react12.default.createElement(Glyph, { name: "arrow" })), /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-person-title" }, /* @__PURE__ */ import_react12.default.createElement("h2", null, contact.name, !contact.wechat && /* @__PURE__ */ import_react12.default.createElement("span", null, contact.segment)), /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-person-meta" }, /* @__PURE__ */ import_react12.default.createElement("span", { className: "ws-person-source" }, /* @__PURE__ */ import_react12.default.createElement("span", { className: "ws-dot", "aria-hidden": "true" }), t("wechat"), /* @__PURE__ */ import_react12.default.createElement("span", { className: "ws-separator", "aria-hidden": "true" }, "/"), contact.wechat ? contact.crm ? t("wxBound") : t("wxUnbound") : t("sampleContact")), contact.wechat && /* @__PURE__ */ import_react12.default.createElement(IntentDetails, { key: contact.id, intent: contact.intent, t }))), /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-conversation-actions" }, /* @__PURE__ */ import_react12.default.createElement("button", { className: "ws-button ws-handle", disabled: frozen || contact.status === "handled", onClick: () => {
|
|
13021
13360
|
dispatch({ type: "handled", id: contact.id });
|
|
13022
13361
|
setNotice(t(contact.wechat ? "wxHandled" : "handledDone"));
|
|
13023
|
-
} }, /* @__PURE__ */
|
|
13362
|
+
} }, /* @__PURE__ */ import_react12.default.createElement(Glyph, { name: "check", size: 15 }), contact.status === "handled" ? t("handled") : t("markHandled")), /* @__PURE__ */ import_react12.default.createElement("button", { type: "button", className: "ws-button ws-profile-toggle", ref: openProfileButton, "aria-label": t("expand"), "aria-controls": profileId, "aria-expanded": profileVisibility === "open", onClick: () => setProfileVisibility("open") }, /* @__PURE__ */ import_react12.default.createElement(Glyph, { name: "user", size: 15 }), /* @__PURE__ */ import_react12.default.createElement("span", null, t("profile"))))), /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-history-wrap" }, /* @__PURE__ */ import_react12.default.createElement("div", { ref: reading.viewport, onScroll: reading.onScroll, className: "ws-messages", role: "region", tabIndex: 0, "aria-label": t("conversation") }, /* @__PURE__ */ import_react12.default.createElement("div", { ref: reading.content }, /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-date" }, /* @__PURE__ */ import_react12.default.createElement("span", null, contact.wechat ? t("wxHistory") : t("today"))), contact.wechat && wechat && view.contactId === contact.id ? /* @__PURE__ */ import_react12.default.createElement(import_react12.default.Fragment, null, view.hasMore && /* @__PURE__ */ import_react12.default.createElement("button", { className: "ws-button ws-earlier", onClick: () => void wechat.messages(contact.id, true).catch((e) => setNotice(e.message)) }, t("wxEarlier")), view.messages.map((m) => /* @__PURE__ */ import_react12.default.createElement("div", { key: m.id, "data-message-id": m.id, className: `ws-message ${m.direction === "outbound" ? "ws-out" : ""}` }, /* @__PURE__ */ import_react12.default.createElement(WechatAvatar, { client: wechat, scope: JSON.stringify([selectedWorkspace, contact.wechat.accountId]), owner: m.direction === "outbound" ? contact.wechat.accountId : contact.wechat.chatKey, mediaId: m.direction === "outbound" ? contact.wechat.selfAvatarId : contact.wechat.avatarId, fallback: m.direction === "outbound" ? t("user") : contact.initials, className: "ws-message-avatar" }), /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-message-content" }, /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-message-meta" }, /* @__PURE__ */ import_react12.default.createElement("span", null, m.direction === "inbound" ? contact.name : m.direction === "outbound" ? t("user") : t("wxSystem")), /* @__PURE__ */ import_react12.default.createElement("time", { dateTime: m.sentAt, title: m.sentAt }, displayTime(m.sentAt, true))), /* @__PURE__ */ import_react12.default.createElement("div", { className: `ws-bubble${m.kind === "voice" || m.kind === "audio" ? " ws-voice-bubble" : ""}` }, /* @__PURE__ */ import_react12.default.createElement(WechatMessageBody, { message: m, client: wechat, contactId: contact.id, onPrioritize: mediaPriorityReady ? () => wechat.prioritizeMedia(contact.id, crypto.randomUUID(), m.id) : void 0, revision: view.status?.revision, t })))))) : contact.messages.map((message) => /* @__PURE__ */ import_react12.default.createElement("div", { key: message.id, "data-message-id": message.id, className: `ws-message ${message.direction === "out" ? "ws-out" : ""}` }, /* @__PURE__ */ import_react12.default.createElement("span", { className: "ws-avatar ws-message-avatar" }, message.direction === "out" ? t("user") : contact.initials), /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-message-content" }, /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-message-meta" }, /* @__PURE__ */ import_react12.default.createElement("span", null, message.direction === "out" ? t("user") : contact.name), /* @__PURE__ */ import_react12.default.createElement("time", null, message.time)), /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-bubble" }, message.text)))))), reading.unseen && /* @__PURE__ */ import_react12.default.createElement("button", { type: "button", className: "ws-latest-action", onClick: reading.goToLatest }, /* @__PURE__ */ import_react12.default.createElement("span", { className: "ws-latest-dot", "aria-hidden": "true" }), t("wxNewMessagesLatest"), /* @__PURE__ */ import_react12.default.createElement("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", "aria-hidden": "true" }, /* @__PURE__ */ import_react12.default.createElement("path", { d: "m6 9 6 6 6-6" })))), /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-replies" }, /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-reply-heading" }, /* @__PURE__ */ import_react12.default.createElement("div", null, /* @__PURE__ */ import_react12.default.createElement(Glyph, { name: "spark", size: 16 }), /* @__PURE__ */ import_react12.default.createElement("h3", null, t("reply")), /* @__PURE__ */ import_react12.default.createElement("span", { className: "ws-example-badge" }, t(replyView.key))), /* @__PURE__ */ import_react12.default.createElement("button", { className: "ws-text-button", disabled: frozen || running || !selectedWorkspace || !replyView.canGenerate, onClick: () => {
|
|
13024
13363
|
setCopyResult(null);
|
|
13025
13364
|
setNotice("");
|
|
13026
13365
|
void generate(selectedWorkspace, contact.id);
|
|
13027
|
-
} }, /* @__PURE__ */
|
|
13366
|
+
} }, /* @__PURE__ */ import_react12.default.createElement(Glyph, { name: "spark", size: 14 }), running ? t("generating") : t("generate"))), replyView.hint && /* @__PURE__ */ import_react12.default.createElement("p", { className: "ws-draft-hint" }, t(replyView.hint)), workspaceState.error && /* @__PURE__ */ import_react12.default.createElement("p", { role: "status" }, workspaceState.error), state.stale?.[contact.id] && /* @__PURE__ */ import_react12.default.createElement("p", { role: "status" }, t("wxStale")), /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-agent-status", role: "status", "aria-live": "polite" }, running ? t(generation.progress ? generationStageLabels[generation.progress.stage] : "generatingNote") : generation?.status === "error" ? generation.error : generation?.result?.no_send ? t("stopNotice") : ""), running && generation.progress?.preview?.trim() && /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-stream-preview", role: "region", "aria-label": t("generationPreview"), "aria-busy": "true" }, /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-stream-preview-heading" }, /* @__PURE__ */ import_react12.default.createElement("strong", null, t("generationPreview")), /* @__PURE__ */ import_react12.default.createElement("span", null, t("generationPreviewPending"))), /* @__PURE__ */ import_react12.default.createElement("p", { tabIndex: 0 }, generation.progress.preview), /* @__PURE__ */ import_react12.default.createElement("small", null, t("generationPreviewNote"))), contact.customerContext?.state === "unavailable" && contact.customerContext.workspaceId === selectedWorkspace && /* @__PURE__ */ import_react12.default.createElement("p", { role: "status" }, t("customerContextUnavailable")), generation?.result && /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-agent-analysis" }, /* @__PURE__ */ import_react12.default.createElement("strong", null, t("judgment")), /* @__PURE__ */ import_react12.default.createElement("p", null, generation.result.judgment), /* @__PURE__ */ import_react12.default.createElement("strong", null, t("nextStep")), /* @__PURE__ */ import_react12.default.createElement("p", null, generation.result.next_step), !generation.applied && /* @__PURE__ */ import_react12.default.createElement(import_react12.default.Fragment, null, /* @__PURE__ */ import_react12.default.createElement("p", null, t("preservedEdit")), /* @__PURE__ */ import_react12.default.createElement("button", { className: "ws-button", disabled: frozen, onClick: () => dispatch({ type: "apply-generated", id: contact.id }) }, t("applyGenerated")))), wechatSendingEnabled && approval && /* @__PURE__ */ import_react12.default.createElement("div", { role: "region", "aria-label": t("wxAppApproval"), className: "ws-notice" }, /* @__PURE__ */ import_react12.default.createElement("p", null, t("wxAppApprovalNote")), /* @__PURE__ */ import_react12.default.createElement("button", { type: "button", className: "ws-button", disabled: answeringApproval, onClick: () => {
|
|
13028
13367
|
setAnsweringApproval(true);
|
|
13029
13368
|
void wechat?.deliveryApproval(approval.requestId, true).then(() => setApproval(void 0)).catch((e) => setNotice(e.message)).finally(() => setAnsweringApproval(false));
|
|
13030
|
-
} }, t("wxAppAllow")), /* @__PURE__ */
|
|
13369
|
+
} }, t("wxAppAllow")), /* @__PURE__ */ import_react12.default.createElement("button", { type: "button", className: "ws-button", disabled: answeringApproval, onClick: () => {
|
|
13031
13370
|
setAnsweringApproval(true);
|
|
13032
13371
|
void wechat?.deliveryApproval(approval.requestId, false).then(() => setApproval(void 0)).catch((e) => setNotice(e.message)).finally(() => setAnsweringApproval(false));
|
|
13033
|
-
} }, t("wxAppDeny"))), /* @__PURE__ */
|
|
13372
|
+
} }, t("wxAppDeny"))), /* @__PURE__ */ import_react12.default.createElement(ReplyEditor, { key: contact.id, value: draft, t, disabled: frozen, reviewedRequest: generation?.status === "done" && generation.applied ? generation.requestId : void 0, onChange: (text4) => {
|
|
13034
13373
|
dispatch({ type: "edit", id: contact.id, text: text4 });
|
|
13035
13374
|
setCopyResult(null);
|
|
13036
|
-
} }), /* @__PURE__ */
|
|
13375
|
+
} }), /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-editor-footer" }, /* @__PURE__ */ import_react12.default.createElement("span", { className: "ws-char-count" }, draft.length, " ", t("chars")), /* @__PURE__ */ import_react12.default.createElement("button", { type: "button", className: "ws-button ws-primary", disabled: !canCopy, onClick: () => {
|
|
13037
13376
|
void copy();
|
|
13038
|
-
} }, /* @__PURE__ */
|
|
13377
|
+
} }, /* @__PURE__ */ import_react12.default.createElement(Glyph, { name: copyResult?.id === contact.id && copyResult.success ? "check" : "copy", size: 15 }), copyResult?.id === contact.id && copyResult.success ? t("copied") : t("copy"))), wechatSendingEnabled && contact.wechat && /* @__PURE__ */ import_react12.default.createElement("p", { role: "status", "aria-live": "polite" }, !delivery.available ? t("wxCuaRequired") : delivery.status === "sending" ? t("wxSending") : delivery.status === "awaiting-receipt" ? t("wxAwaitReceipt") : delivery.status === "sent" ? t("wxSent") : ["unknown", "claimed", "stopped", "blocked"].includes(delivery.status) ? t("wxSendStopped") : t("wxManualNote")), state.historyErrors?.[contact.id] && /* @__PURE__ */ import_react12.default.createElement("p", { role: "status" }, state.historyErrors[contact.id]), /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-notice", role: "status" }, copyResult?.id === contact.id && !copyResult.success ? t("copyError") : notice)))), contact.id && /* @__PURE__ */ import_react12.default.createElement("aside", { id: profileId, className: "ws-profile", "aria-label": t("profile") }, /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-profile-head" }, /* @__PURE__ */ import_react12.default.createElement("h2", null, t("profile")), /* @__PURE__ */ import_react12.default.createElement("button", { type: "button", className: "ws-icon-button ws-profile-close", ref: closeProfileButton, "aria-label": t("closeProfile"), title: t("closeProfile"), onClick: () => setProfileVisibility("closed") }, /* @__PURE__ */ import_react12.default.createElement(Glyph, { name: "close", size: 17 }))), /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-profile-person" }, /* @__PURE__ */ import_react12.default.createElement(WechatAvatar, { client: wechat, scope: JSON.stringify([selectedWorkspace, contact.wechat?.accountId]), owner: contact.wechat?.chatKey ?? contact.id, mediaId: contact.wechat?.avatarId, fallback: contact.initials, className: "ws-profile-avatar" }), /* @__PURE__ */ import_react12.default.createElement("h3", null, contact.name), /* @__PURE__ */ import_react12.default.createElement("p", null, contact.segment), /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-tags" }, contact.tags.map((tag) => /* @__PURE__ */ import_react12.default.createElement("span", { key: tag }, tag)))), contact.wechat && bindWechat && /* @__PURE__ */ import_react12.default.createElement(CrmForm, { key: contact.id, contact, t, frozen, dirty: updateFormDirty, bind: (binding) => bindWechat(selectedWorkspace, contact.id, binding) }), /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-profile-section" }, /* @__PURE__ */ import_react12.default.createElement("h3", null, t("interest")), /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-product" }, /* @__PURE__ */ import_react12.default.createElement(Glyph, { name: "chat", size: 18 }), /* @__PURE__ */ import_react12.default.createElement("div", null, /* @__PURE__ */ import_react12.default.createElement("strong", null, contact.product), /* @__PURE__ */ import_react12.default.createElement("p", null, contact.wechat ? t("wxContext") : t("contextHint")))), /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-budget" }, /* @__PURE__ */ import_react12.default.createElement("span", null, t("budget")), /* @__PURE__ */ import_react12.default.createElement("strong", null, contact.budget))), /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-profile-section" }, /* @__PURE__ */ import_react12.default.createElement("h3", null, t("facts")), /* @__PURE__ */ import_react12.default.createElement("dl", null, contact.facts.map((fact) => /* @__PURE__ */ import_react12.default.createElement("div", { key: fact.label }, /* @__PURE__ */ import_react12.default.createElement("dt", null, fact.label), /* @__PURE__ */ import_react12.default.createElement("dd", null, fact.value))))), /* @__PURE__ */ import_react12.default.createElement("div", { className: "ws-profile-caption" }, /* @__PURE__ */ import_react12.default.createElement(Glyph, { name: "spark", size: 14 }), /* @__PURE__ */ import_react12.default.createElement("span", null, contact.wechat ? t("wxSources") : t("profileNote"))))));
|
|
13039
13378
|
}
|
|
13040
13379
|
var inject = ["slots", "layout", "locale", "connection", "remote", "remote.session"];
|
|
13041
13380
|
function apply(ctx) {
|
|
13042
13381
|
mountSales(ctx, SalesPage, SalesIcon);
|
|
13043
13382
|
}
|
|
13044
13383
|
function CrmForm({ contact, bind, t, frozen, dirty }) {
|
|
13045
|
-
const [phone, setPhone] = (0,
|
|
13046
|
-
(0,
|
|
13384
|
+
const [phone, setPhone] = (0, import_react12.useState)(""), [sales, setSales] = (0, import_react12.useState)(""), [error, setError] = (0, import_react12.useState)("");
|
|
13385
|
+
(0, import_react12.useEffect)(() => {
|
|
13047
13386
|
dirty?.(!contact.crm && !!(phone || sales));
|
|
13048
13387
|
return () => dirty?.(false);
|
|
13049
13388
|
}, [phone, sales, contact.crm, dirty]);
|
|
13050
|
-
return /* @__PURE__ */
|
|
13389
|
+
return /* @__PURE__ */ import_react12.default.createElement("form", { className: "ws-profile-section", onSubmit: (e) => {
|
|
13051
13390
|
e.preventDefault();
|
|
13052
13391
|
void bind({ conversationId: contact.id, customerPhone: phone.trim(), salesName: sales.trim() }).catch((e2) => setError(e2.message));
|
|
13053
|
-
} }, /* @__PURE__ */
|
|
13392
|
+
} }, /* @__PURE__ */ import_react12.default.createElement("h3", null, t("wxCrmTitle")), contact.crm ? /* @__PURE__ */ import_react12.default.createElement("p", null, t("wxBound"), " ", contact.crm.customerPhone, " \xB7 ", contact.crm.salesName, "\u3002", t("wxCrmImmutable")) : /* @__PURE__ */ import_react12.default.createElement(import_react12.default.Fragment, null, /* @__PURE__ */ import_react12.default.createElement("p", null, t("wxCrmIntro")), /* @__PURE__ */ import_react12.default.createElement("label", null, t("wxPhone"), /* @__PURE__ */ import_react12.default.createElement("input", { disabled: frozen, required: true, inputMode: "tel", value: phone, onChange: (e) => setPhone(e.target.value) })), /* @__PURE__ */ import_react12.default.createElement("label", null, t("wxSales"), /* @__PURE__ */ import_react12.default.createElement("input", { disabled: frozen, required: true, value: sales, onChange: (e) => setSales(e.target.value) })), /* @__PURE__ */ import_react12.default.createElement("button", { disabled: frozen, className: "ws-button", type: "submit" }, t("wxBind"))), error && /* @__PURE__ */ import_react12.default.createElement("p", { role: "status" }, error));
|
|
13054
13393
|
}
|
|
13055
13394
|
|
|
13056
13395
|
return module.exports;}});
|