@opendoor/partner-sdk-client-js-core 1.2.1-beta.104.1 → 1.2.1-beta.106.1
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.
|
@@ -13,6 +13,18 @@ import type { AnswerValue, EngineEvent, PageConfig, QuestionConfig, ValidationRe
|
|
|
13
13
|
export interface DtcOnboardingOptions {
|
|
14
14
|
/** Pre-filled answers (e.g., from address lookup or prior session). */
|
|
15
15
|
initialAnswers?: Record<string, AnswerValue>;
|
|
16
|
+
/**
|
|
17
|
+
* Page IDs to remove from the flow entirely. Useful when the partner
|
|
18
|
+
* already knows the answers (e.g. a homebuilder partner doesn't need to
|
|
19
|
+
* ask "Are you working with a homebuilder?"). For any *required* questions
|
|
20
|
+
* on a skipped page, pair this with `initialAnswers` so the value still
|
|
21
|
+
* makes it into the submitted data.
|
|
22
|
+
*
|
|
23
|
+
* Skipped pages behave as if their `showWhen` evaluated to false — the
|
|
24
|
+
* engine treats them as invisible, downstream `showWhen` conditions can
|
|
25
|
+
* still reference any answers you provided in `initialAnswers`.
|
|
26
|
+
*/
|
|
27
|
+
skipPages?: string[];
|
|
16
28
|
}
|
|
17
29
|
export declare class DtcOnboardingEngine {
|
|
18
30
|
private _allPages;
|
|
@@ -21,8 +33,12 @@ export declare class DtcOnboardingEngine {
|
|
|
21
33
|
private _validationErrors;
|
|
22
34
|
private _submitted;
|
|
23
35
|
private _listeners;
|
|
36
|
+
private _skipPages;
|
|
24
37
|
constructor(pages: PageConfig[], options?: DtcOnboardingOptions);
|
|
25
|
-
/**
|
|
38
|
+
/**
|
|
39
|
+
* Pages visible given current answers — filtered by both `showWhen`
|
|
40
|
+
* conditions and the partner-supplied `skipPages` allowlist.
|
|
41
|
+
*/
|
|
26
42
|
get visiblePages(): PageConfig[];
|
|
27
43
|
/** The current page, or undefined if no pages are visible. */
|
|
28
44
|
get currentPage(): PageConfig | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../../src/internal/questionnaire/engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EACV,WAAW,EACX,WAAW,EACX,UAAU,EACV,cAAc,EACd,gBAAgB,EACjB,MAAM,YAAY,CAAC;AAOpB,MAAM,WAAW,oBAAoB;IACnC,uEAAuE;IACvE,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../../src/internal/questionnaire/engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EACV,WAAW,EACX,WAAW,EACX,UAAU,EACV,cAAc,EACd,gBAAgB,EACjB,MAAM,YAAY,CAAC;AAOpB,MAAM,WAAW,oBAAoB;IACnC,uEAAuE;IACvE,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAC7C;;;;;;;;;;OAUG;IACH,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,SAAS,CAAe;IAChC,OAAO,CAAC,QAAQ,CAA8B;IAC9C,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,iBAAiB,CAA8B;IACvD,OAAO,CAAC,UAAU,CAAkB;IACpC,OAAO,CAAC,UAAU,CAGd;IACJ,OAAO,CAAC,UAAU,CAAc;gBAEpB,KAAK,EAAE,UAAU,EAAE,EAAE,OAAO,CAAC,EAAE,oBAAoB;IAa/D;;;OAGG;IACH,IAAI,YAAY,IAAI,UAAU,EAAE,CAI/B;IAED,8DAA8D;IAC9D,IAAI,WAAW,IAAI,UAAU,GAAG,SAAS,CAExC;IAED,sDAAsD;IACtD,IAAI,gBAAgB,IAAI,MAAM,CAK7B;IAED,wEAAwE;IACxE,IAAI,QAAQ,IAAI,MAAM,CAKrB;IAED,IAAI,WAAW,IAAI,OAAO,CAEzB;IAED,IAAI,UAAU,IAAI,OAAO,CAGxB;IAED,6DAA6D;IAC7D,IAAI,SAAS,IAAI,OAAO,CAEvB;IAID,IAAI,OAAO,IAAI,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAEnD;IAED,IAAI,gBAAgB,IAAI,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAEvD;IAED;;;OAGG;IACH,SAAS,GAAI,KAAK,MAAM,KAAG,WAAW,CAEpC;IAIF;;OAEG;IACH,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,GAAG,IAAI;IAahD;;;OAGG;IACH,UAAU,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,GAAG,IAAI;IAsBtD;;;;;OAKG;IACH,QAAQ,IAAI,gBAAgB;IA0C5B;;OAEG;IACH,QAAQ,IAAI,IAAI;IAehB;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAc7B;;OAEG;IACH,QAAQ,IAAI,gBAAgB;IAQ5B;;OAEG;IACH,iCAAiC,IAAI,cAAc,EAAE;IAQrD;;OAEG;IACH,EAAE,CACA,SAAS,EAAE,WAAW,CAAC,MAAM,CAAC,EAC9B,OAAO,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,GACpC,MAAM,IAAI;IAWb;;OAEG;IACH,OAAO,IAAI,IAAI;IAMf,OAAO,CAAC,IAAI;IASZ;;;OAGG;IACH,OAAO,CAAC,0BAA0B;CAwBnC"}
|
|
@@ -26,14 +26,21 @@ export class DtcOnboardingEngine {
|
|
|
26
26
|
this._answers = options?.initialAnswers
|
|
27
27
|
? { ...options.initialAnswers }
|
|
28
28
|
: {};
|
|
29
|
+
this._skipPages = new Set(options?.skipPages ?? []);
|
|
29
30
|
// Initialize to first visible page
|
|
30
31
|
const visible = this.visiblePages;
|
|
31
32
|
this._currentPageId = visible.length > 0 ? visible[0].id : '';
|
|
32
33
|
}
|
|
33
34
|
// ── Derived state (recomputed on access) ──────────────────────────────────
|
|
34
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* Pages visible given current answers — filtered by both `showWhen`
|
|
37
|
+
* conditions and the partner-supplied `skipPages` allowlist.
|
|
38
|
+
*/
|
|
35
39
|
get visiblePages() {
|
|
36
|
-
|
|
40
|
+
const visible = getVisiblePages(this._allPages, this.getAnswer);
|
|
41
|
+
if (this._skipPages.size === 0)
|
|
42
|
+
return visible;
|
|
43
|
+
return visible.filter((page) => !this._skipPages.has(page.id));
|
|
37
44
|
}
|
|
38
45
|
/** The current page, or undefined if no pages are visible. */
|
|
39
46
|
get currentPage() {
|
package/package.json
CHANGED