nucleus-core-ts 0.10.256 → 0.10.257
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/dist/.build-ok +1 -1
- package/dist/fe/components/Replay/_components/ReplayControls/index.js +4 -3
- package/dist/fe/components/Replay/_utils/copy.js +5 -5
- package/dist/fe/components/Replay/_utils/frameBridge.d.ts +6 -0
- package/dist/fe/components/Replay/_utils/frameBridge.js +2 -1
- package/dist/src/Client/Replay/driver/run.d.ts +12 -1
- package/dist/src/Client/Replay/driver/run.js +22 -6
- package/package.json +1 -1
package/dist/.build-ok
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.10.
|
|
1
|
+
0.10.257
|
|
@@ -12,7 +12,8 @@ const ICON = {
|
|
|
12
12
|
/** Play or pause, restart, speed, and the language switch (only when the recording has more than one language). */ export function ReplayControls(props) {
|
|
13
13
|
const { status, rate, locales, locale, onPlay, onPause, onRate, onLocale, onRestart } = props;
|
|
14
14
|
const playing = status === 'playing';
|
|
15
|
-
const idle = status === 'loading'
|
|
15
|
+
const idle = status === 'loading';
|
|
16
|
+
const noPlay = idle || status === 'failed';
|
|
16
17
|
return /*#__PURE__*/ _jsxs("div", {
|
|
17
18
|
className: "nc-replay__controls",
|
|
18
19
|
role: "group",
|
|
@@ -23,7 +24,7 @@ const ICON = {
|
|
|
23
24
|
type: "button",
|
|
24
25
|
className: "nc-replay__btn",
|
|
25
26
|
"data-primary": "",
|
|
26
|
-
disabled:
|
|
27
|
+
disabled: noPlay,
|
|
27
28
|
onClick: playing ? onPause : onPlay,
|
|
28
29
|
children: [
|
|
29
30
|
/*#__PURE__*/ _jsx("svg", {
|
|
@@ -60,7 +61,7 @@ const ICON = {
|
|
|
60
61
|
type: "button",
|
|
61
62
|
className: "nc-replay__btn",
|
|
62
63
|
"aria-pressed": rate === choice,
|
|
63
|
-
disabled:
|
|
64
|
+
disabled: noPlay,
|
|
64
65
|
onClick: ()=>onRate(choice),
|
|
65
66
|
children: rateLabel(choice)
|
|
66
67
|
}, choice))
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
const RETRY_OR_RERECORD = 'Try again from this chapter
|
|
1
|
+
const RETRY_OR_RERECORD = 'Try again from this chapter, or pick another chapter below.';
|
|
2
2
|
const STOPPED = 'The walkthrough stopped at this step.';
|
|
3
3
|
const FAILURES = {
|
|
4
4
|
manifest_unreachable: {
|
|
5
5
|
what: 'The recording could not be loaded.',
|
|
6
6
|
means: 'There is nothing to play yet.',
|
|
7
|
-
next: 'Check your connection and try again. If it keeps failing,
|
|
7
|
+
next: 'Check your connection and try again. If it keeps failing, come back a little later.'
|
|
8
8
|
},
|
|
9
9
|
manifest_invalid: {
|
|
10
10
|
what: 'The recording file is not in a format this player understands.',
|
|
11
11
|
means: 'It cannot be played, and trying again will not change that.',
|
|
12
|
-
next: '
|
|
12
|
+
next: 'Reload the page. If it keeps failing, come back a little later.'
|
|
13
13
|
},
|
|
14
14
|
frame_timeout: {
|
|
15
15
|
what: 'The product screen did not start in time.',
|
|
@@ -24,7 +24,7 @@ const FAILURES = {
|
|
|
24
24
|
target_unsupported: {
|
|
25
25
|
what: 'This step points at an element the player cannot operate.',
|
|
26
26
|
means: STOPPED,
|
|
27
|
-
next: '
|
|
27
|
+
next: 'Try another chapter below, or reload the page.'
|
|
28
28
|
},
|
|
29
29
|
option_not_found: {
|
|
30
30
|
what: 'A choice in this step is missing from the screen.',
|
|
@@ -44,7 +44,7 @@ const FAILURES = {
|
|
|
44
44
|
step_unknown: {
|
|
45
45
|
what: 'The recording refers to a step it does not contain.',
|
|
46
46
|
means: 'It cannot be played to the end.',
|
|
47
|
-
next: '
|
|
47
|
+
next: 'Reload the page. If it keeps failing, come back a little later.'
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
50
|
export function failureCopy(reason) {
|
|
@@ -28,6 +28,12 @@ export interface ReplayFrameOptions {
|
|
|
28
28
|
pointTimeoutMs?: number;
|
|
29
29
|
targetTimeoutMs?: number;
|
|
30
30
|
visible?: VisibleCheck;
|
|
31
|
+
/**
|
|
32
|
+
* A step whose pointer action cannot be shown (the element is not on the screen) is skipped, logged to the console, and the
|
|
33
|
+
* tape plays on. Default true: a public page never stops its tour and never tells a visitor to contact the site owner.
|
|
34
|
+
* Set false to stop and report `step-failed` instead (a recorder's own check).
|
|
35
|
+
*/
|
|
36
|
+
skipFailedSteps?: boolean;
|
|
31
37
|
}
|
|
32
38
|
export interface ReplayFrameHandle {
|
|
33
39
|
stop: () => void;
|
|
@@ -79,7 +79,8 @@ const MAX_KEY_LENGTH = 200;
|
|
|
79
79
|
navigate: options.navigate,
|
|
80
80
|
waitForFrame: options.waitForFrame,
|
|
81
81
|
waitUntil: (at)=>timeline.waitUntil(at),
|
|
82
|
-
hold
|
|
82
|
+
hold,
|
|
83
|
+
onSkip: options.skipFailedSteps === false ? undefined : ({ actionIndex, reason })=>win.console?.warn(`[replay] step ${step.id} action ${actionIndex} skipped: ${reason}`)
|
|
83
84
|
});
|
|
84
85
|
if (gen !== generation) return false;
|
|
85
86
|
if (result.ok) {
|
|
@@ -24,6 +24,14 @@ export interface RunDeps {
|
|
|
24
24
|
* those seconds (the server's answer to that very click) would otherwise take the control away first.
|
|
25
25
|
*/
|
|
26
26
|
hold?: () => () => void;
|
|
27
|
+
/**
|
|
28
|
+
* Called when an action cannot be done on the screen (its target never appeared, a choice is missing, the action threw).
|
|
29
|
+
* When given, the step carries on with its next action instead of stopping: a public tour keeps playing without that pointer.
|
|
30
|
+
*/
|
|
31
|
+
onSkip?: (skipped: {
|
|
32
|
+
actionIndex: number;
|
|
33
|
+
reason: FailureReason;
|
|
34
|
+
}) => void;
|
|
27
35
|
}
|
|
28
36
|
export type RunResult = {
|
|
29
37
|
ok: true;
|
|
@@ -32,5 +40,8 @@ export type RunResult = {
|
|
|
32
40
|
actionIndex: number;
|
|
33
41
|
reason: FailureReason;
|
|
34
42
|
};
|
|
35
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
* Runs a step's actions in order, settling after each. A failure stops the step with its index and reason, unless
|
|
45
|
+
* `deps.onSkip` is set and the reason is skippable: then it is reported there and the next action runs.
|
|
46
|
+
*/
|
|
36
47
|
export declare function runStep(step: ReplayStep, deps: RunDeps): Promise<RunResult>;
|
|
@@ -53,7 +53,16 @@ async function runAction(deps, action) {
|
|
|
53
53
|
return runTargeted(deps, action);
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
-
/**
|
|
56
|
+
/** Reasons that mean "this pointer action cannot be shown"; the tape itself is fine, so a step may go on without it. */ const SKIPPABLE = [
|
|
57
|
+
'target_timeout',
|
|
58
|
+
'target_unsupported',
|
|
59
|
+
'option_not_found',
|
|
60
|
+
'action_error'
|
|
61
|
+
];
|
|
62
|
+
/**
|
|
63
|
+
* Runs a step's actions in order, settling after each. A failure stops the step with its index and reason, unless
|
|
64
|
+
* `deps.onSkip` is set and the reason is skippable: then it is reported there and the next action runs.
|
|
65
|
+
*/ export async function runStep(step, deps) {
|
|
57
66
|
for (const [actionIndex, action] of step.actions.entries()){
|
|
58
67
|
let reason;
|
|
59
68
|
try {
|
|
@@ -61,11 +70,18 @@ async function runAction(deps, action) {
|
|
|
61
70
|
} catch {
|
|
62
71
|
reason = 'action_error';
|
|
63
72
|
}
|
|
64
|
-
if (reason !== null)
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
73
|
+
if (reason !== null) {
|
|
74
|
+
if (deps.onSkip === undefined || !SKIPPABLE.includes(reason)) return {
|
|
75
|
+
ok: false,
|
|
76
|
+
actionIndex,
|
|
77
|
+
reason
|
|
78
|
+
};
|
|
79
|
+
deps.onSkip({
|
|
80
|
+
actionIndex,
|
|
81
|
+
reason
|
|
82
|
+
});
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
69
85
|
await deps.settle();
|
|
70
86
|
}
|
|
71
87
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nucleus-core-ts",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.257",
|
|
4
4
|
"description": "Production-ready, enterprise-grade TypeScript framework for building multi-tenant APIs",
|
|
5
5
|
"author": "Hidayet Can Özcan <hidayetcan@gmail.com>",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|