@huaqiu/dsh-hardware-ui 0.7.20 → 0.7.22
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/lib/client.js +585 -190
- package/lib/client.js.map +1 -1
- package/package.json +1 -1
- package/src/client/components.tsx +3 -0
- package/src/client/copy.ts +43 -13
- package/src/client/index.ts +81 -0
- package/src/client/locales.ts +54 -26
- package/src/client/model.ts +40 -0
- package/src/client/order.tsx +423 -453
- package/src/client/place-order.tsx +275 -0
- package/src/client/preview.tsx +4 -1
- package/src/client/store.ts +3 -0
- package/src/client/transport.ts +4 -4
package/lib/client.js
CHANGED
|
@@ -162,21 +162,35 @@ window.__ModuleLoader__.load({
|
|
|
162
162
|
"order.opening": "正在打开…",
|
|
163
163
|
"order.copyUrl": "复制链接",
|
|
164
164
|
"order.copied": "已复制",
|
|
165
|
-
"order.
|
|
166
|
-
"order.confirmTitlePcb": "上传板文件并创建 PCB 订单?",
|
|
167
|
-
"order.confirmTitleSmt": "上传贴片文件包?",
|
|
168
|
-
"order.confirmBody": "以下文件将发送到华秋下单服务。订单在那里创建,其页面会在右侧面板中打开;付款仍在该页面完成。",
|
|
169
|
-
"order.confirmZip": "{zip} — Gerber 与钻孔文件({size})",
|
|
170
|
-
"order.confirmPositions": "元件坐标({size})",
|
|
171
|
-
"order.confirmBom": "贴片 BOM({size})",
|
|
172
|
-
"order.confirmHostFallback": "已配置的下单服务",
|
|
173
|
-
"order.confirmAck": "我了解这些板文件将离开本机。",
|
|
174
|
-
"order.cancel": "取消",
|
|
175
|
-
"order.uploadAndOpen": "上传并打开订单页",
|
|
176
|
-
"order.uploading": "正在上传…",
|
|
165
|
+
"order.uploadHint": "点击「提交订单」即上传上面列出的文件到华秋并创建订单,订单页随后在右侧页签打开;付款在华秋页面完成。",
|
|
177
166
|
"order.batch": "生产数量",
|
|
178
167
|
"order.batchUnits": "{count} 片",
|
|
179
168
|
"order.quoteBasis": "报价基准 · {count} 片",
|
|
169
|
+
"order.placeOrder.title": "下单",
|
|
170
|
+
"order.placeOrder.lead": "从当前工作目录中选择一个 KiCad 工程,直接进入 PCB 或 PCBA 下单流程。",
|
|
171
|
+
"order.placeOrder.workspace": "工作目录",
|
|
172
|
+
"order.placeOrder.workspaceUnknown": "尚未确定工作目录",
|
|
173
|
+
"order.placeOrder.refresh": "重新扫描",
|
|
174
|
+
"order.placeOrder.refreshing": "正在扫描…",
|
|
175
|
+
"order.placeOrder.loading": "正在扫描工作目录中的 KiCad 工程…",
|
|
176
|
+
"order.placeOrder.noProjects": "这个工作目录里没有找到 KiCad 工程",
|
|
177
|
+
"order.placeOrder.noProjectsHint": "工程需要包含 .kicad_pro 文件。保存工程后点「重新扫描」。",
|
|
178
|
+
"order.placeOrder.discoveryFailed": "工程扫描失败:{detail}",
|
|
179
|
+
"order.placeOrder.colProject": "工程",
|
|
180
|
+
"order.placeOrder.colArtifacts": "工程文件",
|
|
181
|
+
"order.placeOrder.colActions": "下单",
|
|
182
|
+
"order.placeOrder.pcbAction": "下 PCB",
|
|
183
|
+
"order.placeOrder.pcbaAction": "下 PCBA",
|
|
184
|
+
"order.placeOrder.boardCount": "{count} 个 PCB",
|
|
185
|
+
"order.placeOrder.noSchematic": "缺少工程原理图,无法生成贴片 BOM 与坐标",
|
|
186
|
+
"order.placeOrder.noBoard": "缺少 .kicad_pcb,无法打包制板文件",
|
|
187
|
+
"order.placeOrder.needsKicad": "未配置 KiCad,无法打包 Gerber",
|
|
188
|
+
"order.placeOrder.kicadReady": "KiCad 已就绪",
|
|
189
|
+
"order.placeOrder.checking": "检测中…",
|
|
190
|
+
"order.placeOrder.needsSignIn": "未登录华秋账号,订单页将无法带登录态打开",
|
|
191
|
+
"order.placeOrder.signInReady": "已登录华秋",
|
|
192
|
+
"order.placeOrder.selectedProject": "当前工程",
|
|
193
|
+
"order.placeOrder.multipleProjects": "{count} 个工程",
|
|
180
194
|
"settings.title": "硬件工程",
|
|
181
195
|
"settings.lead": "用于预览、制板打包、一键调用本地程序以及 Agent 环境上下文的本地 EDA / MCAD 可执行文件。",
|
|
182
196
|
"settings.kicadTitle": "KiCad EDA 套件",
|
|
@@ -206,7 +220,7 @@ window.__ModuleLoader__.load({
|
|
|
206
220
|
"errors.stale-revision": "文件已变化,请刷新后重试。",
|
|
207
221
|
"errors.invalid-request": "请求参数不完整。",
|
|
208
222
|
"errors.invalid-application": "不支持该本地程序。",
|
|
209
|
-
"errors.confirmation-required": "
|
|
223
|
+
"errors.confirmation-required": "下单请求缺少确认标志,已被拒绝。",
|
|
210
224
|
"errors.invalid-order-url": "订单链接无效,已拒绝打开。",
|
|
211
225
|
"errors.order-unreachable": "无法连接下单服务。",
|
|
212
226
|
"errors.order-rejected": "下单服务未能返回可用的订单页。",
|
|
@@ -438,21 +452,35 @@ window.__ModuleLoader__.load({
|
|
|
438
452
|
"order.opening": "Opening…",
|
|
439
453
|
"order.copyUrl": "Copy link",
|
|
440
454
|
"order.copied": "Copied",
|
|
441
|
-
"order.
|
|
442
|
-
"order.confirmTitlePcb": "Upload board files and create a PCB order?",
|
|
443
|
-
"order.confirmTitleSmt": "Upload the assembly package?",
|
|
444
|
-
"order.confirmBody": "The following files will be sent to the Huaqiu ordering service. The order is created there and its page opens in the right panel; payment is completed on that page.",
|
|
445
|
-
"order.confirmZip": "{zip} — Gerber and drill files ({size})",
|
|
446
|
-
"order.confirmPositions": "Component positions ({size})",
|
|
447
|
-
"order.confirmBom": "Assembly BOM ({size})",
|
|
448
|
-
"order.confirmHostFallback": "the configured ordering service",
|
|
449
|
-
"order.confirmAck": "I understand these board files will leave this machine.",
|
|
450
|
-
"order.cancel": "Cancel",
|
|
451
|
-
"order.uploadAndOpen": "Upload and open order page",
|
|
452
|
-
"order.uploading": "Uploading…",
|
|
455
|
+
"order.uploadHint": "Clicking the order button uploads the files listed above to Huaqiu and creates the order; the order page then opens in a tab on the right, where payment is completed.",
|
|
453
456
|
"order.batch": "Quantity",
|
|
454
457
|
"order.batchUnits": "{count} boards",
|
|
455
458
|
"order.quoteBasis": "Quote basis · {count} boards",
|
|
459
|
+
"order.placeOrder.title": "Place Order",
|
|
460
|
+
"order.placeOrder.lead": "Pick one KiCad project from the current workspace and go straight to a PCB or PCBA order.",
|
|
461
|
+
"order.placeOrder.workspace": "Workspace",
|
|
462
|
+
"order.placeOrder.workspaceUnknown": "No workspace resolved yet",
|
|
463
|
+
"order.placeOrder.refresh": "Scan again",
|
|
464
|
+
"order.placeOrder.refreshing": "Scanning...",
|
|
465
|
+
"order.placeOrder.loading": "Scanning the workspace for KiCad projects...",
|
|
466
|
+
"order.placeOrder.noProjects": "No KiCad project in this workspace",
|
|
467
|
+
"order.placeOrder.noProjectsHint": "A project needs a .kicad_pro file. Save it, then scan again.",
|
|
468
|
+
"order.placeOrder.discoveryFailed": "Project scan failed: {detail}",
|
|
469
|
+
"order.placeOrder.colProject": "Project",
|
|
470
|
+
"order.placeOrder.colArtifacts": "Files",
|
|
471
|
+
"order.placeOrder.colActions": "Order",
|
|
472
|
+
"order.placeOrder.pcbAction": "Order PCB",
|
|
473
|
+
"order.placeOrder.pcbaAction": "Order PCBA",
|
|
474
|
+
"order.placeOrder.boardCount": "{count} PCB",
|
|
475
|
+
"order.placeOrder.noSchematic": "No project schematic, so no positions or assembly BOM",
|
|
476
|
+
"order.placeOrder.noBoard": "No .kicad_pcb, so no fabrication package",
|
|
477
|
+
"order.placeOrder.needsKicad": "KiCad is not configured, so Gerbers cannot be packaged",
|
|
478
|
+
"order.placeOrder.kicadReady": "KiCad ready",
|
|
479
|
+
"order.placeOrder.checking": "Checking…",
|
|
480
|
+
"order.placeOrder.needsSignIn": "Not signed in to Huaqiu, so the order page cannot open signed in",
|
|
481
|
+
"order.placeOrder.signInReady": "Signed in to Huaqiu",
|
|
482
|
+
"order.placeOrder.selectedProject": "Current project",
|
|
483
|
+
"order.placeOrder.multipleProjects": "{count} projects",
|
|
456
484
|
"settings.title": "Hardware Engineering",
|
|
457
485
|
"settings.lead": "Local EDA / MCAD executables used for previews, fabrication packaging, one-click local open and agent environment context.",
|
|
458
486
|
"settings.kicadTitle": "KiCad EDA suite",
|
|
@@ -482,7 +510,7 @@ window.__ModuleLoader__.load({
|
|
|
482
510
|
"errors.stale-revision": "The file changed; refresh and try again.",
|
|
483
511
|
"errors.invalid-request": "The request parameters are incomplete.",
|
|
484
512
|
"errors.invalid-application": "This local application is not supported.",
|
|
485
|
-
"errors.confirmation-required": "
|
|
513
|
+
"errors.confirmation-required": "The order request carried no confirmation flag, so it was refused.",
|
|
486
514
|
"errors.invalid-order-url": "The order link is invalid and was refused.",
|
|
487
515
|
"errors.order-unreachable": "Could not connect to the ordering service.",
|
|
488
516
|
"errors.order-rejected": "The ordering service did not return a usable order page.",
|
|
@@ -1014,41 +1042,99 @@ window.__ModuleLoader__.load({
|
|
|
1014
1042
|
get copied() {
|
|
1015
1043
|
return translateCopy("order.copied");
|
|
1016
1044
|
},
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
get
|
|
1024
|
-
return translateCopy("order.
|
|
1025
|
-
},
|
|
1026
|
-
get confirmBody() {
|
|
1027
|
-
return translateCopy("order.confirmBody");
|
|
1028
|
-
},
|
|
1029
|
-
confirmZip: (zip, size) => translateCopy("order.confirmZip", {
|
|
1030
|
-
zip,
|
|
1031
|
-
size
|
|
1032
|
-
}),
|
|
1033
|
-
confirmPositions: (size) => translateCopy("order.confirmPositions", { size }),
|
|
1034
|
-
confirmBom: (size) => translateCopy("order.confirmBom", { size }),
|
|
1035
|
-
confirmHost: (baseUrl) => baseUrl ?? translateCopy("order.confirmHostFallback"),
|
|
1036
|
-
get confirmAck() {
|
|
1037
|
-
return translateCopy("order.confirmAck");
|
|
1038
|
-
},
|
|
1039
|
-
get cancel() {
|
|
1040
|
-
return translateCopy("order.cancel");
|
|
1041
|
-
},
|
|
1042
|
-
get uploadAndOpen() {
|
|
1043
|
-
return translateCopy("order.uploadAndOpen");
|
|
1044
|
-
},
|
|
1045
|
-
get uploading() {
|
|
1046
|
-
return translateCopy("order.uploading");
|
|
1045
|
+
/**
|
|
1046
|
+
* The one-click contract, stated once where the click happens.
|
|
1047
|
+
*
|
|
1048
|
+
* There is no confirmation dialog: the button uploads, so the panel says
|
|
1049
|
+
* that plainly instead of asking afterwards.
|
|
1050
|
+
*/
|
|
1051
|
+
get uploadHint() {
|
|
1052
|
+
return translateCopy("order.uploadHint");
|
|
1047
1053
|
},
|
|
1048
1054
|
get batch() {
|
|
1049
1055
|
return translateCopy("order.batch");
|
|
1050
1056
|
},
|
|
1051
1057
|
batchUnits: (count) => translateCopy("order.batchUnits", { count }),
|
|
1058
|
+
/**
|
|
1059
|
+
* The project-selection view in front of this destination.
|
|
1060
|
+
*
|
|
1061
|
+
* It only chooses *what* to order; the package, the price, the token and the
|
|
1062
|
+
* page stay where they already were, so this block is deliberately short.
|
|
1063
|
+
*/
|
|
1064
|
+
placeOrder: {
|
|
1065
|
+
get title() {
|
|
1066
|
+
return translateCopy("order.placeOrder.title");
|
|
1067
|
+
},
|
|
1068
|
+
get lead() {
|
|
1069
|
+
return translateCopy("order.placeOrder.lead");
|
|
1070
|
+
},
|
|
1071
|
+
get workspace() {
|
|
1072
|
+
return translateCopy("order.placeOrder.workspace");
|
|
1073
|
+
},
|
|
1074
|
+
get workspaceUnknown() {
|
|
1075
|
+
return translateCopy("order.placeOrder.workspaceUnknown");
|
|
1076
|
+
},
|
|
1077
|
+
get refresh() {
|
|
1078
|
+
return translateCopy("order.placeOrder.refresh");
|
|
1079
|
+
},
|
|
1080
|
+
get refreshing() {
|
|
1081
|
+
return translateCopy("order.placeOrder.refreshing");
|
|
1082
|
+
},
|
|
1083
|
+
get loading() {
|
|
1084
|
+
return translateCopy("order.placeOrder.loading");
|
|
1085
|
+
},
|
|
1086
|
+
get noProjects() {
|
|
1087
|
+
return translateCopy("order.placeOrder.noProjects");
|
|
1088
|
+
},
|
|
1089
|
+
get noProjectsHint() {
|
|
1090
|
+
return translateCopy("order.placeOrder.noProjectsHint");
|
|
1091
|
+
},
|
|
1092
|
+
discoveryFailed: (detail) => translateCopy("order.placeOrder.discoveryFailed", { detail }),
|
|
1093
|
+
get colProject() {
|
|
1094
|
+
return translateCopy("order.placeOrder.colProject");
|
|
1095
|
+
},
|
|
1096
|
+
get colArtifacts() {
|
|
1097
|
+
return translateCopy("order.placeOrder.colArtifacts");
|
|
1098
|
+
},
|
|
1099
|
+
get colActions() {
|
|
1100
|
+
return translateCopy("order.placeOrder.colActions");
|
|
1101
|
+
},
|
|
1102
|
+
get pcbAction() {
|
|
1103
|
+
return translateCopy("order.placeOrder.pcbAction");
|
|
1104
|
+
},
|
|
1105
|
+
get pcbaAction() {
|
|
1106
|
+
return translateCopy("order.placeOrder.pcbaAction");
|
|
1107
|
+
},
|
|
1108
|
+
boardCount: (count) => translateCopy("order.placeOrder.boardCount", { count }),
|
|
1109
|
+
get noSchematic() {
|
|
1110
|
+
return translateCopy("order.placeOrder.noSchematic");
|
|
1111
|
+
},
|
|
1112
|
+
get noBoard() {
|
|
1113
|
+
return translateCopy("order.placeOrder.noBoard");
|
|
1114
|
+
},
|
|
1115
|
+
get needsKicad() {
|
|
1116
|
+
return translateCopy("order.placeOrder.needsKicad");
|
|
1117
|
+
},
|
|
1118
|
+
get kicadReady() {
|
|
1119
|
+
return translateCopy("order.placeOrder.kicadReady");
|
|
1120
|
+
},
|
|
1121
|
+
/** Emitted while the readiness probes are still in flight, never as a claim. */
|
|
1122
|
+
get checking() {
|
|
1123
|
+
return translateCopy("order.placeOrder.checking");
|
|
1124
|
+
},
|
|
1125
|
+
get needsSignIn() {
|
|
1126
|
+
return translateCopy("order.placeOrder.needsSignIn");
|
|
1127
|
+
},
|
|
1128
|
+
get signInReady() {
|
|
1129
|
+
return translateCopy("order.placeOrder.signInReady");
|
|
1130
|
+
},
|
|
1131
|
+
get selectedProject() {
|
|
1132
|
+
return translateCopy("order.placeOrder.selectedProject");
|
|
1133
|
+
},
|
|
1134
|
+
get multipleProjects() {
|
|
1135
|
+
return translateCopy("order.placeOrder.multipleProjects");
|
|
1136
|
+
}
|
|
1137
|
+
},
|
|
1052
1138
|
quoteBasis: (count) => translateCopy("order.quoteBasis", { count })
|
|
1053
1139
|
},
|
|
1054
1140
|
/**
|
|
@@ -107554,9 +107640,10 @@ while (n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3]
|
|
|
107554
107640
|
});
|
|
107555
107641
|
}
|
|
107556
107642
|
/**
|
|
107557
|
-
* Submit one order.
|
|
107558
|
-
*
|
|
107559
|
-
*
|
|
107643
|
+
* Submit one order. The upload is the user's click on the order card, so there
|
|
107644
|
+
* is no confirmation flag to pass and no second dialog to satisfy: the panel
|
|
107645
|
+
* shows the exact package first, then posts it. The host never opens the page
|
|
107646
|
+
* by itself — the client shows `orderUrl` in its own Browser tab.
|
|
107560
107647
|
*/
|
|
107561
107648
|
async function placeOrder(kind, requestBody, signal) {
|
|
107562
107649
|
return request(`/order/${kind}`, {
|
|
@@ -145415,8 +145502,9 @@ void main() {
|
|
|
145415
145502
|
*
|
|
145416
145503
|
* The panel never prices anything and never keeps its own order backend. It
|
|
145417
145504
|
* prepares the fabrication package with `kicad-cli` through the host, shows
|
|
145418
|
-
* exactly
|
|
145419
|
-
*
|
|
145505
|
+
* exactly which files and which board facts the upload carries, and then
|
|
145506
|
+
* uploads on the click itself — one click, one real order. The URL shown
|
|
145507
|
+
* afterwards is the backend's own URL, passed through.
|
|
145420
145508
|
*/
|
|
145421
145509
|
const QUANTITIES = [
|
|
145422
145510
|
5,
|
|
@@ -145484,7 +145572,7 @@ void main() {
|
|
|
145484
145572
|
overflow: "hidden",
|
|
145485
145573
|
textOverflow: "ellipsis"
|
|
145486
145574
|
};
|
|
145487
|
-
const ROW$
|
|
145575
|
+
const ROW$2 = {
|
|
145488
145576
|
display: "flex",
|
|
145489
145577
|
alignItems: "center",
|
|
145490
145578
|
gap: 6,
|
|
@@ -145492,7 +145580,7 @@ void main() {
|
|
|
145492
145580
|
minWidth: 0
|
|
145493
145581
|
};
|
|
145494
145582
|
const SPREAD = {
|
|
145495
|
-
...ROW$
|
|
145583
|
+
...ROW$2,
|
|
145496
145584
|
justifyContent: "space-between"
|
|
145497
145585
|
};
|
|
145498
145586
|
const TAG = {
|
|
@@ -145512,39 +145600,15 @@ void main() {
|
|
|
145512
145600
|
textDecoration: "underline",
|
|
145513
145601
|
textUnderlineOffset: 2
|
|
145514
145602
|
};
|
|
145515
|
-
const DIALOG_BACKDROP = {
|
|
145516
|
-
position: "absolute",
|
|
145517
|
-
inset: 0,
|
|
145518
|
-
background: "rgba(0,0,0,0.55)",
|
|
145519
|
-
backdropFilter: "blur(2px)",
|
|
145520
|
-
display: "flex",
|
|
145521
|
-
alignItems: "center",
|
|
145522
|
-
justifyContent: "center",
|
|
145523
|
-
padding: 14,
|
|
145524
|
-
zIndex: 20
|
|
145525
|
-
};
|
|
145526
|
-
const DIALOG = {
|
|
145527
|
-
width: "100%",
|
|
145528
|
-
maxWidth: 420,
|
|
145529
|
-
maxHeight: "90%",
|
|
145530
|
-
overflow: "auto",
|
|
145531
|
-
background: C.card,
|
|
145532
|
-
border: `1px solid ${C.border}`,
|
|
145533
|
-
borderRadius: R.lg,
|
|
145534
|
-
boxShadow: "0 24px 60px rgba(0,0,0,0.45)",
|
|
145535
|
-
padding: 14,
|
|
145536
|
-
display: "flex",
|
|
145537
|
-
flexDirection: "column",
|
|
145538
|
-
gap: 10
|
|
145539
|
-
};
|
|
145540
145603
|
/** One workflow card: what it will do, what it needs, and its action. */
|
|
145541
145604
|
function workflowCard(input) {
|
|
145542
145605
|
const blocked = input.blocked !== void 0;
|
|
145606
|
+
const off = blocked || input.busy || input.locked === true;
|
|
145543
145607
|
return (0, react.createElement)("div", {
|
|
145544
145608
|
style: cardStyle({ gap: 9 }),
|
|
145545
145609
|
"data-hardware-order-card": input.tag.toLowerCase()
|
|
145546
145610
|
}, (0, react.createElement)("div", { style: {
|
|
145547
|
-
...ROW$
|
|
145611
|
+
...ROW$2,
|
|
145548
145612
|
gap: 7
|
|
145549
145613
|
} }, (0, react.createElement)("span", { style: {
|
|
145550
145614
|
...TAG,
|
|
@@ -145568,33 +145632,71 @@ void main() {
|
|
|
145568
145632
|
style: {
|
|
145569
145633
|
...buttonStyle("primary"),
|
|
145570
145634
|
width: "100%",
|
|
145571
|
-
...disabled(
|
|
145635
|
+
...disabled(off)
|
|
145572
145636
|
},
|
|
145573
|
-
disabled:
|
|
145637
|
+
disabled: off,
|
|
145574
145638
|
"data-hardware-order-action": input.tag.toLowerCase(),
|
|
145575
145639
|
onClick: input.onAction
|
|
145576
145640
|
}, input.busy ? COPY.order.submitting : input.action));
|
|
145577
145641
|
}
|
|
145578
145642
|
function OrderPanel(props) {
|
|
145579
|
-
const { boardPath, boardTitle, schematicPath, workspaceRoot, session, configured } = props;
|
|
145643
|
+
const { boardPath, boardTitle, schematicPath, workspaceRoot, session, configured, focus } = props;
|
|
145580
145644
|
const [config, setConfig] = (0, react.useState)();
|
|
145581
145645
|
const [prepared, setPrepared] = (0, react.useState)();
|
|
145582
145646
|
const [preparing, setPreparing] = (0, react.useState)(false);
|
|
145583
145647
|
const [message, setMessage] = (0, react.useState)();
|
|
145584
145648
|
const [quantity, setQuantity] = (0, react.useState)(20);
|
|
145585
|
-
const [confirming, setConfirming] = (0, react.useState)();
|
|
145586
|
-
const [acknowledged, setAcknowledged] = (0, react.useState)(false);
|
|
145587
145649
|
const [placing, setPlacing] = (0, react.useState)();
|
|
145588
145650
|
const [placed, setPlaced] = (0, react.useState)();
|
|
145589
145651
|
const [copied, setCopied] = (0, react.useState)(false);
|
|
145590
145652
|
const [reopening, setReopening] = (0, react.useState)(false);
|
|
145591
145653
|
const live = (0, react.useRef)(true);
|
|
145654
|
+
/** One in-flight upload at a time, checked before React can re-render. */
|
|
145655
|
+
const uploading = (0, react.useRef)(false);
|
|
145656
|
+
/** `${boardPath}:${kind}` already auto-placed, so a requote cannot upload twice. */
|
|
145657
|
+
const autoPlaced = (0, react.useRef)();
|
|
145592
145658
|
(0, react.useEffect)(() => {
|
|
145593
145659
|
live.current = true;
|
|
145594
145660
|
return () => {
|
|
145595
145661
|
live.current = false;
|
|
145596
145662
|
};
|
|
145597
145663
|
}, []);
|
|
145664
|
+
const submit = async (kind) => {
|
|
145665
|
+
if (uploading.current) return;
|
|
145666
|
+
uploading.current = true;
|
|
145667
|
+
setPlacing(kind);
|
|
145668
|
+
setMessage(void 0);
|
|
145669
|
+
try {
|
|
145670
|
+
const result = await placeOrder(kind, {
|
|
145671
|
+
path: boardPath,
|
|
145672
|
+
...schematicPath === void 0 ? {} : { schematic: schematicPath },
|
|
145673
|
+
...workspaceRoot === void 0 ? {} : { cwd: workspaceRoot },
|
|
145674
|
+
...session === void 0 ? {} : { session },
|
|
145675
|
+
quantity
|
|
145676
|
+
}, void 0);
|
|
145677
|
+
setPlaced(result);
|
|
145678
|
+
openOrderPage(result.orderUrl);
|
|
145679
|
+
} catch (error) {
|
|
145680
|
+
setMessage(messageOf$2(error));
|
|
145681
|
+
} finally {
|
|
145682
|
+
uploading.current = false;
|
|
145683
|
+
setPlacing(void 0);
|
|
145684
|
+
}
|
|
145685
|
+
};
|
|
145686
|
+
(0, react.useEffect)(() => {
|
|
145687
|
+
if (focus === void 0 || prepared === void 0 || !live.current) return;
|
|
145688
|
+
if (config?.hasToken !== true || placing !== void 0) return;
|
|
145689
|
+
const key = `${boardPath}:${focus}`;
|
|
145690
|
+
if (autoPlaced.current === key) return;
|
|
145691
|
+
autoPlaced.current = key;
|
|
145692
|
+
submit(focus);
|
|
145693
|
+
}, [
|
|
145694
|
+
focus,
|
|
145695
|
+
prepared,
|
|
145696
|
+
config,
|
|
145697
|
+
boardPath,
|
|
145698
|
+
placing
|
|
145699
|
+
]);
|
|
145598
145700
|
(0, react.useEffect)(() => {
|
|
145599
145701
|
loadOrderConfig().then((value) => {
|
|
145600
145702
|
if (live.current) setConfig(value);
|
|
@@ -145631,28 +145733,6 @@ void main() {
|
|
|
145631
145733
|
]);
|
|
145632
145734
|
const facts = prepared?.facts;
|
|
145633
145735
|
const specs = (0, react.useMemo)(() => facts === void 0 ? [] : specRows(facts), [facts]);
|
|
145634
|
-
const submit = async (kind) => {
|
|
145635
|
-
setPlacing(kind);
|
|
145636
|
-
setMessage(void 0);
|
|
145637
|
-
try {
|
|
145638
|
-
const result = await placeOrder(kind, {
|
|
145639
|
-
path: boardPath,
|
|
145640
|
-
...schematicPath === void 0 ? {} : { schematic: schematicPath },
|
|
145641
|
-
...workspaceRoot === void 0 ? {} : { cwd: workspaceRoot },
|
|
145642
|
-
...session === void 0 ? {} : { session },
|
|
145643
|
-
quantity,
|
|
145644
|
-
confirm: true
|
|
145645
|
-
}, void 0);
|
|
145646
|
-
setPlaced(result);
|
|
145647
|
-
setConfirming(void 0);
|
|
145648
|
-
setAcknowledged(false);
|
|
145649
|
-
openOrderPage(result.orderUrl);
|
|
145650
|
-
} catch (error) {
|
|
145651
|
-
setMessage(messageOf$2(error));
|
|
145652
|
-
} finally {
|
|
145653
|
-
setPlacing(void 0);
|
|
145654
|
-
}
|
|
145655
|
-
};
|
|
145656
145736
|
const copy = async () => {
|
|
145657
145737
|
if (placed === void 0) return;
|
|
145658
145738
|
try {
|
|
@@ -145732,10 +145812,10 @@ void main() {
|
|
|
145732
145812
|
}] : specs,
|
|
145733
145813
|
action: COPY.order.pcbAction,
|
|
145734
145814
|
onAction: () => {
|
|
145735
|
-
|
|
145736
|
-
setConfirming("pcb");
|
|
145815
|
+
submit("pcb");
|
|
145737
145816
|
},
|
|
145738
145817
|
busy: placing === "pcb",
|
|
145818
|
+
locked: placing !== void 0 && placing !== "pcb",
|
|
145739
145819
|
...configured && prepared !== void 0 ? tokenReady ? {} : { blocked: COPY.order.signInToOrder } : { blocked: configured ? COPY.order.waitingForPackage : COPY.order.configureToPackage }
|
|
145740
145820
|
});
|
|
145741
145821
|
const smtCard = workflowCard({
|
|
@@ -145759,14 +145839,14 @@ void main() {
|
|
|
145759
145839
|
],
|
|
145760
145840
|
action: COPY.order.smtAction,
|
|
145761
145841
|
onAction: () => {
|
|
145762
|
-
|
|
145763
|
-
setConfirming("smt");
|
|
145842
|
+
submit("smt");
|
|
145764
145843
|
},
|
|
145765
145844
|
busy: placing === "smt",
|
|
145845
|
+
locked: placing !== void 0 && placing !== "smt",
|
|
145766
145846
|
...assembly === void 0 ? { blocked: COPY.order.selectRootSchematic } : tokenReady ? {} : { blocked: COPY.order.signInToOrderSmt }
|
|
145767
145847
|
});
|
|
145768
145848
|
const agentHint = (0, react.createElement)("div", { style: {
|
|
145769
|
-
...ROW$
|
|
145849
|
+
...ROW$2,
|
|
145770
145850
|
gap: 4,
|
|
145771
145851
|
paddingTop: 2
|
|
145772
145852
|
} }, (0, react.createElement)("span", { style: {
|
|
@@ -145796,7 +145876,7 @@ void main() {
|
|
|
145796
145876
|
}, placed.orderUrl), (0, react.createElement)("p", { style: {
|
|
145797
145877
|
...MUTED,
|
|
145798
145878
|
fontSize: 10
|
|
145799
|
-
} }, COPY.order.resultNote), (0, react.createElement)("div", { style: ROW$
|
|
145879
|
+
} }, COPY.order.resultNote), (0, react.createElement)("div", { style: ROW$2 }, (0, react.createElement)("button", {
|
|
145800
145880
|
type: "button",
|
|
145801
145881
|
style: {
|
|
145802
145882
|
...buttonStyle("primary"),
|
|
@@ -145818,65 +145898,6 @@ void main() {
|
|
|
145818
145898
|
...MONO_TEXT,
|
|
145819
145899
|
fontSize: 10
|
|
145820
145900
|
} }, `${placed.archive.zipName} · ${formatBytes(placed.archive.zipBytes)}`)));
|
|
145821
|
-
const dialog = confirming === void 0 ? null : (0, react.createElement)("div", {
|
|
145822
|
-
style: DIALOG_BACKDROP,
|
|
145823
|
-
role: "dialog",
|
|
145824
|
-
"aria-modal": true,
|
|
145825
|
-
"aria-label": COPY.order.confirmAria,
|
|
145826
|
-
"data-hardware-order-confirm": confirming
|
|
145827
|
-
}, (0, react.createElement)("div", { style: DIALOG }, (0, react.createElement)("div", { style: {
|
|
145828
|
-
display: "flex",
|
|
145829
|
-
flexDirection: "column",
|
|
145830
|
-
gap: 3
|
|
145831
|
-
} }, (0, react.createElement)("h4", { style: {
|
|
145832
|
-
margin: 0,
|
|
145833
|
-
fontSize: 13,
|
|
145834
|
-
fontWeight: 600
|
|
145835
|
-
} }, confirming === "pcb" ? COPY.order.confirmTitlePcb : COPY.order.confirmTitleSmt), (0, react.createElement)("p", { style: MUTED }, COPY.order.confirmBody)), (0, react.createElement)("ul", { style: {
|
|
145836
|
-
margin: 0,
|
|
145837
|
-
paddingLeft: 16,
|
|
145838
|
-
fontSize: 11,
|
|
145839
|
-
color: C.text2,
|
|
145840
|
-
lineHeight: 1.7
|
|
145841
|
-
} }, (0, react.createElement)("li", null, COPY.order.confirmZip(prepared?.archive.zipName ?? "board.zip", zipSize ?? "—")), ...confirming === "smt" ? [(0, react.createElement)("li", { key: "pos" }, COPY.order.confirmPositions(assembly === void 0 ? "—" : formatBytes(assembly.positionsBytes))), (0, react.createElement)("li", { key: "bom" }, COPY.order.confirmBom(assembly === void 0 ? "—" : formatBytes(assembly.bomBytes)))] : [], (0, react.createElement)("li", { key: "host" }, (0, react.createElement)("span", { style: MONO_TEXT }, COPY.order.confirmHost(config?.baseUrl)))), (0, react.createElement)("label", { style: {
|
|
145842
|
-
...ROW$1,
|
|
145843
|
-
alignItems: "flex-start",
|
|
145844
|
-
fontSize: 11,
|
|
145845
|
-
color: C.text2,
|
|
145846
|
-
cursor: "pointer"
|
|
145847
|
-
} }, (0, react.createElement)("input", {
|
|
145848
|
-
type: "checkbox",
|
|
145849
|
-
checked: acknowledged,
|
|
145850
|
-
style: {
|
|
145851
|
-
marginTop: 2,
|
|
145852
|
-
accentColor: C.accent
|
|
145853
|
-
},
|
|
145854
|
-
onChange: (event) => {
|
|
145855
|
-
setAcknowledged(event.currentTarget.checked);
|
|
145856
|
-
},
|
|
145857
|
-
"data-hardware-order-ack": true
|
|
145858
|
-
}), COPY.order.confirmAck), (0, react.createElement)("div", { style: {
|
|
145859
|
-
...ROW$1,
|
|
145860
|
-
justifyContent: "flex-end"
|
|
145861
|
-
} }, (0, react.createElement)("button", {
|
|
145862
|
-
type: "button",
|
|
145863
|
-
style: buttonStyle("quiet"),
|
|
145864
|
-
onClick: () => {
|
|
145865
|
-
setConfirming(void 0);
|
|
145866
|
-
setAcknowledged(false);
|
|
145867
|
-
}
|
|
145868
|
-
}, COPY.order.cancel), (0, react.createElement)("button", {
|
|
145869
|
-
type: "button",
|
|
145870
|
-
style: {
|
|
145871
|
-
...buttonStyle("primary"),
|
|
145872
|
-
...disabled(!acknowledged || placing !== void 0)
|
|
145873
|
-
},
|
|
145874
|
-
disabled: !acknowledged || placing !== void 0,
|
|
145875
|
-
"data-hardware-order-confirm-submit": true,
|
|
145876
|
-
onClick: () => {
|
|
145877
|
-
submit(confirming);
|
|
145878
|
-
}
|
|
145879
|
-
}, placing === void 0 ? COPY.order.uploadAndOpen : COPY.order.uploading))));
|
|
145880
145901
|
return (0, react.createElement)("div", {
|
|
145881
145902
|
style: {
|
|
145882
145903
|
position: "relative",
|
|
@@ -145925,7 +145946,13 @@ void main() {
|
|
|
145925
145946
|
...MUTED,
|
|
145926
145947
|
...MONO_TEXT,
|
|
145927
145948
|
fontSize: 10
|
|
145928
|
-
} }, COPY.order.quoteBasis(quantity))), packageCard, resultCard,
|
|
145949
|
+
} }, COPY.order.quoteBasis(quantity))), packageCard, resultCard, (0, react.createElement)("p", {
|
|
145950
|
+
style: {
|
|
145951
|
+
...MUTED,
|
|
145952
|
+
fontSize: 10
|
|
145953
|
+
},
|
|
145954
|
+
"data-hardware-order-hint": true
|
|
145955
|
+
}, COPY.order.uploadHint), agentHint);
|
|
145929
145956
|
}
|
|
145930
145957
|
//#endregion
|
|
145931
145958
|
//#region src/client/preview.tsx
|
|
@@ -146338,7 +146365,7 @@ void main() {
|
|
|
146338
146365
|
} }, [row.dnp ? "DNP" : "", ...Object.entries(row.fields).map(([key, value]) => `${key}=${value}`)].filter(Boolean).join(" · "))))))));
|
|
146339
146366
|
}
|
|
146340
146367
|
/** Destination → preview dispatcher. */
|
|
146341
|
-
function HardwarePreview({ destination, artifact, schematicPath, workspaceRoot, session, revision, configured = false }) {
|
|
146368
|
+
function HardwarePreview({ destination, artifact, schematicPath, workspaceRoot, session, revision, configured = false, orderKind }) {
|
|
146342
146369
|
if (artifact === void 0) return null;
|
|
146343
146370
|
const key = `${destination}:${artifact.path}:${String(revision)}`;
|
|
146344
146371
|
if (destination === "schematic" || destination === "pcb") return (0, react.createElement)(EcadStage, {
|
|
@@ -146370,7 +146397,8 @@ void main() {
|
|
|
146370
146397
|
...schematicPath === void 0 ? {} : { schematicPath },
|
|
146371
146398
|
...workspaceRoot === void 0 ? {} : { workspaceRoot },
|
|
146372
146399
|
...session === void 0 ? {} : { session },
|
|
146373
|
-
configured
|
|
146400
|
+
configured,
|
|
146401
|
+
...orderKind === void 0 ? {} : { focus: orderKind }
|
|
146374
146402
|
});
|
|
146375
146403
|
}
|
|
146376
146404
|
//#endregion
|
|
@@ -147897,7 +147925,7 @@ void main() {
|
|
|
147897
147925
|
navigation: {}
|
|
147898
147926
|
} };
|
|
147899
147927
|
const useEmptyTab = () => EMPTY_TAB;
|
|
147900
|
-
const ROW = {
|
|
147928
|
+
const ROW$1 = {
|
|
147901
147929
|
display: "flex",
|
|
147902
147930
|
alignItems: "center",
|
|
147903
147931
|
gap: 4,
|
|
@@ -147958,7 +147986,7 @@ void main() {
|
|
|
147958
147986
|
minWidth: 0
|
|
147959
147987
|
};
|
|
147960
147988
|
const STRIP_GROUP = {
|
|
147961
|
-
...ROW,
|
|
147989
|
+
...ROW$1,
|
|
147962
147990
|
gap: 2,
|
|
147963
147991
|
flexWrap: "nowrap",
|
|
147964
147992
|
overflowX: "auto",
|
|
@@ -147986,7 +148014,7 @@ void main() {
|
|
|
147986
148014
|
whiteSpace: "nowrap",
|
|
147987
148015
|
minWidth: 0
|
|
147988
148016
|
};
|
|
147989
|
-
const BODY = {
|
|
148017
|
+
const BODY$1 = {
|
|
147990
148018
|
flex: "1 1 0",
|
|
147991
148019
|
minHeight: 0,
|
|
147992
148020
|
display: "flex",
|
|
@@ -148124,6 +148152,8 @@ void main() {
|
|
|
148124
148152
|
const artifact = useStore((state) => selectedArtifact(state, active));
|
|
148125
148153
|
const missing = useStore((state) => missingState(state, active));
|
|
148126
148154
|
const workspaceRoot = useStore((state) => state.workspaceRoot);
|
|
148155
|
+
/** Operation the Place Order view picked, if this navigation came from it. */
|
|
148156
|
+
const orderKind = params?.orderKind;
|
|
148127
148157
|
const cwd = useSessions?.((state) => {
|
|
148128
148158
|
if (sessionId === void 0) return void 0;
|
|
148129
148159
|
return state.byId[sessionId]?.cwd;
|
|
@@ -148258,7 +148288,7 @@ void main() {
|
|
|
148258
148288
|
}, ...(selectedProject.boards ?? []).map((board) => option(board.path, board.title || board.path))));
|
|
148259
148289
|
}
|
|
148260
148290
|
const banner = (0, react.createElement)("div", { style: {
|
|
148261
|
-
...ROW,
|
|
148291
|
+
...ROW$1,
|
|
148262
148292
|
gap: 6,
|
|
148263
148293
|
padding: "0 2px",
|
|
148264
148294
|
flex: "0 0 auto"
|
|
@@ -148281,7 +148311,7 @@ void main() {
|
|
|
148281
148311
|
style: PANEL_ROOT,
|
|
148282
148312
|
"data-hardware-destination": active
|
|
148283
148313
|
}, (0, react.createElement)("style", null, PANEL_STYLE), header, meta, selectors.length === 0 && noticeText === void 0 && (discovery?.issue === void 0 || discovery.issue.code === "selection-required") ? null : (0, react.createElement)("div", { style: { padding: "6px 10px 0" } }, banner), (0, react.createElement)("div", { style: {
|
|
148284
|
-
...BODY,
|
|
148314
|
+
...BODY$1,
|
|
148285
148315
|
overflow: active === "order" || active === "bom" ? "auto" : "hidden"
|
|
148286
148316
|
} }, ...missing === void 0 ? [(0, react.createElement)(HardwarePreview, {
|
|
148287
148317
|
key: `preview:${info.tab.id}:${String(navRevision)}:${active}:${artifact?.path ?? ""}`,
|
|
@@ -148291,7 +148321,8 @@ void main() {
|
|
|
148291
148321
|
...workspaceRoot === void 0 ? {} : { workspaceRoot },
|
|
148292
148322
|
...sessionId === void 0 ? {} : { session: sessionId },
|
|
148293
148323
|
revision: navRevision,
|
|
148294
|
-
configured: kicadConfigured
|
|
148324
|
+
configured: kicadConfigured,
|
|
148325
|
+
...orderKind === void 0 ? {} : { orderKind }
|
|
148295
148326
|
})] : [(0, react.createElement)("div", {
|
|
148296
148327
|
key: "missing",
|
|
148297
148328
|
style: cardStyle({
|
|
@@ -148369,6 +148400,316 @@ void main() {
|
|
|
148369
148400
|
}
|
|
148370
148401
|
}, snapshot.error)]);
|
|
148371
148402
|
}
|
|
148403
|
+
//#endregion
|
|
148404
|
+
//#region src/client/place-order.tsx
|
|
148405
|
+
/**
|
|
148406
|
+
* The Place Order view: pick a KiCad project, then pick the operation.
|
|
148407
|
+
*
|
|
148408
|
+
* This is the plugin-owned entry point the desktop menu and the user both reach
|
|
148409
|
+
* without an agent message. It does exactly two things — list what the Host
|
|
148410
|
+
* discovered in the current workspace, and hand one project to the existing
|
|
148411
|
+
* order destination — because the manufacturing work already exists: packaging,
|
|
148412
|
+
* validation, the upload, the token and the page are the same code the agent's
|
|
148413
|
+
* tools and the order panel use. Nothing here prices, packages or scans on its
|
|
148414
|
+
* own; `discover()` is the Host's deterministic scan and every row is rendered
|
|
148415
|
+
* from its answer.
|
|
148416
|
+
*
|
|
148417
|
+
* Readiness is shown, not guessed: PCB needs a saved board, PCBA additionally
|
|
148418
|
+
* needs the project schematic the positions and BOM are exported from, and both
|
|
148419
|
+
* need a configured KiCad and a signed-in account. An unavailable operation keeps
|
|
148420
|
+
* its button visible but disabled with the reason next to it.
|
|
148421
|
+
*/
|
|
148422
|
+
const ROOT = {
|
|
148423
|
+
display: "flex",
|
|
148424
|
+
flexDirection: "column",
|
|
148425
|
+
height: "100%",
|
|
148426
|
+
minHeight: 0,
|
|
148427
|
+
minWidth: 0,
|
|
148428
|
+
boxSizing: "border-box",
|
|
148429
|
+
background: C.base,
|
|
148430
|
+
color: C.text
|
|
148431
|
+
};
|
|
148432
|
+
const HEAD = {
|
|
148433
|
+
display: "flex",
|
|
148434
|
+
alignItems: "center",
|
|
148435
|
+
gap: 8,
|
|
148436
|
+
flexWrap: "wrap",
|
|
148437
|
+
padding: "8px 12px",
|
|
148438
|
+
borderBottom: `1px solid ${C.borderSoft}`,
|
|
148439
|
+
flex: "0 0 auto"
|
|
148440
|
+
};
|
|
148441
|
+
const BODY = {
|
|
148442
|
+
flex: "1 1 0",
|
|
148443
|
+
minHeight: 0,
|
|
148444
|
+
overflow: "auto",
|
|
148445
|
+
padding: 12,
|
|
148446
|
+
display: "flex",
|
|
148447
|
+
flexDirection: "column",
|
|
148448
|
+
gap: 8
|
|
148449
|
+
};
|
|
148450
|
+
const ROW = {
|
|
148451
|
+
display: "flex",
|
|
148452
|
+
alignItems: "center",
|
|
148453
|
+
gap: 8,
|
|
148454
|
+
minWidth: 0
|
|
148455
|
+
};
|
|
148456
|
+
const NAME = {
|
|
148457
|
+
fontSize: 12.5,
|
|
148458
|
+
fontWeight: 600,
|
|
148459
|
+
color: C.text,
|
|
148460
|
+
minWidth: 0
|
|
148461
|
+
};
|
|
148462
|
+
const SUB = {
|
|
148463
|
+
...MUTED,
|
|
148464
|
+
fontFamily: MONO,
|
|
148465
|
+
fontSize: 10.5,
|
|
148466
|
+
wordBreak: "break-all"
|
|
148467
|
+
};
|
|
148468
|
+
const CHIP = {
|
|
148469
|
+
...pillStyle("muted"),
|
|
148470
|
+
fontSize: 9.5,
|
|
148471
|
+
padding: "0 5px",
|
|
148472
|
+
whiteSpace: "nowrap"
|
|
148473
|
+
};
|
|
148474
|
+
const REASON = {
|
|
148475
|
+
...MUTED,
|
|
148476
|
+
fontSize: 10,
|
|
148477
|
+
maxWidth: 190,
|
|
148478
|
+
lineHeight: 1.45
|
|
148479
|
+
};
|
|
148480
|
+
/** Boardless-safe artifact summary for one row. */
|
|
148481
|
+
function artifactsLine(project) {
|
|
148482
|
+
const boards = project.boards?.length ?? 0;
|
|
148483
|
+
const board = boards === 0 ? void 0 : project.defaultBoard ?? project.boards?.[0]?.path;
|
|
148484
|
+
const boardName = board === void 0 ? void 0 : board.slice(Math.max(board.lastIndexOf("\\"), board.lastIndexOf("/")) + 1);
|
|
148485
|
+
const schematic = project.schematic?.path;
|
|
148486
|
+
const schematicName = schematic === void 0 ? void 0 : schematic.slice(Math.max(schematic.lastIndexOf("\\"), schematic.lastIndexOf("/")) + 1);
|
|
148487
|
+
return [
|
|
148488
|
+
COPY.order.placeOrder.boardCount(boards),
|
|
148489
|
+
boardName ?? COPY.order.placeOrder.noBoard,
|
|
148490
|
+
schematicName ?? COPY.order.placeOrder.noSchematic
|
|
148491
|
+
].join(" · ");
|
|
148492
|
+
}
|
|
148493
|
+
/** Path of the project directory relative to the scanned workspace. */
|
|
148494
|
+
function relativePath(root, path) {
|
|
148495
|
+
const normalizedRoot = root.replace(/[\\/]+$/u, "");
|
|
148496
|
+
if (!path.startsWith(normalizedRoot)) return path;
|
|
148497
|
+
return path.slice(normalizedRoot.length).replace(/^[\\/]+/u, "") || ".";
|
|
148498
|
+
}
|
|
148499
|
+
function PlaceOrderBody(props) {
|
|
148500
|
+
const { discover, installations, orderProject, sessionId, useSessions } = props;
|
|
148501
|
+
const cwd = useSessions?.((state) => {
|
|
148502
|
+
if (sessionId === void 0) return void 0;
|
|
148503
|
+
return state.byId[sessionId]?.cwd;
|
|
148504
|
+
});
|
|
148505
|
+
const [root, setRoot] = (0, react.useState)();
|
|
148506
|
+
const [projects, setProjects] = (0, react.useState)();
|
|
148507
|
+
const [issue, setIssue] = (0, react.useState)();
|
|
148508
|
+
const [error, setError] = (0, react.useState)();
|
|
148509
|
+
const [scanning, setScanning] = (0, react.useState)(false);
|
|
148510
|
+
const [kicadReady, setKicadReady] = (0, react.useState)();
|
|
148511
|
+
const [config, setConfig] = (0, react.useState)();
|
|
148512
|
+
const [revision, setRevision] = (0, react.useState)(0);
|
|
148513
|
+
(0, react.useEffect)(() => {
|
|
148514
|
+
let live = true;
|
|
148515
|
+
setScanning(true);
|
|
148516
|
+
setError(void 0);
|
|
148517
|
+
discover(cwd, void 0, sessionId).then((result) => {
|
|
148518
|
+
if (!live) return;
|
|
148519
|
+
setRoot(result.cwd);
|
|
148520
|
+
setProjects(result.projects ?? []);
|
|
148521
|
+
setIssue(result.issue);
|
|
148522
|
+
}).catch((failure) => {
|
|
148523
|
+
if (!live) return;
|
|
148524
|
+
setProjects([]);
|
|
148525
|
+
setError(messageOf$2(failure));
|
|
148526
|
+
}).finally(() => {
|
|
148527
|
+
if (live) setScanning(false);
|
|
148528
|
+
});
|
|
148529
|
+
return () => {
|
|
148530
|
+
live = false;
|
|
148531
|
+
};
|
|
148532
|
+
}, [
|
|
148533
|
+
cwd,
|
|
148534
|
+
sessionId,
|
|
148535
|
+
discover,
|
|
148536
|
+
revision
|
|
148537
|
+
]);
|
|
148538
|
+
(0, react.useEffect)(() => {
|
|
148539
|
+
let live = true;
|
|
148540
|
+
installations().then((result) => {
|
|
148541
|
+
if (live) setKicadReady(result.kicad?.configured === true);
|
|
148542
|
+
}).catch(() => {
|
|
148543
|
+
if (live) setKicadReady(false);
|
|
148544
|
+
});
|
|
148545
|
+
loadOrderConfig().then((value) => {
|
|
148546
|
+
if (live) setConfig(value);
|
|
148547
|
+
}).catch(() => {
|
|
148548
|
+
if (live) setConfig(void 0);
|
|
148549
|
+
});
|
|
148550
|
+
return () => {
|
|
148551
|
+
live = false;
|
|
148552
|
+
};
|
|
148553
|
+
}, [installations]);
|
|
148554
|
+
const signedIn = config?.hasToken;
|
|
148555
|
+
const scanningNow = scanning;
|
|
148556
|
+
/** Why one operation is unavailable for this row, in priority order. */
|
|
148557
|
+
const blockedReason = (kind, project) => {
|
|
148558
|
+
if (kind === "pcb") {
|
|
148559
|
+
if ((project.boards?.length ?? 0) === 0) return COPY.order.placeOrder.noBoard;
|
|
148560
|
+
} else {
|
|
148561
|
+
if ((project.boards?.length ?? 0) === 0) return COPY.order.placeOrder.noBoard;
|
|
148562
|
+
if (project.schematic === void 0) return COPY.order.placeOrder.noSchematic;
|
|
148563
|
+
}
|
|
148564
|
+
if (kicadReady === false) return COPY.order.placeOrder.needsKicad;
|
|
148565
|
+
if (signedIn === false) return COPY.order.placeOrder.needsSignIn;
|
|
148566
|
+
};
|
|
148567
|
+
const order = (kind, project) => {
|
|
148568
|
+
const boards = project.boards ?? [];
|
|
148569
|
+
const board = project.defaultBoard === void 0 ? boards[0] : boards.find((candidate) => candidate.path === project.defaultBoard) ?? boards[0];
|
|
148570
|
+
if (board === void 0) return;
|
|
148571
|
+
orderProject({
|
|
148572
|
+
projectPath: project.path,
|
|
148573
|
+
boardPath: board.path,
|
|
148574
|
+
...project.schematic === void 0 ? {} : { schematicPath: project.schematic.path },
|
|
148575
|
+
kind: kind === "pcb" ? "pcb" : "smt"
|
|
148576
|
+
});
|
|
148577
|
+
};
|
|
148578
|
+
const row = (project) => {
|
|
148579
|
+
const pcbReason = blockedReason("pcb", project);
|
|
148580
|
+
const pcbaReason = blockedReason("pcba", project);
|
|
148581
|
+
return (0, react.createElement)("div", {
|
|
148582
|
+
key: project.path,
|
|
148583
|
+
style: cardStyle({
|
|
148584
|
+
gap: 6,
|
|
148585
|
+
padding: 10
|
|
148586
|
+
}),
|
|
148587
|
+
"data-hardware-place-order-project": project.path,
|
|
148588
|
+
"data-hardware-place-order-pcb": pcbReason === void 0 ? "ready" : "blocked",
|
|
148589
|
+
"data-hardware-place-order-pcba": pcbaReason === void 0 ? "ready" : "blocked"
|
|
148590
|
+
}, (0, react.createElement)("div", { style: {
|
|
148591
|
+
...ROW,
|
|
148592
|
+
justifyContent: "space-between",
|
|
148593
|
+
alignItems: "flex-start"
|
|
148594
|
+
} }, (0, react.createElement)("div", { style: {
|
|
148595
|
+
display: "flex",
|
|
148596
|
+
flexDirection: "column",
|
|
148597
|
+
gap: 2,
|
|
148598
|
+
minWidth: 0
|
|
148599
|
+
} }, (0, react.createElement)("span", { style: NAME }, project.name), (0, react.createElement)("span", {
|
|
148600
|
+
style: SUB,
|
|
148601
|
+
title: project.path
|
|
148602
|
+
}, relativePath(root ?? "", project.path))), (0, react.createElement)("span", { style: CHIP }, artifactsLine(project))), (0, react.createElement)("div", { style: {
|
|
148603
|
+
...ROW,
|
|
148604
|
+
alignItems: "flex-start",
|
|
148605
|
+
flexWrap: "wrap"
|
|
148606
|
+
} }, (0, react.createElement)("div", { style: {
|
|
148607
|
+
display: "flex",
|
|
148608
|
+
flexDirection: "column",
|
|
148609
|
+
gap: 2,
|
|
148610
|
+
minWidth: 0
|
|
148611
|
+
} }, (0, react.createElement)("button", {
|
|
148612
|
+
type: "button",
|
|
148613
|
+
style: {
|
|
148614
|
+
...buttonStyle("primary", {
|
|
148615
|
+
padding: "4px 10px",
|
|
148616
|
+
fontSize: 11
|
|
148617
|
+
}),
|
|
148618
|
+
...disabled(pcbReason !== void 0 || scanningNow)
|
|
148619
|
+
},
|
|
148620
|
+
disabled: pcbReason !== void 0 || scanningNow,
|
|
148621
|
+
"data-hardware-place-order-action": "pcb",
|
|
148622
|
+
onClick: () => {
|
|
148623
|
+
order("pcb", project);
|
|
148624
|
+
}
|
|
148625
|
+
}, COPY.order.placeOrder.pcbAction), ...pcbReason === void 0 ? [] : [(0, react.createElement)("span", {
|
|
148626
|
+
key: "pcb-why",
|
|
148627
|
+
style: REASON
|
|
148628
|
+
}, pcbReason)]), (0, react.createElement)("div", { style: {
|
|
148629
|
+
display: "flex",
|
|
148630
|
+
flexDirection: "column",
|
|
148631
|
+
gap: 2,
|
|
148632
|
+
minWidth: 0
|
|
148633
|
+
} }, (0, react.createElement)("button", {
|
|
148634
|
+
type: "button",
|
|
148635
|
+
style: {
|
|
148636
|
+
...buttonStyle("secondary", {
|
|
148637
|
+
padding: "4px 10px",
|
|
148638
|
+
fontSize: 11
|
|
148639
|
+
}),
|
|
148640
|
+
...disabled(pcbaReason !== void 0 || scanningNow)
|
|
148641
|
+
},
|
|
148642
|
+
disabled: pcbaReason !== void 0 || scanningNow,
|
|
148643
|
+
"data-hardware-place-order-action": "pcba",
|
|
148644
|
+
onClick: () => {
|
|
148645
|
+
order("pcba", project);
|
|
148646
|
+
}
|
|
148647
|
+
}, COPY.order.placeOrder.pcbaAction), ...pcbaReason === void 0 ? [] : [(0, react.createElement)("span", {
|
|
148648
|
+
key: "pcba-why",
|
|
148649
|
+
style: REASON
|
|
148650
|
+
}, pcbaReason)])));
|
|
148651
|
+
};
|
|
148652
|
+
const header = (0, react.createElement)("div", { style: HEAD }, (0, react.createElement)("span", { style: {
|
|
148653
|
+
...SECTION_TITLE,
|
|
148654
|
+
marginRight: 2
|
|
148655
|
+
} }, COPY.order.placeOrder.title), (0, react.createElement)("span", {
|
|
148656
|
+
style: {
|
|
148657
|
+
fontFamily: MONO,
|
|
148658
|
+
fontSize: 10.5,
|
|
148659
|
+
color: C.text3,
|
|
148660
|
+
minWidth: 0,
|
|
148661
|
+
overflow: "hidden",
|
|
148662
|
+
textOverflow: "ellipsis",
|
|
148663
|
+
whiteSpace: "nowrap",
|
|
148664
|
+
flex: "1 1 120px"
|
|
148665
|
+
},
|
|
148666
|
+
title: root ?? ""
|
|
148667
|
+
}, root ?? COPY.order.placeOrder.workspaceUnknown), (0, react.createElement)("span", {
|
|
148668
|
+
style: pillStyle(kicadReady === false ? "warn" : "muted"),
|
|
148669
|
+
"data-hardware-place-order-kicad": kicadReady === false ? "missing" : kicadReady === true ? "ok" : "checking"
|
|
148670
|
+
}, (0, react.createElement)("span", { style: dotStyle(kicadReady === false ? C.warn : kicadReady === true ? C.ok : C.text3, 6) }), kicadReady === false ? COPY.order.placeOrder.needsKicad : kicadReady === true ? COPY.order.placeOrder.kicadReady : COPY.order.placeOrder.checking), (0, react.createElement)("span", {
|
|
148671
|
+
style: pillStyle(signedIn === false ? "warn" : "muted"),
|
|
148672
|
+
"data-hardware-place-order-signin": signedIn === false ? "missing" : signedIn === true ? "ok" : "checking"
|
|
148673
|
+
}, (0, react.createElement)("span", { style: dotStyle(signedIn === false ? C.warn : signedIn === true ? C.ok : C.text3, 6) }), signedIn === false ? COPY.order.placeOrder.needsSignIn : signedIn === true ? COPY.order.placeOrder.signInReady : COPY.order.placeOrder.checking), (0, react.createElement)("button", {
|
|
148674
|
+
type: "button",
|
|
148675
|
+
style: {
|
|
148676
|
+
...buttonStyle("quiet", {
|
|
148677
|
+
padding: "3px 8px",
|
|
148678
|
+
fontSize: 10.5
|
|
148679
|
+
}),
|
|
148680
|
+
...disabled(scanningNow)
|
|
148681
|
+
},
|
|
148682
|
+
disabled: scanningNow,
|
|
148683
|
+
"data-hardware-place-order-refresh": true,
|
|
148684
|
+
onClick: () => {
|
|
148685
|
+
setRevision((value) => value + 1);
|
|
148686
|
+
}
|
|
148687
|
+
}, scanningNow ? COPY.order.placeOrder.refreshing : COPY.order.placeOrder.refresh));
|
|
148688
|
+
const body = (0, react.createElement)("div", { style: BODY }, (0, react.createElement)("p", { style: MUTED }, COPY.order.placeOrder.lead), ...error === void 0 ? [] : [(0, react.createElement)("p", {
|
|
148689
|
+
key: "error",
|
|
148690
|
+
role: "status",
|
|
148691
|
+
style: {
|
|
148692
|
+
...MUTED,
|
|
148693
|
+
color: C.warn,
|
|
148694
|
+
borderLeft: `2px solid ${C.warn}`,
|
|
148695
|
+
paddingLeft: 8
|
|
148696
|
+
}
|
|
148697
|
+
}, COPY.order.placeOrder.discoveryFailed(error))], ...scanningNow && projects === void 0 ? [(0, react.createElement)("p", {
|
|
148698
|
+
key: "loading",
|
|
148699
|
+
style: MUTED
|
|
148700
|
+
}, COPY.order.placeOrder.loading)] : [], ...projects === void 0 || scanningNow || error !== void 0 || projects.length > 0 ? [] : [(0, react.createElement)("div", {
|
|
148701
|
+
key: "empty",
|
|
148702
|
+
style: cardStyle({
|
|
148703
|
+
alignItems: "flex-start",
|
|
148704
|
+
gap: 4
|
|
148705
|
+
}),
|
|
148706
|
+
"data-hardware-place-order-empty": issue?.code ?? "none"
|
|
148707
|
+
}, (0, react.createElement)("span", { style: pillStyle("warn") }, COPY.order.placeOrder.noProjects), (0, react.createElement)("p", { style: MUTED }, COPY.order.placeOrder.noProjectsHint))], ...projects === void 0 ? [] : projects.map(row));
|
|
148708
|
+
return (0, react.createElement)("div", {
|
|
148709
|
+
style: ROOT,
|
|
148710
|
+
"data-hardware-place-order": true
|
|
148711
|
+
}, header, body);
|
|
148712
|
+
}
|
|
148372
148713
|
/** The mark as an `<img src>`; carries its own viewBox, so it scales to any size. */
|
|
148373
148714
|
const HUAQIU_LOGO_SRC = `data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDI1LjAuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IuWbvuWxgl8xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCIKCSB2aWV3Qm94PSIwIDAgNTAgNTAiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDUwIDUwOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+CjxzdHlsZSB0eXBlPSJ0ZXh0L2NzcyI+Cgkuc3Qwe2ZpbGw6I0NDMDAwMDt9Cjwvc3R5bGU+CjxnPgoJPHBhdGggY2xhc3M9InN0MCIgZD0iTTM4LjMsMEgxMS45QzUuNSwwLDAuMSw1LjMsMC4xLDExLjh2MjYuM0MwLjEsNDQuNiw1LjQsNTAsMTEuOSw1MGgyNi4zYzAuMSwwLDAuMywwLDAuNiwwCgkJYy0xLjUtMS41LTIuMi0zLjMtMi4yLTUuNWMwLTAuNiwwLTEuMiwwLjEtMS43SDEyLjFjLTIuNSwwLTQuNC0yLTQuNC00LjRWMTEuOGMwLTIuNSwyLTQuNCw0LjQtNC40aDI2LjNjMi41LDAsNC40LDIsNC40LDQuNHYyNC43CgkJYzAuNi0wLjEsMS4yLTAuMSwxLjctMC4xYzIuMiwwLDQuMSwwLjksNS41LDIuMmMwLTAuMSwwLTAuMywwLTAuNFYxMS44QzUwLDUuMyw0NC44LDAsMzguMywweiIvPgoJPHBhdGggY2xhc3M9InN0MCIgZD0iTTQ0LjUsMzguOWMtMy4xLDAtNS41LDIuNS01LjUsNS41czIuNSw1LjUsNS41LDUuNWMzLjEsMCw1LjUtMi41LDUuNS01LjVDNDkuOSw0MS4yLDQ3LjYsMzguOSw0NC41LDM4Ljl6Ii8+Cgk8cG9seWdvbiBjbGFzcz0ic3QwIiBwb2ludHM9IjM3LjgsMzcuNyAzNy44LDEyLjMgMzAuNSwxMi4zIDMwLjUsMjEuMyAxOS44LDIxLjMgMTkuOCwxMi4zIDEyLjMsMTIuMyAxMi4zLDM3LjcgMTkuOCwzNy43IAoJCTE5LjgsMjguNiAzMC41LDI4LjYgMzAuNSwzNy43IAkiLz4KPC9nPgo8L3N2Zz4K`;
|
|
148374
148715
|
//#endregion
|
|
@@ -148785,6 +149126,7 @@ void main() {
|
|
|
148785
149126
|
applyNavigation(draft, params) {
|
|
148786
149127
|
draft.activeDestination = params.destination;
|
|
148787
149128
|
if (params.projectPath !== void 0) draft.projectPath = params.projectPath;
|
|
149129
|
+
if (params.schematicPath !== void 0) draft.schematicPath = params.schematicPath;
|
|
148788
149130
|
if (params.path !== void 0) {
|
|
148789
149131
|
if (params.destination === "schematic" || params.destination === "bom") {
|
|
148790
149132
|
draft.schematicPath = params.path;
|
|
@@ -154909,6 +155251,9 @@ void main() {
|
|
|
154909
155251
|
const HARDWARE_SETTINGS_ID = "hardware-engineering";
|
|
154910
155252
|
const HARDWARE_TAB_ID = "@huaqiu/dsh-hardware-ui";
|
|
154911
155253
|
const HARDWARE_TAB_KIND = "hardware-engineering";
|
|
155254
|
+
/** The project-selection view that fronts the order destination. */
|
|
155255
|
+
const PLACE_ORDER_TAB_ID = "@huaqiu/dsh-hardware-ui/place-order";
|
|
155256
|
+
const PLACE_ORDER_TAB_KIND = "hardware-place-order";
|
|
154912
155257
|
/** Host plugin row id whose volatile config backs the product settings page. */
|
|
154913
155258
|
const HARDWARE_CONFIG_ENTRY = "hardware-artifacts";
|
|
154914
155259
|
/**
|
|
@@ -154991,6 +155336,33 @@ void main() {
|
|
|
154991
155336
|
revealIfOpened: true
|
|
154992
155337
|
});
|
|
154993
155338
|
},
|
|
155339
|
+
placeOrder() {
|
|
155340
|
+
const tabs = ctx.sidebarRight;
|
|
155341
|
+
if (tabs === void 0) return false;
|
|
155342
|
+
tabs.openTab(PLACE_ORDER_TAB_KIND, { revealIfOpened: true });
|
|
155343
|
+
return true;
|
|
155344
|
+
},
|
|
155345
|
+
/**
|
|
155346
|
+
* Hand the chosen project to the existing order destination. The path and
|
|
155347
|
+
* the project travel in the navigation params, so the viewer discovers that
|
|
155348
|
+
* project and the order panel packages the board — no second packaging path.
|
|
155349
|
+
*/
|
|
155350
|
+
orderProject(request) {
|
|
155351
|
+
navigation += 1;
|
|
155352
|
+
const params = {
|
|
155353
|
+
destination: "order",
|
|
155354
|
+
path: request.boardPath,
|
|
155355
|
+
kind: "pcb",
|
|
155356
|
+
projectPath: request.projectPath,
|
|
155357
|
+
...request.schematicPath === void 0 ? {} : { schematicPath: request.schematicPath },
|
|
155358
|
+
orderKind: request.kind,
|
|
155359
|
+
navigationRevision: navigation
|
|
155360
|
+
};
|
|
155361
|
+
ctx.sidebarRight?.openTab(HARDWARE_TAB_KIND, {
|
|
155362
|
+
params,
|
|
155363
|
+
revealIfOpened: true
|
|
155364
|
+
});
|
|
155365
|
+
},
|
|
154994
155366
|
async openNative(request) {
|
|
154995
155367
|
await openArtifact({
|
|
154996
155368
|
application: request.application,
|
|
@@ -155023,6 +155395,17 @@ void main() {
|
|
|
155023
155395
|
default: true,
|
|
155024
155396
|
title: () => COPY.product.name
|
|
155025
155397
|
}) ?? (() => {}), "hardware-ui: right-panel tab type");
|
|
155398
|
+
effect(() => ctx.sidebarRightTabs?.register({
|
|
155399
|
+
id: "@huaqiu/dsh-hardware-ui/place-order",
|
|
155400
|
+
kind: "hardware-place-order",
|
|
155401
|
+
title: () => COPY.order.placeOrder.title
|
|
155402
|
+
}) ?? (() => {}), "hardware-ui: place order tab type");
|
|
155403
|
+
if (typeof window !== "undefined") effect(() => {
|
|
155404
|
+
const unregister = window.dshDesktop?.registerPlaceOrder?.(() => controller.placeOrder());
|
|
155405
|
+
return () => {
|
|
155406
|
+
unregister?.();
|
|
155407
|
+
};
|
|
155408
|
+
}, "hardware-ui: place order handle");
|
|
155026
155409
|
const slots = ctx.slots;
|
|
155027
155410
|
if (slots === void 0) return;
|
|
155028
155411
|
effect(() => slots.inject("sidebar.right.pane.tab", () => slots.register({
|
|
@@ -155033,6 +155416,16 @@ void main() {
|
|
|
155033
155416
|
inject: () => face
|
|
155034
155417
|
}, HardwareViewerBody)), "hardware-ui: viewer body");
|
|
155035
155418
|
effect(() => slots.inject("sidebar.right.pane.tab", () => slots.register(orderTabRegistration(), OrderTabBody)), "hardware-ui: order page body");
|
|
155419
|
+
effect(() => slots.inject("sidebar.right.pane.tab", () => slots.register({
|
|
155420
|
+
name: "sidebar.right.pane.tab",
|
|
155421
|
+
key: PLACE_ORDER_TAB_ID,
|
|
155422
|
+
locale: HARDWARE_UI_NS,
|
|
155423
|
+
inject: () => ({
|
|
155424
|
+
discover: controller.discover,
|
|
155425
|
+
installations: controller.installations,
|
|
155426
|
+
orderProject: controller.orderProject
|
|
155427
|
+
})
|
|
155428
|
+
}, PlaceOrderBody)), "hardware-ui: place order body");
|
|
155036
155429
|
effect(() => slots.inject("settings.section", () => slots.register({
|
|
155037
155430
|
name: "settings.section",
|
|
155038
155431
|
id: HARDWARE_SETTINGS_ID,
|
|
@@ -155097,6 +155490,8 @@ void main() {
|
|
|
155097
155490
|
exports.HARDWARE_SETTINGS_ID = HARDWARE_SETTINGS_ID;
|
|
155098
155491
|
exports.HARDWARE_TAB_ID = HARDWARE_TAB_ID;
|
|
155099
155492
|
exports.HARDWARE_TAB_KIND = HARDWARE_TAB_KIND;
|
|
155493
|
+
exports.PLACE_ORDER_TAB_ID = PLACE_ORDER_TAB_ID;
|
|
155494
|
+
exports.PLACE_ORDER_TAB_KIND = PLACE_ORDER_TAB_KIND;
|
|
155100
155495
|
exports.apply = apply;
|
|
155101
155496
|
exports.inject = inject;
|
|
155102
155497
|
exports.kindForPath = kindForPath;
|