@picked/client 0.0.61 → 0.0.62-next.10

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 (135) hide show
  1. package/README.md +0 -8
  2. package/dist/{api-CjGYS0lP.js → api-C11HFYrl.js} +1 -1
  3. package/dist/api-DXosW8uz.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 +41 -34
  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/form/create-form.d.ts +55 -0
  81. package/dist/types/form/create-form.d.ts.map +1 -1
  82. package/dist/types/index.d.ts +3 -1
  83. package/dist/types/index.d.ts.map +1 -1
  84. package/dist/types/lifecycle/lifecycle.d.ts +47 -0
  85. package/dist/types/lifecycle/lifecycle.d.ts.map +1 -0
  86. package/dist/types/lifecycle/rules-logic.d.ts +24 -0
  87. package/dist/types/lifecycle/rules-logic.d.ts.map +1 -0
  88. package/dist/types/lifecycle/state-snapshot.d.ts +37 -0
  89. package/dist/types/lifecycle/state-snapshot.d.ts.map +1 -0
  90. package/dist/types/logic-engine.d.ts +1 -1
  91. package/dist/types/logic-engine.d.ts.map +1 -1
  92. package/dist/types/picked.d.ts +141 -187
  93. package/dist/types/picked.d.ts.map +1 -1
  94. package/dist/types/plugins/dom-observer/index.d.ts +3 -0
  95. package/dist/types/plugins/dom-observer/index.d.ts.map +1 -0
  96. package/dist/types/plugins/dom-observer/plugin.d.ts +50 -0
  97. package/dist/types/plugins/dom-observer/plugin.d.ts.map +1 -0
  98. package/dist/types/plugins/dynamic-experiences/index.d.ts +2 -1
  99. package/dist/types/plugins/dynamic-experiences/index.d.ts.map +1 -1
  100. package/dist/types/plugins/dynamic-experiences/plugin.d.ts +18 -1
  101. package/dist/types/plugins/dynamic-experiences/plugin.d.ts.map +1 -1
  102. package/dist/types/plugins/dynamic-experiences/types.d.ts +63 -1
  103. package/dist/types/plugins/dynamic-experiences/types.d.ts.map +1 -1
  104. package/dist/types/plugins/experience-browser-storage/plugin.d.ts.map +1 -1
  105. package/dist/types/plugins/web-components/plugin.d.ts.map +1 -1
  106. package/dist/types/server/index.d.ts +7 -0
  107. package/dist/types/server/index.d.ts.map +1 -1
  108. package/dist/types/utils/events.d.ts +1 -1
  109. package/dist/types/utils/events.d.ts.map +1 -1
  110. package/dist/types/utils/picked-config.d.ts +12 -4
  111. package/dist/types/utils/picked-config.d.ts.map +1 -1
  112. package/dist/types/utils/rules-logic.d.ts +4 -9
  113. package/dist/types/utils/rules-logic.d.ts.map +1 -1
  114. package/package.json +12 -2
  115. package/dist/api-BarClNGB.cjs +0 -1
  116. package/dist/docs/reference/index.md +0 -11
  117. package/dist/docs/tooling/index.md +0 -19
  118. package/dist/experience-instance-DC2gKwA6.cjs +0 -1
  119. package/dist/experience-instance-DJaNc5Ob.js +0 -486
  120. package/dist/rules-logic-BTIxfrJJ.js +0 -240
  121. package/dist/rules-logic-DNLOv90w.cjs +0 -1
  122. package/dist/types/utils/state-snaphot.d.ts +0 -26
  123. package/dist/types/utils/state-snaphot.d.ts.map +0 -1
  124. package/dist/types/utils/user-session.d.ts +0 -12
  125. package/dist/types/utils/user-session.d.ts.map +0 -1
  126. /package/dist/docs/{tooling/chrome-extension.md → chrome-extension.md} +0 -0
  127. /package/dist/docs/{tooling/gtm-template.md → gtm-template.md} +0 -0
  128. /package/dist/docs/{tooling/mcp.md → mcp.md} +0 -0
  129. /package/dist/docs/{tooling/vite-plugin.md → vite-plugin.md} +0 -0
  130. /package/dist/{id-Bv44ilEo.cjs → id-Cg7fVl1O.cjs} +0 -0
  131. /package/dist/{id-CRqy981z.js → id-n2yrHvNo.js} +0 -0
  132. /package/dist/{object-C82v79xc.js → object-DvUDOytC.js} +0 -0
  133. /package/dist/{object-CUJOjanb.cjs → object-ThO1DEyl.cjs} +0 -0
  134. /package/dist/{storage-B6lQtc4-.cjs → storage-BXSlLTRa.cjs} +0 -0
  135. /package/dist/{storage-6Xk0uAxB.js → storage-hOHCCXvP.js} +0 -0
@@ -0,0 +1,419 @@
1
+ import { n as e, t } from "./rules-logic-D_CVBuv7.js";
2
+ import "./logger-6z_gb4rA.js";
3
+ import { n, o as r } from "./dom-DGePXPpM.js";
4
+ import { attach as i, combine as a, createApi as o, createDomain as s, createEffect as c, createEvent as l, sample as u, split as d } from "effector";
5
+ import { createFactory as f, invoke as p } from "@withease/factories";
6
+ //#region src/utils/nodes.ts
7
+ function m(e) {
8
+ return e.type === "condition";
9
+ }
10
+ function h(e) {
11
+ return e.type === "step";
12
+ }
13
+ function g(e) {
14
+ return e.type === "experience";
15
+ }
16
+ function _(e) {
17
+ return e.type === "origin";
18
+ }
19
+ function v(e) {
20
+ return e.type === "action";
21
+ }
22
+ //#endregion
23
+ //#region src/utils/node-tree/next-reachable-step-nodes.ts
24
+ var y = (e, t, n, r, i = /* @__PURE__ */ new Set()) => i.has(n.id) ? [] : (i.add(n.id), h(n) && !r ? [n] : t.filter((e) => e.sourceNodeId === n.id).flatMap((n) => {
25
+ let r = e.find((e) => e.id === n.destinationNodeId);
26
+ return r ? y(e, t, r, !1, i) : [];
27
+ })), ee = (e, t, n) => y(e, t, n, !0, /* @__PURE__ */ new Set()), b = (e, t, n, r, i = /* @__PURE__ */ new Set()) => {
28
+ if (i.has(n.id)) return [-1, -1];
29
+ i.add(n.id);
30
+ let a = t.filter((e) => e.sourceNodeId === n.id);
31
+ if (a.length === 0) return [0, 0];
32
+ let o = Infinity, s = -Infinity;
33
+ for (let n of a) {
34
+ let r = e.find((e) => e.id === n.destinationNodeId);
35
+ if (!r) continue;
36
+ let [a, c] = b(e, t, r, !1, new Set(i));
37
+ a !== -1 && (o = Math.min(o, a + 1), s = Math.max(s, c + 1));
38
+ }
39
+ return o === Infinity ? [-1, -1] : [o, s];
40
+ }, te = (e, t, n) => b(e, t, n, !0, /* @__PURE__ */ new Set()), x = (e, t, n, r = /* @__PURE__ */ new Set()) => {
41
+ if (r.has(n.id)) return [-1, -1];
42
+ if (r.add(n.id), n.type === "origin") return [0, 0];
43
+ let i = t.filter((e) => e.destinationNodeId === n.id);
44
+ if (i.length === 0) return [-1, -1];
45
+ let a = Infinity, o = -Infinity;
46
+ for (let n of i) {
47
+ let i = e.find((e) => e.id === n.sourceNodeId);
48
+ if (!i) continue;
49
+ let [s, c] = x(e, t, i, new Set(r));
50
+ s !== -1 && (a = Math.min(a, s + 1), o = Math.max(o, c + 1));
51
+ }
52
+ return a === Infinity ? [-1, -1] : [a, o];
53
+ }, S = (e, t, n) => x(e, t, n, /* @__PURE__ */ new Set()), C = (e) => e.find((e) => e.type === "origin") || null, w = (e, t, n) => {
54
+ if (!e) return C(t);
55
+ let r = n.find((t) => t.sourceNodeId === e.id);
56
+ return r && t.find((e) => e.id === r.destinationNodeId) || null;
57
+ };
58
+ //#endregion
59
+ //#region src/utils/node-tree/get-next-node-from-condition.ts
60
+ async function ne(e, t, n, r) {
61
+ let i = e ? "true" : "false", a = r.find((e) => e.sourceHandle === i && e.sourceNodeId === t);
62
+ return n.find((e) => e.id === a?.destinationNodeId);
63
+ }
64
+ //#endregion
65
+ //#region src/entities/experience-instance/experience-instance.ts
66
+ var T = s("experience-instance"), E = f(({ client: r, experience: s, target: f, options: p }) => {
67
+ let y = l(), b = l(), x = l(), E = l(), D = l(), O = l(), k = s.componentStore, A = T.store("transitioning"), j = r.history.entriesStore.map((e) => e.filter((e) => e.experienceId === s.id)), M = j.map((e) => e.filter((e) => h(e.node))), N = j.map((e) => e.at(-1)?.node || null), P = a(r.steps.listStore, N, (e, t) => e.find((e) => t && h(t) && e.id === t.stepId) || null), re = a(r.steps.listStore, M, (e, t) => {
68
+ let n = t.at(-2);
69
+ if (!n || !h(n.node)) return null;
70
+ let r = n.node;
71
+ return e.find((e) => e.id === r.stepId) || null;
72
+ }), F = a(s.treeStore, N, ({ nodes: e, edges: t }, n) => n ? ee(e, t, n) : []), I = a(s.treeStore, N, ({ nodes: e, edges: t }, n) => n ? S(e, t, n) : [-1, -1]), L = a(s.treeStore, N, ({ nodes: e, edges: t }, n) => n ? te(e, t, n) : [-1, -1]), R = T.store(!1), z = o(R, {
73
+ open: () => !0,
74
+ close: () => !1,
75
+ toggle: (e) => !e,
76
+ set: (e, t) => t
77
+ }), B = c(async () => {
78
+ r.history.back({ experienceId: s.id });
79
+ }), V = i({
80
+ source: s.treeStore,
81
+ effect: async (e, t) => {
82
+ let n = e.nodes.find((e) => h(e) && e.stepId === t);
83
+ n && r.history.push({
84
+ experienceId: s.id,
85
+ node: n
86
+ });
87
+ }
88
+ }), H = i({
89
+ source: N,
90
+ effect: (e) => {}
91
+ }), U = i({
92
+ source: s.treeStore,
93
+ effect: async ({ nodes: e }) => C(e)
94
+ }), W = i({
95
+ source: s.treeStore,
96
+ effect: async ({ nodes: e, edges: t }, n) => {
97
+ if (_(n)) return w(n, e, t);
98
+ }
99
+ }), G = i({
100
+ source: s.treeStore,
101
+ effect: async ({ nodes: e, edges: n, conditions: i }, a) => {
102
+ if (!m(a)) return;
103
+ let o = i.find((e) => e.id === a.conditionId)?.logic;
104
+ return o ? ne(!!await t(r, o), a.id, e, n) : void 0;
105
+ }
106
+ }), K = i({
107
+ source: {
108
+ tree: s.treeStore,
109
+ actions: r.actions.listStore,
110
+ snapshot: r.stateSnapshotStore
111
+ },
112
+ effect: async ({ tree: e, actions: t, snapshot: n }, r) => {
113
+ let { nodes: i, edges: a } = e;
114
+ if (!v(r)) return;
115
+ let o = r.actionKey;
116
+ if (!o) {
117
+ `${r.id}`;
118
+ return;
119
+ }
120
+ let s = t.find((e) => e.key === o)?.action;
121
+ if (!s) {
122
+ `${o}`;
123
+ let e = a.find((e) => e.sourceNodeId === r.id && e.sourceHandle === "false");
124
+ return e ? i.find((t) => t.id === e.destinationNodeId) : null;
125
+ }
126
+ if (typeof s != "function") {
127
+ `${o}`;
128
+ let e = a.find((e) => e.sourceNodeId === r.id && e.sourceHandle === "false");
129
+ return e ? i.find((t) => t.id === e.destinationNodeId) : null;
130
+ }
131
+ try {
132
+ `${o}`, await s({
133
+ ...n,
134
+ args: []
135
+ }, { experience: Z });
136
+ let e = a.find((e) => e.sourceNodeId === r.id && e.sourceHandle === "true");
137
+ if (!e) return `${r.id}`, null;
138
+ let t = i.find((t) => t.id === e.destinationNodeId);
139
+ return `${o}${t?.id}`, t || null;
140
+ } catch {
141
+ `${o}`;
142
+ let e = a.find((e) => e.sourceNodeId === r.id && e.sourceHandle === "false");
143
+ if (!e) return `${r.id}`, null;
144
+ let t = i.find((t) => t.id === e.destinationNodeId);
145
+ return `${o}${t?.id}`, t || null;
146
+ }
147
+ }
148
+ }), ie = c((e) => {
149
+ g(e) && r.experiences.launch({ key: e.experienceKey });
150
+ }), q = i({
151
+ source: [N, s.treeStore],
152
+ effect: async ([e, { nodes: t, edges: n }]) => w(e, t, n)
153
+ }), J = i({
154
+ source: [N, s.treeStore],
155
+ effect: async ([e, { nodes: t, edges: n }]) => w(e, t, n)
156
+ }), ae = c((e) => {
157
+ r.history.push({
158
+ experienceId: s.id,
159
+ node: e
160
+ });
161
+ }), Y = i({
162
+ source: s.configStore,
163
+ effect: async ({ initializeOpenLogic: n }) => p?.initialiseOpen === void 0 ? e(n) ? !!await t(r, n) : n ?? !1 : p.initialiseOpen
164
+ }), X = a(k, r.frameworks.listStore, (e, t) => {
165
+ if (!e) return null;
166
+ let n = t.find((t) => t.name === e.component.frameworkName);
167
+ return n ? {
168
+ component: e,
169
+ framework: n
170
+ } : null;
171
+ }, { skipVoid: !1 }), Z, oe = i({
172
+ source: X,
173
+ effect: (e) => {
174
+ if (!e) return;
175
+ if (!f) {
176
+ `${s.id}`;
177
+ return;
178
+ }
179
+ let t = n(f);
180
+ try {
181
+ e.framework.render(t, e.component.component, r, Z);
182
+ } catch {}
183
+ }
184
+ });
185
+ Z = Object.freeze({
186
+ id: Math.random().toString(36).substring(7),
187
+ experienceKey: s.key,
188
+ experienceId: s.id,
189
+ experienceName: s.name,
190
+ configStore: s.configStore,
191
+ target: f,
192
+ componentStore: k,
193
+ componentAndFrameworkStore: X,
194
+ stateStore: A,
195
+ isOpenStore: R,
196
+ open: z.open,
197
+ close: z.close,
198
+ toggleOpen: z.toggle,
199
+ setOpen: z.set,
200
+ treeStore: s.treeStore,
201
+ currentNodeStore: N,
202
+ currentStepStore: P,
203
+ previousStepStore: re,
204
+ nextReachableStepNodesStore: F,
205
+ stepsToOriginStore: I,
206
+ stepsToLeafStore: L,
207
+ goToNextStep: b,
208
+ goToPreviousStep: x,
209
+ goToStepById: E,
210
+ stepsHistoryStore: M,
211
+ mountFx: oe
212
+ });
213
+ let Q = l(), $ = l();
214
+ return u({
215
+ clock: N,
216
+ target: Q
217
+ }), u({
218
+ clock: Q,
219
+ filter: (e) => e === null,
220
+ target: U
221
+ }), u({
222
+ clock: Q,
223
+ filter: (e) => e !== null,
224
+ target: $
225
+ }), d({
226
+ source: $,
227
+ match: (e) => m(e) ? "condition" : h(e) ? "step" : g(e) ? "launchExperience" : _(e) ? "origin" : v(e) ? "action" : "other",
228
+ cases: {
229
+ origin: W,
230
+ condition: G,
231
+ step: H,
232
+ launchExperience: ie,
233
+ action: K,
234
+ __: l()
235
+ }
236
+ }), u({
237
+ clock: [
238
+ G.doneData,
239
+ W.doneData,
240
+ U.doneData,
241
+ J.doneData,
242
+ q.doneData,
243
+ K.doneData
244
+ ],
245
+ filter: Boolean,
246
+ target: ae
247
+ }), u({
248
+ clock: b,
249
+ target: J
250
+ }), u({
251
+ clock: b,
252
+ source: P,
253
+ filter: Boolean,
254
+ target: r.eventBus.prepend((e) => ({
255
+ type: "step_submit",
256
+ step: e,
257
+ experience: Z
258
+ }))
259
+ }), u({
260
+ clock: J.done,
261
+ source: P,
262
+ filter: Boolean,
263
+ target: r.eventBus.prepend((e) => ({
264
+ type: "step_submit_success",
265
+ step: e,
266
+ experience: Z
267
+ }))
268
+ }), u({
269
+ clock: J.fail,
270
+ source: P,
271
+ filter: Boolean,
272
+ target: r.eventBus.prepend((e) => ({
273
+ type: "step_submit_error",
274
+ step: e,
275
+ experience: Z
276
+ }))
277
+ }), u({
278
+ clock: x,
279
+ target: B
280
+ }), u({
281
+ clock: E,
282
+ target: V
283
+ }), u({
284
+ source: a([
285
+ G.pending,
286
+ W.pending,
287
+ U.pending,
288
+ J.pending
289
+ ]),
290
+ fn: (e) => e.some(Boolean) ? "transitioning" : "ready",
291
+ target: A
292
+ }), u({
293
+ clock: H.doneData,
294
+ source: P,
295
+ filter: Boolean,
296
+ target: r.eventBus.prepend((e) => ({
297
+ type: "step_enter",
298
+ step: e,
299
+ experience: Z
300
+ }))
301
+ }), u({
302
+ clock: O,
303
+ target: Y
304
+ }), u({
305
+ source: Y.doneData,
306
+ fn: Boolean,
307
+ target: R
308
+ }), u({
309
+ source: N,
310
+ clock: y,
311
+ filter: (e) => e ? _(e) : !0,
312
+ target: q
313
+ }), u({
314
+ source: R,
315
+ filter: Boolean,
316
+ target: y
317
+ }), u({
318
+ source: R,
319
+ filter: Boolean,
320
+ target: r.eventBus.prepend(() => ({
321
+ type: "experience_open",
322
+ experience: Z
323
+ }))
324
+ }), u({
325
+ source: R,
326
+ filter: (e) => !e,
327
+ target: r.eventBus.prepend(() => ({
328
+ type: "experience_close",
329
+ experience: Z
330
+ }))
331
+ }), u({
332
+ clock: D,
333
+ target: [O]
334
+ }), D(), Z;
335
+ });
336
+ function D(e) {
337
+ return p(E, e);
338
+ }
339
+ var O = f(({ client: e }) => {
340
+ let t = T.store({}), n = l(), i = l(), a = l(), s = o(t, {
341
+ register(e, t) {
342
+ let n = [...e[t.experienceId] ?? []];
343
+ return n.push(t), {
344
+ ...e,
345
+ [t.experienceId]: n
346
+ };
347
+ },
348
+ unregister(e, t) {
349
+ let n = t.experienceId, r = e[n]?.filter((e) => e !== t);
350
+ return {
351
+ ...e,
352
+ [n]: r ?? []
353
+ };
354
+ }
355
+ }), d = c(({ experience: t, target: n, options: r }) => D({
356
+ client: e,
357
+ experience: t,
358
+ target: n,
359
+ options: r
360
+ })), f = c((e) => {
361
+ s.register(e);
362
+ }), p = c((e) => {
363
+ e.target && r(e.target, () => {
364
+ a(e);
365
+ });
366
+ }), m = c((e) => {
367
+ s.unregister(e);
368
+ }), h = c(async (e) => {
369
+ await e.mountFx();
370
+ });
371
+ u({
372
+ clock: n,
373
+ target: d
374
+ }), u({
375
+ clock: a,
376
+ target: m
377
+ }), u({
378
+ clock: d.doneData,
379
+ target: [
380
+ f,
381
+ p,
382
+ i
383
+ ]
384
+ }), u({
385
+ clock: d.doneData,
386
+ target: e.eventBus.prepend((e) => ({
387
+ type: "experience_initialize",
388
+ experience: e
389
+ }))
390
+ }), u({
391
+ clock: i,
392
+ target: h
393
+ });
394
+ function g(e, t, r) {
395
+ n({
396
+ experience: e,
397
+ target: t,
398
+ options: r
399
+ });
400
+ }
401
+ let _ = t.map((e) => Object.values(e).flat());
402
+ function v(e) {
403
+ return _.map((t) => t.filter((t) => t.experienceKey === e), { skipVoid: !1 });
404
+ }
405
+ function y(e) {
406
+ return t.map((t) => t[e] || [], { skipVoid: !1 });
407
+ }
408
+ return {
409
+ spawn: g,
410
+ getByExperienceKey: v,
411
+ getByExperienceId: y,
412
+ listStore: _
413
+ };
414
+ });
415
+ function k(e) {
416
+ return p(O, e);
417
+ }
418
+ //#endregion
419
+ export { h as i, k as n, m as r, D as t };
@@ -0,0 +1 @@
1
+ const e=require(`./rules-logic-H6P8xwHF.cjs`);require(`./logger-fbvQC40v.cjs`);const t=require(`./dom-C3C6Fmwz.cjs`);let n=require(`effector`),r=require(`@withease/factories`);function i(e){return e.type===`condition`}function a(e){return e.type===`step`}function o(e){return e.type===`experience`}function s(e){return e.type===`origin`}function c(e){return e.type===`action`}var l=(e,t,n,r,i=new Set)=>i.has(n.id)?[]:(i.add(n.id),a(n)&&!r?[n]:t.filter(e=>e.sourceNodeId===n.id).flatMap(n=>{let r=e.find(e=>e.id===n.destinationNodeId);return r?l(e,t,r,!1,i):[]})),u=(e,t,n)=>l(e,t,n,!0,new Set),d=(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 o=1/0,s=-1/0;for(let n of a){let r=e.find(e=>e.id===n.destinationNodeId);if(!r)continue;let[a,c]=d(e,t,r,!1,new Set(i));a!==-1&&(o=Math.min(o,a+1),s=Math.max(s,c+1))}return o===1/0?[-1,-1]:[o,s]},f=(e,t,n)=>d(e,t,n,!0,new Set),p=(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,c]=p(e,t,i,new Set(r));s!==-1&&(a=Math.min(a,s+1),o=Math.max(o,c+1))}return a===1/0?[-1,-1]:[a,o]},m=(e,t,n)=>p(e,t,n,new Set),h=e=>e.find(e=>e.type===`origin`)||null,g=(e,t,n)=>{if(!e)return h(t);let r=n.find(t=>t.sourceNodeId===e.id);return r&&t.find(e=>e.id===r.destinationNodeId)||null};async function _(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 v=(0,n.createDomain)(`experience-instance`),y=(0,r.createFactory)(({client:r,experience:l,target:d,options:p})=>{let y=(0,n.createEvent)(),b=(0,n.createEvent)(),x=(0,n.createEvent)(),S=(0,n.createEvent)(),C=(0,n.createEvent)(),w=(0,n.createEvent)(),T=l.componentStore,E=v.store(`transitioning`),D=r.history.entriesStore.map(e=>e.filter(e=>e.experienceId===l.id)),O=D.map(e=>e.filter(e=>a(e.node))),k=D.map(e=>e.at(-1)?.node||null),A=(0,n.combine)(r.steps.listStore,k,(e,t)=>e.find(e=>t&&a(t)&&e.id===t.stepId)||null),j=(0,n.combine)(r.steps.listStore,O,(e,t)=>{let n=t.at(-2);if(!n||!a(n.node))return null;let r=n.node;return e.find(e=>e.id===r.stepId)||null}),M=(0,n.combine)(l.treeStore,k,({nodes:e,edges:t},n)=>n?u(e,t,n):[]),N=(0,n.combine)(l.treeStore,k,({nodes:e,edges:t},n)=>n?m(e,t,n):[-1,-1]),P=(0,n.combine)(l.treeStore,k,({nodes:e,edges:t},n)=>n?f(e,t,n):[-1,-1]),F=v.store(!1),I=(0,n.createApi)(F,{open:()=>!0,close:()=>!1,toggle:e=>!e,set:(e,t)=>t}),L=(0,n.createEffect)(async()=>{r.history.back({experienceId:l.id})}),R=(0,n.attach)({source:l.treeStore,effect:async(e,t)=>{let n=e.nodes.find(e=>a(e)&&e.stepId===t);n&&r.history.push({experienceId:l.id,node:n})}}),z=(0,n.attach)({source:k,effect:e=>{}}),B=(0,n.attach)({source:l.treeStore,effect:async({nodes:e})=>h(e)}),V=(0,n.attach)({source:l.treeStore,effect:async({nodes:e,edges:t},n)=>{if(s(n))return g(n,e,t)}}),H=(0,n.attach)({source:l.treeStore,effect:async({nodes:t,edges:n,conditions:a},o)=>{if(!i(o))return;let s=a.find(e=>e.id===o.conditionId)?.logic;return s?_(!!await e.t(r,s),o.id,t,n):void 0}}),U=(0,n.attach)({source:{tree:l.treeStore,actions:r.actions.listStore,snapshot:r.stateSnapshotStore},effect:async({tree:e,actions:t,snapshot:n},r)=>{let{nodes:i,edges:a}=e;if(!c(r))return;let o=r.actionKey;if(!o){`${r.id}`;return}let s=t.find(e=>e.key===o)?.action;if(!s){`${o}`;let e=a.find(e=>e.sourceNodeId===r.id&&e.sourceHandle===`false`);return e?i.find(t=>t.id===e.destinationNodeId):null}if(typeof s!=`function`){`${o}`;let e=a.find(e=>e.sourceNodeId===r.id&&e.sourceHandle===`false`);return e?i.find(t=>t.id===e.destinationNodeId):null}try{`${o}`,await s({...n,args:[]},{experience:X});let e=a.find(e=>e.sourceNodeId===r.id&&e.sourceHandle===`true`);if(!e)return`${r.id}`,null;let t=i.find(t=>t.id===e.destinationNodeId);return`${o}${t?.id}`,t||null}catch{`${o}`;let e=a.find(e=>e.sourceNodeId===r.id&&e.sourceHandle===`false`);if(!e)return`${r.id}`,null;let t=i.find(t=>t.id===e.destinationNodeId);return`${o}${t?.id}`,t||null}}}),W=(0,n.createEffect)(e=>{o(e)&&r.experiences.launch({key:e.experienceKey})}),G=(0,n.attach)({source:[k,l.treeStore],effect:async([e,{nodes:t,edges:n}])=>g(e,t,n)}),K=(0,n.attach)({source:[k,l.treeStore],effect:async([e,{nodes:t,edges:n}])=>g(e,t,n)}),q=(0,n.createEffect)(e=>{r.history.push({experienceId:l.id,node:e})}),J=(0,n.attach)({source:l.configStore,effect:async({initializeOpenLogic:t})=>p?.initialiseOpen===void 0?e.n(t)?!!await e.t(r,t):t??!1:p.initialiseOpen}),Y=(0,n.combine)(T,r.frameworks.listStore,(e,t)=>{if(!e)return null;let n=t.find(t=>t.name===e.component.frameworkName);return n?{component:e,framework:n}:null},{skipVoid:!1}),X,Z=(0,n.attach)({source:Y,effect:e=>{if(!e)return;if(!d){`${l.id}`;return}let n=t.n(d);try{e.framework.render(n,e.component.component,r,X)}catch{}}});X=Object.freeze({id:Math.random().toString(36).substring(7),experienceKey:l.key,experienceId:l.id,experienceName:l.name,configStore:l.configStore,target:d,componentStore:T,componentAndFrameworkStore:Y,stateStore:E,isOpenStore:F,open:I.open,close:I.close,toggleOpen:I.toggle,setOpen:I.set,treeStore:l.treeStore,currentNodeStore:k,currentStepStore:A,previousStepStore:j,nextReachableStepNodesStore:M,stepsToOriginStore:N,stepsToLeafStore:P,goToNextStep:b,goToPreviousStep:x,goToStepById:S,stepsHistoryStore:O,mountFx:Z});let Q=(0,n.createEvent)(),$=(0,n.createEvent)();return(0,n.sample)({clock:k,target:Q}),(0,n.sample)({clock:Q,filter:e=>e===null,target:B}),(0,n.sample)({clock:Q,filter:e=>e!==null,target:$}),(0,n.split)({source:$,match:e=>i(e)?`condition`:a(e)?`step`:o(e)?`launchExperience`:s(e)?`origin`:c(e)?`action`:`other`,cases:{origin:V,condition:H,step:z,launchExperience:W,action:U,__:(0,n.createEvent)()}}),(0,n.sample)({clock:[H.doneData,V.doneData,B.doneData,K.doneData,G.doneData,U.doneData],filter:Boolean,target:q}),(0,n.sample)({clock:b,target:K}),(0,n.sample)({clock:b,source:A,filter:Boolean,target:r.eventBus.prepend(e=>({type:`step_submit`,step:e,experience:X}))}),(0,n.sample)({clock:K.done,source:A,filter:Boolean,target:r.eventBus.prepend(e=>({type:`step_submit_success`,step:e,experience:X}))}),(0,n.sample)({clock:K.fail,source:A,filter:Boolean,target:r.eventBus.prepend(e=>({type:`step_submit_error`,step:e,experience:X}))}),(0,n.sample)({clock:x,target:L}),(0,n.sample)({clock:S,target:R}),(0,n.sample)({source:(0,n.combine)([H.pending,V.pending,B.pending,K.pending]),fn:e=>e.some(Boolean)?`transitioning`:`ready`,target:E}),(0,n.sample)({clock:z.doneData,source:A,filter:Boolean,target:r.eventBus.prepend(e=>({type:`step_enter`,step:e,experience:X}))}),(0,n.sample)({clock:w,target:J}),(0,n.sample)({source:J.doneData,fn:Boolean,target:F}),(0,n.sample)({source:k,clock:y,filter:e=>e?s(e):!0,target:G}),(0,n.sample)({source:F,filter:Boolean,target:y}),(0,n.sample)({source:F,filter:Boolean,target:r.eventBus.prepend(()=>({type:`experience_open`,experience:X}))}),(0,n.sample)({source:F,filter:e=>!e,target:r.eventBus.prepend(()=>({type:`experience_close`,experience:X}))}),(0,n.sample)({clock:C,target:[w]}),C(),X});function b(e){return(0,r.invoke)(y,e)}var x=(0,r.createFactory)(({client:e})=>{let r=v.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})=>b({client:e,experience:t,target:n,options:r})),l=(0,n.createEffect)(e=>{s.register(e)}),u=(0,n.createEffect)(e=>{e.target&&t.o(e.target,()=>{o(e)})}),d=(0,n.createEffect)(e=>{s.unregister(e)}),f=(0,n.createEffect)(async e=>{await e.mountFx()});(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 p(e,t,n){i({experience:e,target:t,options:n})}let m=r.map(e=>Object.values(e).flat());function h(e){return m.map(t=>t.filter(t=>t.experienceKey===e),{skipVoid:!1})}function g(e){return r.map(t=>t[e]||[],{skipVoid:!1})}return{spawn:p,getByExperienceKey:h,getByExperienceId:g,listStore:m}});function S(e){return(0,r.invoke)(x,e)}Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return b}});
@@ -0,0 +1,13 @@
1
+ import { t as e } from "./object-DvUDOytC.js";
2
+ //#region src/utils/rules-logic.ts
3
+ function t(t) {
4
+ return !e(t);
5
+ }
6
+ async function n(e, t, n) {
7
+ return await e.evaluateRuleLogicFx({
8
+ rule: t,
9
+ context: n
10
+ });
11
+ }
12
+ //#endregion
13
+ export { t as n, n as t };
@@ -0,0 +1 @@
1
+ const e=require(`./object-ThO1DEyl.cjs`);function t(t){return!e.t(t)}async function n(e,t,n){return await e.evaluateRuleLogicFx({rule:t,context:n})}Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return n}});
@@ -6,8 +6,8 @@ import { AdaptedComponent } from './entities/component/component';
6
6
  import { LogicRule } from './logic-engine';
7
7
  export interface CreateClientOptions {
8
8
  /**
9
- * Your organizations unique identifier.
10
- * If not provided the organizationId will be read from window.pickedConfig.organizationId or data-organizationid on the script tag.
9
+ * @deprecated The organization id is no longer used by the Picked client. The
10
+ * field is accepted for backwards compatibility but the value is ignored.
11
11
  */
12
12
  organizationId?: string;
13
13
  /**
@@ -1,5 +1,5 @@
1
- import { Store } from 'effector';
2
- import { StateSnapshot } from '../../utils/state-snaphot';
1
+ import { EventCallable, Store } from 'effector';
2
+ import { StateSnapshot } from '../../lifecycle/state-snapshot';
3
3
  import { Picked } from '../../picked';
4
4
  import { ExperienceInstance } from '../experience-instance/experience-instance';
5
5
  /**
@@ -40,7 +40,10 @@ export interface ActionIndexItem {
40
40
  declare const createActionIndexFactory: ({ client }: {
41
41
  client: Picked;
42
42
  }) => {
43
- register: (key: string, action: Action) => void;
43
+ register: EventCallable<{
44
+ key: string;
45
+ action: Action;
46
+ }>;
44
47
  getByKey: (key: string) => Store<Action | undefined>;
45
48
  listStore: Store<ActionIndexItem[]>;
46
49
  getEvokableAction: (actionKey: string, options?: {
@@ -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,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4CAA4C,CAAA;AAEpF;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,sEAAsE;IACtE,UAAU,EAAE,kBAAkB,CAAA;CAC/B;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,MAAM,GAAG,CACnB,QAAQ,EAAE,aAAa,GAAG;IAAE,IAAI,EAAE,OAAO,EAAE,CAAA;CAAE,EAC7C,OAAO,EAAE,aAAa,GAAG,IAAI,KAE3B,OAAO,GACP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ked } from '../../picked';
3
3
  import { LazyComponentLoader } from './lazyComponent';
4
4
  export interface AdaptedComponentStyle {
@@ -32,11 +32,25 @@ declare const createComponentFactory: ({ client, component, name }: {
32
32
  component: AdaptedComponent<string, unknown>;
33
33
  frameworkStore: Store<import('../..').Framework | undefined>;
34
34
  };
35
+ /**
36
+ * Creates a component with framework-specific metadata and loader.
37
+ *
38
+ * @template T - Factory parameter type.
39
+ * @param params - The client, component name, and adapted component.
40
+ * @returns A component with name, component, and frameworkStore.
41
+ * @example
42
+ * ```ts
43
+ * const component = createComponent({ client, name: 'experience', component: adaptedComp })
44
+ * ```
45
+ */
35
46
  export declare function createComponent<T extends Parameters<typeof createComponentFactory>[0]>(params: T): ReturnType<typeof createComponentFactory>;
36
47
  declare const createComponentIndexFactory: ({ client }: {
37
48
  client: Picked;
38
49
  }) => {
39
- register: (name: string, component: AdaptedComponent) => void;
50
+ register: EventCallable<{
51
+ name: string;
52
+ component: AdaptedComponent;
53
+ }>;
40
54
  getByName: (name: string) => Store<{
41
55
  name: string;
42
56
  component: AdaptedComponent;
@@ -47,7 +61,30 @@ declare const createComponentIndexFactory: ({ client }: {
47
61
  frameworkStore: Store<import('../..').Framework | undefined>;
48
62
  }[]>;
49
63
  };
64
+ /**
65
+ * Creates a component index with lifecycle stores and registration logic.
66
+ *
67
+ * @template T - Factory parameter type.
68
+ * @param {T} params - Factory parameters including the client.
69
+ * @returns {ReturnType<typeof createComponentIndexFactory>} The component index with register, getByName, and listStore methods.
70
+ * @example
71
+ * ```ts
72
+ * const components = createComponentIndex({ client })
73
+ * components.register('experience', adaptedComponent)
74
+ * ```
75
+ */
50
76
  export declare function createComponentIndex<T extends Parameters<typeof createComponentIndexFactory>[0]>(params: T): ReturnType<typeof createComponentIndexFactory>;
77
+ /**
78
+ * Convenience helper that registers a single component on the given index.
79
+ *
80
+ * @param {string} name - Unique name for the component.
81
+ * @param {AdaptedComponent} component - The adapted component to register.
82
+ * @param {ComponentIndex} components - The component index to register into.
83
+ * @example
84
+ * ```ts
85
+ * setupComponent('experience', adaptedComponent, componentsIndex)
86
+ * ```
87
+ */
51
88
  export declare const setupComponent: (name: string, component: AdaptedComponent, components: ComponentIndex) => void;
52
89
  export {};
53
90
  //# sourceMappingURL=component.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../../src/entities/component/component.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAIrC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAE1D,MAAM,WAAW,qBAAqB;IACpC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;IACjB,GAAG,CAAC,EAAE,MAAM,EAAE,CAAA;CACf;AAED,MAAM,WAAW,oBAAoB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,CAAC,GAAG,OAAO;IAC1E,aAAa,EAAE,CAAC,CAAA;IAChB,SAAS,EAAE,OAAO,CAAC;QAAE,OAAO,EAAE,CAAC,CAAA;KAAE,CAAC,GAAG,mBAAmB,CAAC,CAAC,CAAC,CAAA;IAC3D,KAAK,CAAC,EAAE,qBAAqB,CAAA;CAC9B;AAED,MAAM,WAAW,qBAAqB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,CAAC,GAAG,OAAO;IAC3E,aAAa,EAAE,CAAC,CAAA;IAChB,SAAS,EAAE,CAAC,CAAA;IACZ,KAAK,CAAC,EAAE,qBAAqB,CAAA;CAC9B;AAED,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,CAAC,GAAG,OAAO,IAC/D,oBAAoB,CAAC,CAAC,EAAE,CAAC,CAAC,GAC1B,qBAAqB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;AAE/B,MAAM,WAAW,mBAAmB,CAAC,CAAC,GA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AACH,wBAAgB,eAAe,CAAC,CAAC,SAAS,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAAC,CAAC,CAAC,EACpF,MAAM,EAAE,CAAC,GACR,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAE3C;AAED,QAAA,MAAM,2BAA2B,eAA8B;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE;;cAkBzC,MAAM;mBAAa,gBAAgB;;sBAmChD,MAAM,KAAG,KAAK,CACnC;QACE,IAAI,EAAE,MAAM,CAAA;QACZ,SAAS,EAAE,gBAAgB,CAAA;KAC5B,GACD,SAAS,CACZ;;;;;;CASD,CAAA;AAEF;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,UAAU,CAAC,OAAO,2BAA2B,CAAC,CAAC,CAAC,CAAC,EAC9F,MAAM,EAAE,CAAC,GACR,UAAU,CAAC,OAAO,2BAA2B,CAAC,CAEhD;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,cAAc,GACzB,MAAM,MAAM,EACZ,WAAW,gBAAgB,EAC3B,YAAY,cAAc,KACzB,IAEF,CAAA"}
@@ -0,0 +1,37 @@
1
+ import { Store } from 'effector';
2
+ export interface Content {
3
+ id: string;
4
+ data: Record<string, unknown>;
5
+ }
6
+ export type ContentsStore = ReturnType<typeof createContentIndex>;
7
+ declare const createContentIndexFactory: () => {
8
+ register: (content: Content) => void;
9
+ getById: (id: Content["id"]) => Store<Content | null>;
10
+ listStore: Store<Content[]>;
11
+ indexStore: import('effector').StoreWritable<{
12
+ [id: string]: Content;
13
+ }>;
14
+ };
15
+ /**
16
+ * Creates an Effector-based index for registering and retrieving content records.
17
+ *
18
+ * @returns {ContentsStore} A content index with register, getById, and listStore.
19
+ * @example
20
+ * ```typescript
21
+ * const contents = createContentIndex()
22
+ * ```
23
+ */
24
+ export declare function createContentIndex(): ReturnType<typeof createContentIndexFactory>;
25
+ /**
26
+ * Registers a content record with the given index via the helper function.
27
+ *
28
+ * @param {Content} content - The content record to register.
29
+ * @param {ContentsStore} index - The content index to register the record with.
30
+ * @example
31
+ * ```typescript
32
+ * setupContent(content, index)
33
+ * ```
34
+ */
35
+ export declare function setupContent(content: Content, index: ContentsStore): void;
36
+ export {};
37
+ //# sourceMappingURL=content.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../../../src/entities/content/content.ts"],"names":[],"mappings":"AAAA,oGAAoG;AACpG,OAAO,EAA2B,KAAK,KAAK,EAAE,MAAM,UAAU,CAAA;AAK9D,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC9B;AAED,MAAM,MAAM,aAAa,GAAG,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAEjE,QAAA,MAAM,yBAAyB;wBAuBF,OAAO,KAAG,IAAI;kBAmBpB,OAAO,CAAC,IAAI,CAAC,KAAG,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC;;;;;CAU1D,CAAA;AAEF;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,IAAI,UAAU,CAAC,OAAO,yBAAyB,CAAC,CAEjF;AAED;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,aAAa,GAAG,IAAI,CAEzE"}