nucleus-core-ts 0.10.56 → 0.10.58
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/VerificationFlowPage/components/PendingTab.js +27 -3
- package/dist/fe/components/VerificationFlowPage/components/decisionPlan.d.ts +15 -0
- package/dist/fe/components/VerificationFlowPage/components/decisionPlan.js +20 -0
- package/dist/fe/components/VerificationFlowPage/labels.d.ts +2 -0
- package/dist/fe/components/VerificationFlowPage/labels.js +1 -0
- package/package.json +1 -1
package/dist/.build-ok
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.10.
|
|
1
|
+
0.10.58
|
|
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { useEffect, useEffectEvent, useState } from 'react';
|
|
4
4
|
import { DEFAULT_VERIFICATION_FLOW_LABELS } from '../labels';
|
|
5
5
|
import { useVerificationFlowStore } from '../store';
|
|
6
|
-
import { planDecision } from './decisionPlan';
|
|
6
|
+
import { planDecision, signatureFileType } from './decisionPlan';
|
|
7
7
|
import { getActiveTheme } from '../theme/store';
|
|
8
8
|
export function PendingTab({ pendingAction, decideAction, uploadSignatureAction, onDecisionMade, labels }) {
|
|
9
9
|
// Local, not in the store: only one card is in deciding mode at a time, and
|
|
@@ -54,13 +54,37 @@ export function PendingTab({ pendingAction, decideAction, uploadSignatureAction,
|
|
|
54
54
|
signature_id: signatureId
|
|
55
55
|
} : {}
|
|
56
56
|
},
|
|
57
|
-
onAfterHandle: ()=>{
|
|
57
|
+
onAfterHandle: (res)=>{
|
|
58
|
+
/*
|
|
59
|
+
* This API answers a REFUSED decision with HTTP 200 and
|
|
60
|
+
* `success: false`, and `onAfterHandle` fires on the status code. So
|
|
61
|
+
* closing the card here unconditionally is how a refusal came to look
|
|
62
|
+
* exactly like an approval.
|
|
63
|
+
*
|
|
64
|
+
* Measured on a leaflet install: a reviewer who had also submitted the
|
|
65
|
+
* version pressed Approve, the engine answered "The person who
|
|
66
|
+
* submitted this for verification cannot decide it", the card closed,
|
|
67
|
+
* nothing was recorded, and the item sat back in the queue with no
|
|
68
|
+
* explanation. The same silence covered every other refusal the engine
|
|
69
|
+
* makes -- wrong role, already decided, account switched off.
|
|
70
|
+
*
|
|
71
|
+
* The engine's own sentence is shown instead of a generic failure: it
|
|
72
|
+
* already says exactly what is wrong, and a reviewer can act on
|
|
73
|
+
* "cannot decide it" in a way they cannot act on "something failed".
|
|
74
|
+
*/ if (res && res.success === false) {
|
|
75
|
+
setSignatureNote(res.message || say.decisionRefused);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
58
78
|
store.setDecidingId(null);
|
|
59
79
|
store.setDecisionReason('');
|
|
60
80
|
setSignatureFile(null);
|
|
61
81
|
setSignatureNote(null);
|
|
62
82
|
onDecisionMade?.(item.entity_name, item.entity_id);
|
|
63
83
|
loadPending();
|
|
84
|
+
},
|
|
85
|
+
onErrorHandle: (err)=>{
|
|
86
|
+
const msg = err?.message;
|
|
87
|
+
setSignatureNote(msg || say.decisionRefused);
|
|
64
88
|
}
|
|
65
89
|
});
|
|
66
90
|
});
|
|
@@ -100,7 +124,7 @@ export function PendingTab({ pendingAction, decideAction, uploadSignatureAction,
|
|
|
100
124
|
size: signatureFile.size,
|
|
101
125
|
mime_type: signatureFile.type || 'application/octet-stream',
|
|
102
126
|
extension: signatureFile.name.split('.').pop() || '',
|
|
103
|
-
type:
|
|
127
|
+
type: signatureFileType(signatureFile.type)
|
|
104
128
|
}));
|
|
105
129
|
setSignatureNote(say.signatureUploading);
|
|
106
130
|
uploadSignatureAction.start({
|
|
@@ -25,3 +25,18 @@ export declare function planDecision(input: {
|
|
|
25
25
|
hasUploadAction: boolean;
|
|
26
26
|
hasFile: boolean;
|
|
27
27
|
}): DecisionPlan;
|
|
28
|
+
/**
|
|
29
|
+
* Which `files.type` a signature upload should declare.
|
|
30
|
+
*
|
|
31
|
+
* The column is an enum the HOST configures, and a generic component cannot
|
|
32
|
+
* invent a value for it. The first version of this sent `type: 'signature'`
|
|
33
|
+
* and the install answered, from its own list: "type must be one of: image,
|
|
34
|
+
* document, video, audio, profile_picture" — a 400 the reviewer saw only as
|
|
35
|
+
* "the signature could not be uploaded".
|
|
36
|
+
*
|
|
37
|
+
* So it is derived from the file itself and lands on one of the names every
|
|
38
|
+
* install carries. `document` is the fallback because a signature that is not
|
|
39
|
+
* an image is a signed document, and because it is the safest of the five to
|
|
40
|
+
* be wrong about.
|
|
41
|
+
*/
|
|
42
|
+
export declare function signatureFileType(mimeType: string | undefined): string;
|
|
@@ -29,3 +29,23 @@
|
|
|
29
29
|
kind: 'upload-then-send'
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Which `files.type` a signature upload should declare.
|
|
34
|
+
*
|
|
35
|
+
* The column is an enum the HOST configures, and a generic component cannot
|
|
36
|
+
* invent a value for it. The first version of this sent `type: 'signature'`
|
|
37
|
+
* and the install answered, from its own list: "type must be one of: image,
|
|
38
|
+
* document, video, audio, profile_picture" — a 400 the reviewer saw only as
|
|
39
|
+
* "the signature could not be uploaded".
|
|
40
|
+
*
|
|
41
|
+
* So it is derived from the file itself and lands on one of the names every
|
|
42
|
+
* install carries. `document` is the fallback because a signature that is not
|
|
43
|
+
* an image is a signed document, and because it is the safest of the five to
|
|
44
|
+
* be wrong about.
|
|
45
|
+
*/ export function signatureFileType(mimeType) {
|
|
46
|
+
const mime = (mimeType || '').toLowerCase();
|
|
47
|
+
if (mime.startsWith('image/')) return 'image';
|
|
48
|
+
if (mime.startsWith('video/')) return 'video';
|
|
49
|
+
if (mime.startsWith('audio/')) return 'audio';
|
|
50
|
+
return 'document';
|
|
51
|
+
}
|
|
@@ -97,6 +97,8 @@ export type VerificationFlowLabels = {
|
|
|
97
97
|
signatureUploadFailed: string;
|
|
98
98
|
/** Shown when the host wired no upload action at all. */
|
|
99
99
|
signatureUnavailable: string;
|
|
100
|
+
/** Fallback when a decision is refused and the engine sent no sentence. */
|
|
101
|
+
decisionRefused: string;
|
|
100
102
|
recipientAllVerifiers: string;
|
|
101
103
|
recipientStepVerifier: string;
|
|
102
104
|
recipientEntityCreator: string;
|
|
@@ -77,6 +77,7 @@
|
|
|
77
77
|
signatureUploading: 'Uploading signature…',
|
|
78
78
|
signatureUploadFailed: 'The signature could not be uploaded. The decision was not sent.',
|
|
79
79
|
signatureUnavailable: 'This step requires a signature, but signing is not available on this screen. Nobody can complete it here — remove the signature requirement from the step, or wire an upload action.',
|
|
80
|
+
decisionRefused: 'The decision was refused and nothing was recorded.',
|
|
80
81
|
recipientAllVerifiers: 'All Verifiers',
|
|
81
82
|
recipientStepVerifier: 'Step Verifier',
|
|
82
83
|
recipientEntityCreator: 'Entity Creator',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nucleus-core-ts",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.58",
|
|
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",
|