@picked/client 0.0.1-dev.1774231221701 → 0.0.1-dev.1774912386475

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.
Files changed (79) hide show
  1. package/dist/{api-BEXzPJHZ.cjs → api-B-wGEgt8.cjs} +1 -1
  2. package/dist/{api-oudcFuUX.js → api-DwERBrAZ.js} +1 -1
  3. package/dist/cjs/form/index.js +1 -1
  4. package/dist/cjs/index.js +2 -2
  5. package/dist/cjs/plugins/create-experience/index.js +1 -1
  6. package/dist/cjs/plugins/dynamic-experiences/index.js +1 -1
  7. package/dist/cjs/plugins/responses-browser-storage/index.js +1 -1
  8. package/dist/cjs/plugins/web-components/index.js +1 -1
  9. package/dist/cjs/server/index.js +1 -1
  10. package/dist/esm/form/index.js +128 -84
  11. package/dist/esm/index.js +393 -334
  12. package/dist/esm/plugins/create-experience/index.js +183 -151
  13. package/dist/esm/plugins/dynamic-experiences/index.js +52 -30
  14. package/dist/esm/plugins/responses-browser-storage/index.js +47 -20
  15. package/dist/esm/plugins/web-components/index.js +1 -1
  16. package/dist/esm/server/index.js +1 -1
  17. package/dist/{experience-instance-DZiAwXph.js → experience-instance-CwwrKUI8.js} +50 -46
  18. package/dist/experience-instance-DdFUcVRd.cjs +1 -0
  19. package/dist/{rules-logic-B7vJrWyO.js → rules-logic-BIkBWZmf.js} +4 -2
  20. package/dist/rules-logic-DDxCiq4P.cjs +1 -0
  21. package/dist/types/entities/condition/condition.d.ts +17 -0
  22. package/dist/types/entities/condition/condition.d.ts.map +1 -0
  23. package/dist/types/entities/experience/experience.d.ts +40 -35
  24. package/dist/types/entities/experience/experience.d.ts.map +1 -1
  25. package/dist/types/entities/experience-instance/experience-instance.d.ts +21 -2
  26. package/dist/types/entities/experience-instance/experience-instance.d.ts.map +1 -1
  27. package/dist/types/entities/field/field.d.ts +13 -2
  28. package/dist/types/entities/field/field.d.ts.map +1 -1
  29. package/dist/types/entities/response/response-validation.d.ts +76 -0
  30. package/dist/types/entities/response/response-validation.d.ts.map +1 -0
  31. package/dist/types/entities/response/response.d.ts +24 -17
  32. package/dist/types/entities/response/response.d.ts.map +1 -1
  33. package/dist/types/entities/step/step.d.ts +36 -0
  34. package/dist/types/entities/step/step.d.ts.map +1 -0
  35. package/dist/types/form/build-responses.d.ts +12 -9
  36. package/dist/types/form/build-responses.d.ts.map +1 -1
  37. package/dist/types/form/create-field-evaluator.d.ts +11 -3
  38. package/dist/types/form/create-field-evaluator.d.ts.map +1 -1
  39. package/dist/types/form/create-field-validation.d.ts +21 -6
  40. package/dist/types/form/create-field-validation.d.ts.map +1 -1
  41. package/dist/types/form/create-form.d.ts +42 -11
  42. package/dist/types/form/create-form.d.ts.map +1 -1
  43. package/dist/types/form/create-submit-pipeline.d.ts +21 -9
  44. package/dist/types/form/create-submit-pipeline.d.ts.map +1 -1
  45. package/dist/types/form/get-step-fields.d.ts +13 -0
  46. package/dist/types/form/get-step-fields.d.ts.map +1 -1
  47. package/dist/types/index.d.ts +2 -0
  48. package/dist/types/index.d.ts.map +1 -1
  49. package/dist/types/logic-engine.d.ts +10 -2
  50. package/dist/types/logic-engine.d.ts.map +1 -1
  51. package/dist/types/picked.d.ts +68 -32
  52. package/dist/types/picked.d.ts.map +1 -1
  53. package/dist/types/plugins/create-experience/create-experience.d.ts +51 -29
  54. package/dist/types/plugins/create-experience/create-experience.d.ts.map +1 -1
  55. package/dist/types/plugins/create-experience/index.d.ts +2 -2
  56. package/dist/types/plugins/create-experience/index.d.ts.map +1 -1
  57. package/dist/types/plugins/create-experience/plugin.d.ts.map +1 -1
  58. package/dist/types/plugins/create-experience/serialization.d.ts +1 -0
  59. package/dist/types/plugins/create-experience/serialization.d.ts.map +1 -1
  60. package/dist/types/plugins/dynamic-experiences/plugin.d.ts +21 -4
  61. package/dist/types/plugins/dynamic-experiences/plugin.d.ts.map +1 -1
  62. package/dist/types/plugins/dynamic-experiences/types.d.ts +41 -0
  63. package/dist/types/plugins/dynamic-experiences/types.d.ts.map +1 -1
  64. package/dist/types/plugins/responses-browser-storage/plugin.d.ts.map +1 -1
  65. package/dist/types/utils/events.d.ts +1 -1
  66. package/dist/types/utils/events.d.ts.map +1 -1
  67. package/dist/types/utils/node-tree/get-next-node-from-condition.d.ts +3 -0
  68. package/dist/types/utils/node-tree/get-next-node-from-condition.d.ts.map +1 -0
  69. package/dist/types/utils/node-tree/next-reachable-step-nodes.d.ts +10 -6
  70. package/dist/types/utils/node-tree/next-reachable-step-nodes.d.ts.map +1 -1
  71. package/dist/types/utils/nodes.d.ts +74 -2
  72. package/dist/types/utils/nodes.d.ts.map +1 -1
  73. package/dist/types/utils/rules-logic.d.ts +31 -0
  74. package/dist/types/utils/rules-logic.d.ts.map +1 -1
  75. package/package.json +32 -6
  76. package/dist/experience-instance-Ddk4Jktn.cjs +0 -1
  77. package/dist/rules-logic-CXr4wXcG.cjs +0 -1
  78. package/dist/types/utils/node-tree/get-next-node-from-conditional.d.ts +0 -3
  79. package/dist/types/utils/node-tree/get-next-node-from-conditional.d.ts.map +0 -1
@@ -1,3 +1,8 @@
1
+ import { ExperienceStep } from '../../entities/step/step';
2
+ import { Field } from '../../entities/field/field';
3
+ import { ExperienceEdge, ExperienceNode, ExperienceTarget } from '../../entities/experience/experience';
4
+ import { Condition } from '../../entities/condition/condition';
5
+ import { LogicRule, LogicValue } from '../../logic-engine';
1
6
  export interface ProjectConfigFeature {
2
7
  id: string;
3
8
  name: string;
@@ -5,8 +10,44 @@ export interface ProjectConfigFeature {
5
10
  weight: number;
6
11
  version: number;
7
12
  }
13
+ export type ProjectConfigNode = ExperienceNode;
14
+ /**
15
+ * An experience payload as returned by the API.
16
+ * Steps are referenced by ID only; the full step definitions live in the
17
+ * top-level `steps` array of ProjectConfig.
18
+ * Conditions are referenced by nodes via `conditionId`; the full condition
19
+ * definitions live in the top-level `conditions` array of ProjectConfig.
20
+ */
21
+ export interface ProjectConfigExperience {
22
+ id: string;
23
+ key: string;
24
+ name: string;
25
+ componentName: string;
26
+ nodes: ProjectConfigNode[];
27
+ edges: ExperienceEdge[];
28
+ /** Decision logic that controls whether this experience is initialised. */
29
+ condition: LogicRule | LogicValue;
30
+ /** Logic that controls the initial open state of the experience. */
31
+ initializeOpen: LogicRule | LogicValue;
32
+ /** DOM targets this experience mounts into. */
33
+ targets: ExperienceTarget[];
34
+ }
8
35
  export interface ProjectConfig {
36
+ id: string;
37
+ name: string;
38
+ status: string;
39
+ versionId: string;
40
+ workspaceId: string;
9
41
  features: ProjectConfigFeature[];
42
+ /** Experience definitions with steps and conditions referenced by ID. */
43
+ experiences: ProjectConfigExperience[];
44
+ /** Global step definitions shared across experiences. */
45
+ steps: ExperienceStep[];
46
+ /** Global field definitions shared across steps. */
47
+ fields: Field[];
48
+ /** Global condition definitions referenced by experience flow nodes. */
49
+ conditions: Condition[];
50
+ actions: unknown[];
10
51
  }
11
52
  export interface DynamicExperiencesPluginOptions {
12
53
  apiUrl?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/plugins/dynamic-experiences/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,OAAO,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,oBAAoB,EAAE,CAAA;CACjC;AAED,MAAM,WAAW,+BAA+B;IAC9C,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,aAAa,CAAC,EAAE,aAAa,CAAA;CAC9B;AAED,MAAM,WAAW,mBAAmB;IAClC,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACjC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/plugins/dynam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AAW,EAAE,uBAAuB,EAAE,CAAA;IACtC,yDAAyD;IACzD,KAAK,EAAE,cAAc,EAAE,CAAA;IACvB,oDAAoD;IACpD,MAAM,EAAE,KAAK,EAAE,CAAA;IACf,wEAAwE;IACxE,UAAU,EAAE,SAAS,EAAE,CAAA;IACvB,OAAO,EAAE,OAAO,EAAE,CAAA;CACnB;AAED,MAAM,WAAW,+BAA+B;IAC9C,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,aAAa,CAAC,EAAE,aAAa,CAAA;CAC9B;AAED,MAAM,WAAW,mBAAmB;IAClC,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACjC"}
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/plugins/responses-browser-storage/plugin.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AAK1D,UAAU,6BAA6B;IACrC,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAC9B;AAkBD,eAAO,MAAM,6BAA6B,GAAI,eAE3C,6BAAkC,KAAG,MAsCvC,CAAA"}
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/plugins/responses-browser-storage/plugin.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AAK1D,UAAU,6BAA6B;IACrC,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAC9B;AAoDD,eAAO,MAAM,6BAA6B,GAAI,eAE3C,6BAAkC,KAAG,MA6FvC,CAAA"}
@@ -1,6 +1,6 @@
1
1
  import { Store, createEvent } from 'effector';
2
2
  import { ValidationError } from '../entities/response/response';
3
- import { ExperienceStep } from '../entities/experience/experience';
3
+ import { ExperienceStep } from '../entities/step/step';
4
4
  import { ExperienceInstance } from '../entities/experience-instance/experience-instance';
5
5
  import { ResolvedFeature } from '../entities/feature/feature';
6
6
  import { Session } from './user-session';
@@ -1 +1 @@
1
- {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../src/utils/events.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAClD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AACpE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAA;AACvE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qDAAqD,CAAA;AAC7F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAClE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAE7C,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,KAAK,CAAA;IACZ,IAAI,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAA;IACzB,UAAU,EAAE,KAAK,CAAA;IACjB,OAAO,EAAE,OAAO,CAAA;IAChB,WAAW,EAAE;QAAE,KAAK,EAAE,OAAO,CAAA;KAAE,CAAA;IAC/B,cAAc,EAAE;QAAE,OAAO,EAAE,eAAe,CAAA;KAAE,CAAA;IAC5C,qBAAqB,EAAE;QAAE,UAAU,EAAE,kBAAkB,CAAA;KAAE,CAAA;IACzD,eAAe,EAAE;QAAE,UAAU,EAAE,kBAAkB,CAAA;KAAE,CAAA;IACnD,gBAAgB,EAAE;QAAE,UAAU,EAAE,kBAAkB,CAAA;KAAE,CAAA;IACpD,mBAAmB,EAAE;QAAE,UAAU,EAAE,kBAAkB,CAAA;KAAE,CAAA;IACvD,UAAU,EAAE;QACV,IAAI,EAAE,cAAc,CAAA;QACpB,UAAU,EAAE,kBAAkB,CAAA;KAC/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cAAc,CAAA;KACtB,CAAA;IACD,sBAAsB,EAAE;QACtB,SAAS,EAAE;YAAE,MAAM,EAAE,eAAe,EAAE,CAAA;SAAE,CAAA;QACxC,UAAU,EAAE,kBAAkB,CAAA;QAC9B,IAAI,CAAC,EAAE,cAAc,CAAA;KACtB,CAAA;IACD,SAAS,EAAE;QACT,KAAK,EAAE,OAAO,GAAG,MAAM,CAAA;QACvB,IAAI,EAAE,OAAO,CAAA;KACd,CAAA;CACF;AAED,MAAM,MAAM,eAAe,GAAG,MAAM,UAAU,CAAA;AAE9C,MAAM,MAAM,eAAe,GAAG;KAC3B,CAAC,IAAI,eAAe,GAAG;QAAE,IAAI,EAAE,CAAC,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,KAAK,GACxF,MAAM,GACN,UAAU,CAAC,CAAC,CAAC,CAAC;CACnB,CAAC,eAAe,CAAC,CAAA;AAElB,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAA;IACV,EAAE,EAAE,IAAI,CAAA;IACR,OAAO,EAAE,eAAe,CAAA;CACzB;AAED,MAAM,MAAM,iBAAiB,GAAG,KAAK,CAAC,iBAAiB,EAAE,CAAC,CAAA;AAgB1D,eAAO,MAAM,kBAAkB,GAC7B,UAAU,UAAU,CAAC,OAAO,WAAW,CAAC,eAAe,CAAC,CAAC,KACxD,iBAoBF,CAAA"}
@@ -0,0 +1,3 @@
1
+ import { ExperienceEdge, ExperienceNode } from '../../entities/experience/experience';
2
+ export declare function getNextNodeFromCondition(conditionResult: boolean, conditionNodeId: string, nodes: ExperienceNode[], edges: ExperienceEdge[]): Promise<ExperienceNode | undefined>;
3
+ //# sourceMappingURL=get-next-node-from-condition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-next-node-from-condition.d.ts","sourceRoot":"","sources":["../../../../src/utils/node-tree/get-next-node-from-condition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAA;AAE1F,wBAAsB,wBAAwB,CAC5C,eAAe,EAAE,OAAO,EACxB,eAAe,EAAE,MAAM,EACvB,KAAK,EAAE,cAAc,EAAE,EACvB,KAAK,EAAE,cAAc,EAAE,uCAQxB"}
@@ -1,13 +1,17 @@
1
1
  import { ExperienceEdge, ExperienceNode } from '../../entities/experience/experience';
2
2
  /**
3
3
  * Given the current Node as the starting point, recursively traverses every branch
4
- * of the tree until encountering nodes with stepId properties.
5
- * Does not progress past a node with a stepId.
4
+ * of the tree until encountering nodes with stepKey properties.
5
+ * Does not progress past a node with a stepKey.
6
6
  *
7
- * @param nodes - Array of all nodes in the tree
8
- * @param edges - Array of all edges connecting the nodes
9
- * @param currentNode - The starting node for traversal
10
- * @returns Array of nodes with stepId properties that are descendants of the current node
7
+ * @param nodes - Array of all nodes in the tree.
8
+ * @param edges - Array of all edges connecting the nodes.
9
+ * @param currentNode - The starting node for traversal.
10
+ * @returns Array of nodes with stepId properties that are descendants of the current node.
11
+ * @example
12
+ * ```typescript
13
+ * nextReachableStepNodes(nodes, edges, currentNode)
14
+ * ```
11
15
  */
12
16
  export declare const nextReachableStepNodes: (nodes: ExperienceNode[], edges: ExperienceEdge[], currentNode: ExperienceNode) => ExperienceNode[];
13
17
  //# sourceMappingURL=next-reachable-step-nodes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"next-reachable-step-nodes.d.ts","sourceRoot":"","sources":["../../../../src/utils/node-tree/next-reachable-step-nodes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAA;AAuC1F;;;;;;;;;GASG;AACH,eAAO,MAAM,sBAAsB,GACjC,OAAO,cAAc,EAAE,EACvB,OAAO,cAAc,EAAE,EACvB,aAAa,cAAc,KAC1B,cAAc,EAEhB,CAAA"}
1
+ {"version":3,"file":"next-reachable-step-nodes.d.ts","sourceRoot":"","sources":["../../../../src/utils/node-tree/next-reachable-step-nodes.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAA;AA2C1F;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,sBAAsB,GACjC,OAAO,cAAc,EAAE,EACvB,OAAO,cAAc,EAAE,EACvB,aAAa,cAAc,KAC1B,cAAc,EAEhB,CAAA"}
@@ -1,7 +1,79 @@
1
- import { ConditionalNode, ExperienceNode, LaunchExperienceNode, OriginNode, StepNode, ActionNode } from '../entities/experience/experience';
2
- export declare function isConditionNode(node: ExperienceNode): node is ConditionalNode;
1
+ import { ConditionNode, ExperienceNode, LaunchExperienceNode, OriginNode, StepNode, ActionNode } from '../entities/experience/experience';
2
+ /**
3
+ * Narrows an {@link ExperienceNode} to a {@link ConditionNode}.
4
+ *
5
+ * @param {ExperienceNode} node - The node to check.
6
+ * @returns {boolean} `true` when the node is a condition node.
7
+ * @example
8
+ * ```typescript
9
+ * isConditionNode({ id: 'n1', type: 'condition', conditionId: 'c1' }) // true
10
+ * ```
11
+ */
12
+ export declare function isConditionNode(node: ExperienceNode): node is ConditionNode;
13
+ /**
14
+ * Narrows an {@link ExperienceNode} to a {@link StepNode}.
15
+ *
16
+ * @param {ExperienceNode} node - The node to check.
17
+ * @returns {boolean} `true` when the node is a step node.
18
+ * @example
19
+ * ```typescript
20
+ * isStepNode({ id: 'n1', type: 'step', stepId: 's1' }) // true
21
+ * ```
22
+ */
3
23
  export declare function isStepNode(node: ExperienceNode): node is StepNode;
24
+ /**
25
+ * Narrows an {@link ExperienceNode} to a {@link LaunchExperienceNode}.
26
+ *
27
+ * @param {ExperienceNode} node - The node to check.
28
+ * @returns {boolean} `true` when the node is an experience launch node.
29
+ * @example
30
+ * ```typescript
31
+ * isLaunchExperienceNode({ id: 'n1', type: 'experience', experienceId: 'e1' }) // true
32
+ * ```
33
+ */
4
34
  export declare function isLaunchExperienceNode(node: ExperienceNode): node is LaunchExperienceNode;
35
+ /**
36
+ * Narrows an {@link ExperienceNode} to an {@link OriginNode}.
37
+ *
38
+ * @param {ExperienceNode} node - The node to check.
39
+ * @returns {boolean} `true` when the node is an origin node.
40
+ * @example
41
+ * ```typescript
42
+ * isOriginNode({ id: 'n1', type: 'origin' }) // true
43
+ * ```
44
+ */
5
45
  export declare function isOriginNode(node: ExperienceNode): node is OriginNode;
46
+ /**
47
+ * Narrows an {@link ExperienceNode} to an {@link ActionNode}.
48
+ *
49
+ * @param {ExperienceNode} node - The node to check.
50
+ * @returns {boolean} `true` when the node is an action node.
51
+ * @example
52
+ * ```typescript
53
+ * isActionNode({ id: 'n1', type: 'action', action: 'submit' }) // true
54
+ * ```
55
+ */
6
56
  export declare function isActionNode(node: ExperienceNode): node is ActionNode;
57
+ /**
58
+ * Resolves the condition ID from a ConditionNode.
59
+ *
60
+ * @param {ConditionNode} node - The condition node to resolve the ID from.
61
+ * @returns {string} The condition ID string.
62
+ * @example
63
+ * ```typescript
64
+ * resolveConditionId({ id: 'n1', type: 'condition', conditionId: 'cond-1' }) // 'cond-1'
65
+ * ```
66
+ */
67
+ export declare function resolveConditionId(node: ConditionNode): string;
68
+ /**
69
+ * Resolves the step key from a StepNode.
70
+ *
71
+ * @param {StepNode} node - The step node to resolve the key from.
72
+ * @returns {string} The step key string.
73
+ * @example
74
+ * ```typescript
75
+ * resolveStepKey({ id: 'n1', type: 'step', stepId: 'step-1' }) // 'step-1'
76
+ * ```
77
+ */
78
+ export declare function resolveStepKey(node: StepNode): string;
7
79
  //# sourceMappingURL=nodes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"nodes.d.ts","sourceRoot":"","sources":["../../../src/utils/nodes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,cAAc,EACd,oBAAoB,EACpB,UAAU,EACV,QAAQ,EACR,UAAU,EACX,MAAM,mCAAmC,CAAA;AAE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,5 +1,36 @@
1
1
  import { LogicObject, LogicRule } from '../logic-engine';
2
2
  import { Picked } from '../picked';
3
+ /**
4
+ * Type guard that checks whether a value is a non-empty LogicRule.
5
+ *
6
+ * @param {unknown} rules - The value to check.
7
+ * @returns {boolean} True if `rules` is a non-empty LogicRule.
8
+ * @example
9
+ * ```ts
10
+ * if (isRulesLogic(maybeRule)) {
11
+ * await evaluateRuleLogic(client, maybeRule)
12
+ * }
13
+ * ```
14
+ */
3
15
  export declare function isRulesLogic(rules: unknown): rules is LogicRule;
16
+ /**
17
+ * Evaluates a json-logic condition against the current client state.
18
+ *
19
+ * Builds a {@link LogicContext} from committed responses, location, predicates,
20
+ * and features, then applies the caller-supplied `context` on top so that
21
+ * callers such as the field evaluator can override defaults like `responses`
22
+ * with staged/in-session values.
23
+ *
24
+ * @param {Picked} client - The Picked client instance providing state snapshots.
25
+ * @param {LogicRule} condition - The json-logic rule to evaluate.
26
+ * @param {LogicObject} [context] - Optional overrides merged on top of the default context.
27
+ * @returns {Promise<unknown>} The result of applying the logic rule.
28
+ * @example
29
+ * ```ts
30
+ * const visible = await evaluateRuleLogic(client, field.condition, {
31
+ * responses: { ...committed, ...staged },
32
+ * })
33
+ * ```
34
+ */
4
35
  export declare function evaluateRuleLogic(client: Picked, condition: LogicRule, context?: LogicObject): Promise<import('../logic-engine').SyncLogicValue | (() => import('../logic-engine').LogicValue) | (() => Promise<import('../logic-engine').SyncLogicValue>)>;
5
36
  //# sourceMappingURL=rules-logic.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"rules-logic.d.ts","sourceRoot":"","sources":["../../../src/utils/rules-logic.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAgB,WAAW,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAE3E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAGvC,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,SAAS,CAE/D;AAED,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,EACpB,OAAO,CAAC,EAAE,WAAW,gKA2CtB"}
1
+ {"version":3,"file":"rules-logic.d.ts","sourceRoot":"","sources":["../../../src/utils/rules-logic.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAgB,WAAW,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAE3E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAGvC;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,SAAS,CAE/D;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,EACpB,OAAO,CAAC,EAAE,WAAW,gKA2CtB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@picked/client",
3
- "version": "0.0.1-dev.1774231221701",
3
+ "version": "0.0.1-dev.1774912386475",
4
4
  "dependencies": {
5
5
  "@withease/factories": "^1.0.5"
6
6
  },
@@ -11,9 +11,9 @@
11
11
  "@size-limit/preset-small-lib": "^12.0.0",
12
12
  "@testing-library/dom": "^10.4.0",
13
13
  "@vitest/browser": "^4.1.0",
14
- "@vitest/coverage-istanbul": "^4.1.0",
14
+ "@vitest/coverage-v8": "^4.1.0",
15
15
  "effector": "^23.3.0",
16
- "happy-dom": "^20.0.2",
16
+ "happy-dom": "^20.8.8",
17
17
  "size-limit": "^12.0.0",
18
18
  "tslib": "^2.8.1",
19
19
  "typedoc": "^0.28.5",
@@ -100,12 +100,38 @@
100
100
  "dist"
101
101
  ],
102
102
  "knip": {
103
+ "entry": [
104
+ "src/plugins/*/index.ts",
105
+ "eslint.config.js"
106
+ ],
103
107
  "ignoreBinaries": [
104
108
  "knip",
105
109
  "jscpd",
106
110
  "eslint",
107
- "tsgo"
108
- ]
111
+ "tsgo",
112
+ "attw"
113
+ ],
114
+ "exclude": [
115
+ "duplicates"
116
+ ],
117
+ "ignoreDependencies": [
118
+ "@repo/eslint-config",
119
+ "@repo/typescript-config",
120
+ "@testing-library/dom",
121
+ "tslib"
122
+ ],
123
+ "ignore": [
124
+ "src/utils/dom.ts",
125
+ "src/utils/global-obj.ts",
126
+ "src/utils/object.ts",
127
+ "src/utils/indexed-db.ts",
128
+ "src/utils/search-params.ts",
129
+ "src/logic-engine.ts",
130
+ "src/plugins/experience-browser-storage/plugin.ts",
131
+ "src/plugins/history-browser-storage/plugin.ts",
132
+ "src/plugins/responses-browser-storage/plugin.ts"
133
+ ],
134
+ "includeEntryExports": false
109
135
  },
110
136
  "main": "./dist/cjs/index.js",
111
137
  "module": "./dist/esm/index.js",
@@ -126,7 +152,7 @@
126
152
  "lint:report": "eslint . -o './.reports/eslint.json' -f json || [ -f './.reports/eslint.json' ]",
127
153
  "size": "size-limit",
128
154
  "test": "vitest run",
129
- "test:coverage": "vitest run --coverage",
155
+ "test:coverage": "../../scripts/vitest-coverage.sh",
130
156
  "test:packaged-types": "attw --pack",
131
157
  "test:watch": "vitest",
132
158
  "type-check": "tsgo -p . --noEmit"
@@ -1 +0,0 @@
1
- const e=require(`./rules-logic-CXr4wXcG.cjs`);require(`./logger-fbvQC40v.cjs`);const t=require(`./supports-Dsjg-82e.cjs`);let n=require(`effector`),r=require(`@withease/factories`);function i(e){return!t.d()||!t.r()?[]:Array.from(window.document.querySelectorAll(e)).filter(e=>e instanceof HTMLElement)}var a=`open`;function o(e){if(!t.l())throw Error(`Shadow DOM is not supported in this environment`);return e.attachShadow({mode:a})}function s(){return new Promise((e,n)=>{if(!t.r()){n();return}document.readyState===`loading`?document.addEventListener(`readystatechange`,()=>e(),{once:!0}):e()})}function c(e,t){let n=new MutationObserver(r=>{document.contains(e)||(n.disconnect(),t())});n.observe(document.body,{childList:!0,subtree:!0})}var l=`picked-root`,u=`picked-target`,d=`picked-root`;function f(e,t){return[...e,{selector:`${d}[experience-id="${t}"]`,placement:`replace`}].flatMap(e=>{let n=i(e.selector).filter(e=>!h(e,t)&&!g(e,t));return{...e,elements:n}})}function p(e,t){return e.flatMap(e=>e.elements.map(n=>v(n,e.placement,t)))}function m(e,t){e.classList.add(u),e.classList.add(`${u}-${t}`)}function h(e,t){return t?e.classList.contains(`${u}-${t}`):e.classList.contains(`${u}`)}function g(e,t){return t?e.classList.contains(`${l}-${t}`):e.classList.contains(l)}function _(e){let t=document.createElement(`div`);return t.style.display=`block`,t.classList.add(l),t.classList.add(`${l}-${e}`),t}function v(e,t,n){let r,i=_(n);if(e instanceof Document)r=e.body.appendChild(i);else{switch(t){case`replace`:e.replaceWith(i);break;case`before`:e.before(i);break;case`after`:e.after(i);break;case`prepend`:e.prepend(i);break;case`append`:e.append(i);break}r=i}return r}function y(e){return e.type===`conditional`}function b(e){return e.type===`step`}function x(e){return e.type===`experience`}function S(e){return e.type===`origin`}function C(e){return e.type===`action`}var w=(e,t,n,r,i=new Set)=>i.has(n.id)?[]:(i.add(n.id),b(n)&&!r?[n]:t.filter(e=>e.sourceNodeId===n.id).flatMap(n=>{let r=e.find(e=>e.id===n.destinationNodeId);return r?w(e,t,r,!1,i):[]})),T=(e,t,n)=>w(e,t,n,!0,new Set),E=(e,t,n,r,i=new Set)=>{if(i.has(n.id))return[-1,-1];i.add(n.id);let a=t.filter(e=>e.sourceNodeId===n.id);if(a.length===0)return[0,0];let o=1/0,s=-1/0;for(let n of a){let r=e.find(e=>e.id===n.destinationNodeId);if(!r)continue;let[a,c]=E(e,t,r,!1,new Set(i));a!==-1&&(o=Math.min(o,a+1),s=Math.max(s,c+1))}return o===1/0?[-1,-1]:[o,s]},D=(e,t,n)=>E(e,t,n,!0,new Set),O=(e,t,n,r=new Set)=>{if(r.has(n.id))return[-1,-1];if(r.add(n.id),n.type===`origin`)return[0,0];let i=t.filter(e=>e.destinationNodeId===n.id);if(i.length===0)return[-1,-1];let a=1/0,o=-1/0;for(let n of i){let i=e.find(e=>e.id===n.sourceNodeId);if(!i)continue;let[s,c]=O(e,t,i,new Set(r));s!==-1&&(a=Math.min(a,s+1),o=Math.max(o,c+1))}return a===1/0?[-1,-1]:[a,o]},k=(e,t,n)=>O(e,t,n,new Set),A=e=>e.find(e=>e.type===`origin`)||null,j=(e,t,n)=>{if(!e)return A(t);let r=n.find(t=>t.sourceNodeId===e.id);return r&&t.find(e=>e.id===r.destinationNodeId)||null};async function M(e,t,n,r){let i=e?`true`:`false`,a=r.find(e=>e.sourceNodeHandle===i&&e.sourceNodeId===t);return n.find(e=>e.id===a?.destinationNodeId)}var N=(0,n.createDomain)(`experience-instance`),P=(0,r.createFactory)(({client:t,experience:r,target:i,options:a})=>{let o=(0,n.createEvent)(),s=(0,n.createEvent)(),c=(0,n.createEvent)(),l=(0,n.createEvent)(),u=(0,n.createEvent)(),d=(0,n.createEvent)(),f=r.componentStore,p=N.store(`transitioning`),m=t.history.entriesStore.map(e=>e.filter(e=>e.experienceId===r.id)),h=m.map(e=>e.filter(e=>b(e.node))),g=m.map(e=>e.at(-1)?.node||null),_=(0,n.combine)(r.treeStore,g,({steps:e},t)=>e.find(e=>t&&b(t)&&e.id===t.stepId)||null),v=(0,n.combine)(r.treeStore,h,({steps:e},t)=>{let n=t.at(-2);if(!n||!b(n.node))return null;let r=n.node;return e.find(e=>e.id===r.stepId)||null}),w=(0,n.combine)(r.treeStore,g,({nodes:e,edges:t},n)=>n?T(e,t,n):[]),E=(0,n.combine)(r.treeStore,g,({nodes:e,edges:t},n)=>n?k(e,t,n):[-1,-1]),O=(0,n.combine)(r.treeStore,g,({nodes:e,edges:t},n)=>n?D(e,t,n):[-1,-1]),P=N.store(!1),F=(0,n.createApi)(P,{open:()=>!0,close:()=>!1,toggle:e=>!e,set:(e,t)=>t}),I=(0,n.createEffect)(async()=>{t.history.back({experienceId:r.id})}),L=(0,n.attach)({source:r.treeStore,effect:async(e,n)=>{let i=e.nodes.find(e=>b(e)&&e.stepId===n);i&&t.history.push({experienceId:r.id,node:i})}}),R=(0,n.attach)({source:g,effect:e=>{}}),z=(0,n.attach)({source:r.treeStore,effect:async({nodes:e})=>A(e)}),B=(0,n.attach)({source:r.treeStore,effect:async({nodes:e,edges:t},n)=>{if(S(n))return j(n,e,t)}}),V=(0,n.attach)({source:r.treeStore,effect:async({nodes:n,edges:r,conditionals:i},a)=>{if(!y(a))return;let o=i.find(e=>e.id===a.conditionalId);if(!o)return;let s=a.id;return M(!!await e.t(t,o.condition),s,n,r)}}),H=(0,n.attach)({source:r.treeStore,effect:async({nodes:e,edges:n},r)=>{if(!C(r))return;let i=r.action;if(!i){`${r.id}`;return}let a=t.actions.getByName(i).getState();if(!a){`${i}`;let t=n.find(e=>e.sourceNodeId===r.id&&e.sourceNodeHandle===`false`);return t?e.find(e=>e.id===t.destinationNodeId):null}if(typeof a.action!=`function`){`${i}`;let t=n.find(e=>e.sourceNodeId===r.id&&e.sourceNodeHandle===`false`);return t?e.find(e=>e.id===t.destinationNodeId):null}try{`${i}`,await a.action(i);let t=n.find(e=>e.sourceNodeId===r.id&&e.sourceNodeHandle===`true`);if(!t)return`${r.id}`,null;let o=e.find(e=>e.id===t.destinationNodeId);return`${i}${o?.id}`,o||null}catch{`${i}`;let t=n.find(e=>e.sourceNodeId===r.id&&e.sourceNodeHandle===`false`);if(!t)return`${r.id}`,null;let a=e.find(e=>e.id===t.destinationNodeId);return`${i}${a?.id}`,a||null}}}),U=(0,n.createEffect)(e=>{x(e)&&t.experiences.launch({id:e.experienceId})}),W=(0,n.attach)({source:[g,r.treeStore],effect:async([e,{nodes:t,edges:n}])=>j(e,t,n)}),G=(0,n.attach)({source:[g,r.treeStore],effect:async([e,{nodes:t,edges:n}])=>j(e,t,n)}),K=(0,n.createEffect)(e=>{t.history.push({experienceId:r.id,node:e})}),q=(0,n.attach)({source:r.configStore,effect:async({initializeOpenLogic:n})=>a?.initialiseOpen===void 0?e.n(n)?!!await e.t(t,n):n??!1:a.initialiseOpen}),J=Object.freeze({id:Math.random().toString(36).substring(7),experienceId:r.id,configStore:r.configStore,target:i,componentStore:f,stateStore:p,isOpenStore:P,open:F.open,close:F.close,toggleOpen:F.toggle,setOpen:F.set,treeStore:r.treeStore,fieldsStore:r.fieldsStore,currentNodeStore:g,currentStepStore:_,previousStepStore:v,nextReachableStepNodesStore:w,stepsToOriginStore:E,stepsToLeafStore:O,goToNextStep:s,goToPreviousStep:c,goToStepById:l,stepsHistoryStore:h}),Y=(0,n.createEvent)(),X=(0,n.createEvent)();return(0,n.sample)({source:g,target:Y}),(0,n.sample)({clock:Y,filter:e=>e===null,target:z}),(0,n.sample)({clock:Y,filter:e=>e!==null,target:X}),(0,n.split)({source:X,match:e=>y(e)?`condition`:b(e)?`step`:x(e)?`launchExperience`:S(e)?`origin`:C(e)?`action`:`other`,cases:{origin:B,condition:V,step:R,launchExperience:U,action:H,__:(0,n.createEvent)()}}),(0,n.sample)({clock:[V.doneData,B.doneData,z.doneData,G.doneData,W.doneData,H.doneData],filter:Boolean,target:K}),(0,n.sample)({clock:s,target:G}),(0,n.sample)({clock:s,source:_,filter:Boolean,target:t.eventBus.prepend(e=>({type:`step_submit`,step:e,experience:J}))}),(0,n.sample)({clock:G.done,source:_,filter:Boolean,target:t.eventBus.prepend(e=>({type:`step_submit_success`,step:e,experience:J}))}),(0,n.sample)({clock:G.fail,source:_,filter:Boolean,target:t.eventBus.prepend(e=>({type:`step_submit_error`,step:e,experience:J}))}),(0,n.sample)({clock:c,target:I}),(0,n.sample)({clock:l,target:L}),(0,n.sample)({source:(0,n.combine)([V.pending,B.pending,z.pending,G.pending]),fn:e=>e.some(Boolean)?`transitioning`:`ready`,target:p}),(0,n.sample)({clock:R.doneData,source:_,filter:Boolean,target:t.eventBus.prepend(e=>({type:`step_enter`,step:e,experience:J}))}),(0,n.sample)({clock:d,target:q}),(0,n.sample)({source:q.doneData,fn:Boolean,target:P}),(0,n.sample)({source:g,clock:o,filter:e=>e?S(e):!0,target:W}),(0,n.sample)({source:P,filter:Boolean,target:o}),(0,n.sample)({source:P,filter:Boolean,target:t.eventBus.prepend(()=>({type:`experience_open`,experience:J}))}),(0,n.sample)({source:P,filter:e=>!e,target:t.eventBus.prepend(()=>({type:`experience_close`,experience:J}))}),(0,n.sample)({clock:u,target:[d]}),u(),J});function F(e){return(0,r.invoke)(P,e)}var I=(0,r.createFactory)(({client:e})=>{let t=N.store({}),r=(0,n.createEvent)(),i=(0,n.createEvent)(),a=(0,n.createEvent)(),s=(0,n.createApi)(t,{register(e,t){let n=[...e[t.experienceId]??[]];return n.push(t),{...e,[t.experienceId]:n}},unregister(e,t){let n=t.experienceId,r=e[n]?.filter(e=>e!==t);return{...e,[n]:r??[]}}}),l=(0,n.createEffect)(({experience:t,target:n,options:r})=>F({client:e,experience:t,target:n,options:r})),u=(0,n.createEffect)(e=>{s.register(e)}),d=(0,n.createEffect)(e=>{e.target&&c(e.target,()=>{a(e)})}),f=(0,n.createEffect)(e=>{s.unregister(e)}),p=(0,n.createEffect)(t=>{let n=t.componentStore.getState();if(!n)return;let r=n.frameworkStore.getState();if(!r){`${n.name}`;return}let i=t.target;if(!i){`${t.experienceId}`;return}let a=o(i);try{r.render(a,n.component,e,t)}catch{}});(0,n.sample)({clock:r,target:l}),(0,n.sample)({clock:a,target:f}),(0,n.sample)({clock:l.doneData,target:[u,d,i]}),(0,n.sample)({clock:l.doneData,target:e.eventBus.prepend(e=>({type:`experience_initialize`,experience:e}))}),(0,n.sample)({clock:i,target:p});function m(e,t,n){r({experience:e,target:t,options:n})}let h=t.map(e=>Object.values(e).flat());function g(e){return t.map(t=>t[e]||[],{skipVoid:!1})}return{spawn:m,getByExperienceId:g,listStore:h}});function L(e){return(0,r.invoke)(I,e)}Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return L}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return F}});
@@ -1 +0,0 @@
1
- const e=require(`./object-CUJOjanb.cjs`);function t(e){return typeof e==`number`&&!isNaN(e)}function n(e){return typeof e==`string`}function r(e){return Array.isArray(e)}function i(e){return e instanceof Promise}function a(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&Object.keys(e).length===1}function o(e){if(t(e))return e;let n=parseFloat(`${e}`);return isNaN(n)?0:n}function s(e){return`${e}`}var c={"==":(e,t)=>e==t,"===":(e,t)=>e===t,"!=":(e,t)=>e!=t,"!==":(e,t)=>e!==t,">":(e,t)=>o(e)>o(t),">=":(e,t)=>o(e)>=o(t),"<":(e,t,n)=>{let r=o(e),i=o(t);if(n===void 0)return r<i;let a=o(n);return r<i&&i<a},"<=":(e,t,n)=>{let r=o(e),i=o(t);if(n===void 0)return r<=i;let a=o(n);return r<=i&&i<=a},"!!":async e=>await u(e),"!":async e=>!await u(e),"%":(e,t)=>o(e)%o(t),log:e=>(console.log(e),e),in:(e,t)=>t?n(t)?t.indexOf(s(e))!==-1:r(t)?t.includes(e):!1:!1,cat:(...e)=>e.map(s).join(``),substr:(e,t,n)=>{let r=s(e),i=o(t);if(n===void 0)return r.substr(i);let a=o(n);if(a<0){let e=r.substr(i);return e.substr(0,e.length+a)}return r.substr(i,a)},"+":(...e)=>e.reduce((e,t)=>o(e)+o(t),0),"*":(...e)=>e.reduce((e,t)=>o(e)*o(t),1),"-":(e,t)=>{let n=o(e);return t===void 0?-n:n-o(t)},"/":(e,t)=>o(e)/o(t),min:(...e)=>Math.min(...e.map(o)),max:(...e)=>Math.max(...e.map(o)),merge:(...e)=>e.reduce((e,t)=>r(t)?e.concat(t):e.concat([t]),[]),var(e,t){let n=arguments.length>1?t:null;if(e===``||e===`.`||e==null)return this;if(typeof e==`number`&&Array.isArray(this))return e>=0&&e<this.length?this[e]:n;let r=s(e);if(r===``||r===`.`)return this;let i=r.split(`.`),a=this;for(let e of i){if(a==null)return n;if(Array.isArray(a)){let t=parseInt(e,10);a=isNaN(t)?a[e]:a[t]}else a=a[e]}return a===void 0?n:a},async missing(...e){let t=r(e[0])?e[0]:e,n=[];for(let e of t){let t=await l({var:e},this);(t===null||t===``)&&n.push(`${e}`)}return n},async missing_some(e,t){let i=await l({missing:t},this);if(!r(i)||!r(t))return[];let a=i.filter(n);return t.filter(n).length-a.length>=o(e)?[]:a},invoke(...e){let[t,...n]=e;return typeof t==`function`?Reflect.apply(t,null,n):null},regexp_matches(e,t){let i=e,a=``;if(r(e)){let[t,n]=e;i=t,a=n}return!n(i)||!n(a)?!1:new RegExp(i,a).test(s(t))},throw(e){throw Error(s(e))}};async function l(e,t){if(!e)return e;if(i(e))return l(await e,t);if(r(e))return Promise.all(e.map(e=>l(e,t)));if(!a(e))return e;let n=d(e),o=n?e[n]??[]:[];switch(r(o)||(o=[o]),n){case`if`:case`?:`:for(let e=0;e<o.length-1;e+=2)if(await u(await l(o[e],t)))return l(o[e+1],t);return o.length%2==1?l(o[o.length-1],t):null;case`and`:{let e=null;for(let n of o)if(e=await l(n,t),!await u(e))return e;return e}case`or`:{let e=null;for(let n of o)if(e=await l(n,t),await u(e))return e;return e}case`map`:{let e=await l(o[0],t);return r(e)?await Promise.all(e.map(e=>l(o[1],e))):[]}case`filter`:{let e=await l(o[0],t);return r(e)?(await Promise.all(e.map(async e=>({item:e,shouldInclude:await u(await l(o[1],e))})))).filter(({shouldInclude:e})=>e).map(({item:e})=>e):[]}case`reduce`:{let e=await l(o[0],t);if(!r(e))return o.length>2?await l(o[2],t):null;let n=o[1],i=o.length>2?await l(o[2],t):null;for(let t of e)i=await l(n,{current:t,accumulator:i});return i}case`all`:{let e=await l(o[0],t);if(!r(e)||e.length===0)return!1;for(let t of e)if(!await u(await l(o[1],t)))return!1;return!0}case`some`:{let e=await l(o[0],t);if(!r(e))return!1;for(let t of e)if(await u(await l(o[1],t)))return!0;return!1}case`none`:{let e=await l(o[0],t);if(!r(e))return!0;for(let t of e)if(await u(await l(o[1],t)))return!1;return!0}case`catch`:try{return await l(o[0],t)}catch(e){return a(e)?await l(e,t):o[1]?await l(o[1],e):e instanceof Error?e.message:e}}let s=await Promise.all(o.map(e=>l(e,t))),f=n?c[n]:void 0;if(!f)throw Error(`Unrecognized operation ${n}`);return f.apply(t,s)}async function u(e){return i(e)?u(await e):!(Array.isArray(e)&&e.length===0)&&!!e}function d(e){return Object.keys(e)[0]}function f(t){return!e.t(t)}async function p(e,t,n){let r=e.getStateSnapshot(),i=e.predicates.listStore.getState().reduce((e,t)=>({...e,[t.name]:(...e)=>t.predicate({...r,args:e})}),{}),a=e.features.listStore.getState().reduce((e,t)=>({...e,[t.id]:async()=>{let{bucket:e}=await t.getBucket();return e}}),{});return await l(t,{...n,responses:e.responses.getAllStore.getState(),location:typeof r.location==`object`?{hash:r.location.hash,host:r.location.host,hostname:r.location.hostname,href:r.location.href,origin:r.location.origin,pathname:r.location.pathname,port:r.location.port,protocol:r.location.protocol,search:r.location.search}:void 0,predicates:i,features:a})}Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return p}});
@@ -1,3 +0,0 @@
1
- import { ExperienceEdge, ExperienceNode } from '../../entities/experience/experience';
2
- export declare function getNextNodeFromConditional(conditionResult: boolean, conditionalNodeId: string, nodes: ExperienceNode[], edges: ExperienceEdge[]): Promise<ExperienceNode | undefined>;
3
- //# sourceMappingURL=get-next-node-from-conditional.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-next-node-from-conditional.d.ts","sourceRoot":"","sources":["../../../../src/utils/node-tree/get-next-node-from-conditional.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAA;AAE1F,wBAAsB,0BAA0B,CAC9C,eAAe,EAAE,OAAO,EACxB,iBAAiB,EAAE,MAAM,EACzB,KAAK,EAAE,cAAc,EAAE,EACvB,KAAK,EAAE,cAAc,EAAE,uCAQxB"}