@picked/client 0.0.1-dev.1773729274420 → 0.0.1-dev.1773807602703
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-DuHeVrL4.js → api-GlH9T8_1.js} +1 -1
- package/dist/{api-47L967ES.cjs → api-GvmToTw0.cjs} +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/experience-browser-storage/index.js +1 -1
- package/dist/cjs/plugins/history-browser-storage/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/plugins/single-page-app/index.js +1 -1
- package/dist/cjs/server/index.js +1 -1
- package/dist/esm/index.js +738 -741
- package/dist/esm/plugins/create-experience/index.js +360 -286
- package/dist/esm/plugins/dynamic-experiences/index.js +145 -78
- package/dist/esm/plugins/experience-browser-storage/index.js +1 -1
- package/dist/esm/plugins/history-browser-storage/index.js +1 -1
- package/dist/esm/plugins/responses-browser-storage/index.js +1 -1
- package/dist/esm/plugins/responses-indexeddb/index.js +46 -51
- package/dist/esm/plugins/single-page-app/index.js +24 -24
- package/dist/esm/server/index.js +7 -7
- package/dist/experience-instance-CxiOyYPf.cjs +1 -0
- package/dist/{experience-instance-DTyL1fNb.js → experience-instance-DCknHRkX.js} +328 -349
- package/dist/nodes-DQt4TfuO.js +26 -0
- package/dist/nodes-DsL8kMSX.cjs +1 -0
- package/dist/object-BbFTsGh3.cjs +1 -0
- package/dist/{object-CJssU1Pm.js → object-JwZ58NOH.js} +1 -1
- package/dist/storage-Be5xWNPC.cjs +1 -0
- package/dist/{storage-B2d81EOI.js → storage-Co_LbKr_.js} +30 -35
- package/dist/types/entities/action/action.d.ts +2 -5
- package/dist/types/entities/action/action.d.ts.map +1 -1
- package/dist/types/entities/condition/condition.d.ts +17 -0
- package/dist/types/entities/condition/condition.d.ts.map +1 -0
- package/dist/types/entities/experience/experience.d.ts +48 -31
- package/dist/types/entities/experience/experience.d.ts.map +1 -1
- package/dist/types/entities/experience-instance/experience-instance.d.ts +2 -2
- package/dist/types/entities/experience-instance/experience-instance.d.ts.map +1 -1
- package/dist/types/entities/feature/feature.d.ts.map +1 -1
- package/dist/types/entities/field/field.d.ts +23 -52
- package/dist/types/entities/field/field.d.ts.map +1 -1
- package/dist/types/entities/history/history.d.ts.map +1 -1
- package/dist/types/entities/project/project.d.ts.map +1 -1
- package/dist/types/entities/response/response.d.ts +9 -7
- package/dist/types/entities/response/response.d.ts.map +1 -1
- package/dist/types/entities/step/step.d.ts +20 -0
- package/dist/types/entities/step/step.d.ts.map +1 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/logic-engine.d.ts +8 -2
- package/dist/types/logic-engine.d.ts.map +1 -1
- package/dist/types/picked.d.ts +41 -32
- package/dist/types/picked.d.ts.map +1 -1
- package/dist/types/plugins/create-experience/create-experience.d.ts +70 -43
- package/dist/types/plugins/create-experience/create-experience.d.ts.map +1 -1
- package/dist/types/plugins/create-experience/index.d.ts +1 -1
- 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 +20 -5
- package/dist/types/plugins/dynamic-experiences/plugin.d.ts.map +1 -1
- package/dist/types/plugins/dynamic-experiences/types.d.ts +46 -0
- package/dist/types/plugins/dynamic-experiences/types.d.ts.map +1 -1
- package/dist/types/plugins/experience-browser-storage/plugin.d.ts +1 -2
- package/dist/types/plugins/experience-browser-storage/plugin.d.ts.map +1 -1
- package/dist/types/plugins/history-browser-storage/plugin.d.ts +1 -2
- package/dist/types/plugins/history-browser-storage/plugin.d.ts.map +1 -1
- package/dist/types/plugins/responses-browser-storage/plugin.d.ts +1 -2
- 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/plugins/single-page-app/plugin.d.ts +1 -1
- package/dist/types/plugins/single-page-app/plugin.d.ts.map +1 -1
- package/dist/types/utils/dom.d.ts +3 -0
- package/dist/types/utils/dom.d.ts.map +1 -1
- package/dist/types/utils/events.d.ts +2 -2
- package/dist/types/utils/events.d.ts.map +1 -1
- package/dist/types/utils/global-obj.d.ts +1 -0
- package/dist/types/utils/global-obj.d.ts.map +1 -1
- package/dist/types/utils/indexed-db.d.ts +1 -2
- package/dist/types/utils/indexed-db.d.ts.map +1 -1
- package/dist/types/utils/key.d.ts +12 -0
- package/dist/types/utils/key.d.ts.map +1 -0
- package/dist/types/utils/logger.d.ts.map +1 -1
- package/dist/types/utils/node-tree/min-max-steps-to-leaf.d.ts.map +1 -1
- package/dist/types/utils/node-tree/min-max-steps-to-origin.d.ts.map +1 -1
- package/dist/types/utils/node-tree/next-reachable-step-nodes.d.ts +3 -3
- package/dist/types/utils/node-tree/next-reachable-step-nodes.d.ts.map +1 -1
- package/dist/types/utils/nodes.d.ts +7 -2
- package/dist/types/utils/nodes.d.ts.map +1 -1
- package/dist/types/utils/object.d.ts +8 -0
- package/dist/types/utils/object.d.ts.map +1 -1
- package/dist/types/utils/picked-config.d.ts +1 -1
- package/dist/types/utils/picked-config.d.ts.map +1 -1
- package/dist/types/utils/rules-logic.d.ts.map +1 -1
- package/dist/types/utils/search-params.d.ts.map +1 -1
- package/dist/types/utils/storage.d.ts.map +1 -1
- package/package.json +2 -16
- package/dist/experience-instance-BX0aqKsC.cjs +0 -1
- package/dist/object-mwaxtjLG.cjs +0 -1
- package/dist/storage-58NoTSsc.cjs +0 -1
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
function n(e) {
|
|
2
|
+
return e.type === "conditional";
|
|
3
|
+
}
|
|
4
|
+
function t(e) {
|
|
5
|
+
return e.type === "step";
|
|
6
|
+
}
|
|
7
|
+
function i(e) {
|
|
8
|
+
return e.type === "experience";
|
|
9
|
+
}
|
|
10
|
+
function o(e) {
|
|
11
|
+
return e.type === "origin";
|
|
12
|
+
}
|
|
13
|
+
function r(e) {
|
|
14
|
+
return e.type === "action";
|
|
15
|
+
}
|
|
16
|
+
function s(e) {
|
|
17
|
+
return e.stepKey || e.stepId || "";
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
o as a,
|
|
21
|
+
n as b,
|
|
22
|
+
r as c,
|
|
23
|
+
i as d,
|
|
24
|
+
t as i,
|
|
25
|
+
s as r
|
|
26
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";function i(e){return e.type==="conditional"}function n(e){return e.type==="step"}function t(e){return e.type==="experience"}function o(e){return e.type==="origin"}function r(e){return e.type==="action"}function s(e){return e.stepKey||e.stepId||""}exports.isActionNode=r;exports.isConditionNode=i;exports.isLaunchExperienceNode=t;exports.isOriginNode=o;exports.isStepNode=n;exports.resolveStepKey=s;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";function c(t,e,n){if(!(e in t))return;const o=t[e];if(typeof o!="function")throw new Error(`Expected '${String(e)}' to be a function`);const r=n(o);p(r,o),t[e]=r}function i(t,e,n){Object.defineProperty(t,e,{enumerable:!1,value:n,writable:!0,configurable:!0})}function p(t,e){const n=e.prototype||{};t.prototype=e.prototype=n,i(t,"__picked_original",e)}function u(t){return t===void 0||typeof t=="object"&&t!==null&&t.constructor===Object&&Object.keys(t).length===0}exports.isEmpty=u;exports.patchMethod=c;
|
|
@@ -17,7 +17,7 @@ function c(t, e, n) {
|
|
|
17
17
|
}
|
|
18
18
|
function i(t, e) {
|
|
19
19
|
const n = e.prototype || {};
|
|
20
|
-
|
|
20
|
+
t.prototype = e.prototype = n, c(t, "__picked_original", e);
|
|
21
21
|
}
|
|
22
22
|
function u(t) {
|
|
23
23
|
return t === void 0 || typeof t == "object" && t !== null && t.constructor === Object && Object.keys(t).length === 0;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const p=e=>btoa([...e].map(t=>String.fromCharCode(t.charCodeAt(0)^7)).join("")).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");function w(e,t="global",o){let r="pckd";if(t==="experience"){if(!o)throw new Error("Experience instance is required to scope storage to an experience");r=`${r}:${o.experienceId}`}return{_:`${r}:${p(e)}`,scope:t}}const a=new Map;function m(e,t){const o=a.get(e._);o&&o.forEach(r=>r(e,t))}function S(e,t,o,r){const i=o==="local"?localStorage:sessionStorage,c=typeof t!="string"?JSON.stringify(t):t;if(i.setItem(e._,c),typeof r=="number"){const s=new Date(Date.now()+r).toISOString();i.setItem(`${e._}:expires-at`,s)}m(e,o)}function b(e,t){const o=t==="local"?localStorage:sessionStorage;o.removeItem(e._),o.removeItem(`${e._}:expires-at`),m(e,t)}function f(e,t,o,r){const i=t==="local"?localStorage:sessionStorage;function c(s){s.storageArea===i&&s.key===e._&&r(o(e))}function l(s,n){n===t&&r(o(s))}return window.addEventListener("storage",c),a.has(e._)||a.set(e._,new Set),a.get(e._).add(l),function(){window.removeEventListener("storage",c);const n=a.get(e._);n&&(n.delete(l),n.size===0&&a.delete(e._))}}function g(e,t){const o=t==="local"?localStorage:sessionStorage,r=o.getItem(e._),i=o.getItem(`${e._}:expires-at`),c=(n,u)=>S(e,n,t,u),l=()=>b(e,t),s=n=>f(e,t,u=>g(u,t),n);if(i){const n=new Date,u=new Date(i);if(n>u)return b(e,t),{isSet:()=>!1,text:()=>null,json:()=>null,boolean:()=>null,set:c,remove:l,subscribe:s}}return{isSet(){return r!==null},text(){return r},json(){return r?JSON.parse(r):null},boolean(){return r?r==="true":null},set:c,remove:l,subscribe:s}}const d={get(e){return g(e,"session")},set(e,t,o){S(e,t,"session",o)},remove(e){b(e,"session")},subscribe(e,t){return f(e,"session",this.get,t)}},_={get(e){return g(e,"local")},set(e,t,o){S(e,t,"local",o)},remove(e){b(e,"local")},subscribe(e,t){return f(e,"local",this.get,t)}};exports.createStorageKey=w;exports.localStore=_;exports.sessionStore=d;exports.subscribe=f;
|
|
@@ -1,26 +1,23 @@
|
|
|
1
|
-
const m = (e) => (
|
|
2
|
-
// eslint-disable-next-line no-bitwise -- XOR cipher for cookie consent banner detection avoidance
|
|
3
|
-
btoa([...e].map((t) => String.fromCharCode(t.charCodeAt(0) ^ 7)).join("")).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "")
|
|
4
|
-
);
|
|
1
|
+
const m = (e) => btoa([...e].map((t) => String.fromCharCode(t.charCodeAt(0) ^ 7)).join("")).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
5
2
|
function w(e, t = "global", o) {
|
|
6
|
-
let
|
|
3
|
+
let r = "pckd";
|
|
7
4
|
if (t === "experience") {
|
|
8
5
|
if (!o)
|
|
9
6
|
throw new Error("Experience instance is required to scope storage to an experience");
|
|
10
|
-
|
|
7
|
+
r = `${r}:${o.experienceId}`;
|
|
11
8
|
}
|
|
12
|
-
return { _: `${
|
|
9
|
+
return { _: `${r}:${m(e)}`, scope: t };
|
|
13
10
|
}
|
|
14
|
-
const
|
|
11
|
+
const l = /* @__PURE__ */ new Map();
|
|
15
12
|
function p(e, t) {
|
|
16
|
-
const o =
|
|
17
|
-
o && o.forEach((
|
|
13
|
+
const o = l.get(e._);
|
|
14
|
+
o && o.forEach((r) => r(e, t));
|
|
18
15
|
}
|
|
19
|
-
function b(e, t, o,
|
|
16
|
+
function b(e, t, o, r) {
|
|
20
17
|
const i = o === "local" ? localStorage : sessionStorage, c = typeof t != "string" ? JSON.stringify(t) : t;
|
|
21
|
-
if (i.setItem(e._, c), typeof
|
|
22
|
-
const
|
|
23
|
-
i.setItem(`${e._}:expires-at`,
|
|
18
|
+
if (i.setItem(e._, c), typeof r == "number") {
|
|
19
|
+
const s = new Date(Date.now() + r).toISOString();
|
|
20
|
+
i.setItem(`${e._}:expires-at`, s);
|
|
24
21
|
}
|
|
25
22
|
p(e, o);
|
|
26
23
|
}
|
|
@@ -28,53 +25,51 @@ function f(e, t) {
|
|
|
28
25
|
const o = t === "local" ? localStorage : sessionStorage;
|
|
29
26
|
o.removeItem(e._), o.removeItem(`${e._}:expires-at`), p(e, t);
|
|
30
27
|
}
|
|
31
|
-
function S(e, t, o,
|
|
28
|
+
function S(e, t, o, r) {
|
|
32
29
|
const i = t === "local" ? localStorage : sessionStorage;
|
|
33
|
-
function c(
|
|
34
|
-
|
|
30
|
+
function c(s) {
|
|
31
|
+
s.storageArea === i && s.key === e._ && r(o(e));
|
|
35
32
|
}
|
|
36
|
-
function
|
|
37
|
-
|
|
33
|
+
function a(s, n) {
|
|
34
|
+
n === t && r(o(s));
|
|
38
35
|
}
|
|
39
|
-
window.addEventListener("storage", c),
|
|
40
|
-
const a = u.get(e._);
|
|
41
|
-
return a && a.add(l), function() {
|
|
36
|
+
return window.addEventListener("storage", c), l.has(e._) || l.set(e._, /* @__PURE__ */ new Set()), l.get(e._).add(a), function() {
|
|
42
37
|
window.removeEventListener("storage", c);
|
|
43
|
-
const
|
|
44
|
-
|
|
38
|
+
const n = l.get(e._);
|
|
39
|
+
n && (n.delete(a), n.size === 0 && l.delete(e._));
|
|
45
40
|
};
|
|
46
41
|
}
|
|
47
42
|
function g(e, t) {
|
|
48
|
-
const o = t === "local" ? localStorage : sessionStorage,
|
|
43
|
+
const o = t === "local" ? localStorage : sessionStorage, r = o.getItem(e._), i = o.getItem(`${e._}:expires-at`), c = (n, u) => b(e, n, t, u), a = () => f(e, t), s = (n) => S(e, t, (u) => g(u, t), n);
|
|
49
44
|
if (i) {
|
|
50
|
-
const
|
|
51
|
-
if (
|
|
45
|
+
const n = /* @__PURE__ */ new Date(), u = new Date(i);
|
|
46
|
+
if (n > u)
|
|
52
47
|
return f(e, t), {
|
|
53
48
|
isSet: () => !1,
|
|
54
49
|
text: () => null,
|
|
55
50
|
json: () => null,
|
|
56
51
|
boolean: () => null,
|
|
57
52
|
set: c,
|
|
58
|
-
remove:
|
|
59
|
-
subscribe:
|
|
53
|
+
remove: a,
|
|
54
|
+
subscribe: s
|
|
60
55
|
};
|
|
61
56
|
}
|
|
62
57
|
return {
|
|
63
58
|
isSet() {
|
|
64
|
-
return
|
|
59
|
+
return r !== null;
|
|
65
60
|
},
|
|
66
61
|
text() {
|
|
67
|
-
return
|
|
62
|
+
return r;
|
|
68
63
|
},
|
|
69
64
|
json() {
|
|
70
|
-
return
|
|
65
|
+
return r ? JSON.parse(r) : null;
|
|
71
66
|
},
|
|
72
67
|
boolean() {
|
|
73
|
-
return
|
|
68
|
+
return r ? r === "true" : null;
|
|
74
69
|
},
|
|
75
70
|
set: c,
|
|
76
|
-
remove:
|
|
77
|
-
subscribe:
|
|
71
|
+
remove: a,
|
|
72
|
+
subscribe: s
|
|
78
73
|
};
|
|
79
74
|
}
|
|
80
75
|
const d = {
|
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
import { Store } from 'effector';
|
|
2
|
-
import { Picked } from '../../picked';
|
|
3
2
|
export type Action = <T = void>(params?: T) => void;
|
|
4
3
|
export type ActionsStore = ReturnType<typeof createActionIndexFactory>;
|
|
5
4
|
export interface ActionIndexItem {
|
|
6
5
|
name: string;
|
|
7
6
|
action: Action;
|
|
8
7
|
}
|
|
9
|
-
declare const createActionIndexFactory: (
|
|
10
|
-
client: Picked;
|
|
11
|
-
}) => {
|
|
8
|
+
declare const createActionIndexFactory: () => {
|
|
12
9
|
register: (name: string, action: Action) => void;
|
|
13
10
|
getByName: (name: string) => Store<ActionIndexItem | undefined>;
|
|
14
11
|
listStore: Store<ActionIndexItem[]>;
|
|
15
12
|
getEvokableAction: (actionName: string) => Store<(<T = void>(params?: T) => void) | undefined>;
|
|
16
13
|
};
|
|
17
|
-
export declare function createActionIndex
|
|
14
|
+
export declare function createActionIndex(): ReturnType<typeof createActionIndexFactory>;
|
|
18
15
|
export declare const setupAction: (name: string, action: Action, actions: ActionsStore) => void;
|
|
19
16
|
export {};
|
|
20
17
|
//# sourceMappingURL=action.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../../../src/entities/action/action.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,KAAK,KAAK,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../../../src/entities/action/action.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,KAAK,KAAK,EAAE,MAAM,UAAU,CAAA;AAG9D,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,MAAM,CAAC,EAAE,CAAC,KAAK,IAAI,CAAA;AACnD,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAA;AAItE,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;CACf;AAED,QAAA,MAAM,wBAAwB;qBAiBJ,MAAM,UAAU,MAAM,KAAG,IAAI;sBAQ5B,MAAM;;oCAIQ,MAAM,KAAG,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,EAAE,MAAM,CAAC,EAAE,CAAC,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;CAgBnG,CAAA;AAEF,wBAAgB,iBAAiB,IAAI,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAE/E;AAED,eAAO,MAAM,WAAW,GAAI,MAAM,MAAM,EAAE,QAAQ,MAAM,EAAE,SAAS,YAAY,KAAG,IAEjF,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { LogicRule } from '../../logic-engine';
|
|
2
|
+
export type ConditionsStore = ReturnType<typeof createConditionIndex>;
|
|
3
|
+
export interface Condition {
|
|
4
|
+
id: string;
|
|
5
|
+
key: string;
|
|
6
|
+
name: string;
|
|
7
|
+
condition: LogicRule;
|
|
8
|
+
}
|
|
9
|
+
declare const createConditionIndexFactory: () => {
|
|
10
|
+
register: (condition: Condition) => void;
|
|
11
|
+
getById: (id: Condition["id"]) => import('effector').Store<Condition | null>;
|
|
12
|
+
getByKey: (key: Condition["key"]) => import('effector').Store<Condition | null>;
|
|
13
|
+
listStore: import('effector').Store<Condition[]>;
|
|
14
|
+
};
|
|
15
|
+
export declare function createConditionIndex(): ReturnType<typeof createConditionIndexFactory>;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=condition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"condition.d.ts","sourceRoot":"","sources":["../../../../src/entities/condition/condition.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAEnD,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAIrE,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAA;IACV,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,SAAS,CAAA;CACrB;AAGD,QAAA,MAAM,2BAA2B;0BAcF,SAAS,KAAG,IAAI;kBAQxB,SAAS,CAAC,IAAI,CAAC;oBAIb,SAAS,CAAC,KAAK,CAAC;;CAYvC,CAAA;AAEF,wBAAgB,oBAAoB,IAAI,UAAU,CAAC,OAAO,2BAA2B,CAAC,CAErF"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { AdaptedComponent } from '../component/component';
|
|
2
2
|
import { Picked } from '../../picked';
|
|
3
3
|
import { LogicRule, LogicValue } from '../../logic-engine';
|
|
4
|
-
import { Field } from '../field/field';
|
|
5
4
|
export type ExperiencesListStore = ReturnType<typeof createExperienceIndex>;
|
|
6
5
|
export type ExperienceStore = ReturnType<typeof createExperience>;
|
|
7
6
|
declare const createExperienceFactory: ({ client, experience }: {
|
|
@@ -9,6 +8,8 @@ declare const createExperienceFactory: ({ client, experience }: {
|
|
|
9
8
|
experience: Experience;
|
|
10
9
|
}) => {
|
|
11
10
|
id: string;
|
|
11
|
+
key: string | undefined;
|
|
12
|
+
name: string;
|
|
12
13
|
configStore: import('effector').Store<{
|
|
13
14
|
name: string;
|
|
14
15
|
decisionLogic: LogicValue | LogicRule;
|
|
@@ -16,12 +17,11 @@ declare const createExperienceFactory: ({ client, experience }: {
|
|
|
16
17
|
initializeOpenLogic: LogicValue | LogicRule;
|
|
17
18
|
}>;
|
|
18
19
|
treeStore: import('effector').Store<{
|
|
19
|
-
steps:
|
|
20
|
+
steps: string[];
|
|
20
21
|
nodes: ExperienceNode[];
|
|
21
22
|
edges: ExperienceEdge[];
|
|
22
|
-
|
|
23
|
+
conditions: ExperienceCondition[];
|
|
23
24
|
}>;
|
|
24
|
-
fieldsStore: import('effector').Store<Field[]>;
|
|
25
25
|
componentStore: import('effector').Store<{
|
|
26
26
|
name: string;
|
|
27
27
|
component: AdaptedComponent<string, unknown>;
|
|
@@ -35,6 +35,7 @@ declare const createExperienceFactory: ({ client, experience }: {
|
|
|
35
35
|
};
|
|
36
36
|
/**
|
|
37
37
|
* Creates an Effector store for a single experience.
|
|
38
|
+
*
|
|
38
39
|
* @param params - The client instance and experience data.
|
|
39
40
|
* @returns An experience store with config, tree, fields, and component sub-stores.
|
|
40
41
|
* @example
|
|
@@ -57,9 +58,11 @@ declare const createExperienceIndexFactory: ({ client }: {
|
|
|
57
58
|
}) => {
|
|
58
59
|
/** Registers an experience in the index. If an experience with the same ID already exists, it is merged. */
|
|
59
60
|
register: (experience: Experience) => void;
|
|
60
|
-
/** Returns a derived store for an experience by its ID. The store value is `undefined` when no match exists. */
|
|
61
|
-
get: (
|
|
61
|
+
/** Returns a derived store for an experience by its ID or key. The store value is `undefined` when no match exists. */
|
|
62
|
+
get: (idOrKey: string) => import('effector').Store<{
|
|
62
63
|
id: string;
|
|
64
|
+
key: string | undefined;
|
|
65
|
+
name: string;
|
|
63
66
|
configStore: import('effector').Store<{
|
|
64
67
|
name: string;
|
|
65
68
|
decisionLogic: LogicValue | LogicRule;
|
|
@@ -67,12 +70,11 @@ declare const createExperienceIndexFactory: ({ client }: {
|
|
|
67
70
|
initializeOpenLogic: LogicValue | LogicRule;
|
|
68
71
|
}>;
|
|
69
72
|
treeStore: import('effector').Store<{
|
|
70
|
-
steps:
|
|
73
|
+
steps: string[];
|
|
71
74
|
nodes: ExperienceNode[];
|
|
72
75
|
edges: ExperienceEdge[];
|
|
73
|
-
|
|
76
|
+
conditions: ExperienceCondition[];
|
|
74
77
|
}>;
|
|
75
|
-
fieldsStore: import('effector').Store<Field[]>;
|
|
76
78
|
componentStore: import('effector').Store<{
|
|
77
79
|
name: string;
|
|
78
80
|
component: AdaptedComponent<string, unknown>;
|
|
@@ -85,8 +87,10 @@ declare const createExperienceIndexFactory: ({ client }: {
|
|
|
85
87
|
}>;
|
|
86
88
|
} | undefined>;
|
|
87
89
|
/** @deprecated Use `experiences.get(id)` instead. */
|
|
88
|
-
getById: (
|
|
90
|
+
getById: (idOrKey: string) => import('effector').Store<{
|
|
89
91
|
id: string;
|
|
92
|
+
key: string | undefined;
|
|
93
|
+
name: string;
|
|
90
94
|
configStore: import('effector').Store<{
|
|
91
95
|
name: string;
|
|
92
96
|
decisionLogic: LogicValue | LogicRule;
|
|
@@ -94,12 +98,11 @@ declare const createExperienceIndexFactory: ({ client }: {
|
|
|
94
98
|
initializeOpenLogic: LogicValue | LogicRule;
|
|
95
99
|
}>;
|
|
96
100
|
treeStore: import('effector').Store<{
|
|
97
|
-
steps:
|
|
101
|
+
steps: string[];
|
|
98
102
|
nodes: ExperienceNode[];
|
|
99
103
|
edges: ExperienceEdge[];
|
|
100
|
-
|
|
104
|
+
conditions: ExperienceCondition[];
|
|
101
105
|
}>;
|
|
102
|
-
fieldsStore: import('effector').Store<Field[]>;
|
|
103
106
|
componentStore: import('effector').Store<{
|
|
104
107
|
name: string;
|
|
105
108
|
component: AdaptedComponent<string, unknown>;
|
|
@@ -111,7 +114,7 @@ declare const createExperienceIndexFactory: ({ client }: {
|
|
|
111
114
|
strategy: "override";
|
|
112
115
|
}>;
|
|
113
116
|
} | undefined>;
|
|
114
|
-
/** Effector effect that launches an experience by ID, creating instances for each DOM target. */
|
|
117
|
+
/** Effector effect that launches an experience by ID or key, creating instances for each DOM target. */
|
|
115
118
|
launch: import('effector').Effect<{
|
|
116
119
|
id: string;
|
|
117
120
|
options?: LaunchExperienceOptions;
|
|
@@ -124,6 +127,8 @@ declare const createExperienceIndexFactory: ({ client }: {
|
|
|
124
127
|
/** Derived store containing all registered experiences as an array. */
|
|
125
128
|
listStore: import('effector').Store<{
|
|
126
129
|
id: string;
|
|
130
|
+
key: string | undefined;
|
|
131
|
+
name: string;
|
|
127
132
|
configStore: import('effector').Store<{
|
|
128
133
|
name: string;
|
|
129
134
|
decisionLogic: LogicValue | LogicRule;
|
|
@@ -131,12 +136,11 @@ declare const createExperienceIndexFactory: ({ client }: {
|
|
|
131
136
|
initializeOpenLogic: LogicValue | LogicRule;
|
|
132
137
|
}>;
|
|
133
138
|
treeStore: import('effector').Store<{
|
|
134
|
-
steps:
|
|
139
|
+
steps: string[];
|
|
135
140
|
nodes: ExperienceNode[];
|
|
136
141
|
edges: ExperienceEdge[];
|
|
137
|
-
|
|
142
|
+
conditions: ExperienceCondition[];
|
|
138
143
|
}>;
|
|
139
|
-
fieldsStore: import('effector').Store<Field[]>;
|
|
140
144
|
componentStore: import('effector').Store<{
|
|
141
145
|
name: string;
|
|
142
146
|
component: AdaptedComponent<string, unknown>;
|
|
@@ -151,6 +155,7 @@ declare const createExperienceIndexFactory: ({ client }: {
|
|
|
151
155
|
};
|
|
152
156
|
/**
|
|
153
157
|
* Creates an Effector-based index for registering and retrieving experiences.
|
|
158
|
+
*
|
|
154
159
|
* @param params - The client instance.
|
|
155
160
|
* @returns An experience index with register, get, launch, and open methods.
|
|
156
161
|
* @example
|
|
@@ -159,12 +164,7 @@ declare const createExperienceIndexFactory: ({ client }: {
|
|
|
159
164
|
* ```
|
|
160
165
|
*/
|
|
161
166
|
export declare function createExperienceIndex<T extends Parameters<typeof createExperienceIndexFactory>[0]>(params: T): ReturnType<typeof createExperienceIndexFactory>;
|
|
162
|
-
export
|
|
163
|
-
id: string;
|
|
164
|
-
label: string;
|
|
165
|
-
fieldIds: string[];
|
|
166
|
-
}
|
|
167
|
-
export type ExperienceNode = StepNode | ConditionalNode | LaunchExperienceNode | OriginNode | ActionNode;
|
|
167
|
+
export type ExperienceNode = StepNode | ConditionNode | LaunchExperienceNode | OriginNode | ActionNode;
|
|
168
168
|
export interface ExperienceAction {
|
|
169
169
|
id: string;
|
|
170
170
|
action: string;
|
|
@@ -179,13 +179,21 @@ export interface BaseNode {
|
|
|
179
179
|
}
|
|
180
180
|
export interface StepNode extends BaseNode {
|
|
181
181
|
type: 'step';
|
|
182
|
-
|
|
183
|
-
|
|
182
|
+
stepKey: string;
|
|
183
|
+
/** @deprecated Use `stepKey` instead. Populated for backwards compatibility. */
|
|
184
|
+
stepId?: string;
|
|
185
|
+
name?: string;
|
|
186
|
+
/** @deprecated Use `name` instead. Populated for backwards compatibility. */
|
|
187
|
+
label?: string;
|
|
184
188
|
}
|
|
185
|
-
export interface
|
|
189
|
+
export interface ConditionNode extends BaseNode {
|
|
186
190
|
type: 'conditional';
|
|
187
|
-
|
|
191
|
+
conditionId?: string;
|
|
192
|
+
/** @deprecated Use `conditionId` instead. */
|
|
193
|
+
conditionalId?: string;
|
|
188
194
|
}
|
|
195
|
+
/** @deprecated Use {@link ConditionNode} instead. */
|
|
196
|
+
export type ConditionalNode = ConditionNode;
|
|
189
197
|
export interface LaunchExperienceNode extends BaseNode {
|
|
190
198
|
type: 'experience';
|
|
191
199
|
experienceId: string;
|
|
@@ -199,39 +207,48 @@ export interface ExperienceEdge {
|
|
|
199
207
|
destinationNodeId: string;
|
|
200
208
|
sourceNodeHandle?: string;
|
|
201
209
|
}
|
|
202
|
-
export interface
|
|
210
|
+
export interface ExperienceCondition {
|
|
203
211
|
id: string;
|
|
204
212
|
label?: string;
|
|
205
213
|
condition: LogicRule;
|
|
206
214
|
}
|
|
215
|
+
/** @deprecated Use {@link ExperienceCondition} instead. */
|
|
216
|
+
export type ExperienceConditional = ExperienceCondition;
|
|
207
217
|
export interface ExperienceTarget {
|
|
208
218
|
selector: string;
|
|
209
219
|
placement: 'replace' | 'append' | 'prepend' | 'before' | 'after';
|
|
210
220
|
}
|
|
211
221
|
export interface Experience {
|
|
212
222
|
id: string;
|
|
223
|
+
key?: string;
|
|
213
224
|
name: string;
|
|
214
225
|
componentName?: string;
|
|
215
226
|
component?: AdaptedComponent;
|
|
216
|
-
|
|
227
|
+
/** Inline condition definitions for this experience's flow nodes. */
|
|
228
|
+
conditions?: ExperienceCondition[];
|
|
229
|
+
/** @deprecated Use `conditions` instead. */
|
|
230
|
+
conditionals?: ExperienceCondition[];
|
|
217
231
|
initializeOpen?: LogicRule | LogicValue;
|
|
218
232
|
actions?: ExperienceAction[];
|
|
233
|
+
/** Decision logic that controls whether this experience is initialised. */
|
|
219
234
|
condition?: LogicRule | LogicValue;
|
|
220
235
|
edges: ExperienceEdge[];
|
|
221
236
|
nodes: ExperienceNode[];
|
|
222
|
-
|
|
223
|
-
steps:
|
|
237
|
+
/** Step IDs referencing steps in the global step registry (client.steps). */
|
|
238
|
+
steps: string[];
|
|
224
239
|
targets: ExperienceTarget[];
|
|
225
240
|
}
|
|
226
241
|
export declare const setupExperience: (experience: Experience, experienceStore: ExperiencesListStore) => void;
|
|
227
242
|
/**
|
|
228
243
|
* Initializes an experience for each target that exists in the DOM.
|
|
244
|
+
*
|
|
229
245
|
* @param client - The Picked client instance.
|
|
230
246
|
* @param experience - The experience store to initialise.
|
|
231
247
|
*/
|
|
232
248
|
export declare const initialiseExperience: (client: Picked, experience: ExperienceStore, options?: LaunchExperienceOptions) => void;
|
|
233
249
|
/**
|
|
234
250
|
* Conditionally initializes experiences.
|
|
251
|
+
*
|
|
235
252
|
* @param client - The Picked client instance.
|
|
236
253
|
*/
|
|
237
254
|
export declare const initialiseExperiences: (client: Picked) => Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"experience.d.ts","sourceRoot":"","sources":["../../../../src/entities/experience/experience.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAC9D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAG1C,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"experience.d.ts","sourceRoot":"","sources":["../../../../src/entities/experience/experience.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAC9D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAG1C,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAG/D,MAAM,MAAM,oBAAoB,GAAG,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAC3E,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAIjE,QAAA,MAAM,uBAAuB,2BACF;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,UAAU,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;;;;oBAIjB,OAAO,CAAC,UAAU,CAAC;kBAAY,UAAU;;CAgE5F,CAAA;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAC,CAAC,CAAC,EACtF,MAAM,EAAE,CAAC,GACR,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAE5C;AAED,2CAA2C;AAC3C,MAAM,WAAW,uBAAuB;IACtC,iFAAiF;IACjF,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,iGAAiG;IACjG,eAAe,CAAC,EAAE,OAAO,CAAA;CAC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M,CAAA;IACtB,SAAS,CAAC,EAAE,gBAAgB,CAAA;IAC5B,qEAAqE;IACrE,UAAU,CAAC,EAAE,mBAAmB,EAAE,CAAA;IAClC,4CAA4C;IAC5C,YAAY,CAAC,EAAE,mBAAmB,EAAE,CAAA;IACpC,cAAc,CAAC,EAAE,SAAS,GAAG,UAAU,CAAA;IACvC,OAAO,CAAC,EAAE,gBAAgB,EAAE,CAAA;IAC5B,2EAA2E;IAC3E,SAAS,CAAC,EAAE,SAAS,GAAG,UAAU,CAAA;IAClC,KAAK,EAAE,cAAc,EAAE,CAAA;IACvB,KAAK,EAAE,cAAc,EAAE,CAAA;IACvB,6EAA6E;IAC7E,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,OAAO,EAAE,gBAAgB,EAAE,CAAA;CAC5B;AAED,eAAO,MAAM,eAAe,GAC1B,YAAY,UAAU,EACtB,iBAAiB,oBAAoB,KACpC,IAEF,CAAA;AAED;;;;;GAKG;AAEH,eAAO,MAAM,oBAAoB,GAC/B,QAAQ,MAAM,EACd,YAAY,eAAe,EAC3B,UAAU,uBAAuB,SAkBlC,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,GAAU,QAAQ,MAAM,kBASzD,CAAA;AAmBD,eAAO,MAAM,0BAA0B,GACrC,QAAQ,MAAM,EACd,YAAY,eAAe,KAC1B,OAAO,CAAC,OAAO,CAiCjB,CAAA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { EventCallable, Store } from 'effector';
|
|
2
|
-
import { Experience, ExperienceNode,
|
|
2
|
+
import { Experience, ExperienceNode, ExperienceStore, ExperienceTarget, LaunchExperienceOptions } from '../experience/experience';
|
|
3
|
+
import { ExperienceStep } from '../step/step';
|
|
3
4
|
import { Picked } from '../../picked';
|
|
4
5
|
import { HistoryEntry } from '../history/history';
|
|
5
6
|
export interface ExperienceInstance {
|
|
@@ -15,7 +16,6 @@ export interface ExperienceInstance {
|
|
|
15
16
|
toggleOpen: EventCallable<void>;
|
|
16
17
|
setOpen: EventCallable<boolean>;
|
|
17
18
|
treeStore: ExperienceStore['treeStore'];
|
|
18
|
-
fieldsStore: ExperienceStore['fieldsStore'];
|
|
19
19
|
currentNodeStore: Store<ExperienceNode | null>;
|
|
20
20
|
currentStepStore: Store<ExperienceStep | null>;
|
|
21
21
|
previousStepStore: Store<ExperienceStep | null>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"experience-instance.d.ts","sourceRoot":"","sources":["../../../../src/entities/experience-instance/experience-instance.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,aAAa,EAGlB,KAAK,KAAK,EACX,MAAM,UAAU,CAAA;AAEjB,OAAO,KAAK,EACV,UAAU,EACV,cAAc,EACd,
|
|
1
|
+
{"version":3,"file":"experience-instance.d.ts","sourceRoot":"","sources":["../../../../src/entities/experience-instance/experience-instance.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,aAAa,EAGlB,KAAK,KAAK,EACX,MAAM,UAAU,CAAA;AAEjB,OAAO,KAAK,EACV,UAAU,EACV,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,uBAAuB,EACxB,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAClD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAkB1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAItD,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAA;IACV,YAAY,EAAE,UAAU,CAAC,IAAI,CAAC,CAAA;IAC9B,WAAW,EAAE,eAAe,CAAC,aAAa,CAAC,CAAA;IAC3C,MAAM,EAAE,WAAW,GAAG,SAAS,CAAA;IAC/B,cAAc,EAAE,eAAe,CAAC,gBAAgB,CAAC,CAAA;IACjD,UAAU,EAAE,KAAK,CAAC,eAAe,GAAG,OAAO,CAAC,CAAA;IAC5C,WAAW,EAA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O,CAAC,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC,CAAC;CA2CrD,CAAA;AAEF,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,UAAU,CAAC,OAAO,yBAAyB,CAAC,CAAC,CAAC,CAAC,EAC1F,MAAM,EAAE,CAAC,GACR,UAAU,CAAC,OAAO,yBAAyB,CAAC,CAE9C;AAED,eAAO,MAAM,YAAY,GAAI,MAAM,MAAM,EAAE,SAAS,OAAO,EAAE,UAAU,aAAa,SAEnF,CAAA"}
|
|
@@ -1,19 +1,7 @@
|
|
|
1
1
|
import { Store } from 'effector';
|
|
2
|
-
import {
|
|
3
|
-
import { Picked } from '../../picked';
|
|
2
|
+
import { LogicRule } from '../../logic-engine';
|
|
4
3
|
export type FieldsStore = ReturnType<typeof createFieldIndex>;
|
|
5
|
-
export type FieldOptionsStatus = 'idle' | 'loading' | 'resolved' | 'error' | 'waiting';
|
|
6
4
|
export type PrimitiveFieldValue = string | number | boolean | null;
|
|
7
|
-
export type FieldOptionValue = string | number | boolean;
|
|
8
|
-
export interface FieldOption<T = FieldOptionValue> {
|
|
9
|
-
id?: string;
|
|
10
|
-
label: string;
|
|
11
|
-
description?: string;
|
|
12
|
-
value: T;
|
|
13
|
-
condition?: LogicRule;
|
|
14
|
-
}
|
|
15
|
-
export type FieldOptionArray<T = FieldOptionValue> = FieldOption<T>[];
|
|
16
|
-
export type FieldOptions<T = FieldOptionValue> = FieldOptionArray<T> | LogicRule;
|
|
17
5
|
/**
|
|
18
6
|
* JSON-serializable value type for object fields.
|
|
19
7
|
* Recursively defines all valid JSON-serializable structures.
|
|
@@ -22,8 +10,10 @@ export type JsonValue = string | number | boolean | null | {
|
|
|
22
10
|
[key: string]: JsonValue;
|
|
23
11
|
} | JsonValue[];
|
|
24
12
|
export type FieldValue = PrimitiveFieldValue | PrimitiveFieldValue[] | JsonValue | JsonValue[];
|
|
25
|
-
export interface FieldBase<TOptionValue =
|
|
13
|
+
export interface FieldBase<TOptionValue = PrimitiveFieldValue> {
|
|
26
14
|
id: string;
|
|
15
|
+
/** Stable kebab-case identifier used for lookups across API versions. */
|
|
16
|
+
key: string;
|
|
27
17
|
name: string;
|
|
28
18
|
label: string;
|
|
29
19
|
type: 'text' | 'number' | 'object' | 'boolean';
|
|
@@ -31,6 +21,8 @@ export interface FieldBase<TOptionValue = JsonValue> {
|
|
|
31
21
|
required: boolean;
|
|
32
22
|
defaultValue?: FieldValue;
|
|
33
23
|
condition?: LogicRule;
|
|
24
|
+
/** References a global condition by key. Takes precedence over inline `condition`. */
|
|
25
|
+
conditionKey?: string;
|
|
34
26
|
placeholder?: string;
|
|
35
27
|
description?: string;
|
|
36
28
|
helpText?: string;
|
|
@@ -39,16 +31,13 @@ export interface FieldBase<TOptionValue = JsonValue> {
|
|
|
39
31
|
doNotTrackValue?: boolean;
|
|
40
32
|
doNotStoreValue?: boolean;
|
|
41
33
|
};
|
|
42
|
-
options?:
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
* options: { if: [{ '==': [{ var: 'responses.city-selector-field' }, 'sydney'] }, { invoke: { var: 'actions.fetchSydneyEmployees' } }, ...] }
|
|
50
|
-
*/
|
|
51
|
-
dependsOn?: string[];
|
|
34
|
+
options?: {
|
|
35
|
+
id: string;
|
|
36
|
+
label: string;
|
|
37
|
+
description?: string;
|
|
38
|
+
value: TOptionValue;
|
|
39
|
+
condition?: LogicRule;
|
|
40
|
+
}[] | null;
|
|
52
41
|
}
|
|
53
42
|
export interface FieldTextSingular extends FieldBase<string> {
|
|
54
43
|
type: 'text';
|
|
@@ -91,36 +80,18 @@ export interface FieldBooleanMultiple extends FieldBase<boolean> {
|
|
|
91
80
|
defaultValue?: boolean[];
|
|
92
81
|
}
|
|
93
82
|
export type Field = FieldTextSingular | FieldTextMultiple | FieldNumberSingular | FieldNumberMultiple | FieldObjectSingular | FieldObjectMultiple | FieldBooleanSingular | FieldBooleanMultiple;
|
|
94
|
-
|
|
95
|
-
* A field enriched with its runtime options resolution state.
|
|
96
|
-
* Returned by getById, getByName, and listStore — status is always present.
|
|
97
|
-
*/
|
|
98
|
-
export type FieldWithStatus = Field & {
|
|
99
|
-
status: FieldOptionsStatus;
|
|
100
|
-
options: FieldOptionArray<JsonValue> | null;
|
|
101
|
-
error?: string;
|
|
102
|
-
};
|
|
103
|
-
declare const createFieldIndexFactory: ({ client }: {
|
|
104
|
-
client?: Picked;
|
|
105
|
-
}) => {
|
|
83
|
+
declare const createFieldIndexFactory: () => {
|
|
106
84
|
register: (field: Field) => void;
|
|
107
|
-
update: (
|
|
108
|
-
getById: (id: FieldBase["id"]) => Store<
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
force?: boolean;
|
|
113
|
-
context?: LogicObject;
|
|
114
|
-
}) => void;
|
|
115
|
-
resolveAll: (fieldIds: string[], opts?: {
|
|
116
|
-
force?: boolean;
|
|
117
|
-
context?: LogicObject;
|
|
118
|
-
}) => void;
|
|
119
|
-
setWaiting: import('effector').EventCallable<string>;
|
|
85
|
+
update: (fieldKeyOrId: FieldBase["key"], updates: Partial<Field>) => void;
|
|
86
|
+
getById: (id: FieldBase["id"]) => Store<Field | null>;
|
|
87
|
+
getByKey: (key: FieldBase["key"]) => Store<Field | null>;
|
|
88
|
+
listStore: Store<Field[]>;
|
|
89
|
+
getByName: (name: FieldBase["name"]) => Store<Field | null>;
|
|
120
90
|
};
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
91
|
+
/**
|
|
92
|
+
*
|
|
93
|
+
*/
|
|
94
|
+
export declare function createFieldIndex(): ReturnType<typeof createFieldIndexFactory>;
|
|
124
95
|
export declare const setupField: (field: Field, fields: FieldsStore) => void;
|
|
125
96
|
export {};
|
|
126
97
|
//# sourceMappingURL=field.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../../../../src/entities/field/field.ts"],"names":[],"m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