@nodii/onboarding 0.1.0-dev.0 → 0.2.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 +124 -0
- package/dist/{chunk-4SWOVHZ2.js → chunk-A3DE2IAH.js} +155 -18
- package/dist/chunk-A3DE2IAH.js.map +1 -0
- package/dist/{chunk-AFCJLUPK.js → chunk-DWFZA5T6.js} +19 -8
- package/dist/chunk-DWFZA5T6.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-JFDQZ3AC.js +3 -0
- package/dist/chunk-JFDQZ3AC.js.map +1 -0
- package/dist/{chunk-34BQX2KR.js → chunk-KFHVZGX6.js} +61 -6
- package/dist/chunk-KFHVZGX6.js.map +1 -0
- package/dist/chunk-NDSBIB3N.js +99 -0
- package/dist/chunk-NDSBIB3N.js.map +1 -0
- package/dist/chunk-OLWR5COK.js +10 -0
- package/dist/chunk-OLWR5COK.js.map +1 -0
- package/dist/{chunk-SWMIIUXR.js → chunk-OVULPWNZ.js} +917 -158
- package/dist/chunk-OVULPWNZ.js.map +1 -0
- package/dist/chunk-SEKNVHD3.js +59 -0
- package/dist/chunk-SEKNVHD3.js.map +1 -0
- package/dist/chunk-T7EWURTF.js +321 -0
- package/dist/chunk-T7EWURTF.js.map +1 -0
- package/dist/{chunk-BQCTDU5V.js → chunk-UHOFGWI7.js} +90 -15
- package/dist/chunk-UHOFGWI7.js.map +1 -0
- package/dist/chunk-WKN4U7QF.js +35 -0
- package/dist/chunk-WKN4U7QF.js.map +1 -0
- package/dist/{chunk-AW7W3HAC.js → chunk-XJTJPBJB.js} +40 -3
- package/dist/chunk-XJTJPBJB.js.map +1 -0
- package/dist/chunk-ZR6X3GSM.js +186 -0
- package/dist/chunk-ZR6X3GSM.js.map +1 -0
- package/dist/client-NvqPpfQP.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-BLH3wnxl.d.ts +177 -0
- package/dist/dynamic/index.d.ts +65 -6
- package/dist/dynamic/index.js +5 -2
- package/dist/errors-vJkye4a0.d.ts +110 -0
- package/dist/form/index.d.ts +12 -4
- package/dist/form/index.js +2 -2
- package/dist/index-BMSbQGWP.d.ts +103 -0
- package/dist/index.d.ts +13 -7
- package/dist/index.js +13 -8
- package/dist/model-BI_I-D_V.d.ts +267 -0
- package/dist/{model-IEyDI54w.d.ts → model-CEwvHlWA.d.ts} +212 -46
- package/dist/render-EWQXF73I.js +5 -0
- package/dist/render-EWQXF73I.js.map +1 -0
- package/dist/schema-BrtjpXfL.d.ts +257 -0
- package/dist/{signup-client-Bl6eUrxR.d.ts → signup-client-CS95nkVO.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 +4 -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 +102 -20
- package/dist/widget/index.js +10 -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
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
import { z } from 'zod/v3';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Contact-form Zod schema — mirrors the LOCKED hub REST contract exactly:
|
|
5
|
+
* POST /api/v1/public/onboarding/leads
|
|
6
|
+
* Schema: PublicOnboardingLeadsRequest (hub id 8686dd33)
|
|
7
|
+
*
|
|
8
|
+
* Constraints (per hub JSON Schema):
|
|
9
|
+
* name — string, 1-200 chars, required
|
|
10
|
+
* email — email format, required
|
|
11
|
+
* phone — string, optional (no server-side constraint beyond string)
|
|
12
|
+
* message — string, ≤4000 chars, optional
|
|
13
|
+
* botToken — string, required (reCAPTCHA token, D537)
|
|
14
|
+
*
|
|
15
|
+
* additionalProperties: false
|
|
16
|
+
*
|
|
17
|
+
* The schema intentionally does NOT include botToken in the public-facing
|
|
18
|
+
* ContactFormValues type — that field is injected by the submit client right
|
|
19
|
+
* before the POST (the widget/form never exposes it to the user).
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The user-visible contact form fields. Validated client-side for UX.
|
|
24
|
+
* Server re-validates authoritatively (D540 §2).
|
|
25
|
+
*/
|
|
26
|
+
declare const contactFormSchema: z.ZodObject<{
|
|
27
|
+
name: z.ZodOptional<z.ZodString>;
|
|
28
|
+
companyName: z.ZodString;
|
|
29
|
+
contactName: z.ZodString;
|
|
30
|
+
email: z.ZodString;
|
|
31
|
+
phone: z.ZodOptional<z.ZodString>;
|
|
32
|
+
message: z.ZodOptional<z.ZodString>;
|
|
33
|
+
interestModules: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
34
|
+
sizeBand: z.ZodOptional<z.ZodString>;
|
|
35
|
+
attribution: z.ZodOptional<z.ZodObject<{
|
|
36
|
+
campaignTags: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
37
|
+
referringSite: z.ZodOptional<z.ZodString>;
|
|
38
|
+
landingPage: z.ZodOptional<z.ZodString>;
|
|
39
|
+
button: z.ZodOptional<z.ZodString>;
|
|
40
|
+
}, "strict", z.ZodTypeAny, {
|
|
41
|
+
campaignTags?: Record<string, string> | undefined;
|
|
42
|
+
referringSite?: string | undefined;
|
|
43
|
+
landingPage?: string | undefined;
|
|
44
|
+
button?: string | undefined;
|
|
45
|
+
}, {
|
|
46
|
+
campaignTags?: Record<string, string> | undefined;
|
|
47
|
+
referringSite?: string | undefined;
|
|
48
|
+
landingPage?: string | undefined;
|
|
49
|
+
button?: string | undefined;
|
|
50
|
+
}>>;
|
|
51
|
+
privacyNoticeAcknowledged: z.ZodEffects<z.ZodBoolean, boolean, boolean>;
|
|
52
|
+
marketingOptIn: z.ZodBoolean;
|
|
53
|
+
intakeKind: z.ZodEnum<["contact", "enquiry"]>;
|
|
54
|
+
}, "strip", z.ZodTypeAny, {
|
|
55
|
+
companyName: string;
|
|
56
|
+
contactName: string;
|
|
57
|
+
email: string;
|
|
58
|
+
interestModules: string[];
|
|
59
|
+
privacyNoticeAcknowledged: boolean;
|
|
60
|
+
marketingOptIn: boolean;
|
|
61
|
+
intakeKind: "contact" | "enquiry";
|
|
62
|
+
name?: string | undefined;
|
|
63
|
+
phone?: string | undefined;
|
|
64
|
+
message?: string | undefined;
|
|
65
|
+
sizeBand?: string | undefined;
|
|
66
|
+
attribution?: {
|
|
67
|
+
campaignTags?: Record<string, string> | undefined;
|
|
68
|
+
referringSite?: string | undefined;
|
|
69
|
+
landingPage?: string | undefined;
|
|
70
|
+
button?: string | undefined;
|
|
71
|
+
} | undefined;
|
|
72
|
+
}, {
|
|
73
|
+
companyName: string;
|
|
74
|
+
contactName: string;
|
|
75
|
+
email: string;
|
|
76
|
+
privacyNoticeAcknowledged: boolean;
|
|
77
|
+
marketingOptIn: boolean;
|
|
78
|
+
intakeKind: "contact" | "enquiry";
|
|
79
|
+
name?: string | undefined;
|
|
80
|
+
phone?: string | undefined;
|
|
81
|
+
message?: string | undefined;
|
|
82
|
+
interestModules?: string[] | undefined;
|
|
83
|
+
sizeBand?: string | undefined;
|
|
84
|
+
attribution?: {
|
|
85
|
+
campaignTags?: Record<string, string> | undefined;
|
|
86
|
+
referringSite?: string | undefined;
|
|
87
|
+
landingPage?: string | undefined;
|
|
88
|
+
button?: string | undefined;
|
|
89
|
+
} | undefined;
|
|
90
|
+
}>;
|
|
91
|
+
type ContactFormValues = z.infer<typeof contactFormSchema>;
|
|
92
|
+
/**
|
|
93
|
+
* The full wire payload — contactFormSchema + botToken.
|
|
94
|
+
*
|
|
95
|
+
* STRICT mode: unknown keys are REJECTED (not stripped), mirroring the
|
|
96
|
+
* server's `additionalProperties: false`. `submitLead` runs every outgoing
|
|
97
|
+
* payload through this schema before the POST — an extra key never reaches
|
|
98
|
+
* the wire; it fails fast client-side with OnboardingValidationError.
|
|
99
|
+
*/
|
|
100
|
+
declare const leadsWireSchema: z.ZodObject<{
|
|
101
|
+
name: z.ZodOptional<z.ZodString>;
|
|
102
|
+
companyName: z.ZodString;
|
|
103
|
+
contactName: z.ZodString;
|
|
104
|
+
email: z.ZodString;
|
|
105
|
+
phone: z.ZodOptional<z.ZodString>;
|
|
106
|
+
message: z.ZodOptional<z.ZodString>;
|
|
107
|
+
interestModules: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
108
|
+
sizeBand: z.ZodOptional<z.ZodString>;
|
|
109
|
+
attribution: z.ZodOptional<z.ZodObject<{
|
|
110
|
+
campaignTags: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
111
|
+
referringSite: z.ZodOptional<z.ZodString>;
|
|
112
|
+
landingPage: z.ZodOptional<z.ZodString>;
|
|
113
|
+
button: z.ZodOptional<z.ZodString>;
|
|
114
|
+
}, "strict", z.ZodTypeAny, {
|
|
115
|
+
campaignTags?: Record<string, string> | undefined;
|
|
116
|
+
referringSite?: string | undefined;
|
|
117
|
+
landingPage?: string | undefined;
|
|
118
|
+
button?: string | undefined;
|
|
119
|
+
}, {
|
|
120
|
+
campaignTags?: Record<string, string> | undefined;
|
|
121
|
+
referringSite?: string | undefined;
|
|
122
|
+
landingPage?: string | undefined;
|
|
123
|
+
button?: string | undefined;
|
|
124
|
+
}>>;
|
|
125
|
+
privacyNoticeAcknowledged: z.ZodEffects<z.ZodBoolean, boolean, boolean>;
|
|
126
|
+
marketingOptIn: z.ZodBoolean;
|
|
127
|
+
intakeKind: z.ZodEnum<["contact", "enquiry"]>;
|
|
128
|
+
} & {
|
|
129
|
+
botToken: z.ZodOptional<z.ZodString>;
|
|
130
|
+
}, "strict", z.ZodTypeAny, {
|
|
131
|
+
companyName: string;
|
|
132
|
+
contactName: string;
|
|
133
|
+
email: string;
|
|
134
|
+
interestModules: string[];
|
|
135
|
+
privacyNoticeAcknowledged: boolean;
|
|
136
|
+
marketingOptIn: boolean;
|
|
137
|
+
intakeKind: "contact" | "enquiry";
|
|
138
|
+
name?: string | undefined;
|
|
139
|
+
phone?: string | undefined;
|
|
140
|
+
message?: string | undefined;
|
|
141
|
+
sizeBand?: string | undefined;
|
|
142
|
+
attribution?: {
|
|
143
|
+
campaignTags?: Record<string, string> | undefined;
|
|
144
|
+
referringSite?: string | undefined;
|
|
145
|
+
landingPage?: string | undefined;
|
|
146
|
+
button?: string | undefined;
|
|
147
|
+
} | undefined;
|
|
148
|
+
botToken?: string | undefined;
|
|
149
|
+
}, {
|
|
150
|
+
companyName: string;
|
|
151
|
+
contactName: string;
|
|
152
|
+
email: string;
|
|
153
|
+
privacyNoticeAcknowledged: boolean;
|
|
154
|
+
marketingOptIn: boolean;
|
|
155
|
+
intakeKind: "contact" | "enquiry";
|
|
156
|
+
name?: string | undefined;
|
|
157
|
+
phone?: string | undefined;
|
|
158
|
+
message?: string | undefined;
|
|
159
|
+
interestModules?: string[] | undefined;
|
|
160
|
+
sizeBand?: string | undefined;
|
|
161
|
+
attribution?: {
|
|
162
|
+
campaignTags?: Record<string, string> | undefined;
|
|
163
|
+
referringSite?: string | undefined;
|
|
164
|
+
landingPage?: string | undefined;
|
|
165
|
+
button?: string | undefined;
|
|
166
|
+
} | undefined;
|
|
167
|
+
botToken?: string | undefined;
|
|
168
|
+
}>;
|
|
169
|
+
type LeadsWirePayload = z.infer<typeof leadsWireSchema>;
|
|
170
|
+
/**
|
|
171
|
+
* Validate user-visible form values (no botToken required here).
|
|
172
|
+
* Returns a Zod SafeParseReturnType (inferred).
|
|
173
|
+
*/
|
|
174
|
+
declare function validateContactForm(values: unknown): z.SafeParseReturnType<{
|
|
175
|
+
companyName: string;
|
|
176
|
+
contactName: string;
|
|
177
|
+
email: string;
|
|
178
|
+
privacyNoticeAcknowledged: boolean;
|
|
179
|
+
marketingOptIn: boolean;
|
|
180
|
+
intakeKind: "contact" | "enquiry";
|
|
181
|
+
name?: string | undefined;
|
|
182
|
+
phone?: string | undefined;
|
|
183
|
+
message?: string | undefined;
|
|
184
|
+
interestModules?: string[] | undefined;
|
|
185
|
+
sizeBand?: string | undefined;
|
|
186
|
+
attribution?: {
|
|
187
|
+
campaignTags?: Record<string, string> | undefined;
|
|
188
|
+
referringSite?: string | undefined;
|
|
189
|
+
landingPage?: string | undefined;
|
|
190
|
+
button?: string | undefined;
|
|
191
|
+
} | undefined;
|
|
192
|
+
}, {
|
|
193
|
+
companyName: string;
|
|
194
|
+
contactName: string;
|
|
195
|
+
email: string;
|
|
196
|
+
interestModules: string[];
|
|
197
|
+
privacyNoticeAcknowledged: boolean;
|
|
198
|
+
marketingOptIn: boolean;
|
|
199
|
+
intakeKind: "contact" | "enquiry";
|
|
200
|
+
name?: string | undefined;
|
|
201
|
+
phone?: string | undefined;
|
|
202
|
+
message?: string | undefined;
|
|
203
|
+
sizeBand?: string | undefined;
|
|
204
|
+
attribution?: {
|
|
205
|
+
campaignTags?: Record<string, string> | undefined;
|
|
206
|
+
referringSite?: string | undefined;
|
|
207
|
+
landingPage?: string | undefined;
|
|
208
|
+
button?: string | undefined;
|
|
209
|
+
} | undefined;
|
|
210
|
+
}>;
|
|
211
|
+
/**
|
|
212
|
+
* Validate the full wire payload (including botToken) before submission.
|
|
213
|
+
* STRICT: unknown keys are rejected, matching additionalProperties:false.
|
|
214
|
+
* This is the exact validation `submitLead` applies on the wire path.
|
|
215
|
+
* Returns a Zod SafeParseReturnType (inferred).
|
|
216
|
+
*/
|
|
217
|
+
declare function validateLeadsPayload(payload: unknown): z.SafeParseReturnType<{
|
|
218
|
+
companyName: string;
|
|
219
|
+
contactName: string;
|
|
220
|
+
email: string;
|
|
221
|
+
privacyNoticeAcknowledged: boolean;
|
|
222
|
+
marketingOptIn: boolean;
|
|
223
|
+
intakeKind: "contact" | "enquiry";
|
|
224
|
+
name?: string | undefined;
|
|
225
|
+
phone?: string | undefined;
|
|
226
|
+
message?: string | undefined;
|
|
227
|
+
interestModules?: string[] | undefined;
|
|
228
|
+
sizeBand?: string | undefined;
|
|
229
|
+
attribution?: {
|
|
230
|
+
campaignTags?: Record<string, string> | undefined;
|
|
231
|
+
referringSite?: string | undefined;
|
|
232
|
+
landingPage?: string | undefined;
|
|
233
|
+
button?: string | undefined;
|
|
234
|
+
} | undefined;
|
|
235
|
+
botToken?: string | undefined;
|
|
236
|
+
}, {
|
|
237
|
+
companyName: string;
|
|
238
|
+
contactName: string;
|
|
239
|
+
email: string;
|
|
240
|
+
interestModules: string[];
|
|
241
|
+
privacyNoticeAcknowledged: boolean;
|
|
242
|
+
marketingOptIn: boolean;
|
|
243
|
+
intakeKind: "contact" | "enquiry";
|
|
244
|
+
name?: string | undefined;
|
|
245
|
+
phone?: string | undefined;
|
|
246
|
+
message?: string | undefined;
|
|
247
|
+
sizeBand?: string | undefined;
|
|
248
|
+
attribution?: {
|
|
249
|
+
campaignTags?: Record<string, string> | undefined;
|
|
250
|
+
referringSite?: string | undefined;
|
|
251
|
+
landingPage?: string | undefined;
|
|
252
|
+
button?: string | undefined;
|
|
253
|
+
} | undefined;
|
|
254
|
+
botToken?: string | undefined;
|
|
255
|
+
}>;
|
|
256
|
+
|
|
257
|
+
export { type ContactFormValues as C, type LeadsWirePayload as L, validateLeadsPayload as a, contactFormSchema as c, leadsWireSchema as l, validateContactForm as v };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod/v3';
|
|
2
|
-
import { T as TerminalStage } from './model-
|
|
3
|
-
import {
|
|
2
|
+
import { T as TerminalStage } from './model-CEwvHlWA.js';
|
|
3
|
+
import { e as ConsentSubmitDocument } from './controller-BLH3wnxl.js';
|
|
4
|
+
import { C as ContactFormValues } from './schema-BrtjpXfL.js';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Submit client for POST /api/v1/public/onboarding/leads.
|
|
@@ -42,7 +43,7 @@ interface LeadsSubmitOptions {
|
|
|
42
43
|
* fresh token (recommended — tokens are single-use; a fixed string on a
|
|
43
44
|
* retried request risks 403 after the first attempt consumed it).
|
|
44
45
|
*/
|
|
45
|
-
botToken
|
|
46
|
+
botToken?: BotTokenSource;
|
|
46
47
|
/**
|
|
47
48
|
* Stable idempotency key for this submission. Generate ONCE with
|
|
48
49
|
* `generateIdempotencyKey()` and pass the same key for retries.
|
|
@@ -116,7 +117,7 @@ declare function submitLead(values: ContactFormValues, options: LeadsSubmitOptio
|
|
|
116
117
|
* Contract per the LOCKED hub REST interface (PublicOnboardingSubmitRequest):
|
|
117
118
|
* - Body: { specVersion, answers, selectedServices?, botToken,
|
|
118
119
|
* consent:{tosAccepted:true, privacyAccepted:true},
|
|
119
|
-
* credentials:{email,
|
|
120
|
+
* credentials:{email, displayName?}, organisationName?, subdomain }
|
|
120
121
|
* additionalProperties: false — validated STRICTLY client-side before
|
|
121
122
|
* any fetch (unknown keys are rejected, not stripped).
|
|
122
123
|
* - Idempotency-Key header REQUIRED (same D538 discipline as leads:
|
|
@@ -134,61 +135,177 @@ declare function submitLead(values: ContactFormValues, options: LeadsSubmitOptio
|
|
|
134
135
|
* (/leads tolerates body-less 2xx because its only signal IS the status.)
|
|
135
136
|
*/
|
|
136
137
|
|
|
138
|
+
/**
|
|
139
|
+
* STRICT wire schema for ONE element of the D543 §4 consent.documents array.
|
|
140
|
+
* `accepted` is const-true (an unaccepted doc is never sent — the consent
|
|
141
|
+
* controller omits it), and `evidence` carries only the gate-relevant flags.
|
|
142
|
+
*/
|
|
143
|
+
declare const consentSubmitDocumentSchema: z.ZodObject<{
|
|
144
|
+
legalDocumentId: z.ZodString;
|
|
145
|
+
versionNo: z.ZodNumber;
|
|
146
|
+
accepted: z.ZodLiteral<true>;
|
|
147
|
+
evidence: z.ZodObject<{
|
|
148
|
+
scrolled_to_end: z.ZodOptional<z.ZodBoolean>;
|
|
149
|
+
opened: z.ZodOptional<z.ZodBoolean>;
|
|
150
|
+
}, "strict", z.ZodTypeAny, {
|
|
151
|
+
opened?: boolean | undefined;
|
|
152
|
+
scrolled_to_end?: boolean | undefined;
|
|
153
|
+
}, {
|
|
154
|
+
opened?: boolean | undefined;
|
|
155
|
+
scrolled_to_end?: boolean | undefined;
|
|
156
|
+
}>;
|
|
157
|
+
}, "strict", z.ZodTypeAny, {
|
|
158
|
+
legalDocumentId: string;
|
|
159
|
+
versionNo: number;
|
|
160
|
+
accepted: true;
|
|
161
|
+
evidence: {
|
|
162
|
+
opened?: boolean | undefined;
|
|
163
|
+
scrolled_to_end?: boolean | undefined;
|
|
164
|
+
};
|
|
165
|
+
}, {
|
|
166
|
+
legalDocumentId: string;
|
|
167
|
+
versionNo: number;
|
|
168
|
+
accepted: true;
|
|
169
|
+
evidence: {
|
|
170
|
+
opened?: boolean | undefined;
|
|
171
|
+
scrolled_to_end?: boolean | undefined;
|
|
172
|
+
};
|
|
173
|
+
}>;
|
|
137
174
|
/**
|
|
138
175
|
* STRICT wire schema — mirrors PublicOnboardingSubmitRequest exactly
|
|
139
|
-
* (additionalProperties: false; consent booleans are const-true;
|
|
140
|
-
*
|
|
176
|
+
* (additionalProperties: false; consent booleans are const-true; passwordless
|
|
177
|
+
* per D1010, with the workspace subdomain required by D836).
|
|
178
|
+
*
|
|
179
|
+
* D543 §4: `consent` extends from booleans to a per-document array. The
|
|
180
|
+
* `documents` array is AUTHORITATIVE (the server re-validates it); the
|
|
181
|
+
* `tosAccepted`/`privacyAccepted` booleans are kept as a DERIVED convenience
|
|
182
|
+
* (D543 "kept as a derived convenience only"). `documents` is OPTIONAL on the
|
|
183
|
+
* wire for backward-compat — a pre-ConsentPack onboarder serves no consentPack
|
|
184
|
+
* and submits the booleans alone (D543 "pre-ConsentPack submits still parse").
|
|
141
185
|
*/
|
|
142
186
|
declare const signupWireSchema: z.ZodObject<{
|
|
143
187
|
specVersion: z.ZodString;
|
|
144
188
|
answers: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
145
189
|
selectedServices: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
146
|
-
botToken: z.ZodString
|
|
190
|
+
botToken: z.ZodOptional<z.ZodString>;
|
|
147
191
|
consent: z.ZodObject<{
|
|
148
192
|
tosAccepted: z.ZodLiteral<true>;
|
|
149
193
|
privacyAccepted: z.ZodLiteral<true>;
|
|
194
|
+
documents: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
195
|
+
legalDocumentId: z.ZodString;
|
|
196
|
+
versionNo: z.ZodNumber;
|
|
197
|
+
accepted: z.ZodLiteral<true>;
|
|
198
|
+
evidence: z.ZodObject<{
|
|
199
|
+
scrolled_to_end: z.ZodOptional<z.ZodBoolean>;
|
|
200
|
+
opened: z.ZodOptional<z.ZodBoolean>;
|
|
201
|
+
}, "strict", z.ZodTypeAny, {
|
|
202
|
+
opened?: boolean | undefined;
|
|
203
|
+
scrolled_to_end?: boolean | undefined;
|
|
204
|
+
}, {
|
|
205
|
+
opened?: boolean | undefined;
|
|
206
|
+
scrolled_to_end?: boolean | undefined;
|
|
207
|
+
}>;
|
|
208
|
+
}, "strict", z.ZodTypeAny, {
|
|
209
|
+
legalDocumentId: string;
|
|
210
|
+
versionNo: number;
|
|
211
|
+
accepted: true;
|
|
212
|
+
evidence: {
|
|
213
|
+
opened?: boolean | undefined;
|
|
214
|
+
scrolled_to_end?: boolean | undefined;
|
|
215
|
+
};
|
|
216
|
+
}, {
|
|
217
|
+
legalDocumentId: string;
|
|
218
|
+
versionNo: number;
|
|
219
|
+
accepted: true;
|
|
220
|
+
evidence: {
|
|
221
|
+
opened?: boolean | undefined;
|
|
222
|
+
scrolled_to_end?: boolean | undefined;
|
|
223
|
+
};
|
|
224
|
+
}>, "many">>;
|
|
150
225
|
}, "strict", z.ZodTypeAny, {
|
|
151
226
|
tosAccepted: true;
|
|
152
227
|
privacyAccepted: true;
|
|
228
|
+
documents?: {
|
|
229
|
+
legalDocumentId: string;
|
|
230
|
+
versionNo: number;
|
|
231
|
+
accepted: true;
|
|
232
|
+
evidence: {
|
|
233
|
+
opened?: boolean | undefined;
|
|
234
|
+
scrolled_to_end?: boolean | undefined;
|
|
235
|
+
};
|
|
236
|
+
}[] | undefined;
|
|
153
237
|
}, {
|
|
154
238
|
tosAccepted: true;
|
|
155
239
|
privacyAccepted: true;
|
|
240
|
+
documents?: {
|
|
241
|
+
legalDocumentId: string;
|
|
242
|
+
versionNo: number;
|
|
243
|
+
accepted: true;
|
|
244
|
+
evidence: {
|
|
245
|
+
opened?: boolean | undefined;
|
|
246
|
+
scrolled_to_end?: boolean | undefined;
|
|
247
|
+
};
|
|
248
|
+
}[] | undefined;
|
|
156
249
|
}>;
|
|
157
250
|
credentials: z.ZodObject<{
|
|
158
251
|
email: z.ZodString;
|
|
159
|
-
|
|
252
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
160
253
|
}, "strict", z.ZodTypeAny, {
|
|
161
254
|
email: string;
|
|
162
|
-
|
|
255
|
+
displayName?: string | undefined;
|
|
163
256
|
}, {
|
|
164
257
|
email: string;
|
|
165
|
-
|
|
258
|
+
displayName?: string | undefined;
|
|
166
259
|
}>;
|
|
260
|
+
organisationName: z.ZodOptional<z.ZodString>;
|
|
261
|
+
subdomain: z.ZodEffects<z.ZodString, string, string>;
|
|
167
262
|
}, "strict", z.ZodTypeAny, {
|
|
168
|
-
botToken: string;
|
|
169
263
|
specVersion: string;
|
|
170
264
|
credentials: {
|
|
171
265
|
email: string;
|
|
172
|
-
|
|
266
|
+
displayName?: string | undefined;
|
|
173
267
|
};
|
|
268
|
+
subdomain: string;
|
|
174
269
|
answers: Record<string, unknown>;
|
|
175
270
|
consent: {
|
|
176
271
|
tosAccepted: true;
|
|
177
272
|
privacyAccepted: true;
|
|
273
|
+
documents?: {
|
|
274
|
+
legalDocumentId: string;
|
|
275
|
+
versionNo: number;
|
|
276
|
+
accepted: true;
|
|
277
|
+
evidence: {
|
|
278
|
+
opened?: boolean | undefined;
|
|
279
|
+
scrolled_to_end?: boolean | undefined;
|
|
280
|
+
};
|
|
281
|
+
}[] | undefined;
|
|
178
282
|
};
|
|
283
|
+
botToken?: string | undefined;
|
|
284
|
+
organisationName?: string | undefined;
|
|
179
285
|
selectedServices?: string[] | undefined;
|
|
180
286
|
}, {
|
|
181
|
-
botToken: string;
|
|
182
287
|
specVersion: string;
|
|
183
288
|
credentials: {
|
|
184
289
|
email: string;
|
|
185
|
-
|
|
290
|
+
displayName?: string | undefined;
|
|
186
291
|
};
|
|
292
|
+
subdomain: string;
|
|
187
293
|
answers: Record<string, unknown>;
|
|
188
294
|
consent: {
|
|
189
295
|
tosAccepted: true;
|
|
190
296
|
privacyAccepted: true;
|
|
297
|
+
documents?: {
|
|
298
|
+
legalDocumentId: string;
|
|
299
|
+
versionNo: number;
|
|
300
|
+
accepted: true;
|
|
301
|
+
evidence: {
|
|
302
|
+
opened?: boolean | undefined;
|
|
303
|
+
scrolled_to_end?: boolean | undefined;
|
|
304
|
+
};
|
|
305
|
+
}[] | undefined;
|
|
191
306
|
};
|
|
307
|
+
botToken?: string | undefined;
|
|
308
|
+
organisationName?: string | undefined;
|
|
192
309
|
selectedServices?: string[] | undefined;
|
|
193
310
|
}>;
|
|
194
311
|
type SignupWirePayload = z.infer<typeof signupWireSchema>;
|
|
@@ -197,14 +314,22 @@ interface SignupSubmitBody {
|
|
|
197
314
|
specVersion: string;
|
|
198
315
|
answers: Record<string, unknown>;
|
|
199
316
|
selectedServices?: string[];
|
|
317
|
+
/**
|
|
318
|
+
* D543 §4 consent. `documents` (the per-doc array) is authoritative when
|
|
319
|
+
* present; the booleans are the derived convenience. `documents` is omitted
|
|
320
|
+
* for a pre-ConsentPack onboarder (backward-compat).
|
|
321
|
+
*/
|
|
200
322
|
consent: {
|
|
201
323
|
tosAccepted: true;
|
|
202
324
|
privacyAccepted: true;
|
|
325
|
+
documents?: ConsentSubmitDocument[];
|
|
203
326
|
};
|
|
204
327
|
credentials: {
|
|
205
328
|
email: string;
|
|
206
|
-
|
|
329
|
+
displayName?: string;
|
|
207
330
|
};
|
|
331
|
+
organisationName?: string;
|
|
332
|
+
subdomain: string;
|
|
208
333
|
}
|
|
209
334
|
interface SignupSubmitOptions {
|
|
210
335
|
baseUrl: string;
|
|
@@ -214,7 +339,7 @@ interface SignupSubmitOptions {
|
|
|
214
339
|
* string on a retried request risks 403 after the first attempt consumed
|
|
215
340
|
* it — pass a provider for retry-safe recovery.
|
|
216
341
|
*/
|
|
217
|
-
botToken
|
|
342
|
+
botToken?: BotTokenSource;
|
|
218
343
|
/** Stable idempotency key — same discipline as submitLead. */
|
|
219
344
|
idempotencyKey: string;
|
|
220
345
|
fetch?: typeof globalThis.fetch;
|
|
@@ -247,13 +372,21 @@ declare function computeSignupFingerprint(body: SignupSubmitBody): string;
|
|
|
247
372
|
* throws (reCAPTCHA unreachable) on any attempt
|
|
248
373
|
* @throws {OnboardingSpecStaleError} on 409 with code:"spec_stale" (caller
|
|
249
374
|
* refetches spec); carries the server's currentSpecVersion
|
|
250
|
-
* @throws {
|
|
375
|
+
* @throws {OnboardingConsentStaleError} on 409 with code:"consent_stale"
|
|
376
|
+
* (D543 §4 — a required legal doc changed; caller refetches spec + requires
|
|
377
|
+
* re-acceptance of the changed docs, NEVER auto-accepts); carries
|
|
378
|
+
* staleDocuments
|
|
379
|
+
* @throws {OnboardingConsentIncompleteError} on 400 with
|
|
380
|
+
* code:"consent_incomplete" (D543 §4 — server found a required doc missing/
|
|
381
|
+
* unaccepted/evidence-insufficient)
|
|
382
|
+
* @throws {OnboardingConflictError} on a 409 that is NOT spec_stale/consent_stale
|
|
251
383
|
* @throws {OnboardingRateLimitError} on 429
|
|
252
|
-
* @throws {OnboardingValidationError} on 422 (server re-validation)
|
|
384
|
+
* @throws {OnboardingValidationError} on 422 (server re-validation) or a
|
|
385
|
+
* generic 400 that is NOT consent_incomplete
|
|
253
386
|
* @throws {OnboardingServerError} on 5xx after retries, or a 2xx without
|
|
254
387
|
* the required {accepted:true, terminalStage} body
|
|
255
388
|
* @throws {OnboardingNetworkError} on network failure OR timeout after retries
|
|
256
389
|
*/
|
|
257
390
|
declare function submitSignup(body: SignupSubmitBody, options: SignupSubmitOptions): Promise<SignupSubmitResult>;
|
|
258
391
|
|
|
259
|
-
export { type BotTokenSource as B, type LeadsSubmitOptions as L, type SignupSubmitBody as S, type LeadsSubmitResult as a, type SignupSubmitOptions as b, type SignupSubmitResult as c, type SignupWirePayload as d, computePayloadFingerprint as e, computeSignupFingerprint as f,
|
|
392
|
+
export { type BotTokenSource as B, type LeadsSubmitOptions as L, type SignupSubmitBody as S, type LeadsSubmitResult as a, type SignupSubmitOptions as b, type SignupSubmitResult as c, type SignupWirePayload as d, computePayloadFingerprint as e, computeSignupFingerprint as f, consentSubmitDocumentSchema as g, generateIdempotencyKey as h, submitLead as i, submitSignup as j, resolveBotToken as r, signupWireSchema as s };
|
package/dist/spec/index.d.ts
CHANGED
|
@@ -1,88 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
1
|
+
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-CEwvHlWA.js';
|
|
2
|
+
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-BI_I-D_V.js';
|
|
3
|
+
export { O as OnboardingSpecCache, S as SpecFetchOptions, a as SpecFieldDiff, d as defaultSpecCache, b as diffSpecFields, f as fetchOnboardingSpec } from '../client-NvqPpfQP.js';
|
|
3
4
|
import 'zod/v3';
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
* - The onboarder is derived SERVER-side from the request Host (D536) —
|
|
9
|
-
* it is NOT sent by the client. The `onboarder` value here is purely the
|
|
10
|
-
* CLIENT-side cache key (D540 §3: "cache key (onboarder, specVersion)").
|
|
11
|
-
* - The spec response is validated against the LOCKED D540 shape before
|
|
12
|
-
* it is returned; a malformed spec throws OnboardingSpecInvalidError.
|
|
13
|
-
* - Cache semantics: every successful fetch is stored under
|
|
14
|
-
* (onboarder, specVersion) and as the onboarder's "latest". The versioned
|
|
15
|
-
* entries let the 409 spec_stale flow diff the previously-served version
|
|
16
|
-
* against the refetched one (see `diffSpecFields` + the signup widget's
|
|
17
|
-
* handleSpecStale, which reads the cached prior version before refetching).
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* In-memory spec cache keyed by (onboarder, specVersion), with a "latest"
|
|
22
|
-
* pointer per onboarder. Purely client-side; no TTL — the reject-stale
|
|
23
|
-
* policy (409 spec_stale on submit) is the authoritative staleness signal,
|
|
24
|
-
* and a refetch overwrites "latest".
|
|
25
|
-
*/
|
|
26
|
-
declare class OnboardingSpecCache {
|
|
27
|
-
private readonly byVersion;
|
|
28
|
-
private readonly latest;
|
|
29
|
-
/**
|
|
30
|
-
* Collision-proof composite key. Uses JSON.stringify of the tuple so an
|
|
31
|
-
* onboarder or version containing the delimiter can never alias another
|
|
32
|
-
* entry — and, critically, contains NO control characters (an earlier
|
|
33
|
-
* NUL-separator made git treat this whole file as binary/undiffable).
|
|
34
|
-
*/
|
|
35
|
-
private static versionKey;
|
|
36
|
-
get(onboarder: string, specVersion: string): OnboardingSpec | undefined;
|
|
37
|
-
getLatest(onboarder: string): OnboardingSpec | undefined;
|
|
38
|
-
set(onboarder: string, spec: OnboardingSpec): void;
|
|
39
|
-
clear(): void;
|
|
40
|
-
}
|
|
41
|
-
/** Module-level default cache (one per page). Injectable for tests/apps. */
|
|
42
|
-
declare const defaultSpecCache: OnboardingSpecCache;
|
|
43
|
-
/**
|
|
44
|
-
* Diff two spec versions' signup field sets — used by the 409 spec_stale
|
|
45
|
-
* flow to tell the user WHAT changed. Compares by field key across all
|
|
46
|
-
* signup steps.
|
|
47
|
-
*/
|
|
48
|
-
interface SpecFieldDiff {
|
|
49
|
-
added: string[];
|
|
50
|
-
removed: string[];
|
|
51
|
-
changed: string[];
|
|
6
|
+
interface PinStateResult {
|
|
7
|
+
pin: string;
|
|
8
|
+
stateIso: string | null;
|
|
52
9
|
}
|
|
53
|
-
declare function
|
|
54
|
-
interface SpecFetchOptions {
|
|
10
|
+
declare function fetchPinState(options: {
|
|
55
11
|
baseUrl: string;
|
|
56
|
-
|
|
57
|
-
* Client-side cache key ONLY (never transmitted; trust is host-derived
|
|
58
|
-
* per D536). Use the onboarder slug/id your embed is configured with.
|
|
59
|
-
*/
|
|
60
|
-
onboarder: string;
|
|
61
|
-
/** Custom fetch implementation (defaults to globalThis.fetch). */
|
|
12
|
+
pin: string;
|
|
62
13
|
fetch?: typeof globalThis.fetch;
|
|
63
|
-
/** Cache to read/write (defaults to the module-level cache). */
|
|
64
|
-
cache?: OnboardingSpecCache;
|
|
65
|
-
/**
|
|
66
|
-
* Request timeout in ms (default 15s). A stalled intake aborts with
|
|
67
|
-
* OnboardingNetworkError so the boot doesn't hang on "Loading signup form…".
|
|
68
|
-
*/
|
|
69
14
|
timeoutMs?: number;
|
|
70
|
-
|
|
71
|
-
* When true, return the cached "latest" for this onboarder if present
|
|
72
|
-
* WITHOUT a network round-trip. Default false (spec fetches are cheap
|
|
73
|
-
* and the server bumps specVersion on any change). The signup widget's
|
|
74
|
-
* boot passes preferCached:true so a remount reuses the loaded spec.
|
|
75
|
-
*/
|
|
76
|
-
preferCached?: boolean;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Fetch (and validate, and cache) the onboarding spec.
|
|
80
|
-
*
|
|
81
|
-
* @throws {OnboardingSpecInvalidError} response does not match D540 §1
|
|
82
|
-
* @throws {OnboardingRateLimitError} on 429
|
|
83
|
-
* @throws {OnboardingServerError} on any other non-2xx status
|
|
84
|
-
* @throws {OnboardingNetworkError} on network failure OR timeout
|
|
85
|
-
*/
|
|
86
|
-
declare function fetchOnboardingSpec(options: SpecFetchOptions): Promise<OnboardingSpec>;
|
|
15
|
+
}): Promise<PinStateResult>;
|
|
87
16
|
|
|
88
|
-
export {
|
|
17
|
+
export { type PinStateResult, fetchPinState };
|
package/dist/spec/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { FIELD_KEY_PATTERN, OnboardingSpecCache, defaultSpecCache, diffSpecFields, fetchOnboardingSpec, onboardingSpecSchema, specFieldSchema, specStepSchema, validateOnboardingSpec } from '../chunk-
|
|
2
|
-
|
|
1
|
+
export { FIELD_KEY_PATTERN, OnboardingSpecCache, defaultSpecCache, diffSpecFields, fetchOnboardingSpec, fetchPinState, onboardingSpecSchema, specFieldSchema, specStepSchema, validateOnboardingSpec } from '../chunk-KFHVZGX6.js';
|
|
2
|
+
export { ACCEPTANCE_LEVELS, DOC_TYPES, acceptanceLevelSchema, consentDocKey, consentDocumentSchema, consentPackSchema } from '../chunk-NDSBIB3N.js';
|
|
3
|
+
import '../chunk-XJTJPBJB.js';
|
|
3
4
|
//# sourceMappingURL=index.js.map
|
|
4
5
|
//# sourceMappingURL=index.js.map
|