@picked/client 0.0.1-dev.1776837084253 → 0.0.1-dev.1777506629683
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-CIC-Uysx.cjs → api-CPZcLXHT.cjs} +1 -1
- package/dist/{api-6oxKA__k.js → api-DstdB1oU.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/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/plugins/web-components/index.js +1 -1
- package/dist/cjs/plugins/window-object/index.js +1 -1
- package/dist/cjs/server/index.js +1 -1
- package/dist/docs/{actions.md → actions.mdx} +7 -0
- package/dist/docs/{api-keys.md → api-keys.mdx} +7 -0
- package/dist/docs/{conditions.md → conditions.mdx} +7 -0
- package/dist/docs/{experiences.md → experiences.mdx} +7 -0
- package/dist/docs/{features.md → features.mdx} +7 -0
- package/dist/docs/{fields.md → fields.mdx} +7 -0
- package/dist/docs/flow-builder/{overview.md → overview.mdx} +7 -0
- package/dist/docs/pickedql/data-sources.md +49 -2
- package/dist/docs/pickedql/dimensions.md +20 -0
- package/dist/docs/pickedql/examples.md +1 -1
- package/dist/docs/pickedql/filtering.md +22 -0
- package/dist/docs/pickedql/index.md +2 -1
- package/dist/docs/pickedql/schema.md +34 -1
- package/dist/docs/pickedql/virtual-functions.md +4 -4
- package/dist/docs/{projects.md → projects.mdx} +7 -0
- package/dist/docs/{reports.md → reports.mdx} +7 -0
- package/dist/docs/{steps.md → steps.mdx} +7 -0
- package/dist/docs/{workspaces.md → workspaces.mdx} +8 -0
- package/dist/esm/form/index.js +11 -5
- package/dist/esm/index.js +292 -166
- package/dist/esm/plugins/create-experience/index.js +1 -1
- package/dist/esm/plugins/dynamic-experiences/index.js +2 -2
- package/dist/esm/plugins/experience-browser-storage/index.js +21 -19
- package/dist/esm/plugins/history-browser-storage/index.js +17 -15
- package/dist/esm/plugins/responses-browser-storage/index.js +21 -19
- package/dist/esm/plugins/responses-indexeddb/index.js +37 -35
- package/dist/esm/plugins/single-page-app/index.js +14 -28
- package/dist/esm/plugins/web-components/index.js +1 -1
- package/dist/esm/plugins/window-object/index.js +1 -1
- package/dist/esm/server/index.js +1 -1
- package/dist/experience-instance-DC2gKwA6.cjs +1 -0
- package/dist/experience-instance-DJaNc5Ob.js +486 -0
- package/dist/object-C82v79xc.js +25 -0
- package/dist/object-CUJOjanb.cjs +1 -0
- package/dist/rules-logic-BTIxfrJJ.js +240 -0
- package/dist/rules-logic-DNLOv90w.cjs +1 -0
- package/dist/types/entities/action/action.d.ts +30 -4
- package/dist/types/entities/action/action.d.ts.map +1 -1
- package/dist/types/entities/experience-instance/experience-instance.d.ts +4 -2
- package/dist/types/entities/experience-instance/experience-instance.d.ts.map +1 -1
- package/dist/types/entities/response/response-validation.d.ts.map +1 -1
- package/dist/types/form/create-field-evaluator.d.ts.map +1 -1
- package/dist/types/picked.d.ts +3 -1
- package/dist/types/picked.d.ts.map +1 -1
- package/dist/types/plugins/experience-browser-storage/plugin.d.ts.map +1 -1
- package/dist/types/plugins/history-browser-storage/plugin.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/plugins/single-page-app/plugin.d.ts +4 -15
- package/dist/types/plugins/single-page-app/plugin.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/experience-CNIhapU2.js +0 -136
- package/dist/experience-CTEBY-it.cjs +0 -1
- package/dist/experience-instance-Cu8oGGr9.cjs +0 -1
- package/dist/experience-instance-DIpWYaA6.js +0 -387
- package/dist/nodes-2fst8XKi.js +0 -101
- package/dist/nodes-DBK4N9YY.cjs +0 -1
- package/dist/rules-logic-D7dL30U1.js +0 -263
- package/dist/rules-logic-DJhGFqhC.cjs +0 -1
- /package/dist/{id-Cg7fVl1O.cjs → id-Bv44ilEo.cjs} +0 -0
- /package/dist/{id-n2yrHvNo.js → id-CRqy981z.js} +0 -0
- /package/dist/{logger-C44jSdYl.js → logger-6z_gb4rA.js} +0 -0
- /package/dist/{logger-CJUj90QX.cjs → logger-fbvQC40v.cjs} +0 -0
- /package/dist/{supports-B_trw6lj.js → supports-0XIfd4-R.js} +0 -0
- /package/dist/{supports-CKSVYpQx.cjs → supports-Dsjg-82e.cjs} +0 -0
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import { t as e } from "./object-C82v79xc.js";
|
|
2
|
+
//#region src/logic-engine.ts
|
|
3
|
+
function t(e) {
|
|
4
|
+
return typeof e == "number" && !isNaN(e);
|
|
5
|
+
}
|
|
6
|
+
function n(e) {
|
|
7
|
+
return typeof e == "string";
|
|
8
|
+
}
|
|
9
|
+
function r(e) {
|
|
10
|
+
return Array.isArray(e);
|
|
11
|
+
}
|
|
12
|
+
function i(e) {
|
|
13
|
+
return e instanceof Promise;
|
|
14
|
+
}
|
|
15
|
+
function a(e) {
|
|
16
|
+
return typeof e == "object" && !!e && !Array.isArray(e) && Object.keys(e).length === 1;
|
|
17
|
+
}
|
|
18
|
+
function o(e) {
|
|
19
|
+
if (t(e)) return e;
|
|
20
|
+
let n = parseFloat(`${e}`);
|
|
21
|
+
return isNaN(n) ? 0 : n;
|
|
22
|
+
}
|
|
23
|
+
function s(e) {
|
|
24
|
+
return `${e}`;
|
|
25
|
+
}
|
|
26
|
+
var c = {
|
|
27
|
+
"==": (e, t) => e == t,
|
|
28
|
+
"===": (e, t) => e === t,
|
|
29
|
+
"!=": (e, t) => e != t,
|
|
30
|
+
"!==": (e, t) => e !== t,
|
|
31
|
+
">": (e, t) => o(e) > o(t),
|
|
32
|
+
">=": (e, t) => o(e) >= o(t),
|
|
33
|
+
"<": (e, t, n) => {
|
|
34
|
+
let r = o(e), i = o(t);
|
|
35
|
+
if (n === void 0) return r < i;
|
|
36
|
+
let a = o(n);
|
|
37
|
+
return r < i && i < a;
|
|
38
|
+
},
|
|
39
|
+
"<=": (e, t, n) => {
|
|
40
|
+
let r = o(e), i = o(t);
|
|
41
|
+
if (n === void 0) return r <= i;
|
|
42
|
+
let a = o(n);
|
|
43
|
+
return r <= i && i <= a;
|
|
44
|
+
},
|
|
45
|
+
"!!": async (e) => await u(e),
|
|
46
|
+
"!": async (e) => !await u(e),
|
|
47
|
+
"%": (e, t) => o(e) % o(t),
|
|
48
|
+
log: (e) => (console.log(e), e),
|
|
49
|
+
in: (e, t) => t ? n(t) ? t.indexOf(s(e)) !== -1 : r(t) ? t.includes(e) : !1 : !1,
|
|
50
|
+
cat: (...e) => e.map(s).join(""),
|
|
51
|
+
substr: (e, t, n) => {
|
|
52
|
+
let r = s(e), i = o(t);
|
|
53
|
+
if (n === void 0) return r.substr(i);
|
|
54
|
+
let a = o(n);
|
|
55
|
+
if (a < 0) {
|
|
56
|
+
let e = r.substr(i);
|
|
57
|
+
return e.substr(0, e.length + a);
|
|
58
|
+
}
|
|
59
|
+
return r.substr(i, a);
|
|
60
|
+
},
|
|
61
|
+
"+": (...e) => e.reduce((e, t) => o(e) + o(t), 0),
|
|
62
|
+
"*": (...e) => e.reduce((e, t) => o(e) * o(t), 1),
|
|
63
|
+
"-": (e, t) => {
|
|
64
|
+
let n = o(e);
|
|
65
|
+
return t === void 0 ? -n : n - o(t);
|
|
66
|
+
},
|
|
67
|
+
"/": (e, t) => o(e) / o(t),
|
|
68
|
+
min: (...e) => Math.min(...e.map(o)),
|
|
69
|
+
max: (...e) => Math.max(...e.map(o)),
|
|
70
|
+
merge: (...e) => e.reduce((e, t) => r(t) ? e.concat(t) : e.concat([t]), []),
|
|
71
|
+
var(e, t) {
|
|
72
|
+
let n = arguments.length > 1 ? t : null;
|
|
73
|
+
if (e === "" || e === "." || e == null) return this;
|
|
74
|
+
if (typeof e == "number" && Array.isArray(this)) return e >= 0 && e < this.length ? this[e] : n;
|
|
75
|
+
let r = s(e);
|
|
76
|
+
if (r === "" || r === ".") return this;
|
|
77
|
+
let i = r.split("."), a = this;
|
|
78
|
+
for (let e of i) {
|
|
79
|
+
if (a == null) return n;
|
|
80
|
+
if (Array.isArray(a)) {
|
|
81
|
+
let t = parseInt(e, 10);
|
|
82
|
+
a = isNaN(t) ? a[e] : a[t];
|
|
83
|
+
} else a = a[e];
|
|
84
|
+
}
|
|
85
|
+
return a === void 0 ? n : a;
|
|
86
|
+
},
|
|
87
|
+
async missing(...e) {
|
|
88
|
+
let t = r(e[0]) ? e[0] : e, n = [];
|
|
89
|
+
for (let e of t) {
|
|
90
|
+
let t = await l({ var: e }, this);
|
|
91
|
+
(t === null || t === "") && n.push(`${e}`);
|
|
92
|
+
}
|
|
93
|
+
return n;
|
|
94
|
+
},
|
|
95
|
+
async missing_some(e, t) {
|
|
96
|
+
let i = await l({ missing: t }, this);
|
|
97
|
+
if (!r(i) || !r(t)) return [];
|
|
98
|
+
let a = i.filter(n);
|
|
99
|
+
return t.filter(n).length - a.length >= o(e) ? [] : a;
|
|
100
|
+
},
|
|
101
|
+
invoke(...e) {
|
|
102
|
+
let [t, ...n] = e;
|
|
103
|
+
return typeof t == "function" ? Reflect.apply(t, null, n) : null;
|
|
104
|
+
},
|
|
105
|
+
startsWith: (e, t) => n(e) && n(t) && e.startsWith(t),
|
|
106
|
+
endsWith: (e, t) => n(e) && n(t) && e.endsWith(t),
|
|
107
|
+
regexp_matches(e, t) {
|
|
108
|
+
let i = e, a = "";
|
|
109
|
+
if (r(e)) {
|
|
110
|
+
let [t, n] = e;
|
|
111
|
+
i = t, a = n;
|
|
112
|
+
}
|
|
113
|
+
return !n(i) || !n(a) ? !1 : new RegExp(i, a).test(s(t));
|
|
114
|
+
},
|
|
115
|
+
throw(e) {
|
|
116
|
+
throw Error(s(e));
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
async function l(e, t) {
|
|
120
|
+
if (!e) return e;
|
|
121
|
+
if (i(e)) return l(await e, t);
|
|
122
|
+
if (r(e)) return Promise.all(e.map((e) => l(e, t)));
|
|
123
|
+
if (!a(e)) return e;
|
|
124
|
+
let n = d(e), o = n ? e[n] ?? [] : [];
|
|
125
|
+
switch (r(o) || (o = [o]), n) {
|
|
126
|
+
case "if":
|
|
127
|
+
case "?:":
|
|
128
|
+
for (let e = 0; e < o.length - 1; e += 2) if (await u(await l(o[e], t))) return l(o[e + 1], t);
|
|
129
|
+
return o.length % 2 == 1 ? l(o[o.length - 1], t) : null;
|
|
130
|
+
case "and": {
|
|
131
|
+
let e = null;
|
|
132
|
+
for (let n of o) if (e = await l(n, t), !await u(e)) return e;
|
|
133
|
+
return e;
|
|
134
|
+
}
|
|
135
|
+
case "or": {
|
|
136
|
+
let e = null;
|
|
137
|
+
for (let n of o) if (e = await l(n, t), await u(e)) return e;
|
|
138
|
+
return e;
|
|
139
|
+
}
|
|
140
|
+
case "map": {
|
|
141
|
+
let e = await l(o[0], t);
|
|
142
|
+
return r(e) ? await Promise.all(e.map((e) => l(o[1], e))) : [];
|
|
143
|
+
}
|
|
144
|
+
case "filter": {
|
|
145
|
+
let e = await l(o[0], t);
|
|
146
|
+
return r(e) ? (await Promise.all(e.map(async (e) => ({
|
|
147
|
+
item: e,
|
|
148
|
+
shouldInclude: await u(await l(o[1], e))
|
|
149
|
+
})))).filter(({ shouldInclude: e }) => e).map(({ item: e }) => e) : [];
|
|
150
|
+
}
|
|
151
|
+
case "reduce": {
|
|
152
|
+
let e = await l(o[0], t);
|
|
153
|
+
if (!r(e)) return o.length > 2 ? await l(o[2], t) : null;
|
|
154
|
+
let n = o[1], i = o.length > 2 ? await l(o[2], t) : null;
|
|
155
|
+
for (let t of e) i = await l(n, {
|
|
156
|
+
current: t,
|
|
157
|
+
accumulator: i
|
|
158
|
+
});
|
|
159
|
+
return i;
|
|
160
|
+
}
|
|
161
|
+
case "all": {
|
|
162
|
+
let e = await l(o[0], t);
|
|
163
|
+
if (!r(e) || e.length === 0) return !1;
|
|
164
|
+
for (let t of e) if (!await u(await l(o[1], t))) return !1;
|
|
165
|
+
return !0;
|
|
166
|
+
}
|
|
167
|
+
case "some": {
|
|
168
|
+
let e = await l(o[0], t);
|
|
169
|
+
if (!r(e)) return !1;
|
|
170
|
+
for (let t of e) if (await u(await l(o[1], t))) return !0;
|
|
171
|
+
return !1;
|
|
172
|
+
}
|
|
173
|
+
case "none": {
|
|
174
|
+
let e = await l(o[0], t);
|
|
175
|
+
if (!r(e)) return !0;
|
|
176
|
+
for (let t of e) if (await u(await l(o[1], t))) return !1;
|
|
177
|
+
return !0;
|
|
178
|
+
}
|
|
179
|
+
case "catch": try {
|
|
180
|
+
return await l(o[0], t);
|
|
181
|
+
} catch (e) {
|
|
182
|
+
return a(e) ? await l(e, t) : o[1] ? await l(o[1], e) : e instanceof Error ? e.message : e;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
let s = await Promise.all(o.map((e) => l(e, t))), f = n ? c[n] : void 0;
|
|
186
|
+
if (!f) throw Error(`Unrecognized operation ${n}`);
|
|
187
|
+
return f.apply(t, s);
|
|
188
|
+
}
|
|
189
|
+
async function u(e) {
|
|
190
|
+
return i(e) ? u(await e) : !(Array.isArray(e) && e.length === 0) && !!e;
|
|
191
|
+
}
|
|
192
|
+
function d(e) {
|
|
193
|
+
return Object.keys(e)[0];
|
|
194
|
+
}
|
|
195
|
+
//#endregion
|
|
196
|
+
//#region src/utils/rules-logic.ts
|
|
197
|
+
function f(t) {
|
|
198
|
+
return !e(t);
|
|
199
|
+
}
|
|
200
|
+
async function p(e, t, n) {
|
|
201
|
+
let r = e.getStateSnapshot(), i = e.predicates.listStore.getState().reduce((e, t) => ({
|
|
202
|
+
...e,
|
|
203
|
+
[t.name]: (...e) => t.predicate({
|
|
204
|
+
...r,
|
|
205
|
+
args: e
|
|
206
|
+
})
|
|
207
|
+
}), {}), a = e.actions.listStore.getState().reduce((e, t) => ({
|
|
208
|
+
...e,
|
|
209
|
+
[t.key]: (...e) => t.action({
|
|
210
|
+
...r,
|
|
211
|
+
args: e
|
|
212
|
+
}, null)
|
|
213
|
+
}), {}), o = e.features.listStore.getState().reduce((e, t) => ({
|
|
214
|
+
...e,
|
|
215
|
+
[t.id]: async () => {
|
|
216
|
+
let { bucket: e } = await t.getBucket();
|
|
217
|
+
return e;
|
|
218
|
+
}
|
|
219
|
+
}), {});
|
|
220
|
+
return await l(t, {
|
|
221
|
+
responses: e.responses.getAllStore.getState(),
|
|
222
|
+
location: typeof r.location == "object" ? {
|
|
223
|
+
hash: r.location.hash,
|
|
224
|
+
host: r.location.host,
|
|
225
|
+
hostname: r.location.hostname,
|
|
226
|
+
href: r.location.href,
|
|
227
|
+
origin: r.location.origin,
|
|
228
|
+
pathname: r.location.pathname,
|
|
229
|
+
port: r.location.port,
|
|
230
|
+
protocol: r.location.protocol,
|
|
231
|
+
search: r.location.search
|
|
232
|
+
} : void 0,
|
|
233
|
+
predicates: i,
|
|
234
|
+
actions: a,
|
|
235
|
+
features: o,
|
|
236
|
+
...n
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
//#endregion
|
|
240
|
+
export { f as n, p as t };
|
|
@@ -0,0 +1 @@
|
|
|
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},startsWith:(e,t)=>n(e)&&n(t)&&e.startsWith(t),endsWith:(e,t)=>n(e)&&n(t)&&e.endsWith(t),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.actions.listStore.getState().reduce((e,t)=>({...e,[t.key]:(...e)=>t.action({...r,args:e},null)}),{}),o=e.features.listStore.getState().reduce((e,t)=>({...e,[t.id]:async()=>{let{bucket:e}=await t.getBucket();return e}}),{});return await l(t,{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,actions:a,features:o,...n})}Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return p}});
|
|
@@ -1,13 +1,37 @@
|
|
|
1
1
|
import { Store } from 'effector';
|
|
2
2
|
import { StateSnapshot } from '../../utils/state-snaphot';
|
|
3
3
|
import { Picked } from '../../picked';
|
|
4
|
+
import { ExperienceInstance } from '../experience-instance/experience-instance';
|
|
4
5
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
6
|
+
* Context supplied by the experience-flow runtime when an ActionNode triggers the action.
|
|
7
|
+
* `null` for every other invocation path (see {@link Action}).
|
|
8
|
+
*/
|
|
9
|
+
export interface ActionContext {
|
|
10
|
+
/** The experience instance whose ActionNode triggered this action. */
|
|
11
|
+
experience: ExperienceInstance;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* A named callable function that receives a state snapshot, action args, and a context.
|
|
15
|
+
*
|
|
16
|
+
* `context` is an {@link ActionContext} only when the action is executed as an
|
|
17
|
+
* ActionNode in an experience flow. It is `null` for every other invocation path,
|
|
18
|
+
* including `getEvokableAction` and actions referenced from rule logic (condition
|
|
19
|
+
* rules, `initializeOpenLogic`, launch decisions, feature gates, field
|
|
20
|
+
* validation/visibility). Rule-logic paths evaluate the action against a snapshot
|
|
21
|
+
* only and have no triggering instance.
|
|
22
|
+
*
|
|
23
|
+
* Re-entrancy: do not synchronously call navigation events (`goToNextStep`,
|
|
24
|
+
* `goToPreviousStep`, `goToStepById`) or open-state events (`open`, `close`,
|
|
25
|
+
* `toggleOpen`, `setOpen`) on `context.experience` before the handler's returned
|
|
26
|
+
* promise resolves. Those writes race the flow runtime's post-action history
|
|
27
|
+
* push and produce non-deterministic ordering. Perform control flow after your
|
|
28
|
+
* side effect resolves.
|
|
29
|
+
*
|
|
30
|
+
* Returns a value (boolean, string, string[]) or runs a side effect (void).
|
|
7
31
|
*/
|
|
8
32
|
export type Action = (snapshot: StateSnapshot & {
|
|
9
33
|
args: unknown[];
|
|
10
|
-
}) => boolean | Promise<boolean> | string | Promise<string> | string[] | Promise<string[]> | void | Promise<void> | undefined;
|
|
34
|
+
}, context: ActionContext | null) => boolean | Promise<boolean> | string | Promise<string> | string[] | Promise<string[]> | void | Promise<void> | undefined;
|
|
11
35
|
export type ActionsStore = ReturnType<typeof createActionIndexFactory>;
|
|
12
36
|
export interface ActionIndexItem {
|
|
13
37
|
key: string;
|
|
@@ -19,7 +43,9 @@ declare const createActionIndexFactory: ({ client }: {
|
|
|
19
43
|
register: (key: string, action: Action) => void;
|
|
20
44
|
getByKey: (key: string) => Store<Action | undefined>;
|
|
21
45
|
listStore: Store<ActionIndexItem[]>;
|
|
22
|
-
getEvokableAction: (actionKey: string
|
|
46
|
+
getEvokableAction: (actionKey: string, options?: {
|
|
47
|
+
experience: ExperienceInstance;
|
|
48
|
+
}) => Store<() => ReturnType<Action>>;
|
|
23
49
|
};
|
|
24
50
|
/**
|
|
25
51
|
* Creates an action index with lifecycle stores and registration logic.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../../../src/entities/action/action.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,OAAO,EAA8D,KAAK,KAAK,EAAE,MAAM,UAAU,CAAA;AAGjG,OAAO,EAAuB,KAAK,aAAa,EAAE,MAAM,2BAA2B,CAAA;AACnF,OAAO,KAAK,EAAE,MAAM,E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;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC,CAAC,CAAC,EACxF,MAAM,EAAE,CAAC,GACR,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAE7C;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,WAAW,GAAI,KAAK,MAAM,EAAE,QAAQ,MAAM,EAAE,SAAS,YAAY,KAAG,IAEhF,CAAA"}
|
|
@@ -42,7 +42,8 @@ declare const createExperienceInstanceFactory: ({ client, experience, target, op
|
|
|
42
42
|
/**
|
|
43
43
|
* Creates an experience instance with lifecycle stores and navigation logic.
|
|
44
44
|
*
|
|
45
|
-
* @param params - Factory parameters including the client and experience store.
|
|
45
|
+
* @param {Parameters<typeof createExperienceInstanceFactory>[0]} params - Factory parameters including the client and experience store.
|
|
46
|
+
* @returns {ExperienceInstance} The created experience instance.
|
|
46
47
|
* @example
|
|
47
48
|
* ```typescript
|
|
48
49
|
* const instance = createExperienceInstance({ client, experience })
|
|
@@ -60,7 +61,8 @@ declare const createExperienceInstanceIndexFactory: ({ client }: {
|
|
|
60
61
|
/**
|
|
61
62
|
* Creates an index that tracks all experience instances keyed by experience ID.
|
|
62
63
|
*
|
|
63
|
-
* @param params - Factory parameters including the client.
|
|
64
|
+
* @param {Parameters<typeof createExperienceInstanceIndexFactory>[0]} params - Factory parameters including the client.
|
|
65
|
+
* @returns {ExperienceInstanceIndex} The created experience-instance index.
|
|
64
66
|
* @example
|
|
65
67
|
* ```typescript
|
|
66
68
|
* const index = createExperienceInstanceIndex({ client })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"experience-instance.d.ts","sourceRoot":"","sources":["../../../../src/entities/experience-instance/experience-instance.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,OAAO,EAOL,KAAK,aAAa,EAGlB,KAAK,KAAK,EACX,MAAM,UAAU,CAAA;AAEjB,OAAO,KAAK,EACV,UAAU,EACV,cA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AE,CAAC,CAAA;IACjC,YAAY,EAAE,aAAa,CAAC,IAAI,CAAC,CAAA;IACjC,gBAAgB,EAAE,aAAa,CAAC,IAAI,CAAC,CAAA;IACrC,YAAY,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;IACnC,iBAAiB,EAAE,KAAK,CAAC,YAAY,EAAE,CAAC,CAAA;CACzC;AAED,MAAM,MAAM,uBAAuB,GAAG,UAAU,CAAC,OAAO,6BAA6B,CAAC,CAAA;AACtF,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,WAAW,EAAE,CAAA;IACvB,SAAS,EAAE,gBAAgB,CAAC,WAAW,CAAC,CAAA;CACzC;AAED,QAAA,MAAM,+BAA+B,6CAMhC;IACD,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,eAAe,CAAA;IAC3B,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB,OAAO,CAAC,EAAE,uBAAuB,CAAA;CAClC,iCAgdF,CAAA;AAED
|
|
1
|
+
{"version":3,"file":"experience-instance.d.ts","sourceRoot":"","sources":["../../../../src/entities/experience-instance/experience-instance.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,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;AAiB1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAItD,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAA;IACV,aAAa,EAAE,UAAU,CAAC,KAAK,CAAC,CAAA;IAChC,YAAY,EAAE,UAAU,CAAC,IAAI,CAAC,CAAA;IAC9B,WAAW,EAA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AAA;CACzC;AAED,QAAA,MAAM,+BAA+B,6CAMhC;IACD,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,eAAe,CAAA;IAC3B,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB,OAAO,CAAC,EAAE,uBAAuB,CAAA;CAClC,iCAgdF,CAAA;AAED;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CACtC,CAAC,SAAS,UAAU,CAAC,OAAO,+BAA+B,CAAC,CAAC,CAAC,CAAC,EAC/D,MAAM,EAAE,CAAC,GAAG,UAAU,CAAC,OAAO,+BAA+B,CAAC,CAE/D;AAED,QAAA,MAAM,oCAAoC,eAA8B;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE;wBA0J1E,eAAe,UACnB,WAAW,YACT,uBAAuB;8BAmBF,UAAU,CAAC,KAAK,CAAC;4BAiBnB,UAAU,CAAC,IAAI,CAAC;;CAU/C,CAAA;AAEF;;;;;;;;;GASG;AACH,wBAAgB,6BAA6B,CAC3C,CAAC,SAAS,UAAU,CAAC,OAAO,oCAAoC,CAAC,CAAC,CAAC,CAAC,EACpE,MAAM,EAAE,CAAC,GAAG,UAAU,CAAC,OAAO,oCAAoC,CAAC,CAEpE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"response-validation.d.ts","sourceRoot":"","sources":["../../../../src/entities/response/response-validation.ts"],"names":[],"mappings":"AAAA,0GAA0G;AAC1G,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAuB,MAAM,gBAAgB,CAAA;AAC5E,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAGhE,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,KAAK,CAAC,KAAK,CAAC,CAAA;IACtB,WAAW,EAAE,MAAM,CAAA;IACnB,aAAa,EAAE,MAAM,CAAA;IACrB,KAAK,EAAE,UAAU,CAAA;CAClB;AAED,qEAAqE;AACrE,KAAK,aAAa,GAAG,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;AAmFlF;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,KAAK,GAAG,IAAI,CAE/E;AAED;;;;;;;;;;GAUG;AAEH,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,GAAG,UAAU,CASzE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,GAAG,eAAe,GAAG,IAAI,CAgE3F;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,GAAG,eAAe,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"response-validation.d.ts","sourceRoot":"","sources":["../../../../src/entities/response/response-validation.ts"],"names":[],"mappings":"AAAA,0GAA0G;AAC1G,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAuB,MAAM,gBAAgB,CAAA;AAC5E,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAGhE,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,KAAK,CAAC,KAAK,CAAC,CAAA;IACtB,WAAW,EAAE,MAAM,CAAA;IACnB,aAAa,EAAE,MAAM,CAAA;IACrB,KAAK,EAAE,UAAU,CAAA;CAClB;AAED,qEAAqE;AACrE,KAAK,aAAa,GAAG,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;AAmFlF;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,KAAK,GAAG,IAAI,CAE/E;AAED;;;;;;;;;;GAUG;AAEH,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,GAAG,UAAU,CASzE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,GAAG,eAAe,GAAG,IAAI,CAgE3F;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,GAAG,eAAe,GAAG,IAAI,CAuCvF;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,uBAAuB,CAC3C,YAAY,EAAE,aAAa,EAC3B,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,UAAU,EACjB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,GACrC,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAsCjC"}
|
|
@@ -1 +1 @@
|
|
|
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,SAAS,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,EAC1B,iBAAiB,EAAE,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,GAC3D;IAAE,WAAW,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,CAAA;CAAE,
|
|
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,SAAS,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,EAC1B,iBAAiB,EAAE,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,GAC3D;IAAE,WAAW,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,CAAA;CAAE,CA8CjC"}
|
package/dist/types/picked.d.ts
CHANGED
|
@@ -241,7 +241,9 @@ export declare class Picked {
|
|
|
241
241
|
register: (key: string, action: Action) => void;
|
|
242
242
|
getByKey: (key: string) => import('effector').Store<Action | undefined>;
|
|
243
243
|
listStore: import('effector').Store<import('.').ActionIndexItem[]>;
|
|
244
|
-
getEvokableAction: (actionKey: string
|
|
244
|
+
getEvokableAction: (actionKey: string, options?: {
|
|
245
|
+
experience: import('.').ExperienceInstance;
|
|
246
|
+
}) => import('effector').Store<() => ReturnType<Action>>;
|
|
245
247
|
};
|
|
246
248
|
constructor(options: CreateClientOptions);
|
|
247
249
|
start: () => void;
|
|
@@ -1 +1 @@
|
|
|
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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+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/plugins/experience-browser-storage/plugin.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AAM1D,UAAU,8BAA8B;IACtC,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAC9B;AAED,eAAO,MAAM,8BAA8B,GAAI,eAE5C,8BAAmC,KAAG,MA+CxC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/plugins/history-browser-storage/plugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/plugins/history-browser-storage/plugin.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AAM1D,cAAc;AACd,MAAM,WAAW,2BAA2B;IAC1C,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAC9B;AAED,eAAO,MAAM,2BAA2B,GAAI,eAEzC,2BAAgC,KAAG,MA8BrC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;AAM1D,UAAU,6BAA6B;IACrC,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAC9B;AAiCD,eAAO,MAAM,6BAA6B,GAAI,eAE3C,6BAAkC,KAAG,MAuCvC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/plugins/responses-indexeddb/plugin.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/plugins/responses-indexeddb/plugin.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AAO1D,eAAO,MAAM,wBAAwB,QAAO,MAuE3C,CAAA"}
|
|
@@ -9,14 +9,12 @@ interface SinglePageAppPluginOptions {
|
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
11
|
* Enables compatibility with Single Page Applications (SPAs).
|
|
12
|
-
* This plugin monitors browser history events and
|
|
13
|
-
*
|
|
14
|
-
* (`initialiseExperiences`) immediately and again on each DOM mutation batch until
|
|
15
|
-
* the DOM settles, so widgets re-appear when their target elements are (re)rendered
|
|
16
|
-
* by the host framework.
|
|
12
|
+
* This plugin monitors browser history events and automatically triggers client re-rendering
|
|
13
|
+
* when navigation occurs within the SPA.
|
|
17
14
|
*
|
|
18
|
-
* @param {SinglePageAppPluginOptions}
|
|
15
|
+
* @param {SinglePageAppPluginOptions} options - Configuration options for the SPA plugin
|
|
19
16
|
* @returns {Plugin} The plugin.
|
|
17
|
+
*
|
|
20
18
|
* @example
|
|
21
19
|
* ```typescript
|
|
22
20
|
* createClient({
|
|
@@ -29,15 +27,6 @@ interface SinglePageAppPluginOptions {
|
|
|
29
27
|
* ```
|
|
30
28
|
*/
|
|
31
29
|
export declare const singlePageAppPlugin: (_options: SinglePageAppPluginOptions) => Plugin;
|
|
32
|
-
/**
|
|
33
|
-
* Instruments browser history so the callback fires whenever the navigation
|
|
34
|
-
* URL changes via `popstate`, `pushState`, or `replaceState`. Same-URL events
|
|
35
|
-
* are ignored so repeated replaces of the current location don't re-trigger.
|
|
36
|
-
*
|
|
37
|
-
* @param {() => void} callback - Invoked once per URL change.
|
|
38
|
-
* @example
|
|
39
|
-
* instrumentHistory(() => console.log('route changed'))
|
|
40
|
-
*/
|
|
41
30
|
export declare function instrumentHistory(callback: () => void): void;
|
|
42
31
|
export {};
|
|
43
32
|
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/plugins/single-page-app/plugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/plugins/single-page-app/plugin.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AAM1D,UAAU,0BAA0B;IAClC;;;;OAIG;IACH,iBAAiB,EAAE,IAAI,CAAA;CACxB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,mBAAmB,GAAI,UAAU,0BAA0B,KAAG,MAa1E,CAAA;AAED,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CAwC5D"}
|
package/package.json
CHANGED
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import { n as e, t } from "./rules-logic-D7dL30U1.js";
|
|
2
|
-
import "./logger-C44jSdYl.js";
|
|
3
|
-
import { a as n, f as r, l as i, n as a, o } from "./nodes-2fst8XKi.js";
|
|
4
|
-
import { attach as s, combine as c, createApi as l, createDomain as u } from "effector";
|
|
5
|
-
import { createFactory as d, invoke as f } from "@withease/factories";
|
|
6
|
-
//#region src/entities/experience/experience.ts
|
|
7
|
-
var p = u("experience"), m = d(({ client: e, experience: t }) => {
|
|
8
|
-
let r = p.store(t), i = l(r, { merge(e, t) {
|
|
9
|
-
return {
|
|
10
|
-
...e,
|
|
11
|
-
...t.experience
|
|
12
|
-
};
|
|
13
|
-
} }), o = r.map((e) => ({
|
|
14
|
-
name: e.name,
|
|
15
|
-
decisionLogic: e.condition,
|
|
16
|
-
targetSelectors: e.targets,
|
|
17
|
-
initializeOpenLogic: e.initializeOpen
|
|
18
|
-
})), s = c(r, e.components.listStore, (e, t) => (e.componentName ? t.find((t) => t.name === e.componentName) : void 0) || t.find((t) => t.name === `experience:${e.id}`) || t.find((e) => e.name === "experience"), { skipVoid: !1 }), u = c(r, e.steps.indexStore, e.conditions.indexStore, (e, t, r) => {
|
|
19
|
-
let i = e.nodes.filter(n).map((e) => t[e.stepId]).filter((e) => e !== void 0), o = e.nodes.filter(a).map((e) => r[e.conditionId]).filter((e) => e !== void 0);
|
|
20
|
-
return {
|
|
21
|
-
steps: i,
|
|
22
|
-
nodes: e.nodes,
|
|
23
|
-
edges: e.edges,
|
|
24
|
-
conditions: o
|
|
25
|
-
};
|
|
26
|
-
}), d = t.actions ?? [];
|
|
27
|
-
return {
|
|
28
|
-
id: t.id,
|
|
29
|
-
key: t.key,
|
|
30
|
-
name: t.name,
|
|
31
|
-
configStore: o,
|
|
32
|
-
treeStore: u,
|
|
33
|
-
componentStore: s,
|
|
34
|
-
actions: d,
|
|
35
|
-
merge: i.merge
|
|
36
|
-
};
|
|
37
|
-
});
|
|
38
|
-
function h(e) {
|
|
39
|
-
return f(m, e);
|
|
40
|
-
}
|
|
41
|
-
var g = d(({ client: e }) => {
|
|
42
|
-
let t = p.store({}), n = l(t, { register(e, t) {
|
|
43
|
-
return {
|
|
44
|
-
...e,
|
|
45
|
-
[t.id]: t
|
|
46
|
-
};
|
|
47
|
-
} });
|
|
48
|
-
function r(r) {
|
|
49
|
-
let i = t.getState()[r.id];
|
|
50
|
-
if (i) {
|
|
51
|
-
i.merge({
|
|
52
|
-
experience: r,
|
|
53
|
-
strategy: "override"
|
|
54
|
-
});
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
let a = h({
|
|
58
|
-
client: e,
|
|
59
|
-
experience: r
|
|
60
|
-
});
|
|
61
|
-
n.register(a);
|
|
62
|
-
}
|
|
63
|
-
let i = t.map((e) => Object.values(e));
|
|
64
|
-
function a(e) {
|
|
65
|
-
return t.map((t) => t[e], { skipVoid: !1 });
|
|
66
|
-
}
|
|
67
|
-
function o(e) {
|
|
68
|
-
return t.map((t) => Object.values(t).find((t) => t.key === e) ?? t[e], { skipVoid: !1 });
|
|
69
|
-
}
|
|
70
|
-
let c = s({
|
|
71
|
-
source: t,
|
|
72
|
-
effect: async (t, n) => {
|
|
73
|
-
let r = "key" in n ? Object.values(t).find((e) => e.key === n.key) : t[n.id];
|
|
74
|
-
if (!r) {
|
|
75
|
-
"key" in n ? `${n.key}` : `${n.id}`;
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
let { options: i } = n;
|
|
79
|
-
if (i?.bypassCondition) {
|
|
80
|
-
v(e, r, i);
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
await b(e, r) && v(e, r, i);
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
return {
|
|
87
|
-
register: r,
|
|
88
|
-
get: a,
|
|
89
|
-
getById: a,
|
|
90
|
-
getByKey: o,
|
|
91
|
-
launch: c,
|
|
92
|
-
open: s({
|
|
93
|
-
source: {
|
|
94
|
-
experiences: t,
|
|
95
|
-
instances: e.experienceInstances.listStore
|
|
96
|
-
},
|
|
97
|
-
effect: ({ experiences: e, instances: t }, n) => {
|
|
98
|
-
let r = "key" in n ? Object.values(e).find((e) => e.key === n.key) : e[n.id], i = t.filter((e) => r && e.experienceId === r.id);
|
|
99
|
-
if (i.length > 0) for (let e of i) e.open();
|
|
100
|
-
else c("key" in n ? {
|
|
101
|
-
key: n.key,
|
|
102
|
-
options: {
|
|
103
|
-
...n.options,
|
|
104
|
-
initialiseOpen: !0
|
|
105
|
-
}
|
|
106
|
-
} : {
|
|
107
|
-
id: n.id,
|
|
108
|
-
options: {
|
|
109
|
-
...n.options,
|
|
110
|
-
initialiseOpen: !0
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
}),
|
|
115
|
-
listStore: i
|
|
116
|
-
};
|
|
117
|
-
});
|
|
118
|
-
function _(e) {
|
|
119
|
-
return f(g, e);
|
|
120
|
-
}
|
|
121
|
-
var v = (e, t, n) => {
|
|
122
|
-
let { targetSelectors: a } = t.configStore.getState(), s = i(a, t.id);
|
|
123
|
-
s.forEach(({ elements: e }) => e.forEach((e) => r(e, t.id))), o(s, t.id, t.key).forEach((r) => {
|
|
124
|
-
n ? e.experienceInstances.spawn(t, r, n) : e.experienceInstances.spawn(t, r);
|
|
125
|
-
});
|
|
126
|
-
}, y = async (e) => {
|
|
127
|
-
await Promise.all(e.experiences.listStore.getState().map(async (t) => {
|
|
128
|
-
await b(e, t) && v(e, t);
|
|
129
|
-
}));
|
|
130
|
-
}, b = async (n, r) => {
|
|
131
|
-
if (!n.preconditionPassed || !n.session?.isUser) return !1;
|
|
132
|
-
let { decisionLogic: a, targetSelectors: o } = r.configStore.getState();
|
|
133
|
-
return i(o, r.id).length < 1 || o.length === 0 ? !1 : a === void 0 ? !0 : e(a) ? await t(n, a) === !0 : !0;
|
|
134
|
-
};
|
|
135
|
-
//#endregion
|
|
136
|
-
export { y as n, _ as t };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require(`./rules-logic-DJhGFqhC.cjs`);require(`./logger-CJUj90QX.cjs`);const t=require(`./nodes-DBK4N9YY.cjs`);let n=require(`effector`),r=require(`@withease/factories`);var i=(0,n.createDomain)(`experience`),a=(0,r.createFactory)(({client:e,experience:r})=>{let a=i.store(r),o=(0,n.createApi)(a,{merge(e,t){return{...e,...t.experience}}}),s=a.map(e=>({name:e.name,decisionLogic:e.condition,targetSelectors:e.targets,initializeOpenLogic:e.initializeOpen})),c=(0,n.combine)(a,e.components.listStore,(e,t)=>(e.componentName?t.find(t=>t.name===e.componentName):void 0)||t.find(t=>t.name===`experience:${e.id}`)||t.find(e=>e.name===`experience`),{skipVoid:!1}),l=(0,n.combine)(a,e.steps.indexStore,e.conditions.indexStore,(e,n,r)=>{let i=e.nodes.filter(t.a).map(e=>n[e.stepId]).filter(e=>e!==void 0),a=e.nodes.filter(t.n).map(e=>r[e.conditionId]).filter(e=>e!==void 0);return{steps:i,nodes:e.nodes,edges:e.edges,conditions:a}}),u=r.actions??[];return{id:r.id,key:r.key,name:r.name,configStore:s,treeStore:l,componentStore:c,actions:u,merge:o.merge}});function o(e){return(0,r.invoke)(a,e)}var s=(0,r.createFactory)(({client:e})=>{let t=i.store({}),r=(0,n.createApi)(t,{register(e,t){return{...e,[t.id]:t}}});function a(n){let i=t.getState()[n.id];if(i){i.merge({experience:n,strategy:`override`});return}let a=o({client:e,experience:n});r.register(a)}let s=t.map(e=>Object.values(e));function c(e){return t.map(t=>t[e],{skipVoid:!1})}function u(e){return t.map(t=>Object.values(t).find(t=>t.key===e)??t[e],{skipVoid:!1})}let f=(0,n.attach)({source:t,effect:async(t,n)=>{let r=`key`in n?Object.values(t).find(e=>e.key===n.key):t[n.id];if(!r){`key`in n?`${n.key}`:`${n.id}`;return}let{options:i}=n;if(i?.bypassCondition){l(e,r,i);return}await d(e,r)&&l(e,r,i)}});return{register:a,get:c,getById:c,getByKey:u,launch:f,open:(0,n.attach)({source:{experiences:t,instances:e.experienceInstances.listStore},effect:({experiences:e,instances:t},n)=>{let r=`key`in n?Object.values(e).find(e=>e.key===n.key):e[n.id],i=t.filter(e=>r&&e.experienceId===r.id);if(i.length>0)for(let e of i)e.open();else f(`key`in n?{key:n.key,options:{...n.options,initialiseOpen:!0}}:{id:n.id,options:{...n.options,initialiseOpen:!0}})}}),listStore:s}});function c(e){return(0,r.invoke)(s,e)}var l=(e,n,r)=>{let{targetSelectors:i}=n.configStore.getState(),a=t.l(i,n.id);a.forEach(({elements:e})=>e.forEach(e=>t.f(e,n.id))),t.o(a,n.id,n.key).forEach(t=>{r?e.experienceInstances.spawn(n,t,r):e.experienceInstances.spawn(n,t)})},u=async e=>{await Promise.all(e.experiences.listStore.getState().map(async t=>{await d(e,t)&&l(e,t)}))},d=async(n,r)=>{if(!n.preconditionPassed||!n.session?.isUser)return!1;let{decisionLogic:i,targetSelectors:a}=r.configStore.getState();return t.l(a,r.id).length<1||a.length===0?!1:i===void 0?!0:e.n(i)?await e.t(n,i)===!0:!0};Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return c}});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require(`./rules-logic-DJhGFqhC.cjs`);require(`./logger-CJUj90QX.cjs`);const t=require(`./nodes-DBK4N9YY.cjs`);let n=require(`effector`),r=require(`@withease/factories`);var i=(e,n,r,a,o=new Set)=>o.has(r.id)?[]:(o.add(r.id),t.a(r)&&!a?[r]:n.filter(e=>e.sourceNodeId===r.id).flatMap(t=>{let r=e.find(e=>e.id===t.destinationNodeId);return r?i(e,n,r,!1,o):[]})),a=(e,t,n)=>i(e,t,n,!0,new Set),o=(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 s=1/0,c=-1/0;for(let n of a){let r=e.find(e=>e.id===n.destinationNodeId);if(!r)continue;let[a,l]=o(e,t,r,!1,new Set(i));a!==-1&&(s=Math.min(s,a+1),c=Math.max(c,l+1))}return s===1/0?[-1,-1]:[s,c]},s=(e,t,n)=>o(e,t,n,!0,new Set),c=(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,l]=c(e,t,i,new Set(r));s!==-1&&(a=Math.min(a,s+1),o=Math.max(o,l+1))}return a===1/0?[-1,-1]:[a,o]},l=(e,t,n)=>c(e,t,n,new Set),u=e=>e.find(e=>e.type===`origin`)||null,d=(e,t,n)=>{if(!e)return u(t);let r=n.find(t=>t.sourceNodeId===e.id);return r&&t.find(e=>e.id===r.destinationNodeId)||null};async function f(e,t,n,r){let i=e?`true`:`false`,a=r.find(e=>e.sourceHandle===i&&e.sourceNodeId===t);return n.find(e=>e.id===a?.destinationNodeId)}var p=(0,n.createDomain)(`experience-instance`),m=(0,r.createFactory)(({client:r,experience:i,target:o,options:c})=>{let m=(0,n.createEvent)(),h=(0,n.createEvent)(),g=(0,n.createEvent)(),_=(0,n.createEvent)(),v=(0,n.createEvent)(),y=(0,n.createEvent)(),b=i.componentStore,x=p.store(`transitioning`),S=r.history.entriesStore.map(e=>e.filter(e=>e.experienceId===i.id)),C=S.map(e=>e.filter(e=>t.a(e.node))),w=S.map(e=>e.at(-1)?.node||null),T=(0,n.combine)(r.steps.listStore,w,(e,n)=>e.find(e=>n&&t.a(n)&&e.id===n.stepId)||null),E=(0,n.combine)(r.steps.listStore,C,(e,n)=>{let r=n.at(-2);if(!r||!t.a(r.node))return null;let i=r.node;return e.find(e=>e.id===i.stepId)||null}),D=(0,n.combine)(i.treeStore,w,({nodes:e,edges:t},n)=>n?a(e,t,n):[]),O=(0,n.combine)(i.treeStore,w,({nodes:e,edges:t},n)=>n?l(e,t,n):[-1,-1]),k=(0,n.combine)(i.treeStore,w,({nodes:e,edges:t},n)=>n?s(e,t,n):[-1,-1]),A=p.store(!1),j=(0,n.createApi)(A,{open:()=>!0,close:()=>!1,toggle:e=>!e,set:(e,t)=>t}),M=(0,n.createEffect)(async()=>{r.history.back({experienceId:i.id})}),N=(0,n.attach)({source:i.treeStore,effect:async(e,n)=>{let a=e.nodes.find(e=>t.a(e)&&e.stepId===n);a&&r.history.push({experienceId:i.id,node:a})}}),P=(0,n.attach)({source:w,effect:e=>{}}),F=(0,n.attach)({source:i.treeStore,effect:async({nodes:e})=>u(e)}),I=(0,n.attach)({source:i.treeStore,effect:async({nodes:e,edges:n},r)=>{if(t.i(r))return d(r,e,n)}}),L=(0,n.attach)({source:i.treeStore,effect:async({nodes:n,edges:i,conditions:a},o)=>{if(!t.n(o))return;let s=a.find(e=>e.id===o.conditionId)?.logic;return s?f(!!await e.t(r,s),o.id,n,i):void 0}}),R=(0,n.attach)({source:i.treeStore,effect:async({nodes:e,edges:n},i)=>{if(!t.t(i))return;let a=i.actionKey;if(!a){`${i.id}`;return}let o=r.actions.getByKey(a).getState();if(!o){`${a}`;let t=n.find(e=>e.sourceNodeId===i.id&&e.sourceHandle===`false`);return t?e.find(e=>e.id===t.destinationNodeId):null}if(typeof o!=`function`){`${a}`;let t=n.find(e=>e.sourceNodeId===i.id&&e.sourceHandle===`false`);return t?e.find(e=>e.id===t.destinationNodeId):null}try{`${a}`,await o({...r.getStateSnapshot(),args:[]});let t=n.find(e=>e.sourceNodeId===i.id&&e.sourceHandle===`true`);if(!t)return`${i.id}`,null;let s=e.find(e=>e.id===t.destinationNodeId);return`${a}${s?.id}`,s||null}catch{`${a}`;let t=n.find(e=>e.sourceNodeId===i.id&&e.sourceHandle===`false`);if(!t)return`${i.id}`,null;let r=e.find(e=>e.id===t.destinationNodeId);return`${a}${r?.id}`,r||null}}}),z=(0,n.createEffect)(e=>{t.r(e)&&r.experiences.launch({key:e.experienceKey})}),B=(0,n.attach)({source:[w,i.treeStore],effect:async([e,{nodes:t,edges:n}])=>d(e,t,n)}),V=(0,n.attach)({source:[w,i.treeStore],effect:async([e,{nodes:t,edges:n}])=>d(e,t,n)}),H=(0,n.createEffect)(e=>{r.history.push({experienceId:i.id,node:e})}),U=(0,n.attach)({source:i.configStore,effect:async({initializeOpenLogic:t})=>c?.initialiseOpen===void 0?e.n(t)?!!await e.t(r,t):t??!1:c.initialiseOpen}),W=Object.freeze({id:Math.random().toString(36).substring(7),experienceKey:i.key,experienceId:i.id,configStore:i.configStore,target:o,componentStore:b,stateStore:x,isOpenStore:A,open:j.open,close:j.close,toggleOpen:j.toggle,setOpen:j.set,treeStore:i.treeStore,currentNodeStore:w,currentStepStore:T,previousStepStore:E,nextReachableStepNodesStore:D,stepsToOriginStore:O,stepsToLeafStore:k,goToNextStep:h,goToPreviousStep:g,goToStepById:_,stepsHistoryStore:C}),G=(0,n.createEvent)(),K=(0,n.createEvent)();return(0,n.sample)({clock:w,target:G}),(0,n.sample)({clock:G,filter:e=>e===null,target:F}),(0,n.sample)({clock:G,filter:e=>e!==null,target:K}),(0,n.split)({source:K,match:e=>t.n(e)?`condition`:t.a(e)?`step`:t.r(e)?`launchExperience`:t.i(e)?`origin`:t.t(e)?`action`:`other`,cases:{origin:I,condition:L,step:P,launchExperience:z,action:R,__:(0,n.createEvent)()}}),(0,n.sample)({clock:[L.doneData,I.doneData,F.doneData,V.doneData,B.doneData,R.doneData],filter:Boolean,target:H}),(0,n.sample)({clock:h,target:V}),(0,n.sample)({clock:h,source:T,filter:Boolean,target:r.eventBus.prepend(e=>({type:`step_submit`,step:e,experience:W}))}),(0,n.sample)({clock:V.done,source:T,filter:Boolean,target:r.eventBus.prepend(e=>({type:`step_submit_success`,step:e,experience:W}))}),(0,n.sample)({clock:V.fail,source:T,filter:Boolean,target:r.eventBus.prepend(e=>({type:`step_submit_error`,step:e,experience:W}))}),(0,n.sample)({clock:g,target:M}),(0,n.sample)({clock:_,target:N}),(0,n.sample)({source:(0,n.combine)([L.pending,I.pending,F.pending,V.pending]),fn:e=>e.some(Boolean)?`transitioning`:`ready`,target:x}),(0,n.sample)({clock:P.doneData,source:T,filter:Boolean,target:r.eventBus.prepend(e=>({type:`step_enter`,step:e,experience:W}))}),(0,n.sample)({clock:y,target:U}),(0,n.sample)({source:U.doneData,fn:Boolean,target:A}),(0,n.sample)({source:w,clock:m,filter:e=>e?t.i(e):!0,target:B}),(0,n.sample)({source:A,filter:Boolean,target:m}),(0,n.sample)({source:A,filter:Boolean,target:r.eventBus.prepend(()=>({type:`experience_open`,experience:W}))}),(0,n.sample)({source:A,filter:e=>!e,target:r.eventBus.prepend(()=>({type:`experience_close`,experience:W}))}),(0,n.sample)({clock:v,target:[y]}),v(),W});function h(e){return(0,r.invoke)(m,e)}var g=(0,r.createFactory)(({client:e})=>{let r=p.store({}),i=(0,n.createEvent)(),a=(0,n.createEvent)(),o=(0,n.createEvent)(),s=(0,n.createApi)(r,{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??[]}}}),c=(0,n.createEffect)(({experience:t,target:n,options:r})=>h({client:e,experience:t,target:n,options:r})),l=(0,n.createEffect)(e=>{s.register(e)}),u=(0,n.createEffect)(e=>{e.target&&t.d(e.target,()=>{o(e)})}),d=(0,n.createEffect)(e=>{s.unregister(e)}),f=(0,n.createEffect)(n=>{let r=n.componentStore.getState();if(!r)return;let i=r.frameworkStore.getState();if(!i){`${r.name}`;return}let a=n.target;if(!a){`${n.experienceId}`;return}let o=t.s(a);try{i.render(o,r.component,e,n)}catch{}});(0,n.sample)({clock:i,target:c}),(0,n.sample)({clock:o,target:d}),(0,n.sample)({clock:c.doneData,target:[l,u,a]}),(0,n.sample)({clock:c.doneData,target:e.eventBus.prepend(e=>({type:`experience_initialize`,experience:e}))}),(0,n.sample)({clock:a,target:f});function m(e,t,n){i({experience:e,target:t,options:n})}let g=r.map(e=>Object.values(e).flat());function _(e){return g.map(t=>t.filter(t=>t.experienceKey===e),{skipVoid:!1})}function v(e){return r.map(t=>t[e]||[],{skipVoid:!1})}return{spawn:m,getByExperienceKey:_,getByExperienceId:v,listStore:g}});function _(e){return(0,r.invoke)(g,e)}Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return h}});
|