@eintrek/erp-shell 0.1.70 → 0.1.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -0
- package/dist/chunks/{guide-runtime-CUCcs6q0.esm.js → guide-runtime-B-3myqxe.esm.js} +36 -5
- package/dist/chunks/guide-runtime-B-3myqxe.esm.js.map +1 -0
- package/dist/chunks/{guide-runtime-BO-BFIgr.cjs → guide-runtime-DfnNdrjZ.cjs} +36 -5
- package/dist/chunks/guide-runtime-DfnNdrjZ.cjs.map +1 -0
- package/dist/guide/machine.d.ts +13 -0
- package/dist/guide-core.cjs +1 -1
- package/dist/guide-core.esm.js +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.esm.js +3 -3
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
- package/dist/chunks/guide-runtime-BO-BFIgr.cjs.map +0 -1
- package/dist/chunks/guide-runtime-CUCcs6q0.esm.js.map +0 -1
|
@@ -747,11 +747,34 @@ function announceStep(d, suite, env) {
|
|
|
747
747
|
const ctx = guideContext(env, d.state.progress.context, routeParamsFor(step, env));
|
|
748
748
|
const title = s.bridge ? COPY.bridgeTitle : plainTitle(resolveText(step.title, ctx));
|
|
749
749
|
const why = s.bridge ? COPY.bridgeWhy(suite.appName) : plainTitle(resolveText(step.why, ctx));
|
|
750
|
+
const pos = stepPosition(mission, s.index, env, d.state.progress.context);
|
|
750
751
|
d.effects.push({
|
|
751
752
|
type: "announce",
|
|
752
|
-
text: `ขั้นที่ ${
|
|
753
|
+
text: `ขั้นที่ ${pos.no} จาก ${pos.total}. ${title}${why ? `. ${why}` : ""}`,
|
|
753
754
|
});
|
|
754
755
|
}
|
|
756
|
+
/**
|
|
757
|
+
* "ขั้นที่ no จาก total" counting only the steps this person will see: a step
|
|
758
|
+
* whose `requires` they lack or whose `skipIf` holds is left out (the step on
|
|
759
|
+
* screen always counts).
|
|
760
|
+
*/
|
|
761
|
+
function stepPosition(mission, index, env, context) {
|
|
762
|
+
let no = 0;
|
|
763
|
+
let total = 0;
|
|
764
|
+
mission.steps.forEach((step, i) => {
|
|
765
|
+
if (i !== index) {
|
|
766
|
+
if (step.requires && !safe(() => env.can(step.requires), true))
|
|
767
|
+
return;
|
|
768
|
+
const ctx = guideContext(env, context, routeParamsFor(step, env));
|
|
769
|
+
if (step.skipIf && safe(() => step.skipIf(ctx), false))
|
|
770
|
+
return;
|
|
771
|
+
}
|
|
772
|
+
total++;
|
|
773
|
+
if (i <= index)
|
|
774
|
+
no = total;
|
|
775
|
+
});
|
|
776
|
+
return { no: Math.max(no, 1), total: Math.max(total, 1) };
|
|
777
|
+
}
|
|
755
778
|
/** "กด [บันทึก]" → "กด บันทึก" (for screen readers). */
|
|
756
779
|
function plainTitle(t) {
|
|
757
780
|
return t.replace(/\[([^\]]+)\]/g, "$1");
|
|
@@ -1473,6 +1496,11 @@ function reduceGuide(state, action, suite, env) {
|
|
|
1473
1496
|
d.effects.push({ type: "navigate", href: filled });
|
|
1474
1497
|
break;
|
|
1475
1498
|
}
|
|
1499
|
+
case "dismissComplete":
|
|
1500
|
+
if (s.name !== "complete")
|
|
1501
|
+
break;
|
|
1502
|
+
setScreen(d, { name: "idle" });
|
|
1503
|
+
break;
|
|
1476
1504
|
case "openPanel":
|
|
1477
1505
|
if (state.audience !== "none" && s.name === "idle") {
|
|
1478
1506
|
d.state = { ...d.state, panelOpen: true };
|
|
@@ -3586,8 +3614,10 @@ function GuideRuntimeInner({ config, organizationId, code, routing, progress: pr
|
|
|
3586
3614
|
dispatchRef.current({ type: "rest" });
|
|
3587
3615
|
}
|
|
3588
3616
|
else if (sc.name === "complete") {
|
|
3617
|
+
// Escape closes the card where the person is; only the button
|
|
3618
|
+
// follows complete.action, which may be another app.
|
|
3589
3619
|
stop();
|
|
3590
|
-
dispatchRef.current({ type: "
|
|
3620
|
+
dispatchRef.current({ type: "dismissComplete" });
|
|
3591
3621
|
}
|
|
3592
3622
|
else if (s.panelOpen) {
|
|
3593
3623
|
stop();
|
|
@@ -3802,8 +3832,9 @@ function GuideRuntimeInner({ config, organizationId, code, routing, progress: pr
|
|
|
3802
3832
|
missionNo,
|
|
3803
3833
|
missionTitle: mission.title,
|
|
3804
3834
|
replay: screen.replay,
|
|
3805
|
-
|
|
3806
|
-
|
|
3835
|
+
// Steps this person skips (requires / skipIf) are not counted.
|
|
3836
|
+
index: stepPosition(mission, screen.index, env(), state.progress.context).no - 1,
|
|
3837
|
+
total: stepPosition(mission, screen.index, env(), state.progress.context).total,
|
|
3807
3838
|
title: bridge ? "กดปุ่มเมนู" : resolveText(step.title, stepCtx),
|
|
3808
3839
|
why: bridge ? `เมนูทั้งหมดของ ${suite.appName} อยู่ในนี้` : resolveText(step.why, stepCtx),
|
|
3809
3840
|
error: screen.error,
|
|
@@ -3877,4 +3908,4 @@ exports.reportApiCall = reportApiCall;
|
|
|
3877
3908
|
exports.reportApiEvent = reportApiEvent;
|
|
3878
3909
|
exports.storeGuides = storeGuides;
|
|
3879
3910
|
exports.useGuideEntry = useGuideEntry;
|
|
3880
|
-
//# sourceMappingURL=guide-runtime-
|
|
3911
|
+
//# sourceMappingURL=guide-runtime-DfnNdrjZ.cjs.map
|