@nodii/onboarding 0.0.1 → 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 +75 -2
- package/dist/chunk-7NS7ENJV.js +232 -0
- package/dist/chunk-7NS7ENJV.js.map +1 -0
- package/dist/chunk-AZE3NPSY.js +186 -0
- package/dist/chunk-AZE3NPSY.js.map +1 -0
- package/dist/chunk-BMQINH6O.js +401 -0
- package/dist/chunk-BMQINH6O.js.map +1 -0
- package/dist/chunk-F75ZJERM.js +199 -0
- package/dist/chunk-F75ZJERM.js.map +1 -0
- package/dist/chunk-FIRSA7EH.js +3 -0
- package/dist/chunk-FIRSA7EH.js.map +1 -0
- package/dist/chunk-IPAKPLIF.js +1660 -0
- 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-JFIONONR.js +3 -0
- package/dist/chunk-JFIONONR.js.map +1 -0
- package/dist/chunk-KQTS47FC.js +546 -0
- 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-U6AXKGYQ.js +101 -0
- package/dist/chunk-U6AXKGYQ.js.map +1 -0
- package/dist/chunk-VH6FWDWI.js +3 -0
- package/dist/chunk-VH6FWDWI.js.map +1 -0
- package/dist/chunk-XJTJPBJB.js +191 -0
- package/dist/chunk-XJTJPBJB.js.map +1 -0
- package/dist/chunk-Z4PA6C2Z.js +3 -0
- package/dist/chunk-Z4PA6C2Z.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 +235 -0
- package/dist/dynamic/index.js +6 -0
- package/dist/dynamic/index.js.map +1 -0
- package/dist/errors-vJkye4a0.d.ts +110 -0
- package/dist/form/index.d.ts +64 -0
- package/dist/form/index.js +5 -0
- package/dist/form/index.js.map +1 -0
- package/dist/index-Dqfa890U.d.ts +83 -0
- package/dist/index.d.ts +16 -2
- package/dist/index.js +18 -2
- package/dist/index.js.map +1 -0
- package/dist/model-ESLSEbi0.d.ts +640 -0
- package/dist/model-mnjAEtKe.d.ts +253 -0
- package/dist/recaptcha/index.d.ts +102 -0
- package/dist/recaptcha/index.js +4 -0
- package/dist/recaptcha/index.js.map +1 -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-BL5DfarJ.d.ts +392 -0
- package/dist/spec/index.d.ts +17 -0
- package/dist/spec/index.js +5 -0
- package/dist/spec/index.js.map +1 -0
- package/dist/submit/index.d.ts +42 -0
- package/dist/submit/index.js +6 -0
- package/dist/submit/index.js.map +1 -0
- 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 +262 -0
- package/dist/widget/index.js +12 -0
- package/dist/widget/index.js.map +1 -0
- package/package.json +96 -6
|
@@ -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,2 +1,16 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
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
|
+
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-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';
|
|
7
|
+
export { SignupConsent, SignupCredentials, SignupStepperControl, SignupStepperListener, SignupStepperState, StepperStatus, createSignupStepper, deriveAnswersSchema, deriveFieldSchema, deriveStepSchema, optionValue } from './dynamic/index.js';
|
|
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';
|
|
13
|
+
export { RecaptchaError, RecaptchaErrorKind, RecaptchaLoadOptions, _resetRecaptchaState, executeRecaptcha, loadRecaptcha } from './recaptcha/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';
|
|
15
|
+
import 'zod/v3';
|
|
16
|
+
import './index-Dqfa890U.js';
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,18 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
1
|
+
export { DEFAULT_WIDGET_CSS, OnboardingWidget, consentDocElementId, cssEscape, idSelector, injectWidgetStyles, mountContactForm, mountSignupForm, renderConsentStep, updateConsentStep } from './chunk-IPAKPLIF.js';
|
|
2
|
+
import './chunk-JFIONONR.js';
|
|
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';
|
|
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';
|
|
15
|
+
import './chunk-VH6FWDWI.js';
|
|
16
|
+
export { RecaptchaError, _resetRecaptchaState, executeRecaptcha, loadRecaptcha } from './chunk-7NS7ENJV.js';
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|