@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.
Files changed (79) hide show
  1. package/dist/{api-CIC-Uysx.cjs → api-CPZcLXHT.cjs} +1 -1
  2. package/dist/{api-6oxKA__k.js → api-DstdB1oU.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/experience-browser-storage/index.js +1 -1
  8. package/dist/cjs/plugins/history-browser-storage/index.js +1 -1
  9. package/dist/cjs/plugins/responses-browser-storage/index.js +1 -1
  10. package/dist/cjs/plugins/responses-indexeddb/index.js +1 -1
  11. package/dist/cjs/plugins/single-page-app/index.js +1 -1
  12. package/dist/cjs/plugins/web-components/index.js +1 -1
  13. package/dist/cjs/plugins/window-object/index.js +1 -1
  14. package/dist/cjs/server/index.js +1 -1
  15. package/dist/docs/{actions.md → actions.mdx} +7 -0
  16. package/dist/docs/{api-keys.md → api-keys.mdx} +7 -0
  17. package/dist/docs/{conditions.md → conditions.mdx} +7 -0
  18. package/dist/docs/{experiences.md → experiences.mdx} +7 -0
  19. package/dist/docs/{features.md → features.mdx} +7 -0
  20. package/dist/docs/{fields.md → fields.mdx} +7 -0
  21. package/dist/docs/flow-builder/{overview.md → overview.mdx} +7 -0
  22. package/dist/docs/pickedql/data-sources.md +49 -2
  23. package/dist/docs/pickedql/dimensions.md +20 -0
  24. package/dist/docs/pickedql/examples.md +1 -1
  25. package/dist/docs/pickedql/filtering.md +22 -0
  26. package/dist/docs/pickedql/index.md +2 -1
  27. package/dist/docs/pickedql/schema.md +34 -1
  28. package/dist/docs/pickedql/virtual-functions.md +4 -4
  29. package/dist/docs/{projects.md → projects.mdx} +7 -0
  30. package/dist/docs/{reports.md → reports.mdx} +7 -0
  31. package/dist/docs/{steps.md → steps.mdx} +7 -0
  32. package/dist/docs/{workspaces.md → workspaces.mdx} +8 -0
  33. package/dist/esm/form/index.js +11 -5
  34. package/dist/esm/index.js +292 -166
  35. package/dist/esm/plugins/create-experience/index.js +1 -1
  36. package/dist/esm/plugins/dynamic-experiences/index.js +2 -2
  37. package/dist/esm/plugins/experience-browser-storage/index.js +21 -19
  38. package/dist/esm/plugins/history-browser-storage/index.js +17 -15
  39. package/dist/esm/plugins/responses-browser-storage/index.js +21 -19
  40. package/dist/esm/plugins/responses-indexeddb/index.js +37 -35
  41. package/dist/esm/plugins/single-page-app/index.js +14 -28
  42. package/dist/esm/plugins/web-components/index.js +1 -1
  43. package/dist/esm/plugins/window-object/index.js +1 -1
  44. package/dist/esm/server/index.js +1 -1
  45. package/dist/experience-instance-DC2gKwA6.cjs +1 -0
  46. package/dist/experience-instance-DJaNc5Ob.js +486 -0
  47. package/dist/object-C82v79xc.js +25 -0
  48. package/dist/object-CUJOjanb.cjs +1 -0
  49. package/dist/rules-logic-BTIxfrJJ.js +240 -0
  50. package/dist/rules-logic-DNLOv90w.cjs +1 -0
  51. package/dist/types/entities/action/action.d.ts +30 -4
  52. package/dist/types/entities/action/action.d.ts.map +1 -1
  53. package/dist/types/entities/experience-instance/experience-instance.d.ts +4 -2
  54. package/dist/types/entities/experience-instance/experience-instance.d.ts.map +1 -1
  55. package/dist/types/entities/response/response-validation.d.ts.map +1 -1
  56. package/dist/types/form/create-field-evaluator.d.ts.map +1 -1
  57. package/dist/types/picked.d.ts +3 -1
  58. package/dist/types/picked.d.ts.map +1 -1
  59. package/dist/types/plugins/experience-browser-storage/plugin.d.ts.map +1 -1
  60. package/dist/types/plugins/history-browser-storage/plugin.d.ts.map +1 -1
  61. package/dist/types/plugins/responses-browser-storage/plugin.d.ts.map +1 -1
  62. package/dist/types/plugins/responses-indexeddb/plugin.d.ts.map +1 -1
  63. package/dist/types/plugins/single-page-app/plugin.d.ts +4 -15
  64. package/dist/types/plugins/single-page-app/plugin.d.ts.map +1 -1
  65. package/package.json +1 -1
  66. package/dist/experience-CNIhapU2.js +0 -136
  67. package/dist/experience-CTEBY-it.cjs +0 -1
  68. package/dist/experience-instance-Cu8oGGr9.cjs +0 -1
  69. package/dist/experience-instance-DIpWYaA6.js +0 -387
  70. package/dist/nodes-2fst8XKi.js +0 -101
  71. package/dist/nodes-DBK4N9YY.cjs +0 -1
  72. package/dist/rules-logic-D7dL30U1.js +0 -263
  73. package/dist/rules-logic-DJhGFqhC.cjs +0 -1
  74. /package/dist/{id-Cg7fVl1O.cjs → id-Bv44ilEo.cjs} +0 -0
  75. /package/dist/{id-n2yrHvNo.js → id-CRqy981z.js} +0 -0
  76. /package/dist/{logger-C44jSdYl.js → logger-6z_gb4rA.js} +0 -0
  77. /package/dist/{logger-CJUj90QX.cjs → logger-fbvQC40v.cjs} +0 -0
  78. /package/dist/{supports-B_trw6lj.js → supports-0XIfd4-R.js} +0 -0
  79. /package/dist/{supports-CKSVYpQx.cjs → supports-Dsjg-82e.cjs} +0 -0
@@ -1,263 +0,0 @@
1
- //#region src/logic-engine.ts
2
- function e(e) {
3
- return typeof e == "number" && !isNaN(e);
4
- }
5
- function t(e) {
6
- return typeof e == "string";
7
- }
8
- function n(e) {
9
- return Array.isArray(e);
10
- }
11
- function r(e) {
12
- return e instanceof Promise;
13
- }
14
- function i(e) {
15
- return typeof e == "object" && !!e && !Array.isArray(e) && Object.keys(e).length === 1;
16
- }
17
- function a(t) {
18
- if (e(t)) return t;
19
- let n = parseFloat(`${t}`);
20
- return isNaN(n) ? 0 : n;
21
- }
22
- function o(e) {
23
- return `${e}`;
24
- }
25
- var s = {
26
- "==": (e, t) => e == t,
27
- "===": (e, t) => e === t,
28
- "!=": (e, t) => e != t,
29
- "!==": (e, t) => e !== t,
30
- ">": (e, t) => a(e) > a(t),
31
- ">=": (e, t) => a(e) >= a(t),
32
- "<": (e, t, n) => {
33
- let r = a(e), i = a(t);
34
- if (n === void 0) return r < i;
35
- let o = a(n);
36
- return r < i && i < o;
37
- },
38
- "<=": (e, t, n) => {
39
- let r = a(e), i = a(t);
40
- if (n === void 0) return r <= i;
41
- let o = a(n);
42
- return r <= i && i <= o;
43
- },
44
- "!!": async (e) => await l(e),
45
- "!": async (e) => !await l(e),
46
- "%": (e, t) => a(e) % a(t),
47
- log: (e) => (console.log(e), e),
48
- in: (e, r) => r ? t(r) ? r.indexOf(o(e)) !== -1 : n(r) ? r.includes(e) : !1 : !1,
49
- cat: (...e) => e.map(o).join(""),
50
- substr: (e, t, n) => {
51
- let r = o(e), i = a(t);
52
- if (n === void 0) return r.substr(i);
53
- let s = a(n);
54
- if (s < 0) {
55
- let e = r.substr(i);
56
- return e.substr(0, e.length + s);
57
- }
58
- return r.substr(i, s);
59
- },
60
- "+": (...e) => e.reduce((e, t) => a(e) + a(t), 0),
61
- "*": (...e) => e.reduce((e, t) => a(e) * a(t), 1),
62
- "-": (e, t) => {
63
- let n = a(e);
64
- return t === void 0 ? -n : n - a(t);
65
- },
66
- "/": (e, t) => a(e) / a(t),
67
- min: (...e) => Math.min(...e.map(a)),
68
- max: (...e) => Math.max(...e.map(a)),
69
- merge: (...e) => e.reduce((e, t) => n(t) ? e.concat(t) : e.concat([t]), []),
70
- var(e, t) {
71
- let n = arguments.length > 1 ? t : null;
72
- if (e === "" || e === "." || e == null) return this;
73
- if (typeof e == "number" && Array.isArray(this)) return e >= 0 && e < this.length ? this[e] : n;
74
- let r = o(e);
75
- if (r === "" || r === ".") return this;
76
- let i = r.split("."), a = this;
77
- for (let e of i) {
78
- if (a == null) return n;
79
- if (Array.isArray(a)) {
80
- let t = parseInt(e, 10);
81
- a = isNaN(t) ? a[e] : a[t];
82
- } else a = a[e];
83
- }
84
- return a === void 0 ? n : a;
85
- },
86
- async missing(...e) {
87
- let t = n(e[0]) ? e[0] : e, r = [];
88
- for (let e of t) {
89
- let t = await c({ var: e }, this);
90
- (t === null || t === "") && r.push(`${e}`);
91
- }
92
- return r;
93
- },
94
- async missing_some(e, r) {
95
- let i = await c({ missing: r }, this);
96
- if (!n(i) || !n(r)) return [];
97
- let o = i.filter(t);
98
- return r.filter(t).length - o.length >= a(e) ? [] : o;
99
- },
100
- invoke(...e) {
101
- let [t, ...n] = e;
102
- return typeof t == "function" ? Reflect.apply(t, null, n) : null;
103
- },
104
- startsWith: (e, n) => t(e) && t(n) && e.startsWith(n),
105
- endsWith: (e, n) => t(e) && t(n) && e.endsWith(n),
106
- regexp_matches(e, r) {
107
- let i = e, a = "";
108
- if (n(e)) {
109
- let [t, n] = e;
110
- i = t, a = n;
111
- }
112
- return !t(i) || !t(a) ? !1 : new RegExp(i, a).test(o(r));
113
- },
114
- throw(e) {
115
- throw Error(o(e));
116
- }
117
- };
118
- async function c(e, t) {
119
- if (!e) return e;
120
- if (r(e)) return c(await e, t);
121
- if (n(e)) return Promise.all(e.map((e) => c(e, t)));
122
- if (!i(e)) return e;
123
- let a = u(e), o = a ? e[a] ?? [] : [];
124
- switch (n(o) || (o = [o]), a) {
125
- case "if":
126
- case "?:":
127
- for (let e = 0; e < o.length - 1; e += 2) if (await l(await c(o[e], t))) return c(o[e + 1], t);
128
- return o.length % 2 == 1 ? c(o[o.length - 1], t) : null;
129
- case "and": {
130
- let e = null;
131
- for (let n of o) if (e = await c(n, t), !await l(e)) return e;
132
- return e;
133
- }
134
- case "or": {
135
- let e = null;
136
- for (let n of o) if (e = await c(n, t), await l(e)) return e;
137
- return e;
138
- }
139
- case "map": {
140
- let e = await c(o[0], t);
141
- return n(e) ? await Promise.all(e.map((e) => c(o[1], e))) : [];
142
- }
143
- case "filter": {
144
- let e = await c(o[0], t);
145
- return n(e) ? (await Promise.all(e.map(async (e) => ({
146
- item: e,
147
- shouldInclude: await l(await c(o[1], e))
148
- })))).filter(({ shouldInclude: e }) => e).map(({ item: e }) => e) : [];
149
- }
150
- case "reduce": {
151
- let e = await c(o[0], t);
152
- if (!n(e)) return o.length > 2 ? await c(o[2], t) : null;
153
- let r = o[1], i = o.length > 2 ? await c(o[2], t) : null;
154
- for (let t of e) i = await c(r, {
155
- current: t,
156
- accumulator: i
157
- });
158
- return i;
159
- }
160
- case "all": {
161
- let e = await c(o[0], t);
162
- if (!n(e) || e.length === 0) return !1;
163
- for (let t of e) if (!await l(await c(o[1], t))) return !1;
164
- return !0;
165
- }
166
- case "some": {
167
- let e = await c(o[0], t);
168
- if (!n(e)) return !1;
169
- for (let t of e) if (await l(await c(o[1], t))) return !0;
170
- return !1;
171
- }
172
- case "none": {
173
- let e = await c(o[0], t);
174
- if (!n(e)) return !0;
175
- for (let t of e) if (await l(await c(o[1], t))) return !1;
176
- return !0;
177
- }
178
- case "catch": try {
179
- return await c(o[0], t);
180
- } catch (e) {
181
- return i(e) ? await c(e, t) : o[1] ? await c(o[1], e) : e instanceof Error ? e.message : e;
182
- }
183
- }
184
- let d = await Promise.all(o.map((e) => c(e, t))), f = a ? s[a] : void 0;
185
- if (!f) throw Error(`Unrecognized operation ${a}`);
186
- return f.apply(t, d);
187
- }
188
- async function l(e) {
189
- return r(e) ? l(await e) : !(Array.isArray(e) && e.length === 0) && !!e;
190
- }
191
- function u(e) {
192
- return Object.keys(e)[0];
193
- }
194
- //#endregion
195
- //#region src/utils/object.ts
196
- function d(e, t, n) {
197
- if (!(t in e)) return;
198
- let r = e[t];
199
- if (typeof r != "function") throw Error(`Expected '${String(t)}' to be a function`);
200
- let i = n(r);
201
- p(i, r), e[t] = i;
202
- }
203
- function f(e, t, n) {
204
- Object.defineProperty(e, t, {
205
- enumerable: !1,
206
- value: n,
207
- writable: !0,
208
- configurable: !0
209
- });
210
- }
211
- function p(e, t) {
212
- let n = t.prototype || {};
213
- t.prototype = n, e.prototype = n, f(e, "__picked_original", t);
214
- }
215
- function m(e) {
216
- return e === void 0 || typeof e == "object" && !!e && e.constructor === Object && Object.keys(e).length === 0;
217
- }
218
- //#endregion
219
- //#region src/utils/rules-logic.ts
220
- function h(e) {
221
- return !m(e);
222
- }
223
- async function g(e, t, n) {
224
- let r = e.getStateSnapshot(), i = e.predicates.listStore.getState().reduce((e, t) => ({
225
- ...e,
226
- [t.name]: (...e) => t.predicate({
227
- ...r,
228
- args: e
229
- })
230
- }), {}), a = e.actions.listStore.getState().reduce((e, t) => ({
231
- ...e,
232
- [t.key]: (...e) => t.action({
233
- ...r,
234
- args: e
235
- })
236
- }), {}), o = e.features.listStore.getState().reduce((e, t) => ({
237
- ...e,
238
- [t.id]: async () => {
239
- let { bucket: e } = await t.getBucket();
240
- return e;
241
- }
242
- }), {});
243
- return await c(t, {
244
- responses: e.responses.getAllStore.getState(),
245
- location: typeof r.location == "object" ? {
246
- hash: r.location.hash,
247
- host: r.location.host,
248
- hostname: r.location.hostname,
249
- href: r.location.href,
250
- origin: r.location.origin,
251
- pathname: r.location.pathname,
252
- port: r.location.port,
253
- protocol: r.location.protocol,
254
- search: r.location.search
255
- } : void 0,
256
- predicates: i,
257
- actions: a,
258
- features: o,
259
- ...n
260
- });
261
- }
262
- //#endregion
263
- export { d as i, h as n, m as r, g as t };
@@ -1 +0,0 @@
1
- function e(e){return typeof e==`number`&&!isNaN(e)}function t(e){return typeof e==`string`}function n(e){return Array.isArray(e)}function r(e){return e instanceof Promise}function i(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&Object.keys(e).length===1}function a(t){if(e(t))return t;let n=parseFloat(`${t}`);return isNaN(n)?0:n}function o(e){return`${e}`}var s={"==":(e,t)=>e==t,"===":(e,t)=>e===t,"!=":(e,t)=>e!=t,"!==":(e,t)=>e!==t,">":(e,t)=>a(e)>a(t),">=":(e,t)=>a(e)>=a(t),"<":(e,t,n)=>{let r=a(e),i=a(t);if(n===void 0)return r<i;let o=a(n);return r<i&&i<o},"<=":(e,t,n)=>{let r=a(e),i=a(t);if(n===void 0)return r<=i;let o=a(n);return r<=i&&i<=o},"!!":async e=>await l(e),"!":async e=>!await l(e),"%":(e,t)=>a(e)%a(t),log:e=>(console.log(e),e),in:(e,r)=>r?t(r)?r.indexOf(o(e))!==-1:n(r)?r.includes(e):!1:!1,cat:(...e)=>e.map(o).join(``),substr:(e,t,n)=>{let r=o(e),i=a(t);if(n===void 0)return r.substr(i);let s=a(n);if(s<0){let e=r.substr(i);return e.substr(0,e.length+s)}return r.substr(i,s)},"+":(...e)=>e.reduce((e,t)=>a(e)+a(t),0),"*":(...e)=>e.reduce((e,t)=>a(e)*a(t),1),"-":(e,t)=>{let n=a(e);return t===void 0?-n:n-a(t)},"/":(e,t)=>a(e)/a(t),min:(...e)=>Math.min(...e.map(a)),max:(...e)=>Math.max(...e.map(a)),merge:(...e)=>e.reduce((e,t)=>n(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=o(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=n(e[0])?e[0]:e,r=[];for(let e of t){let t=await c({var:e},this);(t===null||t===``)&&r.push(`${e}`)}return r},async missing_some(e,r){let i=await c({missing:r},this);if(!n(i)||!n(r))return[];let o=i.filter(t);return r.filter(t).length-o.length>=a(e)?[]:o},invoke(...e){let[t,...n]=e;return typeof t==`function`?Reflect.apply(t,null,n):null},startsWith:(e,n)=>t(e)&&t(n)&&e.startsWith(n),endsWith:(e,n)=>t(e)&&t(n)&&e.endsWith(n),regexp_matches(e,r){let i=e,a=``;if(n(e)){let[t,n]=e;i=t,a=n}return!t(i)||!t(a)?!1:new RegExp(i,a).test(o(r))},throw(e){throw Error(o(e))}};async function c(e,t){if(!e)return e;if(r(e))return c(await e,t);if(n(e))return Promise.all(e.map(e=>c(e,t)));if(!i(e))return e;let a=u(e),o=a?e[a]??[]:[];switch(n(o)||(o=[o]),a){case`if`:case`?:`:for(let e=0;e<o.length-1;e+=2)if(await l(await c(o[e],t)))return c(o[e+1],t);return o.length%2==1?c(o[o.length-1],t):null;case`and`:{let e=null;for(let n of o)if(e=await c(n,t),!await l(e))return e;return e}case`or`:{let e=null;for(let n of o)if(e=await c(n,t),await l(e))return e;return e}case`map`:{let e=await c(o[0],t);return n(e)?await Promise.all(e.map(e=>c(o[1],e))):[]}case`filter`:{let e=await c(o[0],t);return n(e)?(await Promise.all(e.map(async e=>({item:e,shouldInclude:await l(await c(o[1],e))})))).filter(({shouldInclude:e})=>e).map(({item:e})=>e):[]}case`reduce`:{let e=await c(o[0],t);if(!n(e))return o.length>2?await c(o[2],t):null;let r=o[1],i=o.length>2?await c(o[2],t):null;for(let t of e)i=await c(r,{current:t,accumulator:i});return i}case`all`:{let e=await c(o[0],t);if(!n(e)||e.length===0)return!1;for(let t of e)if(!await l(await c(o[1],t)))return!1;return!0}case`some`:{let e=await c(o[0],t);if(!n(e))return!1;for(let t of e)if(await l(await c(o[1],t)))return!0;return!1}case`none`:{let e=await c(o[0],t);if(!n(e))return!0;for(let t of e)if(await l(await c(o[1],t)))return!1;return!0}case`catch`:try{return await c(o[0],t)}catch(e){return i(e)?await c(e,t):o[1]?await c(o[1],e):e instanceof Error?e.message:e}}let d=await Promise.all(o.map(e=>c(e,t))),f=a?s[a]:void 0;if(!f)throw Error(`Unrecognized operation ${a}`);return f.apply(t,d)}async function l(e){return r(e)?l(await e):!(Array.isArray(e)&&e.length===0)&&!!e}function u(e){return Object.keys(e)[0]}function d(e,t,n){if(!(t in e))return;let r=e[t];if(typeof r!=`function`)throw Error(`Expected '${String(t)}' to be a function`);let i=n(r);p(i,r),e[t]=i}function f(e,t,n){Object.defineProperty(e,t,{enumerable:!1,value:n,writable:!0,configurable:!0})}function p(e,t){let n=t.prototype||{};t.prototype=n,e.prototype=n,f(e,`__picked_original`,t)}function m(e){return e===void 0||typeof e==`object`&&!!e&&e.constructor===Object&&Object.keys(e).length===0}function h(e){return!m(e)}async function g(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})}),{}),o=e.features.listStore.getState().reduce((e,t)=>({...e,[t.id]:async()=>{let{bucket:e}=await t.getBucket();return e}}),{});return await c(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,`i`,{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return g}});
File without changes
File without changes
File without changes