@picked/client 0.0.83-next.2 → 0.0.84-next.1
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/.tsbuildinfo +1 -1
- package/dist/{api-DqBJhsaz.js → api-MpZsPlFm.js} +1 -1
- package/dist/api-fdr8U6uj.cjs +1 -0
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/plugins/dynamic-experiences/index.js +1 -1
- package/dist/cjs/server/index.js +1 -1
- package/dist/docs/reference/tools/mcp.md +32 -31
- package/dist/esm/index.js +376 -398
- package/dist/esm/plugins/dynamic-experiences/index.js +2 -2
- package/dist/esm/server/index.js +39 -35
- package/dist/plugin-CP-W1V0R.cjs +1 -0
- package/dist/{plugin-WtyPGoxi.js → plugin-CdfjHKod.js} +68 -52
- package/dist/{version-DSu8zrH_.js → preview-unavailable-Cs6tiz5X.js} +104 -61
- package/dist/preview-unavailable-p5as3RNK.cjs +1 -0
- package/dist/{provider-Bv6_St9B.js → provider-DUACzeBR.js} +6 -3
- package/dist/provider-Dk6CixDl.cjs +1 -0
- package/dist/types/data-source/preview-unavailable.d.ts +18 -0
- package/dist/types/data-source/preview-unavailable.d.ts.map +1 -0
- package/dist/types/data-source/provider.d.ts +5 -0
- package/dist/types/data-source/provider.d.ts.map +1 -1
- package/dist/types/exports.d.ts +1 -0
- package/dist/types/exports.d.ts.map +1 -1
- package/dist/types/picked.d.ts +6 -0
- package/dist/types/picked.d.ts.map +1 -1
- package/dist/types/plugins/dynamic-experiences/plugin.d.ts.map +1 -1
- package/dist/types/server/serialize.d.ts +1 -0
- package/dist/types/server/serialize.d.ts.map +1 -1
- package/dist/types/utils/search-params.d.ts +20 -0
- package/dist/types/utils/search-params.d.ts.map +1 -1
- package/package.json +3 -3
- package/dist/api-lXnAqLoj.cjs +0 -1
- package/dist/plugin-K7326WFb.cjs +0 -1
- package/dist/provider-DB9w0dEw.cjs +0 -1
- package/dist/version-SYU8CWbk.cjs +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as e } from "../../../plugin-
|
|
2
|
-
import { n as t, t as n } from "../../../api-
|
|
1
|
+
import { t as e } from "../../../plugin-CdfjHKod.js";
|
|
2
|
+
import { n as t, t as n } from "../../../api-MpZsPlFm.js";
|
|
3
3
|
import { n as r } from "../../../registry-CXZv0uLg.js";
|
|
4
4
|
import { createClientHeaders as i, fetchSchema as a } from "@picked/delivery-api-client";
|
|
5
5
|
export { i as createClientHeaders, e as dynamicExperiencesPlugin, n as fetchExperienceContent, t as fetchProject, a as fetchSchema, r as registerPickedBundle };
|
package/dist/esm/server/index.js
CHANGED
|
@@ -1,41 +1,45 @@
|
|
|
1
1
|
import { a as e, c as t, d as n, i as r, o as i, s as a, t as o } from "../../experience-instance-BibCf-8y.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { t as s } from "../../preview-unavailable-Cs6tiz5X.js";
|
|
3
|
+
import { n as c } from "../../plugin-CdfjHKod.js";
|
|
4
|
+
import { attach as l, createEffect as u, createEvent as d, createStore as f, sample as p } from "effector";
|
|
4
5
|
//#region src/server/serialize.ts
|
|
5
|
-
var
|
|
6
|
-
function
|
|
6
|
+
var m = 1e4;
|
|
7
|
+
function h(e) {
|
|
7
8
|
if (e?.location !== void 0) return { location: e.location };
|
|
8
9
|
}
|
|
9
|
-
function
|
|
10
|
+
function g(e, t) {
|
|
10
11
|
return e.nodes.filter(n).some((e) => t.get(e.stepId) === !0);
|
|
11
12
|
}
|
|
12
|
-
async function
|
|
13
|
-
let r = n.previewToken === void 0 ? void 0 : { previewToken: n.previewToken }, a = await e.getProjectConfig(r)
|
|
14
|
-
|
|
13
|
+
async function _(e, n = {}) {
|
|
14
|
+
let r = n.previewToken === void 0 ? void 0 : { previewToken: n.previewToken }, a = await e.getProjectConfig(r).catch((t) => {
|
|
15
|
+
if (!(t instanceof s)) throw t;
|
|
16
|
+
return r = void 0, e.getProjectConfig();
|
|
17
|
+
}), o = e.session.store.getState().id;
|
|
18
|
+
e.conditionResults.reset(), c(e, a, {
|
|
15
19
|
isPreview: !1,
|
|
16
20
|
sessionId: o
|
|
17
21
|
});
|
|
18
|
-
let
|
|
22
|
+
let l = h(n.attributes), u = n.timeoutMs ?? m, d = new Map(a.steps.map((e) => [e.id, e.layoutContentId !== void 0 && e.layoutContentId !== null])), f = Object.fromEntries(a.conditions.map((e) => [e.key, e])), p = a.experiences.filter((e) => !t(e.condition, f)), _ = (await Promise.all(p.map(async (t) => ({
|
|
19
23
|
experience: t,
|
|
20
|
-
active: await i(e, { condition: t.condition }, { context:
|
|
21
|
-
})))).filter((e) => e.active).map((e) => e.experience),
|
|
24
|
+
active: await i(e, { condition: t.condition }, { context: l })
|
|
25
|
+
})))).filter((e) => e.active).map((e) => e.experience), v = await Promise.all(_.filter((e) => g(e, d)).map((t) => e.getExperienceContent({
|
|
22
26
|
id: t.id,
|
|
23
27
|
key: t.key
|
|
24
28
|
}, {
|
|
25
29
|
...r,
|
|
26
|
-
signal: AbortSignal.timeout(
|
|
27
|
-
}))),
|
|
28
|
-
for (let e of
|
|
30
|
+
signal: AbortSignal.timeout(u)
|
|
31
|
+
}))), y = /* @__PURE__ */ new Map();
|
|
32
|
+
for (let e of v) if (e) for (let t of [...e.references ?? [], ...e.content]) y.set(t.id, t);
|
|
29
33
|
return {
|
|
30
34
|
versionId: a.versionId,
|
|
31
35
|
projectConfig: a,
|
|
32
|
-
content: Array.from(
|
|
36
|
+
content: Array.from(y.values()),
|
|
33
37
|
conditionResults: e.conditionResults.store.getState()
|
|
34
38
|
};
|
|
35
39
|
}
|
|
36
40
|
//#endregion
|
|
37
41
|
//#region src/server/index.ts
|
|
38
|
-
function
|
|
42
|
+
function v() {
|
|
39
43
|
let e, t;
|
|
40
44
|
return {
|
|
41
45
|
promise: new Promise((n, r) => {
|
|
@@ -45,16 +49,16 @@ function _() {
|
|
|
45
49
|
reject: (e) => t(e)
|
|
46
50
|
};
|
|
47
51
|
}
|
|
48
|
-
function
|
|
49
|
-
let { promise: n, resolve: r } =
|
|
52
|
+
function y(e, t) {
|
|
53
|
+
let { promise: n, resolve: r } = v(), i = d(), a = d(), s = d(), c = d(), m = d(), h = e.experiences.listStore.map((t) => t.map((t) => o({
|
|
50
54
|
client: e,
|
|
51
55
|
experience: t
|
|
52
|
-
}))), g =
|
|
56
|
+
}))), g = f({
|
|
53
57
|
currentExperienceIndex: 0,
|
|
54
58
|
renderedExperiences: [],
|
|
55
59
|
isComplete: !1
|
|
56
|
-
}),
|
|
57
|
-
let n =
|
|
60
|
+
}), _ = u(async (t) => {
|
|
61
|
+
let n = l({
|
|
58
62
|
source: t.experience.componentStore,
|
|
59
63
|
effect: async (n, r) => {
|
|
60
64
|
let i = t.availableRenderers[r];
|
|
@@ -69,7 +73,7 @@ function v(e, t) {
|
|
|
69
73
|
if (t) return t;
|
|
70
74
|
}
|
|
71
75
|
return null;
|
|
72
|
-
}), y =
|
|
76
|
+
}), y = u(async ({ experience: e, availableRenderers: t, startRendererIndex: n = 0 }) => e ? _({
|
|
73
77
|
experience: e,
|
|
74
78
|
availableRenderers: t,
|
|
75
79
|
startRendererIndex: n
|
|
@@ -81,13 +85,13 @@ function v(e, t) {
|
|
|
81
85
|
})).on(m, (e) => ({
|
|
82
86
|
...e,
|
|
83
87
|
currentExperienceIndex: e.currentExperienceIndex + 1
|
|
84
|
-
})).on(
|
|
88
|
+
})).on(c, (e) => ({
|
|
85
89
|
...e,
|
|
86
90
|
isComplete: !0
|
|
87
|
-
})).reset(i),
|
|
91
|
+
})).reset(i), p({
|
|
88
92
|
clock: i,
|
|
89
93
|
target: a
|
|
90
|
-
}),
|
|
94
|
+
}), p({
|
|
91
95
|
clock: a,
|
|
92
96
|
source: {
|
|
93
97
|
experiences: h,
|
|
@@ -100,22 +104,22 @@ function v(e, t) {
|
|
|
100
104
|
startRendererIndex: 0
|
|
101
105
|
}),
|
|
102
106
|
target: y
|
|
103
|
-
}),
|
|
107
|
+
}), p({
|
|
104
108
|
clock: y.doneData,
|
|
105
109
|
filter: (e) => e !== null,
|
|
106
110
|
fn: (e) => e.rendered.body,
|
|
107
111
|
target: s
|
|
108
|
-
}),
|
|
112
|
+
}), p({
|
|
109
113
|
clock: s,
|
|
110
114
|
target: a
|
|
111
|
-
}),
|
|
115
|
+
}), p({
|
|
112
116
|
clock: y.doneData,
|
|
113
117
|
filter: (e) => e === null,
|
|
114
118
|
target: m
|
|
115
|
-
}),
|
|
119
|
+
}), p({
|
|
116
120
|
clock: m,
|
|
117
121
|
target: a
|
|
118
|
-
}),
|
|
122
|
+
}), p({
|
|
119
123
|
clock: [
|
|
120
124
|
a,
|
|
121
125
|
m,
|
|
@@ -126,18 +130,18 @@ function v(e, t) {
|
|
|
126
130
|
state: g
|
|
127
131
|
},
|
|
128
132
|
filter: ({ experiences: e, state: t }) => t.currentExperienceIndex >= e.length,
|
|
129
|
-
target:
|
|
133
|
+
target: c
|
|
130
134
|
});
|
|
131
|
-
let b =
|
|
135
|
+
let b = l({
|
|
132
136
|
source: g,
|
|
133
137
|
effect: (e) => {
|
|
134
138
|
e.isComplete && r(e.renderedExperiences);
|
|
135
139
|
}
|
|
136
140
|
});
|
|
137
|
-
return
|
|
138
|
-
clock:
|
|
141
|
+
return p({
|
|
142
|
+
clock: c,
|
|
139
143
|
target: b
|
|
140
144
|
}), i(), n;
|
|
141
145
|
}
|
|
142
146
|
//#endregion
|
|
143
|
-
export { o as createExperienceInstance, r as evaluateConditionMemo, e as hashRule, i as isExperienceActive,
|
|
147
|
+
export { o as createExperienceInstance, r as evaluateConditionMemo, e as hashRule, i as isExperienceActive, c as registerProjectConfig, y as render, a as ruleReferencesAction, t as ruleReferencesActionDeep, _ as serialize };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require("./logger-CSTvAyyB.cjs");const e=require("./preview-unavailable-p5as3RNK.cjs");require("./api-fdr8U6uj.cjs");let t=require("effector");function n(e){let t=2166136261;for(let n of e)t^=n.codePointAt(0)??0,t=Math.imul(t,16777619);return t>>>0}function r(e){let t=e;return t^=t>>>16,t=Math.imul(t,2246822507),t^=t>>>13,t=Math.imul(t,3266489909),t^=t>>>16,t>>>0}function i(e,t){return r(n(`${e}:${t}`))%100}function a(e,t){return t<=0?!1:t>=100||e<t}var o=4294967296;function s(e,t,i){return(r(n(`${e}:${t}:${i}`))+.5)/o}function c(e,t,n){return n.weight<=0?0:n.weight/-Math.log(s(e,t,n.key))}function l(e,t,n){let r=null,i=0;for(let a of n){let n=c(e,t,a);n<=0||(n>i||n===i&&r!==null&&a.key<r.key)&&(i=n,r=a)}return r}function u(e,t){if(Array.isArray(t.conditions))for(let n of t.conditions)e.registerCondition(n)}function d(e,t){e.registerExperience({id:t.id,key:t.key,name:t.name,targets:t.targets,nodes:t.nodes,edges:t.edges,condition:t.condition,initializeOpen:t.initializeOpen,componentName:t.componentName})}function f(e){return typeof e!=`object`||!e?!1:`id`in e&&`key`in e&&`type`in e&&`name`in e}function p(e,t){if(Array.isArray(t.fields))for(let n of t.fields)f(n)&&e.registerField(n)}function m(e,t){if(!Array.isArray(t.steps))return;let n=new Map(t.fields.map(e=>[e.id,e.key]));for(let r of t.steps){let t=[];for(let e of r.fieldIds??[]){let i=n.get(e);if(i===void 0){`${r.key}${e}`;continue}t.push(i)}let i=r.layoutContentId?e.contents.getById(r.layoutContentId):null;e.registerStep({id:r.id,key:r.key,name:r.name,fieldKeys:t,layoutName:r.layoutName,...r.layoutContentId!==void 0&&{layoutContentId:r.layoutContentId,layoutContentStore:i}})}}function h(e,t){if(Array.isArray(t.experiences))for(let n of t.experiences)d(e,n)}function g(e,t,n){x(e,t,n.isPreview,n.sessionId),u(e,t),p(e,t),m(e,t),h(e,t)}function _(t){let n=t.searchParams[e.n];if(n&&n.length>0)return n[0]}function v(t,n){return t.getProjectConfig(n===void 0?void 0:{previewToken:n}).catch(t=>t instanceof e.t?t:null)}async function y(t){let n=_(t),r=await v(t,n);if(!(r instanceof e.t))return{config:r,previewToken:n};e.i(t.searchParams,e.n),t.previewUnavailable=!0,`${r.message}`;let i=await v(t,void 0);return{config:i instanceof e.t?null:i,previewToken:void 0}}function b(t){let n=new Map,r=t.searchParams.feature;if(!r)return n;for(let t of r){let r=e.c(t);r&&n.set(r.id,r.bucket)}return n}function x(e,t,n,r){let i=b(e);for(let a of t.features){let t=i.get(a.id);if(t!==void 0){S(e,a,t);continue}C(e,a,n,r)}}function S(e,t,n){e.registerFeature(t.id,{key:`${n}`,name:t.name,enabled:!0,weight:t.weight,...t.valueType!==void 0&&{valueType:t.valueType},...t.variants!==void 0&&{variants:t.variants},storage:`session`,decide:()=>n})}function C(e,t,n,r){let o=t.id,s=t.variants;e.registerFeature(o,{key:`v${t.version}`,name:t.name,enabled:t.enabled,weight:t.weight,storage:n?`session`:`local`,valueType:t.valueType,variants:s,decide:()=>t.valueType===`text`?!s||s.length===0?(`${o}`,!1):l(r,o,s)?.value??!1:a(i(r,o),t.weight)})}function w(e,t){for(let n of[...t.references??[],...t.content])e.registerContent({id:n.id,contentModelKey:n.contentModelKey,data:n.data})}function T(e,t){let n=new Map;return(r,i)=>{let a=n.get(r.id);if(a)return a;let o=(async()=>{try{let n=await t(r,i);return n&&w(e,n),n}finally{n.delete(r.id)}})();return n.set(r.id,o),o}}function E(e,t){let n=new Set(t&&Array.isArray(t.experiences)?t.experiences.map(e=>e.id):[]);return(t,r)=>n.has(t.id)?e(t,r):Promise.resolve(null)}function D(){return{name:`dynamic-experiences`,setup:e=>({onStart:(0,t.attach)({source:e.session.store.map(e=>e.id),effect:async t=>{let{config:n,previewToken:r}=await y(e),i=r!==void 0,a=r===void 0?void 0:{previewToken:r};if(e.contentLoader=T(e,E(t=>e.getExperienceContent(t,a),n)),!n)return;let o=e.seededVersionId;if(o!==null&&o!==n.versionId){e.versionSkew={seeded:o,resolved:n.versionId},`${n.versionId}${o}`;return}e.previewEmbedderOrigins=n.previewEmbedderOrigins??null,g(e,n,{isPreview:i,sessionId:t})}})})}}Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return D}});
|
|
@@ -1,44 +1,44 @@
|
|
|
1
1
|
import "./logger-DMN6TxJJ.js";
|
|
2
|
-
import {
|
|
3
|
-
import "./api-
|
|
4
|
-
import { attach as
|
|
2
|
+
import { c as e, i as t, n, t as r } from "./preview-unavailable-Cs6tiz5X.js";
|
|
3
|
+
import "./api-MpZsPlFm.js";
|
|
4
|
+
import { attach as i } from "effector";
|
|
5
5
|
//#region src/plugins/dynamic-experiences/hash.ts
|
|
6
|
-
function
|
|
6
|
+
function a(e) {
|
|
7
7
|
let t = 2166136261;
|
|
8
8
|
for (let n of e) t ^= n.codePointAt(0) ?? 0, t = Math.imul(t, 16777619);
|
|
9
9
|
return t >>> 0;
|
|
10
10
|
}
|
|
11
|
-
function
|
|
11
|
+
function o(e) {
|
|
12
12
|
let t = e;
|
|
13
13
|
return t ^= t >>> 16, t = Math.imul(t, 2246822507), t ^= t >>> 13, t = Math.imul(t, 3266489909), t ^= t >>> 16, t >>> 0;
|
|
14
14
|
}
|
|
15
|
-
function
|
|
16
|
-
return
|
|
15
|
+
function s(e, t) {
|
|
16
|
+
return o(a(`${e}:${t}`)) % 100;
|
|
17
17
|
}
|
|
18
|
-
function
|
|
18
|
+
function c(e, t) {
|
|
19
19
|
return t <= 0 ? !1 : t >= 100 || e < t;
|
|
20
20
|
}
|
|
21
|
-
var
|
|
22
|
-
function
|
|
23
|
-
return (
|
|
21
|
+
var l = 4294967296;
|
|
22
|
+
function u(e, t, n) {
|
|
23
|
+
return (o(a(`${e}:${t}:${n}`)) + .5) / l;
|
|
24
24
|
}
|
|
25
|
-
function
|
|
26
|
-
return n.weight <= 0 ? 0 : n.weight / -Math.log(
|
|
25
|
+
function d(e, t, n) {
|
|
26
|
+
return n.weight <= 0 ? 0 : n.weight / -Math.log(u(e, t, n.key));
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function f(e, t, n) {
|
|
29
29
|
let r = null, i = 0;
|
|
30
30
|
for (let a of n) {
|
|
31
|
-
let n =
|
|
31
|
+
let n = d(e, t, a);
|
|
32
32
|
n <= 0 || (n > i || n === i && r !== null && a.key < r.key) && (i = n, r = a);
|
|
33
33
|
}
|
|
34
34
|
return r;
|
|
35
35
|
}
|
|
36
36
|
//#endregion
|
|
37
37
|
//#region src/plugins/dynamic-experiences/plugin.ts
|
|
38
|
-
function
|
|
38
|
+
function p(e, t) {
|
|
39
39
|
if (Array.isArray(t.conditions)) for (let n of t.conditions) e.registerCondition(n);
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function m(e, t) {
|
|
42
42
|
e.registerExperience({
|
|
43
43
|
id: t.id,
|
|
44
44
|
key: t.key,
|
|
@@ -51,13 +51,13 @@ function d(e, t) {
|
|
|
51
51
|
componentName: t.componentName
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
|
-
function
|
|
54
|
+
function h(e) {
|
|
55
55
|
return typeof e != "object" || !e ? !1 : "id" in e && "key" in e && "type" in e && "name" in e;
|
|
56
56
|
}
|
|
57
|
-
function
|
|
58
|
-
if (Array.isArray(t.fields)) for (let n of t.fields)
|
|
57
|
+
function g(e, t) {
|
|
58
|
+
if (Array.isArray(t.fields)) for (let n of t.fields) h(n) && e.registerField(n);
|
|
59
59
|
}
|
|
60
|
-
function
|
|
60
|
+
function _(e, t) {
|
|
61
61
|
if (!Array.isArray(t.steps)) return;
|
|
62
62
|
let n = new Map(t.fields.map((e) => [e.id, e.key]));
|
|
63
63
|
for (let r of t.steps) {
|
|
@@ -84,17 +84,33 @@ function m(e, t) {
|
|
|
84
84
|
});
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
|
-
function
|
|
88
|
-
if (Array.isArray(t.experiences)) for (let n of t.experiences)
|
|
87
|
+
function v(e, t) {
|
|
88
|
+
if (Array.isArray(t.experiences)) for (let n of t.experiences) m(e, n);
|
|
89
89
|
}
|
|
90
|
-
function
|
|
91
|
-
|
|
90
|
+
function y(e, t, n) {
|
|
91
|
+
w(e, t, n.isPreview, n.sessionId), p(e, t), g(e, t), _(e, t), v(e, t);
|
|
92
92
|
}
|
|
93
|
-
function
|
|
94
|
-
let t = e.searchParams[
|
|
93
|
+
function b(e) {
|
|
94
|
+
let t = e.searchParams[n];
|
|
95
95
|
if (t && t.length > 0) return t[0];
|
|
96
96
|
}
|
|
97
|
-
function
|
|
97
|
+
function x(e, t) {
|
|
98
|
+
return e.getProjectConfig(t === void 0 ? void 0 : { previewToken: t }).catch((e) => e instanceof r ? e : null);
|
|
99
|
+
}
|
|
100
|
+
async function S(e) {
|
|
101
|
+
let i = b(e), a = await x(e, i);
|
|
102
|
+
if (!(a instanceof r)) return {
|
|
103
|
+
config: a,
|
|
104
|
+
previewToken: i
|
|
105
|
+
};
|
|
106
|
+
t(e.searchParams, n), e.previewUnavailable = !0, `${a.message}`;
|
|
107
|
+
let o = await x(e, void 0);
|
|
108
|
+
return {
|
|
109
|
+
config: o instanceof r ? null : o,
|
|
110
|
+
previewToken: void 0
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
function C(t) {
|
|
98
114
|
let n = /* @__PURE__ */ new Map(), r = t.searchParams.feature;
|
|
99
115
|
if (!r) return n;
|
|
100
116
|
for (let t of r) {
|
|
@@ -103,18 +119,18 @@ function v(t) {
|
|
|
103
119
|
}
|
|
104
120
|
return n;
|
|
105
121
|
}
|
|
106
|
-
function
|
|
107
|
-
let i =
|
|
122
|
+
function w(e, t, n, r) {
|
|
123
|
+
let i = C(e);
|
|
108
124
|
for (let a of t.features) {
|
|
109
125
|
let t = i.get(a.id);
|
|
110
126
|
if (t !== void 0) {
|
|
111
|
-
|
|
127
|
+
T(e, a, t);
|
|
112
128
|
continue;
|
|
113
129
|
}
|
|
114
|
-
|
|
130
|
+
E(e, a, n, r);
|
|
115
131
|
}
|
|
116
132
|
}
|
|
117
|
-
function
|
|
133
|
+
function T(e, t, n) {
|
|
118
134
|
e.registerFeature(t.id, {
|
|
119
135
|
key: `${n}`,
|
|
120
136
|
name: t.name,
|
|
@@ -126,27 +142,27 @@ function b(e, t, n) {
|
|
|
126
142
|
decide: () => n
|
|
127
143
|
});
|
|
128
144
|
}
|
|
129
|
-
function
|
|
130
|
-
let
|
|
131
|
-
e.registerFeature(
|
|
145
|
+
function E(e, t, n, r) {
|
|
146
|
+
let i = t.id, a = t.variants;
|
|
147
|
+
e.registerFeature(i, {
|
|
132
148
|
key: `v${t.version}`,
|
|
133
149
|
name: t.name,
|
|
134
150
|
enabled: t.enabled,
|
|
135
151
|
weight: t.weight,
|
|
136
152
|
storage: n ? "session" : "local",
|
|
137
153
|
valueType: t.valueType,
|
|
138
|
-
variants:
|
|
139
|
-
decide: () => t.valueType === "text" ? !
|
|
154
|
+
variants: a,
|
|
155
|
+
decide: () => t.valueType === "text" ? !a || a.length === 0 ? (`${i}`, !1) : f(r, i, a)?.value ?? !1 : c(s(r, i), t.weight)
|
|
140
156
|
});
|
|
141
157
|
}
|
|
142
|
-
function
|
|
158
|
+
function D(e, t) {
|
|
143
159
|
for (let n of [...t.references ?? [], ...t.content]) e.registerContent({
|
|
144
160
|
id: n.id,
|
|
145
161
|
contentModelKey: n.contentModelKey,
|
|
146
162
|
data: n.data
|
|
147
163
|
});
|
|
148
164
|
}
|
|
149
|
-
function
|
|
165
|
+
function O(e, t) {
|
|
150
166
|
let n = /* @__PURE__ */ new Map();
|
|
151
167
|
return (r, i) => {
|
|
152
168
|
let a = n.get(r.id);
|
|
@@ -154,7 +170,7 @@ function C(e, t) {
|
|
|
154
170
|
let o = (async () => {
|
|
155
171
|
try {
|
|
156
172
|
let n = await t(r, i);
|
|
157
|
-
return n &&
|
|
173
|
+
return n && D(e, n), n;
|
|
158
174
|
} finally {
|
|
159
175
|
n.delete(r.id);
|
|
160
176
|
}
|
|
@@ -162,28 +178,28 @@ function C(e, t) {
|
|
|
162
178
|
return n.set(r.id, o), o;
|
|
163
179
|
};
|
|
164
180
|
}
|
|
165
|
-
function
|
|
181
|
+
function k(e, t) {
|
|
166
182
|
let n = new Set(t && Array.isArray(t.experiences) ? t.experiences.map((e) => e.id) : []);
|
|
167
183
|
return (t, r) => n.has(t.id) ? e(t, r) : Promise.resolve(null);
|
|
168
184
|
}
|
|
169
|
-
function
|
|
185
|
+
function A() {
|
|
170
186
|
return {
|
|
171
187
|
name: "dynamic-experiences",
|
|
172
|
-
setup: (e) => ({ onStart:
|
|
188
|
+
setup: (e) => ({ onStart: i({
|
|
173
189
|
source: e.session.store.map((e) => e.id),
|
|
174
190
|
effect: async (t) => {
|
|
175
|
-
let
|
|
176
|
-
if (e.contentLoader =
|
|
191
|
+
let { config: n, previewToken: r } = await S(e), i = r !== void 0, a = r === void 0 ? void 0 : { previewToken: r };
|
|
192
|
+
if (e.contentLoader = O(e, k((t) => e.getExperienceContent(t, a), n)), !n) return;
|
|
177
193
|
let o = e.seededVersionId;
|
|
178
|
-
if (o !== null && o !==
|
|
194
|
+
if (o !== null && o !== n.versionId) {
|
|
179
195
|
e.versionSkew = {
|
|
180
196
|
seeded: o,
|
|
181
|
-
resolved:
|
|
182
|
-
}, `${
|
|
197
|
+
resolved: n.versionId
|
|
198
|
+
}, `${n.versionId}${o}`;
|
|
183
199
|
return;
|
|
184
200
|
}
|
|
185
|
-
e.previewEmbedderOrigins =
|
|
186
|
-
isPreview:
|
|
201
|
+
e.previewEmbedderOrigins = n.previewEmbedderOrigins ?? null, y(e, n, {
|
|
202
|
+
isPreview: i,
|
|
187
203
|
sessionId: t
|
|
188
204
|
});
|
|
189
205
|
}
|
|
@@ -191,4 +207,4 @@ function T() {
|
|
|
191
207
|
};
|
|
192
208
|
}
|
|
193
209
|
//#endregion
|
|
194
|
-
export {
|
|
210
|
+
export { y as n, A as t };
|