@wildo-ai/saas-frontend-lib 1.1.14 → 1.1.15
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/esm/components/ai-elements/meta/agent-wrappers.d.ts +1 -0
- package/dist/esm/components/ai-elements/meta/agent-wrappers.d.ts.map +1 -1
- package/dist/esm/components/ai-elements/meta/agent-wrappers.js.map +1 -1
- package/dist/esm/components/compliance/EmbeddedSigningFrame.d.ts +38 -0
- package/dist/esm/components/compliance/EmbeddedSigningFrame.d.ts.map +1 -0
- package/dist/esm/components/compliance/EmbeddedSigningFrame.js +106 -0
- package/dist/esm/components/compliance/EmbeddedSigningFrame.js.map +1 -0
- package/dist/esm/components/data-display/ResourceAutomaticDisplayer.d.ts.map +1 -1
- package/dist/esm/components/data-display/ResourceAutomaticDisplayer.js +22 -0
- package/dist/esm/components/data-display/ResourceAutomaticDisplayer.js.map +1 -1
- package/dist/esm/components/flows-actors/agent-config.labels.d.ts.map +1 -1
- package/dist/esm/components/flows-actors/agent-config.labels.js +2 -0
- package/dist/esm/components/flows-actors/agent-config.labels.js.map +1 -1
- package/dist/esm/components/flows-actors/approval.d.ts +7 -1
- package/dist/esm/components/flows-actors/approval.d.ts.map +1 -1
- package/dist/esm/components/flows-actors/approval.js +22 -5
- package/dist/esm/components/flows-actors/approval.js.map +1 -1
- package/dist/esm/core/events/events.frontend.schemas.d.ts +40 -0
- package/dist/esm/core/events/events.frontend.schemas.d.ts.map +1 -1
- package/dist/esm/core/events/events.frontend.schemas.js +24 -1
- package/dist/esm/core/events/events.frontend.schemas.js.map +1 -1
- package/dist/esm/core/monitoring/analytics/AnalyticsContext.d.ts.map +1 -1
- package/dist/esm/core/monitoring/analytics/AnalyticsContext.js +50 -18
- package/dist/esm/core/monitoring/analytics/AnalyticsContext.js.map +1 -1
- package/dist/esm/core/resources/resource-read-cache.frontend.service.d.ts +6 -1
- package/dist/esm/core/resources/resource-read-cache.frontend.service.d.ts.map +1 -1
- package/dist/esm/core/resources/resource-read-cache.frontend.service.js +11 -1
- package/dist/esm/core/resources/resource-read-cache.frontend.service.js.map +1 -1
- package/dist/esm/core/runtime/ApplicationMainContext.d.ts +1 -1
- package/dist/esm/core/runtime/ApplicationMainContext.d.ts.map +1 -1
- package/dist/esm/core/runtime/ApplicationMainContext.js +12 -3
- package/dist/esm/core/runtime/ApplicationMainContext.js.map +1 -1
- package/dist/esm/core/security/UserOrgsContext.d.ts +6 -1
- package/dist/esm/core/security/UserOrgsContext.d.ts.map +1 -1
- package/dist/esm/core/security/UserOrgsContext.js +35 -11
- package/dist/esm/core/security/UserOrgsContext.js.map +1 -1
- package/dist/esm/core/security/consent-gate.frontend.utils.d.ts +17 -5
- package/dist/esm/core/security/consent-gate.frontend.utils.d.ts.map +1 -1
- package/dist/esm/core/security/consent-gate.frontend.utils.js +16 -7
- package/dist/esm/core/security/consent-gate.frontend.utils.js.map +1 -1
- package/dist/esm/core/security/useConsentGateBehavior.js +1 -1
- package/dist/esm/core/security/useConsentGateBehavior.js.map +1 -1
- package/dist/esm/core/security/useGrantedConsentPurposes.js +1 -1
- package/dist/esm/core/security/useGrantedConsentPurposes.js.map +1 -1
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-wrappers.d.ts","sourceRoot":"","sources":["../../../../../src/components/ai-elements/meta/agent-wrappers.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,EAAE,oBAAoB,EAAE,MAAM,kFAAkF,CAAA;AACvH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAI3C,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,UAAU,GAAG,YAAY,CAAA;AAC9D,M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EAAE,GAAG,KAAK,EAAE,EAAE,yBAAyB,GAAG,oBAAoB,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAGxJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-wrappers.js","sourceRoot":"","sources":["../../../../../src/components/ai-elements/meta/agent-wrappers.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAA;AAC5F,OAAO,EAAE,uBAAuB,EAAE,MAAM,iFAAiF,CAAA;
|
|
1
|
+
{"version":3,"file":"agent-wrappers.js","sourceRoot":"","sources":["../../../../../src/components/ai-elements/meta/agent-wrappers.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAA;AAC5F,OAAO,EAAE,uBAAuB,EAAE,MAAM,iFAAiF,CAAA;AAoGzH,mBAAmB;AAEnB,MAAM,UAAU,YAAY,CAAC,EAAE,MAAM,GAAG,eAAe,CAAC,OAAO,EAAE,GAAG,KAAK,EAA4C;IACnH,MAAM,SAAS,GAAG,uBAAuB,CAAoB,qBAAqB,CAAC,uBAAuB,EAAE,cAAc,CAAC,CAAC,MAAM,CAAC,CAAA;IACnI,OAAO,KAAC,SAAS,OAAK,KAAK,GAAI,CAAA;AACjC,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,EAAE,MAAM,GAAG,eAAe,CAAC,OAAO,EAAE,GAAG,KAAK,EAA4C;IACnH,MAAM,SAAS,GAAG,uBAAuB,CAAoB,qBAAqB,CAAC,uBAAuB,EAAE,cAAc,CAAC,CAAC,MAAM,CAAC,CAAA;IACnI,OAAO,KAAC,SAAS,OAAK,KAAK,GAAI,CAAA;AACjC,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,EAAE,MAAM,GAAG,eAAe,CAAC,OAAO,EAAE,GAAG,KAAK,EAAkD;IAC/H,MAAM,SAAS,GAAG,uBAAuB,CAA0B,qBAAqB,CAAC,8BAA8B,EAAE,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAA;IACtJ,OAAO,KAAC,SAAS,OAAK,KAAK,GAAI,CAAA;AACjC,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,EAAE,MAAM,GAAG,eAAe,CAAC,OAAO,EAAE,GAAG,KAAK,EAAoD;IACnI,MAAM,SAAS,GAAG,uBAAuB,CAA4B,qBAAqB,CAAC,+BAA+B,EAAE,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAA;IAC3J,OAAO,KAAC,SAAS,OAAK,KAAK,GAAI,CAAA;AACjC,CAAC","sourcesContent":["import React from 'react'\nimport { FrontendComponentType, CorePresetNames } from '@wildo-ai/presets-components-models'\nimport { createComponentResolver } from '~wildo-frontend-lib/core/components-registry/component-resolver.frontend.helper'\nimport { ComponentPresetProps } from '~wildo-frontend-lib/core/components-registry/component-registry.frontend.schemas'\nimport type { ComponentProps } from 'react'\n\n// --- Contracts ---\n\nexport type AgentStatus = \"ACTIVE\" | \"INACTIVE\" | \"DEPRECATED\"\nexport type AgentSkillType = \"GENERATION\" | \"ANALYSIS\" | \"TRANSFORMATION\" | \"DECISION\" | \"CHAT\" | \"CUSTOM\"\nexport type AgentVerbosity = \"LOW\" | \"MEDIUM\" | \"HIGH\"\nexport type AgentTone = \"NEUTRAL\" | \"CASUAL\" | \"FORMAL\" | \"TECHNICAL\"\nexport type AgentConstraintType = \"SECURITY\" | \"SAFETY\" | \"PRIVACY\" | \"SCOPE\" | \"COMPLIANCE\"\nexport type AgentUncertaintyPolicy = \"ASK\" | \"INFER\" | \"CONSERVATIVE\" | \"FAIL\"\n\nexport type AgentConstraint = {\n id: string\n text: string\n type: AgentConstraintType\n onViolation?: \"refuse\" | \"warn\" | \"log\"\n}\n\nexport type AgentOutputSpec = {\n type?: string\n fileFormat?: string\n lengthGuidance?: AgentVerbosity\n includeReasoning?: boolean\n requiredSections?: string[]\n}\n\nexport type AgentUncertainty = {\n policy: AgentUncertaintyPolicy\n confidenceThreshold?: number\n}\n\nexport type AgentExample = {\n input: string\n output: string\n explanation?: string\n}\n\nexport type AgentPromptSpec = {\n role: string\n persona?: string\n skillType: AgentSkillType\n constraints?: AgentConstraint[]\n goal?: string\n output?: AgentOutputSpec\n instructions?: string[]\n hints?: string[]\n uncertainty?: AgentUncertainty\n outOfScope?: string[]\n examples?: AgentExample[]\n style?: { verbosity?: AgentVerbosity; tone?: AgentTone }\n curation?: { maxItems?: number; minRelevance?: number; maxTokens?: number }\n promptFormatOverride?: string\n metadata?: { version?: string; lastModified?: string; author?: string; changelog?: string }\n}\n\nexport type AgentCapabilities = {\n tools?: {\n functionRefs: string[]\n mcpRefs: string[]\n remoteAgentRefs?: string[]\n }\n}\n\nexport type AgentConfigData = {\n operationKey?: string\n seed?: number\n modelName?: string\n}\n\nexport type AgentData = {\n ref: string\n displayName: string\n status: AgentStatus\n promptSpec: AgentPromptSpec\n capabilities?: AgentCapabilities\n config?: AgentConfigData\n version?: string\n createdAt?: string\n updatedAt?: string\n}\n\nexport type AI_AgentListProps = ComponentProps<\"div\"> & {\n agents: AgentData[]\n}\n\nexport type AI_AgentCardProps = ComponentProps<\"div\"> & {\n agent: AgentData\n defaultExpanded?: boolean\n}\n\nexport type AI_AgentPromptSpecProps = ComponentProps<\"div\"> & {\n spec: AgentPromptSpec\n}\n\nexport type AI_AgentCapabilitiesProps = ComponentProps<\"div\"> & {\n capabilities?: AgentCapabilities\n}\n\n// --- Wrappers ---\n\nexport function AI_AgentList({ preset = CorePresetNames.DEFAULT, ...props }: AI_AgentListProps & ComponentPresetProps): React.JSX.Element {\n const Component = createComponentResolver<AI_AgentListProps>(FrontendComponentType.LOW_LEVEL_AI_AGENT_LIST, 'AI_AgentList')(preset)\n return <Component {...props} />\n}\n\nexport function AI_AgentCard({ preset = CorePresetNames.DEFAULT, ...props }: AI_AgentCardProps & ComponentPresetProps): React.JSX.Element {\n const Component = createComponentResolver<AI_AgentCardProps>(FrontendComponentType.LOW_LEVEL_AI_AGENT_CARD, 'AI_AgentCard')(preset)\n return <Component {...props} />\n}\n\nexport function AI_AgentPromptSpec({ preset = CorePresetNames.DEFAULT, ...props }: AI_AgentPromptSpecProps & ComponentPresetProps): React.JSX.Element {\n const Component = createComponentResolver<AI_AgentPromptSpecProps>(FrontendComponentType.LOW_LEVEL_AI_AGENT_PROMPT_SPEC, 'AI_AgentPromptSpec')(preset)\n return <Component {...props} />\n}\n\nexport function AI_AgentCapabilities({ preset = CorePresetNames.DEFAULT, ...props }: AI_AgentCapabilitiesProps & ComponentPresetProps): React.JSX.Element {\n const Component = createComponentResolver<AI_AgentCapabilitiesProps>(FrontendComponentType.LOW_LEVEL_AI_AGENT_CAPABILITIES, 'AI_AgentCapabilities')(preset)\n return <Component {...props} />\n}\n"]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/** @wildo_source:part:start saas.frontend.electronic-signatures.embedded-signing-frame facet:layer:frontend facet:audience:app-developer */
|
|
3
|
+
/**
|
|
4
|
+
* Embedded signing: the signed-in person signs a record's deliverable at the signature vendor, inside a frame of the
|
|
5
|
+
* application, instead of following the vendor's e-mail. Import from `@wildo-ai/saas-frontend-lib`.
|
|
6
|
+
*
|
|
7
|
+
* Place it where the person meets the record (an engagement letter's page, say). On mount it asks the backend for the
|
|
8
|
+
* vendor's signing page (`signatureRequestSigners.openSigningSession`). The answer is given only to a signer an open
|
|
9
|
+
* request on that record names and the vendor says has not signed yet, so for anybody else, once the person has signed,
|
|
10
|
+
* and when the request's provider signs from its e-mail only, the component renders NOTHING. The page is valid for
|
|
11
|
+
* minutes and is never stored, which is why it is asked for here, when the person is in front of it. A signer whose turn
|
|
12
|
+
* has not come (signers who sign in turn) is shown nothing either, until it does.
|
|
13
|
+
*
|
|
14
|
+
* When the person is done, a vendor that redirects sends the frame to the application's own {@link SIGNING_RETURN_PAGE_PATH};
|
|
15
|
+
* the frame sees it arrive (it is now same-origin), closes, and calls `onSigningReturned`. A vendor that does not redirect
|
|
16
|
+
* (or redirects to another of the application's origins) keeps showing its own end page. Either way nothing here says the
|
|
17
|
+
* document is signed: every vendor's own guidance is that the end of the frame is not the outcome, and the request becomes
|
|
18
|
+
* SIGNED only once the engine has validated the signed document, at its next re-read (poll or vendor notification).
|
|
19
|
+
*
|
|
20
|
+
* What it needs elsewhere: a provider that claims `EMBEDDED_ELECTRONIC_SIGNATURE` and declares `embeddedSigning`, and a
|
|
21
|
+
* `wildo config sync` then `wildo dev sync-csp` since it was added, which put the vendor's signing origins in the SaaS
|
|
22
|
+
* frontend's CSP `frame-src` from the provider's own declaration; without them the browser refuses to load the frame.
|
|
23
|
+
*
|
|
24
|
+
* It renders no words of its own: the application passes the frame's accessible `title`.
|
|
25
|
+
*/
|
|
26
|
+
export interface EmbeddedSigningFrameProps {
|
|
27
|
+
/** The record the deliverable belongs to: the signature request's `linkedResourceType`. */
|
|
28
|
+
readonly linkedResourceType: string;
|
|
29
|
+
/** The record the deliverable belongs to: the signature request's `linkedResourceId`. */
|
|
30
|
+
readonly linkedResourceId: string;
|
|
31
|
+
/** The frame's accessible name (WCAG 4.1.2), in the person's language, e.g. "Sign the engagement letter". */
|
|
32
|
+
readonly title: string;
|
|
33
|
+
/** Called once the person left the vendor's page. Re-read the record if you show its signature state. */
|
|
34
|
+
readonly onSigningReturned?: () => void;
|
|
35
|
+
readonly className?: string;
|
|
36
|
+
}
|
|
37
|
+
export declare function EmbeddedSigningFrame({ linkedResourceType, linkedResourceId, title, onSigningReturned, className }: EmbeddedSigningFrameProps): React.JSX.Element | null;
|
|
38
|
+
//# sourceMappingURL=EmbeddedSigningFrame.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmbeddedSigningFrame.d.ts","sourceRoot":"","sources":["../../../../src/components/compliance/EmbeddedSigningFrame.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAiBxE,4IAA4I;AAC5I;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,WAAW,yBAAyB;IACxC,2FAA2F;IAC3F,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACpC,yFAAyF;IACzF,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,6GAA6G;IAC7G,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,yGAAyG;IACzG,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;IACxC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAmCD,wBAAgB,oBAAoB,CAAC,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,EAAE,yBAAyB,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,GAAG,IAAI,CA2EvK"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
3
|
+
import { CoreResourceType, ErrorType, ResourceOperationVariantType, ResourcesConfig_OperationPathUtils, SIGNING_RETURN_PAGE_PATH, SignatureRequestSigners_Operations, } from '@wildo-ai/saas-models';
|
|
4
|
+
import { LoadingSpinner } from '../../components/feedback/loading-spinner.js';
|
|
5
|
+
import { Alert, AlertDescription } from '../../components/overlays/containers/alert.js';
|
|
6
|
+
import { isBackendRefusal } from '../../core/errors/backend-refusal.frontend.js';
|
|
7
|
+
import { useUserFacingErrorMessage } from '../../core/errors/useUserFacingErrorMessage.js';
|
|
8
|
+
import { useResourceRegistry } from '../../core/resources/useResourceRegistry.js';
|
|
9
|
+
import { cn } from '../../core/ui/cn.js';
|
|
10
|
+
/** @wildo_source:part:end saas.frontend.electronic-signatures.embedded-signing-frame */
|
|
11
|
+
/** Where the frame is. */
|
|
12
|
+
var EmbeddedSigningFrameStatus;
|
|
13
|
+
(function (EmbeddedSigningFrameStatus) {
|
|
14
|
+
/** Asking the backend for the signing page. */
|
|
15
|
+
EmbeddedSigningFrameStatus["OPENING"] = "opening";
|
|
16
|
+
/** The vendor's page is in the frame. */
|
|
17
|
+
EmbeddedSigningFrameStatus["SIGNING"] = "signing";
|
|
18
|
+
/** Nothing for this person to sign here, or they have left the vendor's page: nothing is rendered. */
|
|
19
|
+
EmbeddedSigningFrameStatus["NOTHING"] = "nothing";
|
|
20
|
+
/** The page could not be opened. */
|
|
21
|
+
EmbeddedSigningFrameStatus["FAILED"] = "failed";
|
|
22
|
+
})(EmbeddedSigningFrameStatus || (EmbeddedSigningFrameStatus = {}));
|
|
23
|
+
const OPEN_SIGNING_SESSION_KEY = ResourcesConfig_OperationPathUtils.createOperationPathKey({
|
|
24
|
+
resourceIdentifier: CoreResourceType.SIGNATURE_REQUEST_SIGNERS,
|
|
25
|
+
operationIdentifier: SignatureRequestSigners_Operations.OPEN_SIGNING_SESSION,
|
|
26
|
+
variantType: ResourceOperationVariantType.API_CALL,
|
|
27
|
+
isOperationDefault: true,
|
|
28
|
+
isBulkOperation: false,
|
|
29
|
+
});
|
|
30
|
+
/**
|
|
31
|
+
* Whether the frame has reached the application's signing-return page. While it shows the vendor's page, reading its
|
|
32
|
+
* location throws (another origin): that is "not yet".
|
|
33
|
+
*/
|
|
34
|
+
function frameReturned(frame) {
|
|
35
|
+
try {
|
|
36
|
+
return frame?.contentWindow?.location.pathname === SIGNING_RETURN_PAGE_PATH;
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
export function EmbeddedSigningFrame({ linkedResourceType, linkedResourceId, title, onSigningReturned, className }) {
|
|
43
|
+
const { doOperation } = useResourceRegistry();
|
|
44
|
+
const toUserFacingErrorMessage = useUserFacingErrorMessage();
|
|
45
|
+
const [status, setStatus] = useState(EmbeddedSigningFrameStatus.OPENING);
|
|
46
|
+
const [url, setUrl] = useState(null);
|
|
47
|
+
const [failure, setFailure] = useState(null);
|
|
48
|
+
const frameRef = useRef(null);
|
|
49
|
+
// Read through refs so a provider handing out new function identities cannot make the frame ask again.
|
|
50
|
+
const doOperationRef = useRef(doOperation);
|
|
51
|
+
doOperationRef.current = doOperation;
|
|
52
|
+
const toMessageRef = useRef(toUserFacingErrorMessage);
|
|
53
|
+
toMessageRef.current = toUserFacingErrorMessage;
|
|
54
|
+
const onReturnedRef = useRef(onSigningReturned);
|
|
55
|
+
onReturnedRef.current = onSigningReturned;
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
let cancelled = false;
|
|
58
|
+
setStatus(EmbeddedSigningFrameStatus.OPENING);
|
|
59
|
+
doOperationRef.current(OPEN_SIGNING_SESSION_KEY,
|
|
60
|
+
// The application scope (its id in the route) is merged in by the scoped registry.
|
|
61
|
+
{ contextualParameters: {}, requestData: { linkedResourceType, linkedResourceId, returnUrl: `${window.location.origin}${SIGNING_RETURN_PAGE_PATH}` } },
|
|
62
|
+
// A person with nothing to sign is the common case, not an error: no global error toast.
|
|
63
|
+
{ silent: true })
|
|
64
|
+
.then((session) => {
|
|
65
|
+
if (cancelled)
|
|
66
|
+
return;
|
|
67
|
+
setUrl(session.url);
|
|
68
|
+
setStatus(EmbeddedSigningFrameStatus.SIGNING);
|
|
69
|
+
})
|
|
70
|
+
.catch((error) => {
|
|
71
|
+
if (cancelled)
|
|
72
|
+
return;
|
|
73
|
+
// Nothing to sign here (404), or the request's provider signs from its e-mail only (409): nothing to show.
|
|
74
|
+
if (isBackendRefusal(error) && (error.errorType === ErrorType.NOT_FOUND || error.errorType === ErrorType.CONFLICT)) {
|
|
75
|
+
setStatus(EmbeddedSigningFrameStatus.NOTHING);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
setFailure(toMessageRef.current(error));
|
|
79
|
+
setStatus(EmbeddedSigningFrameStatus.FAILED);
|
|
80
|
+
});
|
|
81
|
+
return () => {
|
|
82
|
+
cancelled = true;
|
|
83
|
+
};
|
|
84
|
+
}, [linkedResourceType, linkedResourceId]);
|
|
85
|
+
const handleLoad = useCallback(() => {
|
|
86
|
+
if (!frameReturned(frameRef.current))
|
|
87
|
+
return;
|
|
88
|
+
setStatus(EmbeddedSigningFrameStatus.NOTHING);
|
|
89
|
+
setUrl(null);
|
|
90
|
+
onReturnedRef.current?.();
|
|
91
|
+
}, []);
|
|
92
|
+
if (status === EmbeddedSigningFrameStatus.NOTHING)
|
|
93
|
+
return null;
|
|
94
|
+
if (status === EmbeddedSigningFrameStatus.OPENING)
|
|
95
|
+
return _jsx(LoadingSpinner, {});
|
|
96
|
+
if (status === EmbeddedSigningFrameStatus.FAILED) {
|
|
97
|
+
return (_jsx(Alert, { variant: "destructive", children: _jsx(AlertDescription, { children: failure }) }));
|
|
98
|
+
}
|
|
99
|
+
return (_jsx("iframe", { ref: frameRef, src: url ?? undefined, title: title, onLoad: handleLoad,
|
|
100
|
+
// The vendor's page runs its own scripts and forms, on its own origin, and may open a window (an identity check);
|
|
101
|
+
// it may not navigate the application's own page.
|
|
102
|
+
sandbox: "allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox",
|
|
103
|
+
// The origin only, never the path: some vendors admit a frame by the embedding site's domain (Yousign's allowlist).
|
|
104
|
+
referrerPolicy: "strict-origin", className: cn('h-[80vh] w-full rounded-md border-0', className) }));
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=EmbeddedSigningFrame.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmbeddedSigningFrame.js","sourceRoot":"","sources":["../../../../src/components/compliance/EmbeddedSigningFrame.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxE,OAAO,EACL,gBAAgB,EAChB,SAAS,EACT,4BAA4B,EAC5B,kCAAkC,EAClC,wBAAwB,EACxB,kCAAkC,GAEnC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,cA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GAAG,EAAE,QAAQ,EACb,GAAG,EAAE,GAAG,IAAI,SAAS,EACrB,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,UAAU;QAClB,kHAAkH;QAClH,kDAAkD;QAClD,OAAO,EAAC,yFAAyF;QACjG,oHAAoH;QACpH,cAAc,EAAC,eAAe,EAC9B,SAAS,EAAE,EAAE,CAAC,qCAAqC,EAAE,SAAS,CAAC,GAC/D,CACH,CAAC;AACJ,CAAC","sourcesContent":["import React, { useCallback, useEffect, useRef, useState } from 'react';\nimport {\n CoreResourceType,\n ErrorType,\n ResourceOperationVariantType,\n ResourcesConfig_OperationPathUtils,\n SIGNING_RETURN_PAGE_PATH,\n SignatureRequestSigners_Operations,\n type SignatureRequestSigners_OpenSigningSessionResponse,\n} from '@wildo-ai/saas-models';\nimport { LoadingSpinner } from '~wildo-frontend-lib/components/feedback/loading-spinner';\nimport { Alert, AlertDescription } from '~wildo-frontend-lib/components/overlays/containers/alert';\nimport { isBackendRefusal } from '~wildo-frontend-lib/core/errors/backend-refusal.frontend';\nimport { useUserFacingErrorMessage } from '~wildo-frontend-lib/core/errors/useUserFacingErrorMessage';\nimport { useResourceRegistry } from '~wildo-frontend-lib/core/resources/useResourceRegistry';\nimport { cn } from '~wildo-frontend-lib/core/ui/cn';\n\n/** @wildo_source:part:start saas.frontend.electronic-signatures.embedded-signing-frame facet:layer:frontend facet:audience:app-developer */\n/**\n * Embedded signing: the signed-in person signs a record's deliverable at the signature vendor, inside a frame of the\n * application, instead of following the vendor's e-mail. Import from `@wildo-ai/saas-frontend-lib`.\n *\n * Place it where the person meets the record (an engagement letter's page, say). On mount it asks the backend for the\n * vendor's signing page (`signatureRequestSigners.openSigningSession`). The answer is given only to a signer an open\n * request on that record names and the vendor says has not signed yet, so for anybody else, once the person has signed,\n * and when the request's provider signs from its e-mail only, the component renders NOTHING. The page is valid for\n * minutes and is never stored, which is why it is asked for here, when the person is in front of it. A signer whose turn\n * has not come (signers who sign in turn) is shown nothing either, until it does.\n *\n * When the person is done, a vendor that redirects sends the frame to the application's own {@link SIGNING_RETURN_PAGE_PATH};\n * the frame sees it arrive (it is now same-origin), closes, and calls `onSigningReturned`. A vendor that does not redirect\n * (or redirects to another of the application's origins) keeps showing its own end page. Either way nothing here says the\n * document is signed: every vendor's own guidance is that the end of the frame is not the outcome, and the request becomes\n * SIGNED only once the engine has validated the signed document, at its next re-read (poll or vendor notification).\n *\n * What it needs elsewhere: a provider that claims `EMBEDDED_ELECTRONIC_SIGNATURE` and declares `embeddedSigning`, and a\n * `wildo config sync` then `wildo dev sync-csp` since it was added, which put the vendor's signing origins in the SaaS\n * frontend's CSP `frame-src` from the provider's own declaration; without them the browser refuses to load the frame.\n *\n * It renders no words of its own: the application passes the frame's accessible `title`.\n */\nexport interface EmbeddedSigningFrameProps {\n /** The record the deliverable belongs to: the signature request's `linkedResourceType`. */\n readonly linkedResourceType: string;\n /** The record the deliverable belongs to: the signature request's `linkedResourceId`. */\n readonly linkedResourceId: string;\n /** The frame's accessible name (WCAG 4.1.2), in the person's language, e.g. \"Sign the engagement letter\". */\n readonly title: string;\n /** Called once the person left the vendor's page. Re-read the record if you show its signature state. */\n readonly onSigningReturned?: () => void;\n readonly className?: string;\n}\n/** @wildo_source:part:end saas.frontend.electronic-signatures.embedded-signing-frame */\n\n/** Where the frame is. */\nenum EmbeddedSigningFrameStatus {\n /** Asking the backend for the signing page. */\n OPENING = 'opening',\n /** The vendor's page is in the frame. */\n SIGNING = 'signing',\n /** Nothing for this person to sign here, or they have left the vendor's page: nothing is rendered. */\n NOTHING = 'nothing',\n /** The page could not be opened. */\n FAILED = 'failed',\n}\n\nconst OPEN_SIGNING_SESSION_KEY = ResourcesConfig_OperationPathUtils.createOperationPathKey({\n resourceIdentifier: CoreResourceType.SIGNATURE_REQUEST_SIGNERS,\n operationIdentifier: SignatureRequestSigners_Operations.OPEN_SIGNING_SESSION,\n variantType: ResourceOperationVariantType.API_CALL,\n isOperationDefault: true,\n isBulkOperation: false,\n});\n\n/**\n * Whether the frame has reached the application's signing-return page. While it shows the vendor's page, reading its\n * location throws (another origin): that is \"not yet\".\n */\nfunction frameReturned(frame: HTMLIFrameElement | null): boolean {\n try {\n return frame?.contentWindow?.location.pathname === SIGNING_RETURN_PAGE_PATH;\n } catch {\n return false;\n }\n}\n\nexport function EmbeddedSigningFrame({ linkedResourceType, linkedResourceId, title, onSigningReturned, className }: EmbeddedSigningFrameProps): React.JSX.Element | null {\n const { doOperation } = useResourceRegistry();\n const toUserFacingErrorMessage = useUserFacingErrorMessage();\n const [status, setStatus] = useState<EmbeddedSigningFrameStatus>(EmbeddedSigningFrameStatus.OPENING);\n const [url, setUrl] = useState<string | null>(null);\n const [failure, setFailure] = useState<string | null>(null);\n const frameRef = useRef<HTMLIFrameElement | null>(null);\n // Read through refs so a provider handing out new function identities cannot make the frame ask again.\n const doOperationRef = useRef(doOperation);\n doOperationRef.current = doOperation;\n const toMessageRef = useRef(toUserFacingErrorMessage);\n toMessageRef.current = toUserFacingErrorMessage;\n const onReturnedRef = useRef(onSigningReturned);\n onReturnedRef.current = onSigningReturned;\n\n useEffect(() => {\n let cancelled = false;\n setStatus(EmbeddedSigningFrameStatus.OPENING);\n doOperationRef.current<SignatureRequestSigners_OpenSigningSessionResponse>(\n OPEN_SIGNING_SESSION_KEY,\n // The application scope (its id in the route) is merged in by the scoped registry.\n { contextualParameters: {}, requestData: { linkedResourceType, linkedResourceId, returnUrl: `${window.location.origin}${SIGNING_RETURN_PAGE_PATH}` } },\n // A person with nothing to sign is the common case, not an error: no global error toast.\n { silent: true },\n )\n .then((session) => {\n if (cancelled) return;\n setUrl(session.url);\n setStatus(EmbeddedSigningFrameStatus.SIGNING);\n })\n .catch((error: unknown) => {\n if (cancelled) return;\n // Nothing to sign here (404), or the request's provider signs from its e-mail only (409): nothing to show.\n if (isBackendRefusal(error) && (error.errorType === ErrorType.NOT_FOUND || error.errorType === ErrorType.CONFLICT)) {\n setStatus(EmbeddedSigningFrameStatus.NOTHING);\n return;\n }\n setFailure(toMessageRef.current(error));\n setStatus(EmbeddedSigningFrameStatus.FAILED);\n });\n return () => {\n cancelled = true;\n };\n }, [linkedResourceType, linkedResourceId]);\n\n const handleLoad = useCallback(() => {\n if (!frameReturned(frameRef.current)) return;\n setStatus(EmbeddedSigningFrameStatus.NOTHING);\n setUrl(null);\n onReturnedRef.current?.();\n }, []);\n\n if (status === EmbeddedSigningFrameStatus.NOTHING) return null;\n if (status === EmbeddedSigningFrameStatus.OPENING) return <LoadingSpinner />;\n if (status === EmbeddedSigningFrameStatus.FAILED) {\n return (\n <Alert variant=\"destructive\">\n <AlertDescription>{failure}</AlertDescription>\n </Alert>\n );\n }\n return (\n <iframe\n ref={frameRef}\n src={url ?? undefined}\n title={title}\n onLoad={handleLoad}\n // The vendor's page runs its own scripts and forms, on its own origin, and may open a window (an identity check);\n // it may not navigate the application's own page.\n sandbox=\"allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox\"\n // The origin only, never the path: some vendors admit a frame by the embedding site's domain (Yousign's allowlist).\n referrerPolicy=\"strict-origin\"\n className={cn('h-[80vh] w-full rounded-md border-0', className)}\n />\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResourceAutomaticDisplayer.d.ts","sourceRoot":"","sources":["../../../../src/components/data-display/ResourceAutomaticDisplayer.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAA4D,MAAM,OAAO,CAAC;AAEjF,OAAO,EAIL,QAAQ,EAEiD,MAAM,uBAAuB,CAAC;AAQzF,OAAO,EAAsB,KAAK,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AACzF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAEzE,OAAO,KAAK,EAEV,gCAAgC,EACjC,MAAM,+DAA+D,CAAC;
|
|
1
|
+
{"version":3,"file":"ResourceAutomaticDisplayer.d.ts","sourceRoot":"","sources":["../../../../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G;;;OAGG;IACH,qBAAqB,CAAC,EAAE,qBAAqB,CAAC;IAC9C,iEAAiE;IACjE,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC;;;OAGG;IACH,8BAA8B,CAAC,EAAE,8BAA8B,CAAC;IAChE;;;;;;;;;OASG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAMD,iBAAS,mCAAmC,CAAC,EAC3C,eAAe,EACf,OAAO,EACP,SAAS,EACT,cAAc,EACd,QAAQ,EAAE,YAAY,EACtB,YAAY,EACZ,qBAAqB,EACrB,cAAc,EACd,8BAA4E,EAC5E,oBAA4B,GAC7B,EAAE,+BAA+B,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,GAAG,IAAI,CAs8B5D;kBAj9BQ,mCAAmC;;;AAs9B5C,eAAO,MAAM,0BAA0B,EAAE,OAAO,mCAAmC,GAAG;IAAE,WAAW,EAAE,MAAM,CAAA;CAAwC,CAAC"}
|
|
@@ -42,6 +42,7 @@ import { pickInlineFieldWriteOperation, resolveRecordOrganizationId } from '../.
|
|
|
42
42
|
import { useViewerEffectiveRolesInOrganization } from '../../core/navigation/launcher-runtime-availability.js';
|
|
43
43
|
import { RMMEventType, MutationSourceType, ConflictStrategy } from '../../core/resources/rmm/types.js';
|
|
44
44
|
import { useResourceRMM } from '../../core/resources/rmm/useResourceRMM.js';
|
|
45
|
+
import { useResourceOperationOutcomeEmitter } from '../../core/resources/useResourceOperationOutcomeEmitter.js';
|
|
45
46
|
import { refetchAuthoritativeRMMState } from '../../core/resources/rmm/RMMWebSocketBridge.js';
|
|
46
47
|
import { useShownRowChangedAt } from '../../core/resources/useShownRowChangedAt.js';
|
|
47
48
|
import { canSeedRMMFromLoadedPayload, performCanonicalRMMRead, resolveCanonicalRMMReadOperationPathKey, } from '../../core/resources/rmm/canonical-read.frontend.utils.js';
|
|
@@ -422,6 +423,22 @@ function ResourceAutomaticDisplayerComponent({ resourceContext, onError, classNa
|
|
|
422
423
|
const hasUpdateOperation = useMemo(() => {
|
|
423
424
|
return resolvedInlineEditOperation !== undefined;
|
|
424
425
|
}, [resolvedInlineEditOperation]);
|
|
426
|
+
/*
|
|
427
|
+
* An in-place edit is a WRITE, and the screen learns a write happened from `RESOURCE_OPERATION_EXECUTED`, announced by
|
|
428
|
+
* the one emitter every operation host uses. This host announced only the success notification, so every outcome
|
|
429
|
+
* listener missed an inline edit (#3928 review F3): the person's own consent re-read in `UserOrgsProvider` (#1973),
|
|
430
|
+
* which is how a grant or a withdrawal made in place on the Preferences page reaches the consent-based providers;
|
|
431
|
+
* the shown-row and configuration-presence refreshes. Announced as the WRITE operation the edit ran through, and as a
|
|
432
|
+
* partial write: the record stays open on this screen, so a listener that reads "the operation is done" leaves it be.
|
|
433
|
+
* This displayer hears it too (`useShownRowChangedAt` below) and re-reads its row once, through the version-guarded
|
|
434
|
+
* canonical read that never undoes an edit and announces nothing, as it already did for every other host's write.
|
|
435
|
+
* Through a ref, because the RMM handler below runs keyed on its event id.
|
|
436
|
+
*/
|
|
437
|
+
const announceInlineEditOutcome = useResourceOperationOutcomeEmitter(resourceContext, resolvedInlineEditOperation ?? operation);
|
|
438
|
+
const announceInlineEditOutcomeRef = useRef(null);
|
|
439
|
+
announceInlineEditOutcomeRef.current = resolvedInlineEditOperation
|
|
440
|
+
? (result) => announceInlineEditOutcome(result, { partialWrite: true })
|
|
441
|
+
: null;
|
|
425
442
|
const { rmm, rmmSnapshot } = useResourceRMM({
|
|
426
443
|
resourceType,
|
|
427
444
|
resourceId: currentResourceId != null ? String(currentResourceId) : null,
|
|
@@ -641,6 +658,8 @@ function ResourceAutomaticDisplayerComponent({ resourceContext, onError, classNa
|
|
|
641
658
|
},
|
|
642
659
|
resultSummary: event.result.responseData,
|
|
643
660
|
});
|
|
661
|
+
// After the notification, in the same turn, as a form's main save does (see `announceInlineEditOutcome`).
|
|
662
|
+
announceInlineEditOutcomeRef.current?.(event.result.responseData);
|
|
644
663
|
}
|
|
645
664
|
refetchDisplayedData();
|
|
646
665
|
}
|
|
@@ -726,6 +745,9 @@ function ResourceAutomaticDisplayerComponent({ resourceContext, onError, classNa
|
|
|
726
745
|
? value
|
|
727
746
|
: setNestedValueAtPath({}, fieldName, value)),
|
|
728
747
|
});
|
|
748
|
+
// The same outcome the RMM path announces (see `announceInlineEditOutcome`). The write answered nothing this path
|
|
749
|
+
// keeps, so the edited value stands in for it, as in the notification above.
|
|
750
|
+
announceInlineEditOutcomeRef.current?.(setNestedValueAtPath({}, fieldName, value));
|
|
729
751
|
}, [resourceType]);
|
|
730
752
|
// ── Resource layout config (explicit template, default chrome, inline-edit default) ──
|
|
731
753
|
const explicitDisplayTemplate = resourceConfig?.frontendConfiguration?.layout?.display;
|