@picked/client 0.0.1-dev.1774231221701 → 0.0.1-dev.1774244905386
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-oudcFuUX.js → api-ENA5t36y.js} +1 -1
- package/dist/{api-BEXzPJHZ.cjs → api-dkMxUUe0.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/plugins/web-components/index.js +1 -1
- package/dist/cjs/server/index.js +1 -1
- package/dist/esm/index.js +503 -426
- package/dist/esm/plugins/create-experience/index.js +329 -294
- package/dist/esm/plugins/dynamic-experiences/index.js +53 -30
- 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 +9 -5
- package/dist/esm/plugins/single-page-app/index.js +4 -4
- package/dist/esm/plugins/web-components/index.js +1 -1
- package/dist/esm/server/index.js +1 -1
- package/dist/experience-instance-BODAwa-_.js +713 -0
- package/dist/experience-instance-DImQh64e.cjs +1 -0
- package/dist/object-BReQiaSS.cjs +1 -0
- package/dist/{object-C82v79xc.js → object-Clj5zVr1.js} +1 -2
- package/dist/storage-BFjb8azI.cjs +1 -0
- package/dist/{storage-6Xk0uAxB.js → storage-DyxpJ0pg.js} +1 -3
- 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 +36 -59
- 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 +17 -12
- 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 +9 -0
- package/dist/types/entities/project/project.d.ts.map +1 -0
- package/dist/types/entities/response/response.d.ts +10 -7
- package/dist/types/entities/response/response.d.ts.map +1 -1
- package/dist/types/entities/step/step.d.ts +38 -0
- package/dist/types/entities/step/step.d.ts.map +1 -0
- package/dist/types/index.d.ts +3 -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 +61 -52
- package/dist/types/picked.d.ts.map +1 -1
- package/dist/types/plugins/create-experience/create-experience.d.ts +61 -29
- package/dist/types/plugins/create-experience/create-experience.d.ts.map +1 -1
- package/dist/types/plugins/create-experience/index.d.ts +2 -2
- package/dist/types/plugins/create-experience/index.d.ts.map +1 -1
- package/dist/types/plugins/create-experience/plugin.d.ts.map +1 -1
- package/dist/types/plugins/dynamic-experiences/plugin.d.ts +21 -4
- package/dist/types/plugins/dynamic-experiences/plugin.d.ts.map +1 -1
- package/dist/types/plugins/dynamic-experiences/types.d.ts +47 -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 +0 -1
- 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 +25 -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/search-params.d.ts.map +1 -1
- package/dist/types/utils/storage.d.ts.map +1 -1
- package/package.json +1 -11
- package/dist/cjs/form/index.js +0 -1
- package/dist/esm/form/index.js +0 -428
- package/dist/experience-instance-DZiAwXph.js +0 -481
- package/dist/experience-instance-Ddk4Jktn.cjs +0 -1
- package/dist/object-CUJOjanb.cjs +0 -1
- package/dist/rules-logic-B7vJrWyO.js +0 -231
- package/dist/rules-logic-CXr4wXcG.cjs +0 -1
- package/dist/storage-B6lQtc4-.cjs +0 -1
- package/dist/types/form/build-responses.d.ts +0 -14
- package/dist/types/form/build-responses.d.ts.map +0 -1
- package/dist/types/form/create-field-evaluator.d.ts +0 -19
- package/dist/types/form/create-field-evaluator.d.ts.map +0 -1
- package/dist/types/form/create-field-validation.d.ts +0 -44
- package/dist/types/form/create-field-validation.d.ts.map +0 -1
- package/dist/types/form/create-form.d.ts +0 -66
- package/dist/types/form/create-form.d.ts.map +0 -1
- package/dist/types/form/create-submit-pipeline.d.ts +0 -58
- package/dist/types/form/create-submit-pipeline.d.ts.map +0 -1
- package/dist/types/form/get-step-fields.d.ts +0 -5
- package/dist/types/form/get-step-fields.d.ts.map +0 -1
- package/dist/types/form/index.d.ts +0 -10
- package/dist/types/form/index.d.ts.map +0 -1
- package/dist/types/plugins/create-experience/serialization.d.ts +0 -6
- package/dist/types/plugins/create-experience/serialization.d.ts.map +0 -1
- /package/dist/{id-CRqy981z.js → id-BniPxOdF.js} +0 -0
- /package/dist/{id-Bv44ilEo.cjs → id-CIbS4P60.cjs} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "../../../logger-6z_gb4rA.js";
|
|
2
|
-
import { i as e, t } from "../../../api-
|
|
2
|
+
import { i as e, t } from "../../../api-ENA5t36y.js";
|
|
3
3
|
//#region src/plugins/dynamic-experiences/hash.ts
|
|
4
4
|
function n(e) {
|
|
5
5
|
let t = 2166136261;
|
|
@@ -15,16 +15,39 @@ function i(e, t) {
|
|
|
15
15
|
//#endregion
|
|
16
16
|
//#region src/plugins/dynamic-experiences/plugin.ts
|
|
17
17
|
function a(e) {
|
|
18
|
-
return typeof e
|
|
18
|
+
return typeof e == "object" && !!e && "features" in e && Array.isArray(e.features);
|
|
19
19
|
}
|
|
20
|
-
function o(e) {
|
|
21
|
-
|
|
20
|
+
function o(e, t) {
|
|
21
|
+
if (t.conditions) for (let n of t.conditions) e.registerCondition(n);
|
|
22
22
|
}
|
|
23
|
-
function s(e) {
|
|
23
|
+
function s(e, t) {
|
|
24
|
+
e.registerExperience({
|
|
25
|
+
id: t.id,
|
|
26
|
+
key: t.key,
|
|
27
|
+
name: t.name,
|
|
28
|
+
targets: t.targets ?? [],
|
|
29
|
+
nodes: t.nodes,
|
|
30
|
+
edges: t.edges,
|
|
31
|
+
actions: t.actions,
|
|
32
|
+
condition: t.condition,
|
|
33
|
+
initializeOpen: t.initializeOpen,
|
|
34
|
+
componentName: t.componentName
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
function c(e, t) {
|
|
38
|
+
if (t.fields) for (let n of t.fields) e.registerField(n);
|
|
39
|
+
}
|
|
40
|
+
function l(e, t) {
|
|
41
|
+
if (t.steps) for (let n of t.steps) e.registerStep(n);
|
|
42
|
+
}
|
|
43
|
+
function u(e, t) {
|
|
44
|
+
if (t.experiences) for (let n of t.experiences) s(e, n);
|
|
45
|
+
}
|
|
46
|
+
function d(e) {
|
|
24
47
|
let t = e.searchParams["preview-token"];
|
|
25
48
|
if (t && t.length > 0) return t[0];
|
|
26
49
|
}
|
|
27
|
-
function
|
|
50
|
+
function f(e) {
|
|
28
51
|
let t = /* @__PURE__ */ new Set(), n = e.searchParams.feature;
|
|
29
52
|
if (!n) return t;
|
|
30
53
|
for (let e of n) {
|
|
@@ -33,13 +56,13 @@ function c(e) {
|
|
|
33
56
|
}
|
|
34
57
|
return t;
|
|
35
58
|
}
|
|
36
|
-
function
|
|
37
|
-
let i =
|
|
59
|
+
function p(e, t, n) {
|
|
60
|
+
let i = f(e), a = e.session?.id;
|
|
38
61
|
if (!a) throw Error("Session ID is required for feature registration");
|
|
39
62
|
let o = r(a);
|
|
40
|
-
for (let r of t.features) i.has(r.id) ||
|
|
63
|
+
for (let r of t.features) i.has(r.id) || m(e, r, n, o);
|
|
41
64
|
}
|
|
42
|
-
function
|
|
65
|
+
function m(e, t, n, r) {
|
|
43
66
|
e.registerFeature(t.id, {
|
|
44
67
|
key: `v${t.version}`,
|
|
45
68
|
name: t.name,
|
|
@@ -47,7 +70,7 @@ function u(e, t, n, r) {
|
|
|
47
70
|
decide: () => t.enabled ? i(r, t.weight) : !1
|
|
48
71
|
});
|
|
49
72
|
}
|
|
50
|
-
function
|
|
73
|
+
function h() {
|
|
51
74
|
let e;
|
|
52
75
|
try {
|
|
53
76
|
e = __PICKED_PROJECT_CONFIG__;
|
|
@@ -62,9 +85,9 @@ function d() {
|
|
|
62
85
|
return;
|
|
63
86
|
}
|
|
64
87
|
else t = e;
|
|
65
|
-
if (
|
|
88
|
+
if (a(t)) return t;
|
|
66
89
|
}
|
|
67
|
-
function
|
|
90
|
+
function g(e) {
|
|
68
91
|
try {
|
|
69
92
|
let t = new URL(e).hostname;
|
|
70
93
|
return t === "localhost" || t === "127.0.0.1" || t === "::1";
|
|
@@ -72,49 +95,49 @@ function f(e) {
|
|
|
72
95
|
return !1;
|
|
73
96
|
}
|
|
74
97
|
}
|
|
75
|
-
function
|
|
98
|
+
function _(e) {
|
|
76
99
|
if (typeof e != "object" || !e || !("cause" in e)) return !1;
|
|
77
100
|
let { cause: t } = e;
|
|
78
101
|
return typeof t != "object" || !t || !("code" in t) ? !1 : t.code === "ECONNREFUSED";
|
|
79
102
|
}
|
|
80
|
-
async function
|
|
81
|
-
let i = r?.previewToken ? `projects/${n}?preview_token=${encodeURIComponent(r.previewToken)}` : `projects/${n}`,
|
|
103
|
+
async function v(e, n, r) {
|
|
104
|
+
let i = r?.previewToken ? `projects/${n}?preview_token=${encodeURIComponent(r.previewToken)}` : `projects/${n}`, o;
|
|
82
105
|
try {
|
|
83
|
-
|
|
106
|
+
o = await t(e, i, r?.headers);
|
|
84
107
|
} catch (t) {
|
|
85
|
-
return
|
|
108
|
+
return g(e) && _(t), null;
|
|
86
109
|
}
|
|
87
|
-
if (!
|
|
110
|
+
if (!o.ok) return `${o.status.toString()}`, null;
|
|
88
111
|
let s;
|
|
89
112
|
try {
|
|
90
|
-
s = await
|
|
113
|
+
s = await o.json();
|
|
91
114
|
} catch {
|
|
92
115
|
return null;
|
|
93
116
|
}
|
|
94
|
-
return
|
|
117
|
+
return a(s) ? s : null;
|
|
95
118
|
}
|
|
96
|
-
function
|
|
119
|
+
function y(e) {
|
|
97
120
|
return {
|
|
98
121
|
name: "dynamic-experiences",
|
|
99
122
|
setup: (t) => {
|
|
100
123
|
let n = e?.apiUrl ?? t.apiUrl;
|
|
101
124
|
return { onStart: async () => {
|
|
102
|
-
let r =
|
|
125
|
+
let r = d(t);
|
|
103
126
|
if (r) {
|
|
104
|
-
let e = await
|
|
105
|
-
e &&
|
|
127
|
+
let e = await v(n, t.projectId, { previewToken: r });
|
|
128
|
+
e && (p(t, e, !0), o(t, e), c(t, e), l(t, e), u(t, e));
|
|
106
129
|
return;
|
|
107
130
|
}
|
|
108
|
-
let i = e?.projectConfig ??
|
|
131
|
+
let i = e?.projectConfig ?? h();
|
|
109
132
|
if (i) {
|
|
110
|
-
|
|
133
|
+
p(t, i, !1), o(t, i), c(t, i), l(t, i), u(t, i);
|
|
111
134
|
return;
|
|
112
135
|
}
|
|
113
|
-
let a = await
|
|
114
|
-
a &&
|
|
136
|
+
let a = await v(n, t.projectId);
|
|
137
|
+
a && (p(t, a, !1), o(t, a), c(t, a), l(t, a), u(t, a));
|
|
115
138
|
} };
|
|
116
139
|
}
|
|
117
140
|
};
|
|
118
141
|
}
|
|
119
142
|
//#endregion
|
|
120
|
-
export { e as createClientHeaders,
|
|
143
|
+
export { e as createClientHeaders, y as dynamicExperiencesPlugin, v as fetchProject };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "../../../logger-6z_gb4rA.js";
|
|
2
|
-
import { n as e, r as t, t as n } from "../../../storage-
|
|
2
|
+
import { n as e, r as t, t as n } from "../../../storage-DyxpJ0pg.js";
|
|
3
3
|
import { createEffect as r, sample as i } from "effector";
|
|
4
4
|
//#region src/plugins/experience-browser-storage/plugin.ts
|
|
5
5
|
var a = ({ storage: a = "local" } = {}) => ({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as e, r as t, t as n } from "../../../storage-
|
|
1
|
+
import { n as e, r as t, t as n } from "../../../storage-DyxpJ0pg.js";
|
|
2
2
|
import { createEffect as r, sample as i } from "effector";
|
|
3
3
|
//#region src/plugins/history-browser-storage/plugin.ts
|
|
4
4
|
var a = n("history", "global"), o = ({ storage: n = "local" } = {}) => ({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as e, r as t, t as n } from "../../../storage-
|
|
1
|
+
import { n as e, r as t, t as n } from "../../../storage-DyxpJ0pg.js";
|
|
2
2
|
import { attach as r, createEffect as i, sample as a } from "effector";
|
|
3
3
|
//#region src/plugins/responses-browser-storage/plugin.ts
|
|
4
4
|
var o = n("responses", "global"), s = (e, t) => {
|
|
@@ -47,9 +47,13 @@ var c = "responses", l = {
|
|
|
47
47
|
let e = (await i(await r(l), c)).reduce((e, { fieldId: t, value: n }) => (e[t] = n, e), {});
|
|
48
48
|
await n.responses.commit(e);
|
|
49
49
|
}), d = e(async (e) => {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
e.forEach((e) => {
|
|
51
|
+
r(l).then((t) => {
|
|
52
|
+
a(t, c, e);
|
|
53
|
+
}).catch((e) => {
|
|
54
|
+
console.error("Failed to store response in IndexedDB:", e);
|
|
55
|
+
});
|
|
56
|
+
});
|
|
53
57
|
}), f = e(async () => {
|
|
54
58
|
await s(await r(l), c);
|
|
55
59
|
}), p = e(async (e) => {
|
|
@@ -66,8 +70,8 @@ var c = "responses", l = {
|
|
|
66
70
|
fields: n.fields.listStore
|
|
67
71
|
},
|
|
68
72
|
fn: ({ responses: e, fields: t }) => {
|
|
69
|
-
let n =
|
|
70
|
-
return e.filter((e) => n.
|
|
73
|
+
let n = t.filter((e) => !e.policies?.doNotStoreValue);
|
|
74
|
+
return e.filter((e) => n.some((t) => t.id === e.fieldId));
|
|
71
75
|
},
|
|
72
76
|
target: d
|
|
73
77
|
}), t({
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { n as e } from "../../../object-
|
|
1
|
+
import { n as e } from "../../../object-Clj5zVr1.js";
|
|
2
2
|
import { d as t, f as n, i as r } from "../../../supports-0XIfd4-R.js";
|
|
3
3
|
//#region src/plugins/single-page-app/plugin.ts
|
|
4
4
|
var i = n, a, o = (e) => ({
|
|
5
5
|
name: "single-page-app",
|
|
6
|
-
setup: (
|
|
7
|
-
t() && s(() => {
|
|
6
|
+
setup: (n) => {
|
|
7
|
+
e.instrumentHistory && t() && s(() => {
|
|
8
8
|
requestAnimationFrame(() => {
|
|
9
|
-
|
|
9
|
+
n.start();
|
|
10
10
|
});
|
|
11
11
|
});
|
|
12
12
|
}
|
|
@@ -9,7 +9,7 @@ var n = () => ({
|
|
|
9
9
|
class i extends HTMLElement {
|
|
10
10
|
connectedCallback() {
|
|
11
11
|
let e = this.getAttribute("experience-id");
|
|
12
|
-
n.isReady && e && n.experiences.launch({
|
|
12
|
+
n.isReady && e && n.experiences.launch({ key: e });
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
window.customElements.define(r, i);
|
package/dist/esm/server/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as e } from "../../experience-instance-
|
|
1
|
+
import { t as e } from "../../experience-instance-BODAwa-_.js";
|
|
2
2
|
import { attach as t, createEffect as n, createEvent as r, createStore as i, sample as a } from "effector";
|
|
3
3
|
//#region src/server/index.ts
|
|
4
4
|
function o() {
|