@picked/client 0.0.62-next.1 → 0.0.62-next.11

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 (133) hide show
  1. package/README.md +0 -8
  2. package/dist/{api-Dfrznen2.js → api-C6HQ65g9.js} +1 -1
  3. package/dist/api-v323-Asd.cjs +1 -0
  4. package/dist/cjs/form/index.js +1 -1
  5. package/dist/cjs/index.js +4 -4
  6. package/dist/cjs/plugins/create-experience/index.js +1 -1
  7. package/dist/cjs/plugins/dom-observer/index.js +1 -0
  8. package/dist/cjs/plugins/dynamic-experiences/index.js +1 -1
  9. package/dist/cjs/plugins/experience-browser-storage/index.js +1 -1
  10. package/dist/cjs/plugins/history-browser-storage/index.js +1 -1
  11. package/dist/cjs/plugins/responses-browser-storage/index.js +1 -1
  12. package/dist/cjs/plugins/single-page-app/index.js +1 -1
  13. package/dist/cjs/plugins/web-components/index.js +1 -1
  14. package/dist/cjs/server/index.js +1 -1
  15. package/dist/docs/actions.mdx +0 -1
  16. package/dist/docs/api/authentication.md +376 -0
  17. package/dist/docs/api/authorization-and-scopes.md +262 -0
  18. package/dist/docs/api/error-handling.md +211 -0
  19. package/dist/docs/api/index.md +172 -11
  20. package/dist/docs/api/pagination.md +176 -0
  21. package/dist/docs/image-optimisation-service.md +72 -0
  22. package/dist/docs/index.md +0 -2
  23. package/dist/docs/pickedql/data-sources.md +2 -2
  24. package/dist/docs/pickedql/dimensions.md +2 -0
  25. package/dist/docs/pickedql/schema.md +2 -2
  26. package/dist/docs/pickedql/virtual-functions.md +27 -0
  27. package/dist/docs/sdk/actions.md +0 -1
  28. package/dist/docs/sdk/content-security-policy.md +8 -7
  29. package/dist/docs/sdk/features.md +0 -1
  30. package/dist/docs/sdk/fields.md +2 -2
  31. package/dist/docs/sdk/index.md +0 -1
  32. package/dist/docs/sdk/plugins/create-experience.md +0 -1
  33. package/dist/docs/sdk/plugins/dynamic-experiences.md +2 -3
  34. package/dist/docs/sdk/plugins/window-object.md +0 -1
  35. package/dist/docs/sdk/predicates.md +0 -1
  36. package/dist/docs/workspaces.mdx +60 -1
  37. package/dist/dom-C3C6Fmwz.cjs +1 -0
  38. package/dist/dom-DGePXPpM.js +84 -0
  39. package/dist/esm/form/index.js +1 -1
  40. package/dist/esm/index.js +1020 -494
  41. package/dist/esm/plugins/create-experience/index.js +1 -1
  42. package/dist/esm/plugins/dom-observer/index.js +87 -0
  43. package/dist/esm/plugins/dynamic-experiences/index.js +133 -60
  44. package/dist/esm/plugins/experience-browser-storage/index.js +9 -6
  45. package/dist/esm/plugins/history-browser-storage/index.js +1 -1
  46. package/dist/esm/plugins/responses-browser-storage/index.js +1 -1
  47. package/dist/esm/plugins/single-page-app/index.js +1 -1
  48. package/dist/esm/plugins/web-components/index.js +1 -1
  49. package/dist/esm/server/index.js +23 -13
  50. package/dist/experience-instance-DImym3m_.js +419 -0
  51. package/dist/experience-instance-DygAdzbn.cjs +1 -0
  52. package/dist/rules-logic-D_CVBuv7.js +13 -0
  53. package/dist/rules-logic-H6P8xwHF.cjs +1 -0
  54. package/dist/types/client.d.ts +2 -2
  55. package/dist/types/entities/action/action.d.ts +6 -3
  56. package/dist/types/entities/action/action.d.ts.map +1 -1
  57. package/dist/types/entities/component/component.d.ts +39 -2
  58. package/dist/types/entities/component/component.d.ts.map +1 -1
  59. package/dist/types/entities/content/content.d.ts +37 -0
  60. package/dist/types/entities/content/content.d.ts.map +1 -0
  61. package/dist/types/entities/experience/experience.d.ts +69 -113
  62. package/dist/types/entities/experience/experience.d.ts.map +1 -1
  63. package/dist/types/entities/experience-instance/experience-instance.d.ts +17 -2
  64. package/dist/types/entities/experience-instance/experience-instance.d.ts.map +1 -1
  65. package/dist/types/entities/feature/feature.d.ts +26 -2
  66. package/dist/types/entities/feature/feature.d.ts.map +1 -1
  67. package/dist/types/entities/field/field.d.ts.map +1 -1
  68. package/dist/types/entities/framework/framework.d.ts +24 -3
  69. package/dist/types/entities/framework/framework.d.ts.map +1 -1
  70. package/dist/types/entities/plugin/plugin.d.ts +32 -1
  71. package/dist/types/entities/plugin/plugin.d.ts.map +1 -1
  72. package/dist/types/entities/predicate/predicate.d.ts +24 -3
  73. package/dist/types/entities/predicate/predicate.d.ts.map +1 -1
  74. package/dist/types/entities/session/session.d.ts +45 -0
  75. package/dist/types/entities/session/session.d.ts.map +1 -0
  76. package/dist/types/entities/step/step.d.ts +17 -2
  77. package/dist/types/entities/step/step.d.ts.map +1 -1
  78. package/dist/types/exports.d.ts +9 -3
  79. package/dist/types/exports.d.ts.map +1 -1
  80. package/dist/types/index.d.ts +3 -1
  81. package/dist/types/index.d.ts.map +1 -1
  82. package/dist/types/lifecycle/lifecycle.d.ts +47 -0
  83. package/dist/types/lifecycle/lifecycle.d.ts.map +1 -0
  84. package/dist/types/lifecycle/rules-logic.d.ts +24 -0
  85. package/dist/types/lifecycle/rules-logic.d.ts.map +1 -0
  86. package/dist/types/lifecycle/state-snapshot.d.ts +37 -0
  87. package/dist/types/lifecycle/state-snapshot.d.ts.map +1 -0
  88. package/dist/types/logic-engine.d.ts +1 -1
  89. package/dist/types/logic-engine.d.ts.map +1 -1
  90. package/dist/types/picked.d.ts +141 -187
  91. package/dist/types/picked.d.ts.map +1 -1
  92. package/dist/types/plugins/dom-observer/index.d.ts +3 -0
  93. package/dist/types/plugins/dom-observer/index.d.ts.map +1 -0
  94. package/dist/types/plugins/dom-observer/plugin.d.ts +50 -0
  95. package/dist/types/plugins/dom-observer/plugin.d.ts.map +1 -0
  96. package/dist/types/plugins/dynamic-experiences/index.d.ts +2 -1
  97. package/dist/types/plugins/dynamic-experiences/index.d.ts.map +1 -1
  98. package/dist/types/plugins/dynamic-experiences/plugin.d.ts +18 -1
  99. package/dist/types/plugins/dynamic-experiences/plugin.d.ts.map +1 -1
  100. package/dist/types/plugins/dynamic-experiences/types.d.ts +63 -1
  101. package/dist/types/plugins/dynamic-experiences/types.d.ts.map +1 -1
  102. package/dist/types/plugins/experience-browser-storage/plugin.d.ts.map +1 -1
  103. package/dist/types/plugins/web-components/plugin.d.ts.map +1 -1
  104. package/dist/types/server/index.d.ts +7 -0
  105. package/dist/types/server/index.d.ts.map +1 -1
  106. package/dist/types/utils/events.d.ts +1 -1
  107. package/dist/types/utils/events.d.ts.map +1 -1
  108. package/dist/types/utils/picked-config.d.ts +12 -4
  109. package/dist/types/utils/picked-config.d.ts.map +1 -1
  110. package/dist/types/utils/rules-logic.d.ts +4 -9
  111. package/dist/types/utils/rules-logic.d.ts.map +1 -1
  112. package/package.json +12 -2
  113. package/dist/api-NpGrXHyM.cjs +0 -1
  114. package/dist/docs/reference/index.md +0 -11
  115. package/dist/docs/tooling/index.md +0 -19
  116. package/dist/experience-instance-DC2gKwA6.cjs +0 -1
  117. package/dist/experience-instance-DJaNc5Ob.js +0 -486
  118. package/dist/rules-logic-BTIxfrJJ.js +0 -240
  119. package/dist/rules-logic-DNLOv90w.cjs +0 -1
  120. package/dist/types/utils/state-snaphot.d.ts +0 -26
  121. package/dist/types/utils/state-snaphot.d.ts.map +0 -1
  122. package/dist/types/utils/user-session.d.ts +0 -12
  123. package/dist/types/utils/user-session.d.ts.map +0 -1
  124. /package/dist/docs/{tooling/chrome-extension.md → chrome-extension.md} +0 -0
  125. /package/dist/docs/{tooling/gtm-template.md → gtm-template.md} +0 -0
  126. /package/dist/docs/{tooling/mcp.md → mcp.md} +0 -0
  127. /package/dist/docs/{tooling/vite-plugin.md → vite-plugin.md} +0 -0
  128. /package/dist/{id-Bv44ilEo.cjs → id-Cg7fVl1O.cjs} +0 -0
  129. /package/dist/{id-CRqy981z.js → id-n2yrHvNo.js} +0 -0
  130. /package/dist/{object-C82v79xc.js → object-DvUDOytC.js} +0 -0
  131. /package/dist/{object-CUJOjanb.cjs → object-ThO1DEyl.cjs} +0 -0
  132. /package/dist/{storage-B6lQtc4-.cjs → storage-BXSlLTRa.cjs} +0 -0
  133. /package/dist/{storage-6Xk0uAxB.js → storage-hOHCCXvP.js} +0 -0
@@ -1,4 +1,4 @@
1
- import { t as e } from "../../../id-CRqy981z.js";
1
+ import { t as e } from "../../../id-n2yrHvNo.js";
2
2
  //#region src/plugins/create-experience/serialization.ts
3
3
  var t = {
4
4
  serialize(e) {
@@ -0,0 +1,87 @@
1
+ import "../../../logger-6z_gb4rA.js";
2
+ import { d as e, r as t } from "../../../supports-0XIfd4-R.js";
3
+ import { r as n } from "../../../dom-DGePXPpM.js";
4
+ import { createEffect as r, createEvent as i, createStore as a, sample as o } from "effector";
5
+ //#region src/plugins/dom-observer/plugin.ts
6
+ var s = /* @__PURE__ */ new WeakSet(), c = () => ({
7
+ name: "dom-observer",
8
+ setup: (e) => {
9
+ l() && (s.has(e) || (s.add(e), u(e)));
10
+ }
11
+ });
12
+ function l() {
13
+ return !(!e() || !t() || typeof MutationObserver != "function" || typeof requestAnimationFrame != "function");
14
+ }
15
+ function u(e) {
16
+ n().then(() => {
17
+ document.body && d(e);
18
+ });
19
+ }
20
+ function d(e) {
21
+ let t = i(), n = a(/* @__PURE__ */ new Map()).on(t, (e, { id: t, selectors: n }) => {
22
+ let r = new Map(e);
23
+ return n.length > 0 ? r.set(t, n) : r.delete(t), r;
24
+ }), s = /* @__PURE__ */ new Map();
25
+ e.experiences.listStore.watch((e) => {
26
+ for (let n of e) {
27
+ if (s.has(n.id)) continue;
28
+ let e = n.configStore.watch((e) => {
29
+ t({
30
+ id: n.id,
31
+ selectors: f(e.targetSelectors)
32
+ });
33
+ });
34
+ s.set(n.id, e);
35
+ }
36
+ });
37
+ let c = r(async (e) => {
38
+ await Promise.all(e.map(async (e) => {
39
+ await e.shouldInitialiseFx() && await e.initialiseFx(void 0);
40
+ }));
41
+ });
42
+ c.fail.watch(({ error: e }) => {});
43
+ let l = i();
44
+ o({
45
+ clock: l,
46
+ source: {
47
+ selectorsById: n,
48
+ experiences: e.experiences.listStore
49
+ },
50
+ fn: ({ selectorsById: e, experiences: t }, n) => t.filter((t) => {
51
+ let r = e.get(t.id);
52
+ return r ? r.some((e) => p(n, e)) : !1;
53
+ }),
54
+ target: c
55
+ });
56
+ let u = [], d, m = () => {
57
+ d = void 0;
58
+ let e = u;
59
+ u = [], l(e);
60
+ };
61
+ new MutationObserver((e) => {
62
+ let t = !1;
63
+ for (let n of e) if (n.type === "childList") for (let e of n.addedNodes) e instanceof Element && (u.push(e), t = !0);
64
+ t && (d ??= requestAnimationFrame(m));
65
+ }).observe(document.body, {
66
+ childList: !0,
67
+ subtree: !0
68
+ });
69
+ }
70
+ function f(e) {
71
+ let t = [];
72
+ for (let n of e) {
73
+ let e = n.selector.trim();
74
+ e.length > 0 && t.push(e);
75
+ }
76
+ return t;
77
+ }
78
+ function p(e, t) {
79
+ for (let n of e) try {
80
+ if (n.matches(t) || n.querySelector(t) !== null) return !0;
81
+ } catch {
82
+ return !1;
83
+ }
84
+ return !1;
85
+ }
86
+ //#endregion
87
+ export { c as domObserverPlugin };
@@ -1,26 +1,27 @@
1
1
  import "../../../logger-6z_gb4rA.js";
2
- import { i as e, t } from "../../../api-Dfrznen2.js";
2
+ import { i as e, t } from "../../../api-C6HQ65g9.js";
3
+ import { attach as n } from "effector";
3
4
  //#region src/plugins/dynamic-experiences/hash.ts
4
- function n(e) {
5
+ function r(e) {
5
6
  let t = 2166136261;
6
7
  for (let n = 0; n < e.length; n++) t ^= e.charCodeAt(n), t = Math.imul(t, 16777619);
7
8
  return t >>> 0;
8
9
  }
9
- function r(e) {
10
- return n(e) % 100;
10
+ function i(e) {
11
+ return r(e) % 100;
11
12
  }
12
- function i(e, t) {
13
+ function a(e, t) {
13
14
  return t <= 0 ? !1 : t >= 100 ? !0 : e < t;
14
15
  }
15
16
  //#endregion
16
17
  //#region src/plugins/dynamic-experiences/plugin.ts
17
- function a(e) {
18
+ function o(e) {
18
19
  return typeof e == "object" && !!e && "features" in e && Array.isArray(e.features);
19
20
  }
20
- function o(e, t) {
21
+ function s(e, t) {
21
22
  if (Array.isArray(t.conditions)) for (let n of t.conditions) e.registerCondition(n);
22
23
  }
23
- function s(e, t) {
24
+ function c(e, t) {
24
25
  e.registerExperience({
25
26
  id: t.id,
26
27
  key: t.key,
@@ -33,10 +34,10 @@ function s(e, t) {
33
34
  componentName: t.componentName
34
35
  });
35
36
  }
36
- function c(e, t) {
37
+ function l(e, t) {
37
38
  if (Array.isArray(t.fields)) for (let n of t.fields) e.registerField(n);
38
39
  }
39
- function l(e, t) {
40
+ function u(e, t) {
40
41
  if (!Array.isArray(t.steps)) return;
41
42
  let n = new Map(t.fields.map((e) => [e.id, e.key]));
42
43
  for (let r of t.steps) {
@@ -49,23 +50,28 @@ function l(e, t) {
49
50
  }
50
51
  t.push(i);
51
52
  }
53
+ let i = r.layoutContentId ? e.contents.getById(r.layoutContentId) : null;
52
54
  e.registerStep({
53
55
  id: r.id,
54
56
  key: r.key,
55
57
  name: r.name,
56
58
  fieldKeys: t,
57
- layoutName: r.layoutName
59
+ layoutName: r.layoutName,
60
+ ...r.layoutContentId !== void 0 && {
61
+ layoutContentId: r.layoutContentId,
62
+ layoutContentStore: i
63
+ }
58
64
  });
59
65
  }
60
66
  }
61
- function u(e, t) {
62
- if (Array.isArray(t.experiences)) for (let n of t.experiences) s(e, n);
67
+ function d(e, t) {
68
+ if (Array.isArray(t.experiences)) for (let n of t.experiences) c(e, n);
63
69
  }
64
- function d(e) {
70
+ function f(e) {
65
71
  let t = e.searchParams["preview-token"];
66
72
  if (t && t.length > 0) return t[0];
67
73
  }
68
- function f(e) {
74
+ function p(e) {
69
75
  let t = /* @__PURE__ */ new Set(), n = e.searchParams.feature;
70
76
  if (!n) return t;
71
77
  for (let e of n) {
@@ -74,37 +80,18 @@ function f(e) {
74
80
  }
75
81
  return t;
76
82
  }
77
- function p(e, t, n) {
78
- let i = f(e), a = e.session?.id;
79
- if (!a) throw Error("Session ID is required for feature registration");
80
- let o = r(a);
81
- for (let r of t.features) i.has(r.id) || m(e, r, n, o);
82
- }
83
83
  function m(e, t, n, r) {
84
+ let a = p(e), o = i(r);
85
+ for (let r of t.features) a.has(r.id) || h(e, r, n, o);
86
+ }
87
+ function h(e, t, n, r) {
84
88
  e.registerFeature(t.id, {
85
89
  key: `v${t.version}`,
86
90
  name: t.name,
87
91
  storage: n ? "session" : "local",
88
- decide: () => t.enabled ? i(r, t.weight) : !1
92
+ decide: () => t.enabled ? a(r, t.weight) : !1
89
93
  });
90
94
  }
91
- function h() {
92
- let e;
93
- try {
94
- e = __PICKED_PROJECT_CONFIG__;
95
- } catch {
96
- return;
97
- }
98
- if (e === void 0) return;
99
- let t;
100
- if (typeof e == "string") try {
101
- t = JSON.parse(e);
102
- } catch {
103
- return;
104
- }
105
- else t = e;
106
- if (a(t)) return t;
107
- }
108
95
  function g(e) {
109
96
  try {
110
97
  let t = new URL(e).hostname;
@@ -119,43 +106,129 @@ function _(e) {
119
106
  return typeof t != "object" || !t || !("code" in t) ? !1 : t.code === "ECONNREFUSED";
120
107
  }
121
108
  async function v(e, n, r) {
122
- let i = r?.previewToken ? `projects/${n}?preview_token=${encodeURIComponent(r.previewToken)}` : `projects/${n}`, o;
109
+ let i = r?.previewToken ? `projects/${n}?preview_token=${encodeURIComponent(r.previewToken)}` : `projects/${n}`, a;
123
110
  try {
124
- o = await t(e, i, r?.headers);
111
+ a = await t(e, i, r?.headers);
125
112
  } catch (t) {
126
113
  return g(e) && _(t), null;
127
114
  }
128
- if (!o.ok) return `${o.status.toString()}`, null;
115
+ if (!a.ok) return `${a.status.toString()}`, null;
129
116
  let s;
130
117
  try {
131
- s = await o.json();
118
+ s = await a.json();
132
119
  } catch {
133
120
  return null;
134
121
  }
135
- return a(s) ? s : null;
122
+ return o(s) ? s : null;
136
123
  }
137
124
  function y(e) {
125
+ return typeof e != "object" || !e || !("experienceId" in e) || !("content" in e) ? !1 : Array.isArray(e.content);
126
+ }
127
+ async function b(e, n, r, i) {
128
+ let a = i?.previewToken ? `projects/${n}/experiences/${r}/content?preview_token=${encodeURIComponent(i.previewToken)}` : `projects/${n}/experiences/${r}/content`, o;
129
+ try {
130
+ o = await t(e, a, i?.headers);
131
+ } catch (t) {
132
+ return g(e) && _(t) || `${r}`, null;
133
+ }
134
+ if (!o.ok) return `${r}${o.status.toString()}`, null;
135
+ let s;
136
+ try {
137
+ s = await o.json();
138
+ } catch {
139
+ return `${r}`, null;
140
+ }
141
+ return y(s) ? s : (`${r}`, null);
142
+ }
143
+ function x(e, t) {
144
+ for (let n of t.content) e.registerContent({
145
+ id: n.id,
146
+ data: n.data
147
+ });
148
+ }
149
+ function S(e) {
150
+ if (typeof e != "object" || !e || !("projectConfig" in e) || !("experienceContent" in e) || !("manifestMetadata" in e)) return !1;
151
+ let { experienceContent: t } = e;
152
+ return typeof t == "function";
153
+ }
154
+ async function C() {
155
+ try {
156
+ let e = await import("virtual:picked/data");
157
+ return S(e) ? e : null;
158
+ } catch {
159
+ return null;
160
+ }
161
+ }
162
+ function w(e, t, n) {
163
+ return (r) => b(e, t, r.id, n ? { previewToken: n } : void 0);
164
+ }
165
+ function T(e, t) {
166
+ return (n) => e(n, t ? { previewToken: t } : void 0);
167
+ }
168
+ function E(e) {
169
+ return (t, n) => e.experienceContent(t, n);
170
+ }
171
+ function D(e, t) {
172
+ let n = /* @__PURE__ */ new Map();
173
+ return (r, i) => {
174
+ let a = n.get(r.id);
175
+ if (a) return a;
176
+ let o = (async () => {
177
+ try {
178
+ let n = await t(r, i);
179
+ return n && x(e, n), n;
180
+ } finally {
181
+ n.delete(r.id);
182
+ }
183
+ })();
184
+ return n.set(r.id, o), o;
185
+ };
186
+ }
187
+ async function O(e) {
188
+ let { client: t, apiUrl: n, options: r } = e, i = f(t), a = !!i, o = r?.projectConfig ?? null, s = r?.getContent ? T(r.getContent, i) : null, c = null;
189
+ if (i) return o ??= await v(n, t.projectId, { previewToken: i }), s ??= w(n, t.projectId, i), {
190
+ config: o,
191
+ contentLoader: s,
192
+ dataSource: c,
193
+ isPreview: a
194
+ };
195
+ if (o && s) return {
196
+ config: o,
197
+ contentLoader: s,
198
+ dataSource: c,
199
+ isPreview: a
200
+ };
201
+ let l = await C();
202
+ return l ? (o ??= l.projectConfig, s ??= E(l), c = l.manifestMetadata, {
203
+ config: o,
204
+ contentLoader: s,
205
+ dataSource: c,
206
+ isPreview: a
207
+ }) : (o ??= await v(n, t.projectId), s ??= w(n, t.projectId), {
208
+ config: o,
209
+ contentLoader: s,
210
+ dataSource: c,
211
+ isPreview: a
212
+ });
213
+ }
214
+ function k(e) {
138
215
  return {
139
216
  name: "dynamic-experiences",
140
217
  setup: (t) => {
141
- let n = e?.apiUrl ?? t.apiUrl;
142
- return { onStart: async () => {
143
- let r = d(t);
144
- if (r) {
145
- let e = await v(n, t.projectId, { previewToken: r });
146
- e && (p(t, e, !0), o(t, e), c(t, e), l(t, e), u(t, e));
147
- return;
148
- }
149
- let i = e?.projectConfig ?? h();
150
- if (i) {
151
- p(t, i, !1), o(t, i), c(t, i), l(t, i), u(t, i);
152
- return;
218
+ let r = e?.apiUrl ?? t.apiUrl;
219
+ return { onStart: n({
220
+ source: t.session.store.map((e) => e.id),
221
+ effect: async (n) => {
222
+ let { config: i, contentLoader: a, dataSource: o, isPreview: c } = await O({
223
+ client: t,
224
+ apiUrl: r,
225
+ options: e
226
+ });
227
+ a && (t.contentLoader = D(t, a)), t.dataSource = o, i && (m(t, i, c, n), s(t, i), l(t, i), u(t, i), d(t, i));
153
228
  }
154
- let a = await v(n, t.projectId);
155
- a && (p(t, a, !1), o(t, a), c(t, a), l(t, a), u(t, a));
156
- } };
229
+ }) };
157
230
  }
158
231
  };
159
232
  }
160
233
  //#endregion
161
- export { e as createClientHeaders, y as dynamicExperiencesPlugin, v as fetchProject };
234
+ export { e as createClientHeaders, k as dynamicExperiencesPlugin, b as fetchExperienceContent, v as fetchProject };
@@ -1,6 +1,6 @@
1
1
  import "../../../logger-6z_gb4rA.js";
2
2
  import { d as e } from "../../../supports-0XIfd4-R.js";
3
- import { n as t, r as n, t as r } from "../../../storage-6Xk0uAxB.js";
3
+ import { n as t, r as n, t as r } from "../../../storage-hOHCCXvP.js";
4
4
  import { createEffect as i, sample as a } from "effector";
5
5
  //#region src/plugins/experience-browser-storage/plugin.ts
6
6
  var o = ({ storage: o = "local" } = {}) => ({
@@ -10,7 +10,7 @@ var o = ({ storage: o = "local" } = {}) => ({
10
10
  let c = o === "local" ? t : n, l = i(async (e) => {
11
11
  if (!e) return;
12
12
  let t = r("open-close", "experience", e), n = c.get(t).boolean();
13
- e.setOpen(n ?? e.isOpenStore.getState());
13
+ n !== null && e.setOpen(n);
14
14
  });
15
15
  a({
16
16
  source: s.eventBus,
@@ -18,12 +18,15 @@ var o = ({ storage: o = "local" } = {}) => ({
18
18
  fn: (e) => e.experience,
19
19
  target: l
20
20
  });
21
- let u = i(async (e) => {
22
- let t = r("open-close", "experience", e), n = e.isOpenStore.getState();
23
- c.set(t, n);
21
+ let u = i(async ({ experience: e, isOpen: t }) => {
22
+ let n = r("open-close", "experience", e);
23
+ c.set(n, t);
24
24
  }), d = (e) => a({
25
25
  source: e.isOpenStore,
26
- fn: () => e,
26
+ fn: (t) => ({
27
+ experience: e,
28
+ isOpen: t
29
+ }),
27
30
  target: u
28
31
  });
29
32
  s.experienceInstances.listStore.watch((e) => {
@@ -1,5 +1,5 @@
1
1
  import { d as e } from "../../../supports-0XIfd4-R.js";
2
- import { n as t, r as n, t as r } from "../../../storage-6Xk0uAxB.js";
2
+ import { n as t, r as n, t as r } from "../../../storage-hOHCCXvP.js";
3
3
  import { createEffect as i, sample as a } from "effector";
4
4
  //#region src/plugins/history-browser-storage/plugin.ts
5
5
  var o = r("history", "global"), s = ({ storage: r = "local" } = {}) => ({
@@ -1,5 +1,5 @@
1
1
  import { d as e } from "../../../supports-0XIfd4-R.js";
2
- import { n as t, r as n, t as r } from "../../../storage-6Xk0uAxB.js";
2
+ import { n as t, r as n, t as r } from "../../../storage-hOHCCXvP.js";
3
3
  import { attach as i, createEffect as a, sample as o } from "effector";
4
4
  //#region src/plugins/responses-browser-storage/plugin.ts
5
5
  var s = r("responses", "global");
@@ -1,4 +1,4 @@
1
- import { n as e } from "../../../object-C82v79xc.js";
1
+ import { n as e } from "../../../object-DvUDOytC.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) => ({
@@ -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({ id: e });
12
+ n.readyStore.getState() && e && n.experiences.launch({ id: e });
13
13
  }
14
14
  }
15
15
  window.customElements.define(r, i);
@@ -1,4 +1,4 @@
1
- import { t as e } from "../../experience-instance-DJaNc5Ob.js";
1
+ import { t as e } from "../../experience-instance-DImym3m_.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() {
@@ -19,17 +19,27 @@ function s(s, c) {
19
19
  currentExperienceIndex: 0,
20
20
  renderedExperiences: [],
21
21
  isComplete: !1
22
- }), v = n(async ({ experience: e, availableRenderers: t, startRendererIndex: n = 0 }) => {
23
- if (!e) return null;
24
- for (let r = n; r < t.length; r++) {
25
- let n = t[r], i = e.componentStore.getState();
26
- if (i && n?.isValidComponent(i.component)) return {
27
- rendered: await n.render(i.component, s, e),
28
- rendererIndex: r
29
- };
22
+ }), v = n(async (e) => {
23
+ let n = t({
24
+ source: e.experience.componentStore,
25
+ effect: async (t, n) => {
26
+ let r = e.availableRenderers[n];
27
+ return t && r?.isValidComponent(t.component) ? {
28
+ rendered: await r.render(t.component, s, e.experience),
29
+ rendererIndex: n
30
+ } : null;
31
+ }
32
+ }), r = e.startRendererIndex ?? 0;
33
+ for (let t = r; t < e.availableRenderers.length; t++) {
34
+ let e = await n(t);
35
+ if (e) return e;
30
36
  }
31
37
  return null;
32
- });
38
+ }), y = n(async ({ experience: e, availableRenderers: t, startRendererIndex: n = 0 }) => e ? v({
39
+ experience: e,
40
+ availableRenderers: t,
41
+ startRendererIndex: n
42
+ }) : null);
33
43
  return _.on(p, (e, t) => ({
34
44
  ...e,
35
45
  renderedExperiences: [...e.renderedExperiences, t],
@@ -55,9 +65,9 @@ function s(s, c) {
55
65
  availableRenderers: c,
56
66
  startRendererIndex: 0
57
67
  }),
58
- target: v
68
+ target: y
59
69
  }), a({
60
- clock: v.doneData,
70
+ clock: y.doneData,
61
71
  filter: (e) => e !== null,
62
72
  fn: (e) => e.rendered.body,
63
73
  target: p
@@ -65,7 +75,7 @@ function s(s, c) {
65
75
  clock: p,
66
76
  target: f
67
77
  }), a({
68
- clock: v.doneData,
78
+ clock: y.doneData,
69
79
  filter: (e) => e === null,
70
80
  target: h
71
81
  }), a({