@nodii/onboarding 0.1.0-dev.0 → 0.1.0
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 +78 -0
- package/dist/chunk-AZE3NPSY.js +186 -0
- package/dist/chunk-AZE3NPSY.js.map +1 -0
- package/dist/{chunk-BQCTDU5V.js → chunk-BMQINH6O.js} +89 -15
- package/dist/chunk-BMQINH6O.js.map +1 -0
- package/dist/{chunk-34BQX2KR.js → chunk-F75ZJERM.js} +41 -6
- package/dist/chunk-F75ZJERM.js.map +1 -0
- package/dist/chunk-FIRSA7EH.js +3 -0
- package/dist/{chunk-ZDY2I6KY.js.map → chunk-FIRSA7EH.js.map} +1 -1
- package/dist/{chunk-SWMIIUXR.js → chunk-IPAKPLIF.js} +590 -92
- package/dist/chunk-IPAKPLIF.js.map +1 -0
- package/dist/chunk-JFDQZ3AC.js +3 -0
- package/dist/chunk-JFDQZ3AC.js.map +1 -0
- package/dist/{chunk-4SWOVHZ2.js → chunk-KQTS47FC.js} +129 -17
- package/dist/chunk-KQTS47FC.js.map +1 -0
- package/dist/chunk-LVJM4CTG.js +306 -0
- package/dist/chunk-LVJM4CTG.js.map +1 -0
- package/dist/chunk-SEKNVHD3.js +59 -0
- package/dist/chunk-SEKNVHD3.js.map +1 -0
- package/dist/chunk-SIMLMQPT.js +37 -0
- package/dist/chunk-SIMLMQPT.js.map +1 -0
- package/dist/chunk-U56GQITG.js +79 -0
- package/dist/chunk-U56GQITG.js.map +1 -0
- package/dist/{chunk-AFCJLUPK.js → chunk-U6AXKGYQ.js} +14 -5
- package/dist/chunk-U6AXKGYQ.js.map +1 -0
- package/dist/{chunk-AW7W3HAC.js → chunk-XJTJPBJB.js} +40 -3
- package/dist/chunk-XJTJPBJB.js.map +1 -0
- package/dist/client-CqE2dF9A.d.ts +86 -0
- package/dist/consent/index.d.ts +59 -0
- package/dist/consent/index.js +7 -0
- package/dist/consent/index.js.map +1 -0
- package/dist/controller-BQb62D0N.d.ts +177 -0
- package/dist/dynamic/index.d.ts +57 -6
- package/dist/dynamic/index.js +4 -2
- package/dist/errors-vJkye4a0.d.ts +110 -0
- package/dist/form/index.d.ts +2 -2
- package/dist/form/index.js +2 -2
- package/dist/index-Dqfa890U.d.ts +83 -0
- package/dist/index.d.ts +12 -6
- package/dist/index.js +12 -8
- package/dist/{model-IEyDI54w.d.ts → model-ESLSEbi0.d.ts} +199 -46
- package/dist/model-mnjAEtKe.d.ts +253 -0
- package/dist/render-DC7P2BGQ.js +5 -0
- package/dist/render-DC7P2BGQ.js.map +1 -0
- package/dist/schema-BrXb9gnh.d.ts +267 -0
- package/dist/{signup-client-Bl6eUrxR.d.ts → signup-client-BL5DfarJ.d.ts} +152 -19
- package/dist/spec/index.d.ts +10 -81
- package/dist/spec/index.js +3 -2
- package/dist/submit/index.d.ts +7 -71
- package/dist/submit/index.js +3 -3
- package/dist/viewer/index.d.ts +4 -0
- package/dist/viewer/index.js +5 -0
- package/dist/viewer/index.js.map +1 -0
- package/dist/widget/index.d.ts +50 -7
- package/dist/widget/index.js +9 -7
- package/package.json +21 -2
- package/dist/chunk-34BQX2KR.js.map +0 -1
- package/dist/chunk-4SWOVHZ2.js.map +0 -1
- package/dist/chunk-AFCJLUPK.js.map +0 -1
- package/dist/chunk-AW7W3HAC.js.map +0 -1
- package/dist/chunk-BIFANV7M.js +0 -22
- package/dist/chunk-BIFANV7M.js.map +0 -1
- package/dist/chunk-BQCTDU5V.js.map +0 -1
- package/dist/chunk-SWMIIUXR.js.map +0 -1
- package/dist/chunk-ZDY2I6KY.js +0 -3
- package/dist/schema-TfyBU6JW.d.ts +0 -107
package/dist/dynamic/index.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { z } from 'zod/v3';
|
|
2
|
-
import { c as SpecStep, S as SpecField, T as TerminalStage, a as OnboardingSpec } from '../model-
|
|
2
|
+
import { c as SpecStep, S as SpecField, T as TerminalStage, a as OnboardingSpec } from '../model-ESLSEbi0.js';
|
|
3
|
+
import { c as ConsentState, C as ConsentController, e as ConsentSubmitDocument } from '../controller-BQb62D0N.js';
|
|
4
|
+
export { a as ConsentDocState, b as ConsentEvidence, d as ConsentStateListener, S as SCROLL_END_THRESHOLD, f as createConsentController, i as initialGateSatisfied } from '../controller-BQb62D0N.js';
|
|
3
5
|
import { FieldError } from '../form/index.js';
|
|
4
|
-
import '../
|
|
6
|
+
import '../model-mnjAEtKe.js';
|
|
7
|
+
import '../schema-BrXb9gnh.js';
|
|
5
8
|
|
|
6
9
|
/**
|
|
7
10
|
* Spec → Zod validator derivation (D540 §3).
|
|
@@ -88,7 +91,9 @@ interface SignupConsent {
|
|
|
88
91
|
}
|
|
89
92
|
interface SignupCredentials {
|
|
90
93
|
email: string;
|
|
91
|
-
|
|
94
|
+
displayName: string;
|
|
95
|
+
organisationName: string;
|
|
96
|
+
subdomain: string;
|
|
92
97
|
}
|
|
93
98
|
interface SignupStepperState {
|
|
94
99
|
/** Zero-based index of the current step. */
|
|
@@ -113,6 +118,22 @@ interface SignupStepperState {
|
|
|
113
118
|
specVersion: string;
|
|
114
119
|
/** Set on success from the submit response. */
|
|
115
120
|
terminalStage: TerminalStage | null;
|
|
121
|
+
/**
|
|
122
|
+
* D543 ConsentPack state (per-document acceptance + gates). Empty
|
|
123
|
+
* (documents:[]) when the spec serves no consentPack — the consent stage is
|
|
124
|
+
* then skipped and does not gate the submit.
|
|
125
|
+
*/
|
|
126
|
+
consentState: ConsentState;
|
|
127
|
+
/**
|
|
128
|
+
* True after a 409 consent_stale swap until the user re-accepts the changed
|
|
129
|
+
* docs. Distinct from specStale — a doc-version bump does not necessarily
|
|
130
|
+
* change the form fields, and the banner copy differs.
|
|
131
|
+
*/
|
|
132
|
+
consentStale: boolean;
|
|
133
|
+
/** Keys of the consent docs whose acceptance was reset by the last swap. */
|
|
134
|
+
staleConsentKeys: string[];
|
|
135
|
+
/** Consent-stage errors (submit-time; e.g. a required doc not accepted). */
|
|
136
|
+
consentErrors: FieldError[];
|
|
116
137
|
}
|
|
117
138
|
type SignupStepperListener = (state: SignupStepperState) => void;
|
|
118
139
|
interface SignupStepperControl {
|
|
@@ -120,6 +141,14 @@ interface SignupStepperControl {
|
|
|
120
141
|
setAnswer(key: string, value: unknown): void;
|
|
121
142
|
setConsent(consent: Partial<SignupConsent>): void;
|
|
122
143
|
setCredentials(credentials: Partial<SignupCredentials>): void;
|
|
144
|
+
/**
|
|
145
|
+
* The headless ConsentPack controller (D543 §5). Exposed so the default
|
|
146
|
+
* component layer AND fully custom tenant UIs drive the SAME state: mark
|
|
147
|
+
* scroll/open evidence, set acceptance, read per-doc gate status. The
|
|
148
|
+
* stepper subscribes to it internally so consent mutations re-emit stepper
|
|
149
|
+
* state (consentState/consentStale) to the widget.
|
|
150
|
+
*/
|
|
151
|
+
readonly consent: ConsentController;
|
|
123
152
|
/** Validate ONLY the current step. Returns true when clean. */
|
|
124
153
|
validateStep(): boolean;
|
|
125
154
|
/** Validate current step; advance when clean. Returns true if advanced. */
|
|
@@ -135,6 +164,11 @@ interface SignupStepperControl {
|
|
|
135
164
|
/**
|
|
136
165
|
* The submit payload body (minus botToken, which the transport attaches).
|
|
137
166
|
* Call ONLY after validateAll() returns true.
|
|
167
|
+
*
|
|
168
|
+
* D543 §4: `consent.documents` is the per-doc consent array built from the
|
|
169
|
+
* ACTUAL consent state (omitted when the spec serves no consentPack). The
|
|
170
|
+
* booleans stay as the derived convenience. THROWS if any required consent
|
|
171
|
+
* doc is not accepted at its gate (never fabricates acceptance).
|
|
138
172
|
*/
|
|
139
173
|
buildSubmitPayload(): {
|
|
140
174
|
specVersion: string;
|
|
@@ -143,17 +177,34 @@ interface SignupStepperControl {
|
|
|
143
177
|
consent: {
|
|
144
178
|
tosAccepted: true;
|
|
145
179
|
privacyAccepted: true;
|
|
180
|
+
documents?: ConsentSubmitDocument[];
|
|
181
|
+
};
|
|
182
|
+
credentials: {
|
|
183
|
+
email: string;
|
|
184
|
+
displayName?: string;
|
|
146
185
|
};
|
|
147
|
-
|
|
186
|
+
organisationName?: string;
|
|
187
|
+
subdomain: string;
|
|
148
188
|
};
|
|
149
189
|
/**
|
|
150
190
|
* Swap in a refetched spec after 409 spec_stale. Drops answers for
|
|
151
191
|
* removed fields, re-validates the rest, marks specStale, repositions
|
|
152
|
-
* to the first step with errors.
|
|
192
|
+
* to the first step with errors. ALSO swaps the consentPack (a spec bump
|
|
193
|
+
* may carry new doc versions) — changed docs require re-acceptance. NEVER
|
|
194
|
+
* auto-resubmits.
|
|
153
195
|
*/
|
|
154
196
|
applyNewSpec(spec: OnboardingSpec): void;
|
|
155
197
|
/** Clear the specStale flag once the user has re-confirmed. */
|
|
156
198
|
acknowledgeSpecStale(): void;
|
|
199
|
+
/**
|
|
200
|
+
* Swap in the refetched spec's consentPack after 409 consent_stale (D543
|
|
201
|
+
* §4). Resets acceptance for docs whose version/hash changed (re-acceptance
|
|
202
|
+
* required — NEVER auto-accept a changed doc), marks consentStale, records
|
|
203
|
+
* which keys were reset. NEVER auto-resubmits.
|
|
204
|
+
*/
|
|
205
|
+
applyNewConsentPack(spec: OnboardingSpec): void;
|
|
206
|
+
/** Clear the consentStale flag once the user has re-accepted. */
|
|
207
|
+
acknowledgeConsentStale(): void;
|
|
157
208
|
setSubmitting(): void;
|
|
158
209
|
setSuccess(terminalStage: TerminalStage): void;
|
|
159
210
|
setError(message: string): void;
|
|
@@ -181,4 +232,4 @@ interface SignupStepperControl {
|
|
|
181
232
|
*/
|
|
182
233
|
declare function createSignupStepper(spec: OnboardingSpec): SignupStepperControl;
|
|
183
234
|
|
|
184
|
-
export { type SignupConsent, type SignupCredentials, type SignupStepperControl, type SignupStepperListener, type SignupStepperState, type StepperStatus, createSignupStepper, deriveAnswersSchema, deriveFieldSchema, deriveStepSchema, optionValue };
|
|
235
|
+
export { ConsentController, ConsentState, ConsentSubmitDocument, type SignupConsent, type SignupCredentials, type SignupStepperControl, type SignupStepperListener, type SignupStepperState, type StepperStatus, createSignupStepper, deriveAnswersSchema, deriveFieldSchema, deriveStepSchema, optionValue };
|
package/dist/dynamic/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import '../chunk-
|
|
2
|
-
export { createSignupStepper, deriveAnswersSchema, deriveFieldSchema, deriveStepSchema, optionValue } from '../chunk-
|
|
1
|
+
import '../chunk-JFDQZ3AC.js';
|
|
2
|
+
export { createSignupStepper, deriveAnswersSchema, deriveFieldSchema, deriveStepSchema, optionValue } from '../chunk-KQTS47FC.js';
|
|
3
|
+
export { SCROLL_END_THRESHOLD, createConsentController, initialGateSatisfied } from '../chunk-AZE3NPSY.js';
|
|
4
|
+
import '../chunk-U56GQITG.js';
|
|
3
5
|
//# sourceMappingURL=index.js.map
|
|
4
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error taxonomy for the onboarding submit client.
|
|
3
|
+
*
|
|
4
|
+
* Maps HTTP status codes and server error bodies to typed errors:
|
|
5
|
+
* 403 bot_challenge_failed → OnboardingBotChallengeError
|
|
6
|
+
* 409 spec_stale (SUBMIT) → OnboardingSpecStaleError (submit endpoint only,
|
|
7
|
+
* body { error:true, code:"spec_stale",
|
|
8
|
+
* currentSpecVersion })
|
|
9
|
+
* 409 (other / LEADS) → OnboardingConflictError (generic conflict)
|
|
10
|
+
* 429 → OnboardingRateLimitError
|
|
11
|
+
* 5xx → OnboardingServerError (retryable)
|
|
12
|
+
* network / timeout → OnboardingNetworkError
|
|
13
|
+
*/
|
|
14
|
+
type OnboardingErrorKind = "bot_challenge_failed" | "spec_stale" | "spec_invalid" | "consent_stale" | "consent_incomplete" | "subdomain_taken" | "conflict" | "rate_limited" | "server_error" | "network_error" | "validation_error";
|
|
15
|
+
declare class OnboardingError extends Error {
|
|
16
|
+
readonly kind: OnboardingErrorKind;
|
|
17
|
+
readonly statusCode: number | null;
|
|
18
|
+
constructor(kind: OnboardingErrorKind, message: string, statusCode?: number | null);
|
|
19
|
+
}
|
|
20
|
+
declare class OnboardingBotChallengeError extends OnboardingError {
|
|
21
|
+
constructor(message?: string);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* A 409 that is NOT spec_stale. On the /leads path there is no spec_stale
|
|
25
|
+
* concept (the payload carries no specVersion); on /submit, a 409 that
|
|
26
|
+
* lacks `code:"spec_stale"` also lands here. Distinct from
|
|
27
|
+
* OnboardingSpecStaleError so headless consumers switching on `kind` get the
|
|
28
|
+
* correct diagnosis (a generic conflict, e.g. a D538 same-key concurrent
|
|
29
|
+
* race) rather than a "form has been updated, refresh" recovery message.
|
|
30
|
+
*/
|
|
31
|
+
declare class OnboardingConflictError extends OnboardingError {
|
|
32
|
+
constructor(statusCode?: number, message?: string);
|
|
33
|
+
}
|
|
34
|
+
declare class OnboardingSubdomainTakenError extends OnboardingError {
|
|
35
|
+
constructor();
|
|
36
|
+
}
|
|
37
|
+
declare class OnboardingRateLimitError extends OnboardingError {
|
|
38
|
+
readonly retryAfterSeconds: number | null;
|
|
39
|
+
constructor(retryAfterSeconds?: number | null);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* A /submit 409 whose body carries `code:"spec_stale"` (D540 reject-stale).
|
|
43
|
+
* The PINNED body shape (confirmed against the crm intake) is exactly:
|
|
44
|
+
* { error: true, code: "spec_stale", currentSpecVersion: string }
|
|
45
|
+
* The version is read ONLY from `currentSpecVersion` — no field hedging.
|
|
46
|
+
* Submit-endpoint only; /leads 409s are OnboardingConflictError.
|
|
47
|
+
*/
|
|
48
|
+
declare class OnboardingSpecStaleError extends OnboardingError {
|
|
49
|
+
readonly currentSpecVersion: string;
|
|
50
|
+
constructor(currentSpecVersion: string);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* A /submit 409 whose body carries `code:"consent_stale"` (D543 §4 —
|
|
54
|
+
* SIBLING to spec_stale). Raised when a required legal document's live
|
|
55
|
+
* version/content_hash changed between spec-fetch and submit, so the echoed
|
|
56
|
+
* consent no longer matches the live version.
|
|
57
|
+
*
|
|
58
|
+
* PINNED body shape (D543 §4, mirroring spec_stale):
|
|
59
|
+
* { error: true, code: "consent_stale", staleDocuments?: [...] }
|
|
60
|
+
* where each staleDocuments entry identifies a changed doc so the caller can
|
|
61
|
+
* tell the user WHICH docs changed. The caller refetches the spec and
|
|
62
|
+
* REQUIRES re-acceptance of the changed docs — the SDK NEVER auto-accepts a
|
|
63
|
+
* changed doc (D543 §4). Submit-endpoint only.
|
|
64
|
+
*/
|
|
65
|
+
interface StaleConsentDocument {
|
|
66
|
+
/** The server registry id of the changed doc (D543 §3 legal_documents.id). */
|
|
67
|
+
legalDocumentId?: string;
|
|
68
|
+
/** doc_type of the changed doc, when the server includes it. */
|
|
69
|
+
docType?: string;
|
|
70
|
+
/** The new live version_no, when the server includes it. */
|
|
71
|
+
currentVersionNo?: number;
|
|
72
|
+
}
|
|
73
|
+
declare class OnboardingConsentStaleError extends OnboardingError {
|
|
74
|
+
/**
|
|
75
|
+
* The documents the server reports as changed (may be empty when the
|
|
76
|
+
* server does not enumerate them — the caller then refetches + diffs).
|
|
77
|
+
*/
|
|
78
|
+
readonly staleDocuments: StaleConsentDocument[];
|
|
79
|
+
constructor(staleDocuments?: StaleConsentDocument[]);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* A /submit 400 whose body carries `code:"consent_incomplete"` (D543 §4).
|
|
83
|
+
* The server's authoritative re-validation found a required live document
|
|
84
|
+
* that was missing, not accepted, or whose evidence did not satisfy its
|
|
85
|
+
* acceptance_level gate. Distinct from a generic 422 so headless consumers
|
|
86
|
+
* switching on `kind` route the user back to the consent step specifically.
|
|
87
|
+
*/
|
|
88
|
+
declare class OnboardingConsentIncompleteError extends OnboardingError {
|
|
89
|
+
constructor(message?: string);
|
|
90
|
+
}
|
|
91
|
+
declare class OnboardingServerError extends OnboardingError {
|
|
92
|
+
constructor(statusCode: number, message?: string);
|
|
93
|
+
}
|
|
94
|
+
declare class OnboardingNetworkError extends OnboardingError {
|
|
95
|
+
constructor(cause?: unknown);
|
|
96
|
+
}
|
|
97
|
+
declare class OnboardingValidationError extends OnboardingError {
|
|
98
|
+
constructor(message: string);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* The spec endpoint returned a body that does not conform to the LOCKED
|
|
102
|
+
* D540 §1 response shape. This is a server-side contract violation — the
|
|
103
|
+
* SDK refuses to render a form from a malformed spec (a half-parsed spec
|
|
104
|
+
* could silently drop required fields).
|
|
105
|
+
*/
|
|
106
|
+
declare class OnboardingSpecInvalidError extends OnboardingError {
|
|
107
|
+
constructor(detail: string);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export { OnboardingBotChallengeError as O, type StaleConsentDocument as S, OnboardingConflictError as a, OnboardingConsentIncompleteError as b, OnboardingConsentStaleError as c, OnboardingError as d, type OnboardingErrorKind as e, OnboardingNetworkError as f, OnboardingRateLimitError as g, OnboardingServerError as h, OnboardingSpecInvalidError as i, OnboardingSpecStaleError as j, OnboardingSubdomainTakenError as k, OnboardingValidationError as l };
|
package/dist/form/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as ContactFormValues } from '../schema-
|
|
2
|
-
export { L as LeadsWirePayload, c as contactFormSchema, l as leadsWireSchema, v as validateContactForm, a as validateLeadsPayload } from '../schema-
|
|
1
|
+
import { C as ContactFormValues } from '../schema-BrXb9gnh.js';
|
|
2
|
+
export { L as LeadsWirePayload, c as contactFormSchema, l as leadsWireSchema, v as validateContactForm, a as validateLeadsPayload } from '../schema-BrXb9gnh.js';
|
|
3
3
|
import 'zod/v3';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/form/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import '../chunk-JFIONONR.js';
|
|
2
|
-
export { createContactFormState } from '../chunk-
|
|
3
|
-
export { contactFormSchema, leadsWireSchema, validateContactForm, validateLeadsPayload } from '../chunk-
|
|
2
|
+
export { createContactFormState } from '../chunk-U6AXKGYQ.js';
|
|
3
|
+
export { contactFormSchema, leadsWireSchema, validateContactForm, validateLeadsPayload } from '../chunk-SIMLMQPT.js';
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { C as ConsentController } from './controller-BQb62D0N.js';
|
|
2
|
+
import { b as ConsentDocument } from './model-mnjAEtKe.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Default ConsentPack document viewer (D543 §5) — @nodii/onboarding/viewer.
|
|
6
|
+
*
|
|
7
|
+
* A SEPARATE, opt-in module built on STANDARD libraries so the base SDK stays
|
|
8
|
+
* lean: consumers only pay for the viewer if they render our default consent
|
|
9
|
+
* components. The headless controller (@nodii/onboarding/consent) knows nothing
|
|
10
|
+
* about this — it just receives reportScrollProgress / markScrolledToEnd /
|
|
11
|
+
* markOpened from whatever renders the doc.
|
|
12
|
+
*
|
|
13
|
+
* Renderers (per fetched artifact — NO IFRAME anywhere; everything is inline,
|
|
14
|
+
* same-origin, so `scroll_then_accept` scroll tracking is REAL):
|
|
15
|
+
* - text/html → sanitize with DOMPurify, inject into a scroll <div>.
|
|
16
|
+
* - markdown → marked → DOMPurify → inject into a scroll <div>.
|
|
17
|
+
* - text/plain → escaped text (textContent) in a scroll <div>.
|
|
18
|
+
* - application/pdf → PDF.js (pdfjs-dist), rendered to <canvas> + a text
|
|
19
|
+
* layer, page by page, in a scroll <div>. PDF.js is LAZY-loaded via a
|
|
20
|
+
* dynamic import() ONLY when a PDF doc is actually present, so it never
|
|
21
|
+
* bloats the base bundle.
|
|
22
|
+
*
|
|
23
|
+
* The scroll container's scroll-to-end (and the PDF/open fallbacks) drive the
|
|
24
|
+
* consent controller so the gate works for real. A failed fetch/render
|
|
25
|
+
* degrades to an "open in a new tab" affordance (marks the doc opened /
|
|
26
|
+
* scrolled) so every doc stays consentable.
|
|
27
|
+
*
|
|
28
|
+
* Bundle discipline: DOMPurify + marked are imported at module top (this is
|
|
29
|
+
* the VIEWER entry, not the base SDK — the base `@nodii/onboarding` never
|
|
30
|
+
* statically imports this file). pdfjs-dist is imported ONLY via dynamic
|
|
31
|
+
* import() inside renderPdf, so even the viewer entry doesn't eagerly load it.
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
interface ConsentDocumentViewerOptions {
|
|
35
|
+
/** Injectable fetch for the presigned artifact GET (defaults to global). */
|
|
36
|
+
fetch?: typeof globalThis.fetch;
|
|
37
|
+
/** Per-request timeout in ms (default from fetchDocumentContent). */
|
|
38
|
+
timeoutMs?: number;
|
|
39
|
+
/**
|
|
40
|
+
* The `key` the controller identifies this document by (doc_type |
|
|
41
|
+
* custom:<key>). The viewer reports scroll/open evidence under this key.
|
|
42
|
+
*/
|
|
43
|
+
consentKey: string;
|
|
44
|
+
}
|
|
45
|
+
/** Result of rendering — lets the caller know how the doc was displayed. */
|
|
46
|
+
interface ConsentDocumentViewerResult {
|
|
47
|
+
/**
|
|
48
|
+
* How the artifact was rendered.
|
|
49
|
+
*
|
|
50
|
+
* - html | markdown | text | pdf → rendered inline (gate is driven by real
|
|
51
|
+
* scroll/open).
|
|
52
|
+
* - open-affordance → an `open_then_accept` doc that opens in a new tab (the
|
|
53
|
+
* real-open IS its gate; satisfies ONLY `opened`).
|
|
54
|
+
* - unrenderable → a GATED doc (scroll_then_accept) that could NOT be
|
|
55
|
+
* rendered inline. The gate stays UNSATISFIABLE — accept is disabled and a
|
|
56
|
+
* clear error is shown. NO evidence is ever fabricated (COMPLIANCE, D543).
|
|
57
|
+
*/
|
|
58
|
+
renderedAs: "html" | "markdown" | "text" | "pdf" | "open-affordance" | "unrenderable";
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Fetch + render a consent document INLINE into `container`, wiring its scroll
|
|
62
|
+
* container (or the legitimate open-affordance) to the consent controller so
|
|
63
|
+
* `scroll_then_accept` / `open_then_accept` gates work for real. NO iframe.
|
|
64
|
+
*
|
|
65
|
+
* On ANY inline-render failure for a `scroll_then_accept` doc the gate stays
|
|
66
|
+
* UNSATISFIABLE (never fabricates scrolled_to_end, D543 §5 COMPLIANCE) — the
|
|
67
|
+
* caller's Retry re-invokes this.
|
|
68
|
+
*
|
|
69
|
+
* @returns how the doc was rendered (for the caller's telemetry/UX).
|
|
70
|
+
*/
|
|
71
|
+
declare function renderConsentDocument(container: HTMLElement, doc: ConsentDocument, control: ConsentController, options: ConsentDocumentViewerOptions): Promise<ConsentDocumentViewerResult>;
|
|
72
|
+
/** Reset the module-level pdf-worker latch (tests). */
|
|
73
|
+
declare function _resetPdfWorkerState(): void;
|
|
74
|
+
|
|
75
|
+
type ___viewer_render_js_ConsentDocumentViewerOptions = ConsentDocumentViewerOptions;
|
|
76
|
+
type ___viewer_render_js_ConsentDocumentViewerResult = ConsentDocumentViewerResult;
|
|
77
|
+
declare const ___viewer_render_js__resetPdfWorkerState: typeof _resetPdfWorkerState;
|
|
78
|
+
declare const ___viewer_render_js_renderConsentDocument: typeof renderConsentDocument;
|
|
79
|
+
declare namespace ___viewer_render_js {
|
|
80
|
+
export { type ___viewer_render_js_ConsentDocumentViewerOptions as ConsentDocumentViewerOptions, type ___viewer_render_js_ConsentDocumentViewerResult as ConsentDocumentViewerResult, ___viewer_render_js__resetPdfWorkerState as _resetPdfWorkerState, ___viewer_render_js_renderConsentDocument as renderConsentDocument };
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export { type ConsentDocumentViewerOptions as C, ___viewer_render_js as _, type ConsentDocumentViewerResult as a, _resetPdfWorkerState as b, renderConsentDocument as r };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
export { C as ContactFormValues, L as LeadsWirePayload, c as contactFormSchema, l as leadsWireSchema, v as validateContactForm, a as validateLeadsPayload } from './schema-
|
|
1
|
+
export { C as ContactFormValues, L as LeadsWirePayload, c as contactFormSchema, l as leadsWireSchema, v as validateContactForm, a as validateLeadsPayload } from './schema-BrXb9gnh.js';
|
|
2
2
|
export { ContactFormControl, ContactFormState, ContactFormStateListener, FieldError, FormStatus, createContactFormState } from './form/index.js';
|
|
3
|
-
export { F as FIELD_KEY_PATTERN, O as OnboarderTier, a as OnboardingSpec, P as PiiClass, S as SpecField, b as SpecStage, c as SpecStep, T as TerminalStage, o as onboardingSpecSchema, s as specFieldSchema, d as specStepSchema, v as validateOnboardingSpec } from './model-
|
|
4
|
-
export {
|
|
3
|
+
export { F as FIELD_KEY_PATTERN, O as OnboarderTier, a as OnboardingSpec, P as PiiClass, S as SpecField, b as SpecStage, c as SpecStep, T as TerminalStage, o as onboardingSpecSchema, s as specFieldSchema, d as specStepSchema, v as validateOnboardingSpec } from './model-ESLSEbi0.js';
|
|
4
|
+
export { A as ACCEPTANCE_LEVELS, a as AcceptanceLevel, C as ConsentDocType, b as ConsentDocument, c as ConsentPack, D as DOC_TYPES, d as acceptanceLevelSchema, e as consentDocKey, f as consentDocumentSchema, g as consentPackSchema } from './model-mnjAEtKe.js';
|
|
5
|
+
export { O as OnboardingSpecCache, S as SpecFetchOptions, a as SpecFieldDiff, d as defaultSpecCache, b as diffSpecFields, f as fetchOnboardingSpec } from './client-CqE2dF9A.js';
|
|
6
|
+
export { PinStateResult, fetchPinState } from './spec/index.js';
|
|
5
7
|
export { SignupConsent, SignupCredentials, SignupStepperControl, SignupStepperListener, SignupStepperState, StepperStatus, createSignupStepper, deriveAnswersSchema, deriveFieldSchema, deriveStepSchema, optionValue } from './dynamic/index.js';
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
+
export { C as ConsentController, a as ConsentDocState, b as ConsentEvidence, c as ConsentState, d as ConsentStateListener, e as ConsentSubmitDocument, S as SCROLL_END_THRESHOLD, f as createConsentController, i as initialGateSatisfied } from './controller-BQb62D0N.js';
|
|
9
|
+
export { ConsentDocumentKind, FetchDocumentContentOptions, FetchedConsentDocument, OnboardingDocumentFetchError, fetchDocumentContent } from './consent/index.js';
|
|
10
|
+
export { B as BotTokenSource, L as LeadsSubmitOptions, a as LeadsSubmitResult, S as SignupSubmitBody, b as SignupSubmitOptions, c as SignupSubmitResult, d as SignupWirePayload, e as computePayloadFingerprint, f as computeSignupFingerprint, g as consentSubmitDocumentSchema, h as generateIdempotencyKey, r as resolveBotToken, s as signupWireSchema, i as submitLead, j as submitSignup } from './signup-client-BL5DfarJ.js';
|
|
11
|
+
export { DEFAULT_REQUEST_TIMEOUT_MS, fetchWithTimeout, withTimeout } from './submit/index.js';
|
|
12
|
+
export { O as OnboardingBotChallengeError, a as OnboardingConflictError, b as OnboardingConsentIncompleteError, c as OnboardingConsentStaleError, d as OnboardingError, e as OnboardingErrorKind, f as OnboardingNetworkError, g as OnboardingRateLimitError, h as OnboardingServerError, i as OnboardingSpecInvalidError, j as OnboardingSpecStaleError, k as OnboardingSubdomainTakenError, l as OnboardingValidationError, S as StaleConsentDocument } from './errors-vJkye4a0.js';
|
|
8
13
|
export { RecaptchaError, RecaptchaErrorKind, RecaptchaLoadOptions, _resetRecaptchaState, executeRecaptcha, loadRecaptcha } from './recaptcha/index.js';
|
|
9
|
-
export { ContactFormMountOptions, DEFAULT_WIDGET_CSS, MountedWidget, OnboardingWidget, SignupFormMountOptions, WidgetMountOptions, cssEscape, idSelector, injectWidgetStyles, mountContactForm, mountSignupForm } from './widget/index.js';
|
|
14
|
+
export { ConsentStepRenderOptions, ContactFormMountOptions, DEFAULT_WIDGET_CSS, MountedWidget, OnboardingWidget, SignupFormMountOptions, WidgetMountOptions, consentDocElementId, cssEscape, idSelector, injectWidgetStyles, mountContactForm, mountSignupForm, renderConsentStep, updateConsentStep } from './widget/index.js';
|
|
10
15
|
import 'zod/v3';
|
|
16
|
+
import './index-Dqfa890U.js';
|
package/dist/index.js
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
|
+
export { DEFAULT_WIDGET_CSS, OnboardingWidget, consentDocElementId, cssEscape, idSelector, injectWidgetStyles, mountContactForm, mountSignupForm, renderConsentStep, updateConsentStep } from './chunk-IPAKPLIF.js';
|
|
1
2
|
import './chunk-JFIONONR.js';
|
|
2
|
-
|
|
3
|
+
export { createContactFormState } from './chunk-U6AXKGYQ.js';
|
|
4
|
+
export { FIELD_KEY_PATTERN, OnboardingSpecCache, defaultSpecCache, diffSpecFields, fetchOnboardingSpec, fetchPinState, onboardingSpecSchema, specFieldSchema, specStepSchema, validateOnboardingSpec } from './chunk-F75ZJERM.js';
|
|
5
|
+
import './chunk-JFDQZ3AC.js';
|
|
6
|
+
export { createSignupStepper, deriveAnswersSchema, deriveFieldSchema, deriveStepSchema, optionValue } from './chunk-KQTS47FC.js';
|
|
7
|
+
import './chunk-FIRSA7EH.js';
|
|
8
|
+
export { SCROLL_END_THRESHOLD, createConsentController, initialGateSatisfied } from './chunk-AZE3NPSY.js';
|
|
9
|
+
export { ACCEPTANCE_LEVELS, DOC_TYPES, acceptanceLevelSchema, consentDocKey, consentDocumentSchema, consentPackSchema } from './chunk-U56GQITG.js';
|
|
10
|
+
export { OnboardingDocumentFetchError, fetchDocumentContent } from './chunk-SEKNVHD3.js';
|
|
3
11
|
import './chunk-Z4PA6C2Z.js';
|
|
12
|
+
export { computePayloadFingerprint, computeSignupFingerprint, consentSubmitDocumentSchema, generateIdempotencyKey, resolveBotToken, signupWireSchema, submitLead, submitSignup } from './chunk-BMQINH6O.js';
|
|
13
|
+
export { contactFormSchema, leadsWireSchema, validateContactForm, validateLeadsPayload } from './chunk-SIMLMQPT.js';
|
|
14
|
+
export { DEFAULT_REQUEST_TIMEOUT_MS, OnboardingBotChallengeError, OnboardingConflictError, OnboardingConsentIncompleteError, OnboardingConsentStaleError, OnboardingError, OnboardingNetworkError, OnboardingRateLimitError, OnboardingServerError, OnboardingSpecInvalidError, OnboardingSpecStaleError, OnboardingSubdomainTakenError, OnboardingValidationError, fetchWithTimeout, withTimeout } from './chunk-XJTJPBJB.js';
|
|
4
15
|
import './chunk-VH6FWDWI.js';
|
|
5
|
-
export { DEFAULT_WIDGET_CSS, OnboardingWidget, cssEscape, idSelector, injectWidgetStyles, mountContactForm, mountSignupForm } from './chunk-SWMIIUXR.js';
|
|
6
|
-
export { createContactFormState } from './chunk-AFCJLUPK.js';
|
|
7
|
-
export { FIELD_KEY_PATTERN, OnboardingSpecCache, defaultSpecCache, diffSpecFields, fetchOnboardingSpec, onboardingSpecSchema, specFieldSchema, specStepSchema, validateOnboardingSpec } from './chunk-34BQX2KR.js';
|
|
8
|
-
export { createSignupStepper, deriveAnswersSchema, deriveFieldSchema, deriveStepSchema, optionValue } from './chunk-4SWOVHZ2.js';
|
|
9
|
-
export { computePayloadFingerprint, computeSignupFingerprint, generateIdempotencyKey, resolveBotToken, signupWireSchema, submitLead, submitSignup } from './chunk-BQCTDU5V.js';
|
|
10
|
-
export { contactFormSchema, leadsWireSchema, validateContactForm, validateLeadsPayload } from './chunk-BIFANV7M.js';
|
|
11
|
-
export { DEFAULT_REQUEST_TIMEOUT_MS, OnboardingBotChallengeError, OnboardingConflictError, OnboardingError, OnboardingNetworkError, OnboardingRateLimitError, OnboardingServerError, OnboardingSpecInvalidError, OnboardingSpecStaleError, OnboardingValidationError, fetchWithTimeout, withTimeout } from './chunk-AW7W3HAC.js';
|
|
12
16
|
export { RecaptchaError, _resetRecaptchaState, executeRecaptcha, loadRecaptcha } from './chunk-7NS7ENJV.js';
|
|
13
17
|
//# sourceMappingURL=index.js.map
|
|
14
18
|
//# sourceMappingURL=index.js.map
|