@picked/client 0.0.51-next.1 → 0.0.51-next.11
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/api-CsptHpxs.cjs +1 -0
- package/dist/{api-Brluf3C1.js → api-D900ITyE.js} +1 -1
- package/dist/cjs/form/index.js +1 -1
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/plugins/create-experience/index.js +1 -1
- package/dist/cjs/plugins/dynamic-experiences/index.js +1 -1
- package/dist/cjs/plugins/responses-browser-storage/index.js +1 -1
- package/dist/cjs/plugins/responses-indexeddb/index.js +1 -1
- package/dist/cjs/server/index.js +1 -1
- package/dist/esm/form/index.js +82 -76
- package/dist/esm/index.js +436 -355
- package/dist/esm/plugins/create-experience/index.js +181 -154
- package/dist/esm/plugins/dynamic-experiences/index.js +52 -30
- package/dist/esm/plugins/responses-browser-storage/index.js +6 -8
- package/dist/esm/plugins/responses-indexeddb/index.js +8 -4
- package/dist/esm/server/index.js +1 -1
- package/dist/experience-instance-DOcd8XI1.cjs +1 -0
- package/dist/{experience-instance-CIbQp9D7.js → experience-instance-NHU1moID.js} +37 -32
- package/dist/{rules-logic-BIkBWZmf.js → rules-logic-CnVktz2l.js} +9 -2
- package/dist/{rules-logic-DDxCiq4P.cjs → rules-logic-nMHNVLn7.cjs} +1 -1
- package/dist/types/client.d.ts +47 -43
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/entities/action/action.d.ts +37 -5
- package/dist/types/entities/action/action.d.ts.map +1 -1
- package/dist/types/entities/condition/condition.d.ts +20 -0
- package/dist/types/entities/condition/condition.d.ts.map +1 -0
- package/dist/types/entities/experience/experience.d.ts +63 -47
- package/dist/types/entities/experience/experience.d.ts.map +1 -1
- package/dist/types/entities/experience-instance/experience-instance.d.ts +22 -2
- package/dist/types/entities/experience-instance/experience-instance.d.ts.map +1 -1
- package/dist/types/entities/field/field.d.ts +13 -2
- package/dist/types/entities/field/field.d.ts.map +1 -1
- package/dist/types/entities/response/response-validation.d.ts +74 -0
- package/dist/types/entities/response/response-validation.d.ts.map +1 -0
- package/dist/types/entities/response/response.d.ts +24 -20
- package/dist/types/entities/response/response.d.ts.map +1 -1
- package/dist/types/entities/step/step.d.ts +42 -0
- package/dist/types/entities/step/step.d.ts.map +1 -0
- package/dist/types/form/build-responses.d.ts +12 -9
- package/dist/types/form/build-responses.d.ts.map +1 -1
- package/dist/types/form/create-field-evaluator.d.ts +11 -3
- package/dist/types/form/create-field-evaluator.d.ts.map +1 -1
- package/dist/types/form/create-field-validation.d.ts +4 -4
- package/dist/types/form/create-field-validation.d.ts.map +1 -1
- package/dist/types/form/create-form.d.ts +1 -0
- package/dist/types/form/create-form.d.ts.map +1 -1
- package/dist/types/form/create-submit-pipeline.d.ts +19 -7
- package/dist/types/form/create-submit-pipeline.d.ts.map +1 -1
- package/dist/types/form/get-step-fields.d.ts +13 -0
- package/dist/types/form/get-step-fields.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/picked.d.ts +98 -31
- package/dist/types/picked.d.ts.map +1 -1
- package/dist/types/plugins/create-experience/create-experience.d.ts +31 -11
- package/dist/types/plugins/create-experience/create-experience.d.ts.map +1 -1
- package/dist/types/plugins/create-experience/index.d.ts +2 -2
- package/dist/types/plugins/create-experience/index.d.ts.map +1 -1
- package/dist/types/plugins/create-experience/plugin.d.ts.map +1 -1
- package/dist/types/plugins/dynamic-experiences/plugin.d.ts +21 -4
- package/dist/types/plugins/dynamic-experiences/plugin.d.ts.map +1 -1
- package/dist/types/plugins/dynamic-experiences/types.d.ts +45 -0
- package/dist/types/plugins/dynamic-experiences/types.d.ts.map +1 -1
- package/dist/types/plugins/responses-browser-storage/plugin.d.ts.map +1 -1
- package/dist/types/plugins/responses-indexeddb/plugin.d.ts.map +1 -1
- package/dist/types/utils/events.d.ts +1 -1
- package/dist/types/utils/events.d.ts.map +1 -1
- package/dist/types/utils/node-tree/get-next-node-from-condition.d.ts +13 -0
- package/dist/types/utils/node-tree/get-next-node-from-condition.d.ts.map +1 -1
- package/dist/types/utils/rules-logic.d.ts.map +1 -1
- package/dist/types/utils/state-snaphot.d.ts +11 -1
- package/dist/types/utils/state-snaphot.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/api-A3gUhQJc.cjs +0 -1
- package/dist/experience-instance-Dri5yAp1.cjs +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-responses.d.ts","sourceRoot":"","sources":["../../../src/form/build-responses.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;
|
|
1
|
+
{"version":3,"file":"build-responses.d.ts","sourceRoot":"","sources":["../../../src/form/build-responses.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAwCpE;;;;;;;;;;;;;GAaG;AACH,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,SAAS,EAAE,EACnB,QAAQ,EAAE,QAAQ,GACjB,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAsC5B"}
|
|
@@ -1,17 +1,25 @@
|
|
|
1
|
+
import { Store, StoreWritable } from 'effector';
|
|
1
2
|
import { Field, FieldValue } from '../entities/field/field';
|
|
2
3
|
import { Picked } from '../picked';
|
|
3
|
-
import { Store, StoreWritable } from 'effector';
|
|
4
4
|
/**
|
|
5
5
|
* Creates a reactive store of evaluated fields for a given set of field IDs.
|
|
6
6
|
*
|
|
7
7
|
* Fields are re-evaluated whenever:
|
|
8
|
-
* - The available field IDs change (e.g.
|
|
8
|
+
* - The available field IDs change (e.g. A step is entered)
|
|
9
9
|
* - Any response is committed (options may depend on prior answers)
|
|
10
10
|
* - The global field registry changes (fields registered after init)
|
|
11
|
-
* - Staged values change (field visibility conditions may reference responses.*)
|
|
11
|
+
* - Staged values change (field visibility conditions may reference responses.*).
|
|
12
12
|
*
|
|
13
13
|
* Evaluation runs `getStepFields` with effective responses (committed + staged) as context,
|
|
14
14
|
* so visibility conditions see live in-session values rather than only committed responses.
|
|
15
|
+
*
|
|
16
|
+
* @param client - The Picked client instance.
|
|
17
|
+
* @param fieldIds - Store of field IDs to evaluate.
|
|
18
|
+
* @param stagedValuesStore - Store of in-progress field values not yet committed.
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* const { fieldsStore } = createFieldEvaluator(client, fieldIdsStore, stagedStore)
|
|
22
|
+
* ```
|
|
15
23
|
*/
|
|
16
24
|
export declare function createFieldEvaluator(client: Picked, fieldIds: Store<string[]>, stagedValuesStore: StoreWritable<Record<string, FieldValue>>): {
|
|
17
25
|
fieldsStore: Store<Field[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-field-evaluator.d.ts","sourceRoot":"","sources":["../../../src/form/create-field-evaluator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"create-field-evaluator.d.ts","sourceRoot":"","sources":["../../../src/form/create-field-evaluator.ts"],"names":[],"mappings":"AAAA,8GAA8G;AAC9G,OAAO,EAA6C,KAAK,KAAK,EAAE,KAAK,aAAa,EAAE,MAAM,UAAU,CAAA;AACpG,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAChE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAGvC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,EACzB,iBAAiB,EAAE,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,GAC3D;IAAE,WAAW,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,CAAA;CAAE,CAwCjC"}
|
|
@@ -5,17 +5,17 @@ import { Picked } from '../picked';
|
|
|
5
5
|
export interface FieldValidation {
|
|
6
6
|
/** Dispatch on keyboard input — updates staged values and runs validation if the field has been touched. */
|
|
7
7
|
fieldInputEvent: EventCallable<{
|
|
8
|
-
|
|
8
|
+
fieldKey: string;
|
|
9
9
|
value: FieldValue;
|
|
10
10
|
}>;
|
|
11
11
|
/** Dispatch when a field value is committed (onchange) — updates staged values and runs validation if the field has been touched. */
|
|
12
12
|
fieldChangeEvent: EventCallable<{
|
|
13
|
-
|
|
13
|
+
fieldKey: string;
|
|
14
14
|
value: FieldValue;
|
|
15
15
|
}>;
|
|
16
16
|
/** Dispatch when a field loses focus — always runs full validation including required check. */
|
|
17
17
|
fieldBlurEvent: EventCallable<{
|
|
18
|
-
|
|
18
|
+
fieldKey: string;
|
|
19
19
|
value: FieldValue;
|
|
20
20
|
}>;
|
|
21
21
|
/** Which fields have been interacted with — used by formFieldsStore to show/hide errors. */
|
|
@@ -52,7 +52,7 @@ export interface FieldValidation {
|
|
|
52
52
|
* @example
|
|
53
53
|
* ```ts
|
|
54
54
|
* const validation = createFieldValidation(client, fieldsStore, stagedValuesStore)
|
|
55
|
-
* validation.fieldInputEvent({
|
|
55
|
+
* validation.fieldInputEvent({ fieldKey: 'email', value: 'hi' })
|
|
56
56
|
* ```
|
|
57
57
|
*/
|
|
58
58
|
export declare function createFieldValidation(client: Picked, fieldsStore: Store<Field[]>, stagedValuesStore: StoreWritable<Record<string, FieldValue>>): FieldValidation;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-field-validation.d.ts","sourceRoot":"","sources":["../../../src/form/create-field-validation.ts"],"names":[],"mappings":"AAAA,4GAA4G;AAC5G,OAAO,EAKL,KAAK,aAAa,EAClB,KAAK,KAAK,EACV,KAAK,aAAa,EACnB,MAAM,UAAU,CAAA;AACjB,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAChE,OAAO,KAAK,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EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,GACxB,YAAY,CAoLd"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Event, EventCallable, Store } from 'effector';
|
|
2
2
|
import { ExperienceInstance } from '../entities/experience-instance/experience-instance';
|
|
3
|
-
import { ExperienceStep } from '../entities/
|
|
3
|
+
import { ExperienceStep } from '../entities/step/step';
|
|
4
4
|
import { Field, FieldValue } from '../entities/field/field';
|
|
5
5
|
import { ValidationError } from '../entities/response/response';
|
|
6
6
|
import { Picked } from '../picked';
|
|
@@ -43,16 +43,28 @@ export interface SubmitPipeline {
|
|
|
43
43
|
/**
|
|
44
44
|
* Creates the submit pipeline for a form instance.
|
|
45
45
|
*
|
|
46
|
-
* Manages the full lifecycle of a form submission
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
* - Committing responses to the client store
|
|
50
|
-
* - Running onSuccess/onError callbacks in parallel
|
|
51
|
-
* - Navigating to the next step (unless stopNavigation is called)
|
|
46
|
+
* Manages the full lifecycle of a form submission, including emitting event bus
|
|
47
|
+
* calls, running data-transform callbacks, committing responses, running
|
|
48
|
+
* success/error callbacks, and navigating to the next step.
|
|
52
49
|
*
|
|
53
50
|
* Returns coordination events (`submitStarted`, `validationErrorsReceived`) that the
|
|
54
51
|
* caller wires to the validation module to keep validation state in sync without
|
|
55
52
|
* the pipeline needing direct access to validation stores.
|
|
53
|
+
*
|
|
54
|
+
* @param config - The submit pipeline configuration.
|
|
55
|
+
* @param config.client - The Picked client instance.
|
|
56
|
+
* @param config.experienceInstance - The experience instance.
|
|
57
|
+
* @param config.formId - The form identifier.
|
|
58
|
+
* @param config.title - Store containing the form title.
|
|
59
|
+
* @param config.stepStore - Store containing the current step.
|
|
60
|
+
* @param config.fieldsStore - Store containing the form fields.
|
|
61
|
+
* @param config.goToNextStep - Event to trigger navigation to the next step.
|
|
62
|
+
* @returns The submit pipeline with events, stores, and callback registration.
|
|
63
|
+
* @example
|
|
64
|
+
* ```ts
|
|
65
|
+
* const pipeline = createSubmitPipeline(config)
|
|
66
|
+
* pipeline.onSuccess(({ data }) => console.log(data))
|
|
67
|
+
* ```
|
|
56
68
|
*/
|
|
57
69
|
export declare function createSubmitPipeline({ client, experienceInstance, formId, title, stepStore, fieldsStore, goToNextStep, }: SubmitPipelineConfig): SubmitPipeline;
|
|
58
70
|
//# sourceMappingURL=create-submit-pipeline.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-submit-pipeline.d.ts","sourceRoot":"","sources":["../../../src/form/create-submit-pipeline.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,KAAK,EACV,KAAK,aAAa,EAClB,KAAK,KAAK,EACX,MAAM,UAAU,CAAA;AACjB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qDAAqD,CAAA;AAC7F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"create-submit-pipeline.d.ts","sourceRoot":"","sources":["../../../src/form/create-submit-pipeline.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAChG,OAAO,EAOL,KAAK,KAAK,EACV,KAAK,aAAa,EAClB,KAAK,KAAK,EACX,MAAM,UAAU,CAAA;AACjB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qDAAqD,CAAA;AAC7F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AACpE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAGvC,MAAM,MAAM,4BAA4B,GAAG,WAAW,GAAG;IACvD,aAAa,EAAE,WAAW,GAAG,eAAe,CAAA;CAC7C,CAAA;AAED,MAAM,MAAM,eAAe,CAAC,SAAS,SAAS,MAAM,GAAG,MAAM,IAAI,CAAC,O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AE,KAAK,CAAC,IAAI,CAAC,CAAA;IAC1B;;;OAGG;IACH,wBAAwB,EAAE,KAAK,CAAC,eAAe,EAAE,CAAC,CAAA;CACnD;AA2CD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,MAAM,EACN,kBAAkB,EAClB,MAAM,EACN,KAAK,EACL,SAAS,EACT,WAAW,EACX,YAAY,GACb,EAAE,oBAAoB,GAAG,cAAc,CAiMvC"}
|
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
import { Field } from '../entities/field/field';
|
|
2
2
|
import { Picked } from '../picked';
|
|
3
3
|
import { evaluateRuleLogic } from '../utils/rules-logic';
|
|
4
|
+
/**
|
|
5
|
+
* Evaluates field and option conditions, returning only the fields that should be visible.
|
|
6
|
+
*
|
|
7
|
+
* @template T
|
|
8
|
+
* @param {Picked} client - The Picked client instance for condition evaluation.
|
|
9
|
+
* @param {T[]} fields - The fields to filter by their conditions.
|
|
10
|
+
* @param {Parameters<typeof evaluateRuleLogic>[2]} [context] - Optional context object passed to the rule evaluator.
|
|
11
|
+
* @returns {Promise<T[]>} The filtered array of visible fields with conditional options resolved.
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* const visibleFields = await getStepFields(client, step.fields, { cartTotal: 50 })
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
4
17
|
export declare function getStepFields<T extends Field>(client: Picked, fields: T[], context?: Parameters<typeof evaluateRuleLogic>[2]): Promise<T[]>;
|
|
5
18
|
//# sourceMappingURL=get-step-fields.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-step-fields.d.ts","sourceRoot":"","sources":["../../../src/form/get-step-fields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AACpD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"get-step-fields.d.ts","sourceRoot":"","sources":["../../../src/form/get-step-fields.ts"],"names":[],"mappings":"AAAA,qFAAqF;AACrF,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AACpD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AA8CxD;;;;;;;;;;;;GAYG;AACH,wBAAsB,aAAa,CAAC,CAAC,SAAS,KAAK,EACjD,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,CAAC,EAAE,EACX,OAAO,CAAC,EAAE,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC,CAAC,CAAC,GAChD,OAAO,CAAC,CAAC,EAAE,CAAC,CAoDd"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
export * from './exports';
|
|
2
2
|
export type * from './client';
|
|
3
3
|
export type * from './entities/action/action';
|
|
4
|
+
export type * from './entities/condition/condition';
|
|
4
5
|
export type * from './entities/component/component';
|
|
5
6
|
export type * from './entities/component/lazyComponent';
|
|
6
7
|
export type * from './entities/experience-instance/experience-instance';
|
|
7
8
|
export type * from './entities/experience/experience';
|
|
9
|
+
export type * from './entities/step/step';
|
|
8
10
|
export type * from './entities/feature/feature';
|
|
9
11
|
export type * from './entities/field/field';
|
|
10
12
|
export type * from './entities/framework/framework';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,mBAAmB,UAAU,CAAA;AAC7B,mBAAmB,0BAA0B,CAAA;AAC7C,mBAAmB,gCAAgC,CAAA;AACnD,mBAAmB,oCAAoC,CAAA;AACvD,mBAAmB,oDAAoD,CAAA;AACvE,mBAAmB,kCAAkC,CAAA;AACrD,mBAAmB,4BAA4B,CAAA;AAC/C,mBAAmB,wBAAwB,CAAA;AAC3C,mBAAmB,gCAAgC,CAAA;AACnD,mBAAmB,4BAA4B,CAAA;AAC/C,mBAAmB,0BAA0B,CAAA;AAC7C,mBAAmB,gCAAgC,CAAA;AACnD,mBAAmB,uBAAuB,CAAA;AAC1C,mBAAmB,gBAAgB,CAAA;AACnC,mBAAmB,uBAAuB,CAAA;AAC1C,mBAAmB,8BAA8B,CAAA;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,mBAAmB,UAAU,CAAA;AAC7B,mBAAmB,0BAA0B,CAAA;AAC7C,mBAAmB,gCAAgC,CAAA;AACnD,mBAAmB,gCAAgC,CAAA;AACnD,mBAAmB,oCAAoC,CAAA;AACvD,mBAAmB,oDAAoD,CAAA;AACvE,mBAAmB,kCAAkC,CAAA;AACrD,mBAAmB,sBAAsB,CAAA;AACzC,mBAAmB,4BAA4B,CAAA;AAC/C,mBAAmB,wBAAwB,CAAA;AAC3C,mBAAmB,gCAAgC,CAAA;AACnD,mBAAmB,4BAA4B,CAAA;AAC/C,mBAAmB,0BAA0B,CAAA;AAC7C,mBAAmB,gCAAgC,CAAA;AACnD,mBAAmB,uBAAuB,CAAA;AAC1C,mBAAmB,gBAAgB,CAAA;AACnC,mBAAmB,uBAAuB,CAAA;AAC1C,mBAAmB,8BAA8B,CAAA;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA"}
|
package/dist/types/picked.d.ts
CHANGED
|
@@ -8,7 +8,9 @@ import { Predicate } from './entities/predicate/predicate';
|
|
|
8
8
|
import { Feature } from './entities/feature/feature';
|
|
9
9
|
import { EventBusPayload, EventHistoryStore } from './utils/events';
|
|
10
10
|
import { Field } from './entities/field/field';
|
|
11
|
+
import { ExperienceStep } from './entities/step/step';
|
|
11
12
|
import { Action } from './entities/action/action';
|
|
13
|
+
import { Condition } from './entities/condition/condition';
|
|
12
14
|
import { SessionStore } from './utils/user-session';
|
|
13
15
|
import { LogicRule } from './logic-engine';
|
|
14
16
|
export declare class Picked {
|
|
@@ -60,6 +62,7 @@ export declare class Picked {
|
|
|
60
62
|
};
|
|
61
63
|
readonly experienceInstances: {
|
|
62
64
|
spawn: (experience: import('.').ExperienceStore, target: HTMLElement, options?: LaunchExperienceOptions) => void;
|
|
65
|
+
getByExperienceKey: (key: Experience["key"]) => import('effector').Store<import('.').ExperienceInstance[]>;
|
|
63
66
|
getByExperienceId: (id: Experience["id"]) => import('effector').Store<import('.').ExperienceInstance[]>;
|
|
64
67
|
listStore: import('effector').Store<import('.').ExperienceInstance[]>;
|
|
65
68
|
};
|
|
@@ -67,6 +70,8 @@ export declare class Picked {
|
|
|
67
70
|
register: (experience: Experience) => void;
|
|
68
71
|
get: (id: Experience["id"]) => import('effector').Store<{
|
|
69
72
|
id: string;
|
|
73
|
+
key: string;
|
|
74
|
+
name: string;
|
|
70
75
|
configStore: import('effector').Store<{
|
|
71
76
|
name: string;
|
|
72
77
|
decisionLogic: import('./logic-engine').LogicValue | LogicRule;
|
|
@@ -74,12 +79,11 @@ export declare class Picked {
|
|
|
74
79
|
initializeOpenLogic: import('./logic-engine').LogicValue | LogicRule;
|
|
75
80
|
}>;
|
|
76
81
|
treeStore: import('effector').Store<{
|
|
77
|
-
steps:
|
|
82
|
+
steps: ExperienceStep[];
|
|
78
83
|
nodes: import('.').ExperienceNode[];
|
|
79
84
|
edges: import('.').ExperienceEdge[];
|
|
80
|
-
conditions:
|
|
85
|
+
conditions: Condition[];
|
|
81
86
|
}>;
|
|
82
|
-
fieldsStore: import('effector').Store<Field[]>;
|
|
83
87
|
componentStore: import('effector').Store<{
|
|
84
88
|
name: string;
|
|
85
89
|
component: AdaptedComponent<string, unknown>;
|
|
@@ -93,6 +97,8 @@ export declare class Picked {
|
|
|
93
97
|
} | undefined>;
|
|
94
98
|
getById: (id: Experience["id"]) => import('effector').Store<{
|
|
95
99
|
id: string;
|
|
100
|
+
key: string;
|
|
101
|
+
name: string;
|
|
96
102
|
configStore: import('effector').Store<{
|
|
97
103
|
name: string;
|
|
98
104
|
decisionLogic: import('./logic-engine').LogicValue | LogicRule;
|
|
@@ -100,12 +106,11 @@ export declare class Picked {
|
|
|
100
106
|
initializeOpenLogic: import('./logic-engine').LogicValue | LogicRule;
|
|
101
107
|
}>;
|
|
102
108
|
treeStore: import('effector').Store<{
|
|
103
|
-
steps:
|
|
109
|
+
steps: ExperienceStep[];
|
|
104
110
|
nodes: import('.').ExperienceNode[];
|
|
105
111
|
edges: import('.').ExperienceEdge[];
|
|
106
|
-
conditions:
|
|
112
|
+
conditions: Condition[];
|
|
107
113
|
}>;
|
|
108
|
-
fieldsStore: import('effector').Store<Field[]>;
|
|
109
114
|
componentStore: import('effector').Store<{
|
|
110
115
|
name: string;
|
|
111
116
|
component: AdaptedComponent<string, unknown>;
|
|
@@ -117,16 +122,25 @@ export declare class Picked {
|
|
|
117
122
|
strategy: "override";
|
|
118
123
|
}>;
|
|
119
124
|
} | undefined>;
|
|
125
|
+
getByKey: (key: Experience["key"]) => import('effector').Store<import('.').ExperienceStore | undefined>;
|
|
120
126
|
launch: import('effector').Effect<{
|
|
127
|
+
key: string;
|
|
128
|
+
options?: LaunchExperienceOptions;
|
|
129
|
+
} | {
|
|
121
130
|
id: string;
|
|
122
131
|
options?: LaunchExperienceOptions;
|
|
123
132
|
}, void, Error>;
|
|
124
133
|
open: import('effector').Effect<{
|
|
134
|
+
key: string;
|
|
135
|
+
options?: import('./exports').OpenExperienceOptions;
|
|
136
|
+
} | {
|
|
125
137
|
id: string;
|
|
126
138
|
options?: import('./exports').OpenExperienceOptions;
|
|
127
139
|
}, void, Error>;
|
|
128
140
|
listStore: import('effector').Store<{
|
|
129
141
|
id: string;
|
|
142
|
+
key: string;
|
|
143
|
+
name: string;
|
|
130
144
|
configStore: import('effector').Store<{
|
|
131
145
|
name: string;
|
|
132
146
|
decisionLogic: import('./logic-engine').LogicValue | LogicRule;
|
|
@@ -134,12 +148,11 @@ export declare class Picked {
|
|
|
134
148
|
initializeOpenLogic: import('./logic-engine').LogicValue | LogicRule;
|
|
135
149
|
}>;
|
|
136
150
|
treeStore: import('effector').Store<{
|
|
137
|
-
steps:
|
|
151
|
+
steps: ExperienceStep[];
|
|
138
152
|
nodes: import('.').ExperienceNode[];
|
|
139
153
|
edges: import('.').ExperienceEdge[];
|
|
140
|
-
conditions:
|
|
154
|
+
conditions: Condition[];
|
|
141
155
|
}>;
|
|
142
|
-
fieldsStore: import('effector').Store<Field[]>;
|
|
143
156
|
componentStore: import('effector').Store<{
|
|
144
157
|
name: string;
|
|
145
158
|
component: AdaptedComponent<string, unknown>;
|
|
@@ -173,10 +186,27 @@ export declare class Picked {
|
|
|
173
186
|
listStore: import('effector').Store<import('.').FeatureBucket[]>;
|
|
174
187
|
getEvokableFeature: (featureName: string) => import('effector').Store<() => Promise<boolean | string | undefined>>;
|
|
175
188
|
};
|
|
189
|
+
readonly conditions: {
|
|
190
|
+
register: (condition: Condition) => void;
|
|
191
|
+
getById: (id: Condition["id"]) => import('effector').Store<Condition | null>;
|
|
192
|
+
getByKey: (key: Condition["key"]) => import('effector').Store<Condition | null>;
|
|
193
|
+
listStore: import('effector').Store<Condition[]>;
|
|
194
|
+
indexStore: import('effector').StoreWritable<{
|
|
195
|
+
[id: string]: Condition;
|
|
196
|
+
}>;
|
|
197
|
+
};
|
|
198
|
+
readonly fields: {
|
|
199
|
+
register: (field: Field) => void;
|
|
200
|
+
update: (key: import('.').FieldBase["key"], updates: Partial<Field>) => void;
|
|
201
|
+
getById: (id: import('.').FieldBase["id"]) => import('effector').Store<Field | null>;
|
|
202
|
+
getByKey: (key: import('.').FieldBase["key"]) => import('effector').Store<Field | null>;
|
|
203
|
+
listStore: import('effector').Store<Field[]>;
|
|
204
|
+
getByName: (name: import('.').FieldBase["name"]) => import('effector').Store<Field | null>;
|
|
205
|
+
};
|
|
176
206
|
readonly responses: {
|
|
177
207
|
register: {
|
|
178
|
-
(
|
|
179
|
-
(payload: Record<Field["
|
|
208
|
+
(fieldKey: Field["key"], response: import('.').Response): void;
|
|
209
|
+
(payload: Record<Field["key"], import('.').Response>, response?: never): void;
|
|
180
210
|
};
|
|
181
211
|
clearAll: import('effector').EventCallable<void>;
|
|
182
212
|
clear: import('effector').EventCallable<string>;
|
|
@@ -188,30 +218,30 @@ export declare class Picked {
|
|
|
188
218
|
validationErrors: import('.').ValidationError[];
|
|
189
219
|
}>;
|
|
190
220
|
listStore: import('effector').Store<{
|
|
191
|
-
|
|
192
|
-
value: import('.').FieldValue
|
|
221
|
+
fieldKey: string;
|
|
222
|
+
value: import('.').FieldValue;
|
|
193
223
|
}[]>;
|
|
194
224
|
getAllStore: import('effector').Store<{
|
|
195
|
-
[
|
|
225
|
+
[fieldKey: string]: import('.').FieldValue;
|
|
196
226
|
}>;
|
|
197
|
-
getByFieldId:
|
|
198
|
-
|
|
199
|
-
<T extends import('.').JsonValue>(fieldId: Field["id"]): import('effector').Store<T | null>;
|
|
200
|
-
};
|
|
227
|
+
getByFieldId: (id: Field["id"]) => import('effector').Store<import('.').FieldValue>;
|
|
228
|
+
getByFieldKey: (key: Field["key"]) => import('effector').Store<import('.').FieldValue>;
|
|
201
229
|
getByFieldName: (fieldName: Field["name"]) => import('effector').Store<import('.').FieldValue>;
|
|
202
230
|
};
|
|
203
|
-
readonly
|
|
204
|
-
register: (
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
listStore: import('effector').Store<
|
|
208
|
-
|
|
231
|
+
readonly steps: {
|
|
232
|
+
register: (step: ExperienceStep) => void;
|
|
233
|
+
getById: (id: ExperienceStep["id"]) => import('effector').Store<ExperienceStep | null>;
|
|
234
|
+
getByKey: (key: ExperienceStep["key"]) => import('effector').Store<ExperienceStep | null>;
|
|
235
|
+
listStore: import('effector').Store<ExperienceStep[]>;
|
|
236
|
+
indexStore: import('effector').StoreWritable<{
|
|
237
|
+
[id: string]: ExperienceStep;
|
|
238
|
+
}>;
|
|
209
239
|
};
|
|
210
240
|
readonly actions: {
|
|
211
241
|
register: (name: string, action: Action) => void;
|
|
212
|
-
getByName: (name: string) => import('effector').Store<
|
|
242
|
+
getByName: (name: string) => import('effector').Store<Action | undefined>;
|
|
213
243
|
listStore: import('effector').Store<import('.').ActionIndexItem[]>;
|
|
214
|
-
getEvokableAction: (actionName: string) => import('effector').Store<(
|
|
244
|
+
getEvokableAction: (actionName: string) => import('effector').Store<() => ReturnType<Action>>;
|
|
215
245
|
};
|
|
216
246
|
constructor(options: CreateClientOptions);
|
|
217
247
|
start: () => void;
|
|
@@ -220,14 +250,54 @@ export declare class Picked {
|
|
|
220
250
|
registerPlugin: (plugin: Plugin) => void;
|
|
221
251
|
registerFeature: (name: string, feature: Feature) => void;
|
|
222
252
|
registerPredicate: (name: string, predicate: Predicate) => void;
|
|
253
|
+
registerCondition: (condition: Condition) => void;
|
|
223
254
|
registerField: (field: Field) => void;
|
|
255
|
+
registerStep: (step: ExperienceStep) => void;
|
|
224
256
|
registerAction: (name: string, action: Action) => void;
|
|
225
257
|
registerExperience: (experience: Experience) => void;
|
|
226
258
|
getStateSnapshot: () => StateSnapshot;
|
|
227
|
-
/**
|
|
259
|
+
/**
|
|
260
|
+
* Launches an experience by ID.
|
|
261
|
+
*
|
|
262
|
+
* @param experienceId - The experience id to launch.
|
|
263
|
+
* @param options - Optional launch options.
|
|
264
|
+
* @example
|
|
265
|
+
* ```typescript
|
|
266
|
+
* await client.launchExperienceById('exp-1')
|
|
267
|
+
* ```
|
|
268
|
+
*/
|
|
228
269
|
launchExperienceById: (experienceId: string, options?: LaunchExperienceOptions) => Promise<void>;
|
|
229
|
-
/**
|
|
270
|
+
/**
|
|
271
|
+
* Launches an experience by Key.
|
|
272
|
+
*
|
|
273
|
+
* @param experienceKey - The experience key to launch.
|
|
274
|
+
* @param options - Optional launch options.
|
|
275
|
+
* @example
|
|
276
|
+
* ```typescript
|
|
277
|
+
* await client.launchExperienceByKey('exp-1')
|
|
278
|
+
* ```
|
|
279
|
+
*/
|
|
280
|
+
launchExperienceByKey: (experienceKey: string, options?: LaunchExperienceOptions) => Promise<void>;
|
|
281
|
+
/**
|
|
282
|
+
* Opens an experience by ID.
|
|
283
|
+
*
|
|
284
|
+
* @param experienceId - The experience ID to open.
|
|
285
|
+
* @example
|
|
286
|
+
* ```typescript
|
|
287
|
+
* await client.openExperienceById('exp-1')
|
|
288
|
+
* ```
|
|
289
|
+
*/
|
|
230
290
|
openExperienceById: (experienceId: string) => Promise<void>;
|
|
291
|
+
/**
|
|
292
|
+
* Opens an experience by Key.
|
|
293
|
+
*
|
|
294
|
+
* @param experienceKey - The experience Key to open.
|
|
295
|
+
* @example
|
|
296
|
+
* ```typescript
|
|
297
|
+
* await client.openExperienceById('exp-1')
|
|
298
|
+
* ```
|
|
299
|
+
*/
|
|
300
|
+
openExperienceByKey: (experienceKey: string) => Promise<void>;
|
|
231
301
|
private runPluginStartHooks;
|
|
232
302
|
private evaluateGate;
|
|
233
303
|
private setupPlugins;
|
|
@@ -265,15 +335,12 @@ export declare class Picked {
|
|
|
265
335
|
* @param template Template containing placeholders.
|
|
266
336
|
* @param context Optional data for interpolation. Non-responses.* keys belong here; function values are executed.
|
|
267
337
|
* @returns Interpolated string.
|
|
268
|
-
*
|
|
269
338
|
* @example
|
|
270
339
|
* renderString("Hello {{ name | default: 'Guest' | capitalize }}! Email: {{ responses.email | lower }}.", { name: "ALICE" })
|
|
271
340
|
* // => "Hello Alice! Email: alice@example.com."
|
|
272
|
-
*
|
|
273
341
|
* @example
|
|
274
342
|
* renderString("User: {{ getName | capitalize }}", { getName: () => "alice" })
|
|
275
343
|
* // => "User: Alice"
|
|
276
|
-
*
|
|
277
344
|
* @example
|
|
278
345
|
* renderString("Fruits: {{ fruits | list }}", { fruits: ["apple", "banana", "cherry"] })
|
|
279
346
|
* // => "Fruits: apple, banana, and cherry"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"picked.d.ts","sourceRoot":"","sources":["../../src/picked.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"picked.d.ts","sourceRoot":"","sources":["../../src/picked.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,UAAU,EAEf,KAAK,uBAAuB,EAC7B,MAAM,kCAAkC,CAAA;AACzC,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,iBAAiB,EAAe,MAAM,0BAA0B,CAAA;AAC3F,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,UAAU,CAAA;AACnD,OAAO,EACL,KAAK,gBAAgB,EAGtB,MAAM,gCAAgC,CAAA;AACvC,OAAO,EAEL,KAAK,SAAS,EAEf,MAAM,gCAAgC,CAAA;AAGvC,OAAO,EAAuB,KAAK,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAC/E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAA;AAE/D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAKzD,OAAO,EAAsB,KAAK,eAAe,EAAE,KAAK,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AACjG,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAEnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAE1D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAA;AAGtD,OAAO,EAAE,KAAK,SAAS,EAAwB,MAAM,gCAAgC,CAAA;AAKrF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAExD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAK/C,qBAAa,MAAM;IACjB,MAAM,CAAC,QAAQ,CAAC,MAAM,0FAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAqB;IAE7C,OA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AAC,YAAY;IAgBpB,OAAO,CAAC,eAAe;IAWvB,eAAe,GAAI,YAAY,MAAM,KAAG,iBAAiB,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAE1F;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAsCG;IACH,YAAY,GAAI,UAAU,MAAM,EAAE,UAAU,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAG,MAAM,CAY3E;CACF"}
|
|
@@ -1,13 +1,22 @@
|
|
|
1
|
-
import { ActionNode, Experience,
|
|
1
|
+
import { ActionNode, Experience, ExperienceEdge, ExperienceNode, ExperienceTarget } from '../../entities/experience/experience';
|
|
2
|
+
import { ExperienceStep } from '../../entities/step/step';
|
|
3
|
+
import { Condition } from '../../entities/condition/condition';
|
|
2
4
|
import { AdaptedComponent } from '../../entities/component/component';
|
|
3
5
|
import { LogicRule, LogicValue } from '../../logic-engine';
|
|
4
6
|
import { Field, FieldBooleanMultiple, FieldBooleanSingular, FieldNumberMultiple, FieldNumberSingular, FieldObjectMultiple, FieldObjectSingular, FieldTextMultiple, FieldTextSingular, JsonValue } from '../../entities/field/field';
|
|
5
7
|
import { Serialized } from './serialization';
|
|
8
|
+
export interface SerializedExperience extends Experience {
|
|
9
|
+
steps: ExperienceStep[];
|
|
10
|
+
conditions: Condition[];
|
|
11
|
+
fields: Field[];
|
|
12
|
+
}
|
|
6
13
|
export interface Nodeable {
|
|
7
14
|
node: SerializableNode | null;
|
|
8
15
|
}
|
|
9
16
|
export interface SerializableStep extends Nodeable {
|
|
10
17
|
id: string;
|
|
18
|
+
name: string;
|
|
19
|
+
key: string;
|
|
11
20
|
label: string;
|
|
12
21
|
fields: SerializableField[];
|
|
13
22
|
experience: SerializableExperience;
|
|
@@ -21,7 +30,8 @@ export interface SerializableStep extends Nodeable {
|
|
|
21
30
|
}
|
|
22
31
|
export interface CreateStepOptions {
|
|
23
32
|
id?: string;
|
|
24
|
-
|
|
33
|
+
key?: string;
|
|
34
|
+
name: string;
|
|
25
35
|
fields?: SerializableField[];
|
|
26
36
|
}
|
|
27
37
|
export type SerializableNode = SerializableStepNode | SerializableConditionNode | SerializableLaunchExperienceNode | SerializableOriginNode | SerializableActionNode;
|
|
@@ -75,30 +85,36 @@ export type CreateNodeOptions = {
|
|
|
75
85
|
export interface SerializableEdge {
|
|
76
86
|
id: string;
|
|
77
87
|
sourceNode: SerializableNode;
|
|
78
|
-
|
|
88
|
+
sourceHandle: 'true' | 'false' | null;
|
|
79
89
|
destinationNode: SerializableNode;
|
|
80
90
|
experience: SerializableExperience;
|
|
81
91
|
serialize: () => Serialized<ExperienceEdge>;
|
|
82
92
|
}
|
|
83
93
|
export interface CreateEdgeOptions {
|
|
84
94
|
sourceNode: SerializableNode;
|
|
85
|
-
|
|
95
|
+
sourceHandle: 'true' | 'false' | null;
|
|
86
96
|
destinationNode: SerializableNode;
|
|
87
97
|
}
|
|
88
98
|
export interface SerializableCondition extends Nodeable {
|
|
89
99
|
id: string;
|
|
100
|
+
key: string;
|
|
101
|
+
name: string;
|
|
90
102
|
label?: string;
|
|
91
|
-
|
|
103
|
+
logic: LogicRule;
|
|
92
104
|
experience: SerializableExperience;
|
|
93
105
|
addTrue: (nodeable: Nodeable) => undefined;
|
|
94
106
|
addFalse: (nodeable: Nodeable) => undefined;
|
|
95
|
-
serialize: () => Serialized<
|
|
107
|
+
serialize: () => Serialized<Condition>;
|
|
96
108
|
}
|
|
97
109
|
export interface CreateConditionOptions {
|
|
98
110
|
condition: LogicRule;
|
|
111
|
+
name?: string;
|
|
112
|
+
key?: string;
|
|
99
113
|
label?: string;
|
|
100
114
|
}
|
|
101
|
-
export type CreateFieldOptions = Omit<Field, 'options' | 'placeholder' | 'description' | 'helpText' | 'validation' | 'policies' | 'defaultValue'> & {
|
|
115
|
+
export type CreateFieldOptions = Omit<Field, 'id' | 'key' | 'options' | 'placeholder' | 'description' | 'helpText' | 'validation' | 'policies' | 'defaultValue'> & {
|
|
116
|
+
id?: string;
|
|
117
|
+
key?: string;
|
|
102
118
|
defaultValue?: string | number | boolean | object | null | string[] | number[] | boolean[] | object[];
|
|
103
119
|
placeholder?: string;
|
|
104
120
|
description?: string;
|
|
@@ -112,6 +128,7 @@ export type CreateFieldOptions = Omit<Field, 'options' | 'placeholder' | 'descri
|
|
|
112
128
|
};
|
|
113
129
|
export type SerializableField<T extends JsonValue = JsonValue> = {
|
|
114
130
|
id: string;
|
|
131
|
+
key: string;
|
|
115
132
|
name: string;
|
|
116
133
|
label: string;
|
|
117
134
|
type: 'text' | 'number' | 'object' | 'boolean';
|
|
@@ -139,6 +156,7 @@ export type SerializableField<T extends JsonValue = JsonValue> = {
|
|
|
139
156
|
};
|
|
140
157
|
export interface SerializableExperience {
|
|
141
158
|
id: string;
|
|
159
|
+
key: string;
|
|
142
160
|
component?: AdaptedComponent;
|
|
143
161
|
name: string;
|
|
144
162
|
condition?: LogicRule | LogicValue;
|
|
@@ -166,10 +184,11 @@ export interface SerializableExperience {
|
|
|
166
184
|
addAction: (actionOptions: CreateActionOptions | SerializableActionNode, after?: {
|
|
167
185
|
node: SerializableNode | null;
|
|
168
186
|
}) => SerializableActionNode;
|
|
169
|
-
serialize: () => Serialized<
|
|
187
|
+
serialize: () => Serialized<SerializedExperience>;
|
|
170
188
|
}
|
|
171
189
|
export interface CreateExperienceOptions {
|
|
172
190
|
id: string;
|
|
191
|
+
key?: string;
|
|
173
192
|
name: string;
|
|
174
193
|
condition?: LogicRule | LogicValue;
|
|
175
194
|
initializeOpen?: LogicRule | LogicValue;
|
|
@@ -188,9 +207,10 @@ export declare const createCondition: (conditionOptions: CreateConditionOptions,
|
|
|
188
207
|
export declare const createConditional: (conditionOptions: CreateConditionOptions, experience: SerializableExperience) => SerializableCondition;
|
|
189
208
|
/**
|
|
190
209
|
* Creates a field with optional generic type parameter for object field type safety.
|
|
191
|
-
*
|
|
192
|
-
* @
|
|
193
|
-
* @
|
|
210
|
+
*
|
|
211
|
+
* @template T - The type of the object field value (only applicable for type: 'object').
|
|
212
|
+
* @param {CreateFieldOptions} fieldOptions - The field configuration options.
|
|
213
|
+
* @returns {SerializableField<T>} A serializable field with type information.
|
|
194
214
|
* @example
|
|
195
215
|
* ```typescript
|
|
196
216
|
* // Without type parameter (default JsonValue)
|