@picked/client 0.0.1-dev.1787019239195 → 0.0.1-dev.1787543060859
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-CahTmEWe.cjs +1 -0
- package/dist/api-DwTNwuWK.js +33 -0
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/plugins/dynamic-experiences/index.js +1 -1
- package/dist/cjs/plugins/telemetry/index.js +1 -0
- package/dist/cjs/server/index.js +1 -1
- package/dist/docs/explanation/feature-flag-allocation.md +43 -1
- package/dist/docs/how-to/install-the-sdk.md +2 -2
- package/dist/docs/how-to/read-a-feature-flag.md +22 -10
- package/dist/docs/how-to/read-a-referenced-entry.md +4 -6
- package/dist/docs/how-to/render-a-step-form.md +3 -4
- package/dist/docs/how-to/switch-workspaces.md +1 -2
- package/dist/docs/reference/dashboard/features.mdx +45 -5
- package/dist/docs/reference/delivery-api/workspace-schema.md +12 -1
- package/dist/docs/reference/pickedql/dimensions.md +6 -0
- package/dist/docs/reference/pickedql/virtual-functions.md +16 -5
- package/dist/docs/reference/sdk/content.md +6 -9
- package/dist/docs/reference/sdk/features.md +24 -6
- package/dist/docs/reference/sdk/steps.md +3 -4
- package/dist/docs/reference/sdk/type-generation.md +18 -4
- package/dist/docs/reference/tools/cli.md +3 -5
- package/dist/docs/reference/tools/vite-plugin.md +1 -5
- package/dist/docs/tutorials/first-experience.mdx +4 -5
- package/dist/emit-D-tLiWL1.cjs +1 -0
- package/dist/emit-Ds2EG7CB.js +14 -0
- package/dist/esm/index.js +275 -490
- package/dist/esm/plugins/dynamic-experiences/index.js +2 -2
- package/dist/esm/plugins/telemetry/index.js +101 -0
- package/dist/esm/server/index.js +1 -1
- package/dist/plugin-BcFzHPC7.cjs +1 -0
- package/dist/{plugin-Bb2fJVFr.js → plugin-L5y4NdFX.js} +83 -47
- package/dist/{provider-DZEDUlIk.cjs → provider-BLDm3i8g.cjs} +1 -1
- package/dist/{provider-B8vTLrFT.js → provider-Dx6VjvZg.js} +1 -1
- package/dist/request-observer-BXDfOU0V.cjs +1 -0
- package/dist/request-observer-DtG0cRfz.js +19 -0
- package/dist/types/data-source/api.d.ts.map +1 -1
- package/dist/types/data-source/provider.d.ts +11 -1
- package/dist/types/data-source/provider.d.ts.map +1 -1
- package/dist/types/data-source/request-observer.d.ts +46 -0
- package/dist/types/data-source/request-observer.d.ts.map +1 -0
- package/dist/types/entities/feature/feature.d.ts +53 -5
- package/dist/types/entities/feature/feature.d.ts.map +1 -1
- package/dist/types/entities/plugin/plugin.d.ts +4 -0
- package/dist/types/entities/plugin/plugin.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/lifecycle/lifecycle.d.ts.map +1 -1
- package/dist/types/picked.d.ts +13 -2
- package/dist/types/picked.d.ts.map +1 -1
- package/dist/types/plugins/dynamic-experiences/hash.d.ts +53 -1
- package/dist/types/plugins/dynamic-experiences/hash.d.ts.map +1 -1
- package/dist/types/plugins/dynamic-experiences/index.d.ts +1 -0
- package/dist/types/plugins/dynamic-experiences/index.d.ts.map +1 -1
- package/dist/types/plugins/dynamic-experiences/plugin.d.ts +1 -1
- package/dist/types/plugins/dynamic-experiences/plugin.d.ts.map +1 -1
- package/dist/types/plugins/dynamic-experiences/types.d.ts +3 -4
- package/dist/types/plugins/dynamic-experiences/types.d.ts.map +1 -1
- package/dist/types/plugins/telemetry/emit.d.ts +18 -0
- package/dist/types/plugins/telemetry/emit.d.ts.map +1 -0
- package/dist/types/plugins/telemetry/index.d.ts +4 -0
- package/dist/types/plugins/telemetry/index.d.ts.map +1 -0
- package/dist/types/plugins/telemetry/plugin-summary.d.ts +10 -0
- package/dist/types/plugins/telemetry/plugin-summary.d.ts.map +1 -0
- package/dist/types/plugins/telemetry/plugin.d.ts +36 -0
- package/dist/types/plugins/telemetry/plugin.d.ts.map +1 -0
- package/dist/types/schema-registry.d.ts +16 -0
- package/dist/types/schema-registry.d.ts.map +1 -1
- package/dist/types/utils/user-timing.d.ts +18 -0
- package/dist/types/utils/user-timing.d.ts.map +1 -0
- package/dist/version-BqU6f22c.cjs +1 -0
- package/dist/version-DAFO6eas.js +256 -0
- package/package.json +16 -4
- package/dist/api-TWnRLh3X.cjs +0 -1
- package/dist/api-uttjU_Tg.js +0 -22
- package/dist/plugin-hFQIiHOB.cjs +0 -1
- package/dist/version-CfTz7TK0.cjs +0 -1
- package/dist/version-DjCWhJD5.js +0 -4
|
@@ -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-L5y4NdFX.js";
|
|
2
|
+
import { n as t, t as n } from "../../../api-DwTNwuWK.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 };
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { f as e, p as t } from "../../../supports-CO9bJGNl.js";
|
|
2
|
+
import { n } from "../../../request-observer-DtG0cRfz.js";
|
|
3
|
+
import { createSpanId as r, createTraceId as i, formatTraceparent as a, toUnixNano as o } from "@picked/telemetry";
|
|
4
|
+
//#region src/plugins/telemetry/plugin-summary.ts
|
|
5
|
+
var s = 100;
|
|
6
|
+
function c(e) {
|
|
7
|
+
return [...e].sort((e, t) => e.localeCompare(t)).slice(0, s);
|
|
8
|
+
}
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region src/plugins/telemetry/plugin.ts
|
|
11
|
+
var l = "telemetry", u = "https://production.otel.picked.app/v1/traces", d = "picked:start";
|
|
12
|
+
function f() {
|
|
13
|
+
try {
|
|
14
|
+
let e = t.navigator;
|
|
15
|
+
return "globalPrivacyControl" in e && e.globalPrivacyControl === !0 || e.doNotTrack === "1";
|
|
16
|
+
} catch {
|
|
17
|
+
return !1;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function p() {
|
|
21
|
+
try {
|
|
22
|
+
return performance.getEntriesByName(d, "measure").at(-1);
|
|
23
|
+
} catch {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function m() {
|
|
28
|
+
return performance.timeOrigin + performance.now();
|
|
29
|
+
}
|
|
30
|
+
function h(e) {
|
|
31
|
+
try {
|
|
32
|
+
t.addEventListener("pagehide", e), t.document.addEventListener("visibilitychange", () => {
|
|
33
|
+
t.document.visibilityState === "hidden" && e();
|
|
34
|
+
});
|
|
35
|
+
} catch {}
|
|
36
|
+
}
|
|
37
|
+
function g(t) {
|
|
38
|
+
return {
|
|
39
|
+
name: l,
|
|
40
|
+
setup: (s) => {
|
|
41
|
+
if (!e() || f() || !(Math.random() < (t?.sampleRate ?? 1))) return;
|
|
42
|
+
let c = t?.endpoint ?? u, l = i(), d = r(), g = [], b = () => void y(c, _(s), g);
|
|
43
|
+
h(b), n({ onRequest: (e) => {
|
|
44
|
+
let t = r(), n = m();
|
|
45
|
+
return {
|
|
46
|
+
headers: { traceparent: a(l, t, !0) },
|
|
47
|
+
onSettled: (r) => {
|
|
48
|
+
g.push({
|
|
49
|
+
name: `picked.delivery.${e}`,
|
|
50
|
+
traceId: l,
|
|
51
|
+
spanId: t,
|
|
52
|
+
parentSpanId: d,
|
|
53
|
+
startTimeUnixNano: o(n),
|
|
54
|
+
endTimeUnixNano: o(m()),
|
|
55
|
+
attributes: { "picked.endpoint": e },
|
|
56
|
+
status: r ? "ok" : "error"
|
|
57
|
+
}), g.length >= 50 && b();
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
} }), s.eventBus.watch((e) => {
|
|
61
|
+
if (e.type !== "ready") return;
|
|
62
|
+
let t = p();
|
|
63
|
+
if (t) {
|
|
64
|
+
let e = performance.timeOrigin + t.startTime;
|
|
65
|
+
g.push({
|
|
66
|
+
name: "picked.start",
|
|
67
|
+
traceId: l,
|
|
68
|
+
spanId: d,
|
|
69
|
+
startTimeUnixNano: o(e),
|
|
70
|
+
endTimeUnixNano: o(e + t.duration),
|
|
71
|
+
attributes: v(s),
|
|
72
|
+
status: "ok"
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
b();
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
function _(e) {
|
|
81
|
+
return {
|
|
82
|
+
"service.name": "picked-sdk",
|
|
83
|
+
"picked.project_id": e.projectId
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
function v(e) {
|
|
87
|
+
return {
|
|
88
|
+
"picked.data.mode": e.dataSource ? "bundle" : "api",
|
|
89
|
+
"picked.sdk.plugins": c(e.pluginNames).join(",")
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
async function y(e, t, n) {
|
|
93
|
+
if (n.length === 0) return;
|
|
94
|
+
let r = n.splice(0, n.length);
|
|
95
|
+
try {
|
|
96
|
+
let { flushSpans: n } = await import("../../../emit-Ds2EG7CB.js");
|
|
97
|
+
await n(e, t, r);
|
|
98
|
+
} catch {}
|
|
99
|
+
}
|
|
100
|
+
//#endregion
|
|
101
|
+
export { l as TELEMETRY_PLUGIN_NAME, g as telemetryPlugin };
|
package/dist/esm/server/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as e, c as t, i as n, o as r, s as i, t as a, u as o } from "../../experience-instance-DGk11d8a.js";
|
|
2
|
-
import { n as s } from "../../plugin-
|
|
2
|
+
import { n as s } from "../../plugin-L5y4NdFX.js";
|
|
3
3
|
import { attach as c, createEffect as l, createEvent as u, createStore as d, sample as f } from "effector";
|
|
4
4
|
//#region src/server/serialize.ts
|
|
5
5
|
var p = 1e4;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require("./logger-CSTvAyyB.cjs");const e=require("./version-BqU6f22c.cjs");require("./api-CahTmEWe.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){y(e,t,n.isPreview,n.sessionId),u(e,t),p(e,t),m(e,t),h(e,t)}function _(e){let t=e.searchParams[`preview-token`];if(t&&t.length>0)return t[0]}function v(t){let n=new Map,r=t.searchParams.feature;if(!r)return n;for(let t of r){let r=e.r(t);r&&n.set(r.id,r.bucket)}return n}function y(e,t,n,r){let i=v(e);for(let a of t.features){let t=i.get(a.id);if(t!==void 0){b(e,a,t);continue}x(e,a,n,r)}}function b(e,t,n){e.registerFeature(t.id,{key:`${n}`,name:t.name,weight:t.weight,...t.valueType!==void 0&&{valueType:t.valueType},...t.variants!==void 0&&{variants:t.variants},storage:`session`,decide:()=>n})}function x(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 S(e,t){for(let n of[...t.references??[],...t.content])e.registerContent({id:n.id,contentModelKey:n.contentModelKey,data:n.data})}function C(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&&S(e,n),n}finally{n.delete(r.id)}})();return n.set(r.id,o),o}}function w(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 T(){return{name:`dynamic-experiences`,setup:e=>({onStart:(0,t.attach)({source:e.session.store.map(e=>e.id),effect:async t=>{let n=_(e),r=n!==void 0,i=n===void 0?void 0:{previewToken:n},a=await e.getProjectConfig(n===void 0?void 0:{previewToken:n}).catch(e=>null);if(e.contentLoader=C(e,w(t=>e.getExperienceContent(t,i),a)),!a)return;let o=e.seededVersionId;if(o!==null&&o!==a.versionId){e.versionSkew={seeded:o,resolved:a.versionId},`${a.versionId}${o}`;return}e.previewEmbedderOrigins=a.previewEmbedderOrigins??null,g(e,a,{isPreview:r,sessionId:t})}})})}}Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return T}});
|
|
@@ -1,28 +1,44 @@
|
|
|
1
1
|
import "./logger-DMN6TxJJ.js";
|
|
2
|
-
import "./
|
|
3
|
-
import
|
|
2
|
+
import { r as e } from "./version-DAFO6eas.js";
|
|
3
|
+
import "./api-DwTNwuWK.js";
|
|
4
|
+
import { attach as t } from "effector";
|
|
4
5
|
//#region src/plugins/dynamic-experiences/hash.ts
|
|
5
|
-
function
|
|
6
|
+
function n(e) {
|
|
6
7
|
let t = 2166136261;
|
|
7
8
|
for (let n of e) t ^= n.codePointAt(0) ?? 0, t = Math.imul(t, 16777619);
|
|
8
9
|
return t >>> 0;
|
|
9
10
|
}
|
|
10
|
-
function
|
|
11
|
+
function r(e) {
|
|
11
12
|
let t = e;
|
|
12
13
|
return t ^= t >>> 16, t = Math.imul(t, 2246822507), t ^= t >>> 13, t = Math.imul(t, 3266489909), t ^= t >>> 16, t >>> 0;
|
|
13
14
|
}
|
|
14
|
-
function r(e, r) {
|
|
15
|
-
return n(t(`${e}:${r}`)) % 100;
|
|
16
|
-
}
|
|
17
15
|
function i(e, t) {
|
|
16
|
+
return r(n(`${e}:${t}`)) % 100;
|
|
17
|
+
}
|
|
18
|
+
function a(e, t) {
|
|
18
19
|
return t <= 0 ? !1 : t >= 100 || e < t;
|
|
19
20
|
}
|
|
21
|
+
var o = 4294967296;
|
|
22
|
+
function s(e, t, i) {
|
|
23
|
+
return (r(n(`${e}:${t}:${i}`)) + .5) / o;
|
|
24
|
+
}
|
|
25
|
+
function c(e, t, n) {
|
|
26
|
+
return n.weight <= 0 ? 0 : n.weight / -Math.log(s(e, t, n.key));
|
|
27
|
+
}
|
|
28
|
+
function l(e, t, n) {
|
|
29
|
+
let r = null, i = 0;
|
|
30
|
+
for (let a of n) {
|
|
31
|
+
let n = c(e, t, a);
|
|
32
|
+
n <= 0 || (n > i || n === i && r !== null && a.key < r.key) && (i = n, r = a);
|
|
33
|
+
}
|
|
34
|
+
return r;
|
|
35
|
+
}
|
|
20
36
|
//#endregion
|
|
21
37
|
//#region src/plugins/dynamic-experiences/plugin.ts
|
|
22
|
-
function
|
|
38
|
+
function u(e, t) {
|
|
23
39
|
if (Array.isArray(t.conditions)) for (let n of t.conditions) e.registerCondition(n);
|
|
24
40
|
}
|
|
25
|
-
function
|
|
41
|
+
function d(e, t) {
|
|
26
42
|
e.registerExperience({
|
|
27
43
|
id: t.id,
|
|
28
44
|
key: t.key,
|
|
@@ -35,13 +51,13 @@ function o(e, t) {
|
|
|
35
51
|
componentName: t.componentName
|
|
36
52
|
});
|
|
37
53
|
}
|
|
38
|
-
function
|
|
54
|
+
function f(e) {
|
|
39
55
|
return typeof e != "object" || !e ? !1 : "id" in e && "key" in e && "type" in e && "name" in e;
|
|
40
56
|
}
|
|
41
|
-
function
|
|
42
|
-
if (Array.isArray(t.fields)) for (let n of t.fields)
|
|
57
|
+
function p(e, t) {
|
|
58
|
+
if (Array.isArray(t.fields)) for (let n of t.fields) f(n) && e.registerField(n);
|
|
43
59
|
}
|
|
44
|
-
function
|
|
60
|
+
function m(e, t) {
|
|
45
61
|
if (!Array.isArray(t.steps)) return;
|
|
46
62
|
let n = new Map(t.fields.map((e) => [e.id, e.key]));
|
|
47
63
|
for (let r of t.steps) {
|
|
@@ -68,48 +84,68 @@ function l(e, t) {
|
|
|
68
84
|
});
|
|
69
85
|
}
|
|
70
86
|
}
|
|
71
|
-
function
|
|
72
|
-
if (Array.isArray(t.experiences)) for (let n of t.experiences)
|
|
87
|
+
function h(e, t) {
|
|
88
|
+
if (Array.isArray(t.experiences)) for (let n of t.experiences) d(e, n);
|
|
73
89
|
}
|
|
74
|
-
function
|
|
75
|
-
|
|
90
|
+
function g(e, t, n) {
|
|
91
|
+
y(e, t, n.isPreview, n.sessionId), u(e, t), p(e, t), m(e, t), h(e, t);
|
|
76
92
|
}
|
|
77
|
-
function
|
|
93
|
+
function _(e) {
|
|
78
94
|
let t = e.searchParams["preview-token"];
|
|
79
95
|
if (t && t.length > 0) return t[0];
|
|
80
96
|
}
|
|
81
|
-
function
|
|
82
|
-
let
|
|
83
|
-
if (!
|
|
84
|
-
for (let
|
|
85
|
-
let
|
|
86
|
-
|
|
97
|
+
function v(t) {
|
|
98
|
+
let n = /* @__PURE__ */ new Map(), r = t.searchParams.feature;
|
|
99
|
+
if (!r) return n;
|
|
100
|
+
for (let t of r) {
|
|
101
|
+
let r = e(t);
|
|
102
|
+
r && n.set(r.id, r.bucket);
|
|
103
|
+
}
|
|
104
|
+
return n;
|
|
105
|
+
}
|
|
106
|
+
function y(e, t, n, r) {
|
|
107
|
+
let i = v(e);
|
|
108
|
+
for (let a of t.features) {
|
|
109
|
+
let t = i.get(a.id);
|
|
110
|
+
if (t !== void 0) {
|
|
111
|
+
b(e, a, t);
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
x(e, a, n, r);
|
|
87
115
|
}
|
|
88
|
-
return t;
|
|
89
|
-
}
|
|
90
|
-
function m(e, t, n, r) {
|
|
91
|
-
let i = p(e);
|
|
92
|
-
for (let a of t.features) i.has(a.id) || h(e, a, n, r);
|
|
93
116
|
}
|
|
94
|
-
function
|
|
95
|
-
let o = r(a, t.id);
|
|
117
|
+
function b(e, t, n) {
|
|
96
118
|
e.registerFeature(t.id, {
|
|
119
|
+
key: `${n}`,
|
|
120
|
+
name: t.name,
|
|
121
|
+
weight: t.weight,
|
|
122
|
+
...t.valueType !== void 0 && { valueType: t.valueType },
|
|
123
|
+
...t.variants !== void 0 && { variants: t.variants },
|
|
124
|
+
storage: "session",
|
|
125
|
+
decide: () => n
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
function x(e, t, n, r) {
|
|
129
|
+
let o = t.id, s = t.variants;
|
|
130
|
+
e.registerFeature(o, {
|
|
97
131
|
key: `v${t.version}`,
|
|
98
132
|
name: t.name,
|
|
99
133
|
enabled: t.enabled,
|
|
100
134
|
weight: t.weight,
|
|
101
135
|
storage: n ? "session" : "local",
|
|
102
|
-
|
|
136
|
+
valueType: t.valueType,
|
|
137
|
+
variants: s,
|
|
138
|
+
decide: () => t.valueType === "text" ? !s || s.length === 0 ? (`${o}`, !1) : l(r, o, s)?.value ?? !1 : a(i(r, o), t.weight)
|
|
103
139
|
});
|
|
104
140
|
}
|
|
105
|
-
function
|
|
141
|
+
function S(e, t) {
|
|
106
142
|
for (let n of [...t.references ?? [], ...t.content]) e.registerContent({
|
|
107
143
|
id: n.id,
|
|
108
144
|
contentModelKey: n.contentModelKey,
|
|
109
145
|
data: n.data
|
|
110
146
|
});
|
|
111
147
|
}
|
|
112
|
-
function
|
|
148
|
+
function C(e, t) {
|
|
113
149
|
let n = /* @__PURE__ */ new Map();
|
|
114
150
|
return (r, i) => {
|
|
115
151
|
let a = n.get(r.id);
|
|
@@ -117,7 +153,7 @@ function _(e, t) {
|
|
|
117
153
|
let o = (async () => {
|
|
118
154
|
try {
|
|
119
155
|
let n = await t(r, i);
|
|
120
|
-
return n &&
|
|
156
|
+
return n && S(e, n), n;
|
|
121
157
|
} finally {
|
|
122
158
|
n.delete(r.id);
|
|
123
159
|
}
|
|
@@ -125,33 +161,33 @@ function _(e, t) {
|
|
|
125
161
|
return n.set(r.id, o), o;
|
|
126
162
|
};
|
|
127
163
|
}
|
|
128
|
-
function
|
|
164
|
+
function w(e, t) {
|
|
129
165
|
let n = new Set(t && Array.isArray(t.experiences) ? t.experiences.map((e) => e.id) : []);
|
|
130
166
|
return (t, r) => n.has(t.id) ? e(t, r) : Promise.resolve(null);
|
|
131
167
|
}
|
|
132
|
-
function
|
|
168
|
+
function T() {
|
|
133
169
|
return {
|
|
134
170
|
name: "dynamic-experiences",
|
|
135
|
-
setup: (
|
|
136
|
-
source:
|
|
137
|
-
effect: async (
|
|
138
|
-
let n =
|
|
139
|
-
if (
|
|
140
|
-
let o =
|
|
171
|
+
setup: (e) => ({ onStart: t({
|
|
172
|
+
source: e.session.store.map((e) => e.id),
|
|
173
|
+
effect: async (t) => {
|
|
174
|
+
let n = _(e), r = n !== void 0, i = n === void 0 ? void 0 : { previewToken: n }, a = await e.getProjectConfig(n === void 0 ? void 0 : { previewToken: n }).catch((e) => null);
|
|
175
|
+
if (e.contentLoader = C(e, w((t) => e.getExperienceContent(t, i), a)), !a) return;
|
|
176
|
+
let o = e.seededVersionId;
|
|
141
177
|
if (o !== null && o !== a.versionId) {
|
|
142
|
-
|
|
178
|
+
e.versionSkew = {
|
|
143
179
|
seeded: o,
|
|
144
180
|
resolved: a.versionId
|
|
145
181
|
}, `${a.versionId}${o}`;
|
|
146
182
|
return;
|
|
147
183
|
}
|
|
148
|
-
|
|
184
|
+
e.previewEmbedderOrigins = a.previewEmbedderOrigins ?? null, g(e, a, {
|
|
149
185
|
isPreview: r,
|
|
150
|
-
sessionId:
|
|
186
|
+
sessionId: t
|
|
151
187
|
});
|
|
152
188
|
}
|
|
153
189
|
}) })
|
|
154
190
|
};
|
|
155
191
|
}
|
|
156
192
|
//#endregion
|
|
157
|
-
export {
|
|
193
|
+
export { g as n, T as t };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require("./logger-CSTvAyyB.cjs");const e=require("./api-
|
|
1
|
+
require("./logger-CSTvAyyB.cjs");const e=require("./api-CahTmEWe.cjs"),t=require("./registry-C1t8l3t9.cjs");var n=`bundle`,r=`api`;async function i(){try{let e=await import(`virtual:picked/data`);return t.r(e)?e:null}catch{return null}}function a(e){if(e===void 0||t.r(e))return e}function o(o){let{apiUrl:s,projectId:c,previewToken:l,signal:u}=o,d=!!l,f=d?r:o.mode,p=a(d?void 0:o.bundle),m=d?void 0:o.projectConfig,h=o.getContent,g={mode:f??r,manifest:null},_,v,y=new Map;function b(){if(f===r)return Promise.resolve(null);if(p)return Promise.resolve(p);let e=t.t();return e?Promise.resolve(e):(_??=i(),_)}function x(e){g.mode=e?n:r,g.manifest=e?e.manifestMetadata:null}async function S(){if(m)return x(await b()),m;let t=await b();return x(t),t?t.projectConfig:f===n?null:e.n(s,c,{...l!==void 0&&{previewToken:l},...u!==void 0&&{signal:u}})}async function C(t,r){let i=l===void 0?void 0:{previewToken:l};if(h)return h(t,i);let a=await b();if(x(a),a)try{return await a.experienceContent(t,i)}catch{return`${t.id}`,null}if(f===n)return null;let o=r??u;return e.t(s,c,t.id,{...l!==void 0&&{previewToken:l},...o!==void 0&&{signal:o}})}return{meta:g,getProjectConfig:()=>(v??=S(),v),getContent:(e,t)=>{let n=y.get(e.id);if(n)return n;let r=C(e,t?.signal).finally(()=>{y.delete(e.id)});return y.set(e.id,r),r}}}exports.createPickedDataProvider=o;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=null;function t(t){e=t}function n(t){try{return e?.onRequest(t)??{}}catch{return{}}}function r(e,t){try{e.onSettled?.(t)}catch{}}Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return n}});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//#region src/data-source/request-observer.ts
|
|
2
|
+
var e = null;
|
|
3
|
+
function t(t) {
|
|
4
|
+
e = t;
|
|
5
|
+
}
|
|
6
|
+
function n(t) {
|
|
7
|
+
try {
|
|
8
|
+
return e?.onRequest(t) ?? {};
|
|
9
|
+
} catch {
|
|
10
|
+
return {};
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
function r(e, t) {
|
|
14
|
+
try {
|
|
15
|
+
e.onSettled?.(t);
|
|
16
|
+
} catch {}
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { t as n, r, n as t };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/data-source/api.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACV,yBAAyB,EACzB,mBAAmB,EACnB,aAAa,EACd,MAAM,6BAA6B,CAAA;
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/data-source/api.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACV,yBAAyB,EACzB,mBAAmB,EACnB,aAAa,EACd,MAAM,6BAA6B,CAAA;AA0FpC;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,aAAa,CAEpE;AAED;;;;;;;;;GASG;AACH,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,yBAAyB,CAM5F;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,YAAY,CAChC,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAI/B;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,EACpB,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC,yBAAyB,GAAG,IAAI,CAAC,CAI3C"}
|
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @file The shared Picked data provider.
|
|
3
|
+
*
|
|
4
|
+
* One object answers "where does this session's project config and CMS content come from". A
|
|
5
|
+
* client builds one per preview token and reaches it through `getProjectConfig` and
|
|
6
|
+
* `getExperienceContent`; nothing outside the SDK constructs one. The mode is decided once, at
|
|
7
|
+
* construction, and the provider stays atomic: config and content come from the source the mode
|
|
8
|
+
* names.
|
|
9
|
+
*/
|
|
10
|
+
import type { ExperienceContentResponse, ProjectConfig } from '@picked/delivery-api-client';
|
|
11
|
+
import type { ContentLoader, PickedManifestMetadata, VirtualPickedData } from '../plugins/dynamic-experiences/types';
|
|
2
12
|
import { isVirtualPickedData } from './virtual-data';
|
|
3
13
|
/** Where a data provider reads project config and CMS content from. */
|
|
4
14
|
export type PickedDataMode = 'bundle' | 'api';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../src/data-source/provider.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../src/data-source/provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,yBAAyB,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAE3F,OAAO,KAAK,EACV,aAAa,EACb,sBAAsB,EACtB,iBAAiB,EAClB,MAAM,sCAAsC,CAAA;AAG7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAEpD,uEAAuE;AACvE,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,KAAK,CAAA;AAQ7C,oDAAoD;AACpD,MAAM,WAAW,yBAAyB;IACxC,sFAAsF;IACtF,MAAM,EAAE,MAAM,CAAA;IACd,sCAAsC;IACtC,SAAS,EAAE,MAAM,CAAA;IACjB;;;OAGG;IACH,IAAI,CAAC,EAAE,cAAc,CAAA;IACrB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB;;;;OAIG;IACH,MAAM,CAAC,EAAE,iBAAiB,CAAA;IAC1B,sFAAsF;IACtF,aAAa,CAAC,EAAE,aAAa,CAAA;IAC7B,sFAAsF;IACtF,UAAU,CAAC,EAAE,aAAa,CAAA;IAC1B,sFAAsF;IACtF,MAAM,CAAC,EAAE,WAAW,CAAA;CACrB;AAED,4DAA4D;AAC5D,MAAM,WAAW,sBAAsB;IACrC,yDAAyD;IACzD,IAAI,EAAE,cAAc,CAAA;IACpB,gFAAgF;IAChF,QAAQ,EAAE,sBAAsB,GAAG,IAAI,CAAA;CACxC;AAED,6EAA6E;AAC7E,MAAM,WAAW,kBAAkB;IACjC,wFAAwF;IACxF,QAAQ,CAAC,IAAI,EAAE,sBAAsB,CAAA;IACrC,4FAA4F;IAC5F,gBAAgB,EAAE,MAAM,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAAA;IACrD,oGAAoG;IACpG,UAAU,EAAE,CACV,UAAU,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,EACvC,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE,KAC/B,OAAO,CAAC,yBAAyB,GAAG,IAAI,CAAC,CAAA;CAC/C;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,wBAAwB,IAAI,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAYlF;AAED,OAAO,EAAE,mBAAmB,EAAE,CAAA;AAyB9B;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,yBAAyB,GAAG,kBAAkB,CAuK/F"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file The hook the telemetry plugin uses to observe delivery API requests.
|
|
3
|
+
*
|
|
4
|
+
* The observer hands back a per-request handle, so each completion correlates
|
|
5
|
+
* to its own request through the closure that created it.
|
|
6
|
+
*/
|
|
7
|
+
/** Which delivery endpoint a request is for. */
|
|
8
|
+
export type DeliveryEndpoint = 'project-config' | 'experience-content';
|
|
9
|
+
/** A request in flight, from the observer's point of view. */
|
|
10
|
+
export interface ObservedRequest {
|
|
11
|
+
/** Headers to merge into this request, such as `traceparent`. */
|
|
12
|
+
headers?: Record<string, string>;
|
|
13
|
+
/** Called once the request has settled. */
|
|
14
|
+
onSettled?: (ok: boolean) => void;
|
|
15
|
+
}
|
|
16
|
+
/** Receives delivery requests as they are made. */
|
|
17
|
+
export interface DeliveryRequestObserver {
|
|
18
|
+
/** Called as a request begins; returns headers to add and a completion callback. */
|
|
19
|
+
onRequest: (endpoint: DeliveryEndpoint) => ObservedRequest;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Registers the observer, or clears it when passed `null`.
|
|
23
|
+
*
|
|
24
|
+
* @param {DeliveryRequestObserver | null} next - The observer to install, or `null` to remove it.
|
|
25
|
+
* @returns {void}
|
|
26
|
+
* @example setDeliveryRequestObserver({ onRequest: () => ({ headers: { traceparent } }) })
|
|
27
|
+
*/
|
|
28
|
+
export declare function setDeliveryRequestObserver(next: DeliveryRequestObserver | null): void;
|
|
29
|
+
/**
|
|
30
|
+
* Notifies the observer that a request is starting.
|
|
31
|
+
*
|
|
32
|
+
* @param {DeliveryEndpoint} endpoint - Which endpoint is being called.
|
|
33
|
+
* @returns {ObservedRequest} Headers to merge and a completion callback, both possibly absent.
|
|
34
|
+
* @example const observed = beginObservedRequest('project-config')
|
|
35
|
+
*/
|
|
36
|
+
export declare function beginObservedRequest(endpoint: DeliveryEndpoint): ObservedRequest;
|
|
37
|
+
/**
|
|
38
|
+
* Notifies the observer that a request has settled.
|
|
39
|
+
*
|
|
40
|
+
* @param {ObservedRequest} observed - The handle returned when the request began.
|
|
41
|
+
* @param {boolean} ok - Whether the request produced a usable result.
|
|
42
|
+
* @returns {void}
|
|
43
|
+
* @example settleObservedRequest(observed, true)
|
|
44
|
+
*/
|
|
45
|
+
export declare function settleObservedRequest(observed: ObservedRequest, ok: boolean): void;
|
|
46
|
+
//# sourceMappingURL=request-observer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-observer.d.ts","sourceRoot":"","sources":["../../../src/data-source/request-observer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,gDAAgD;AAChD,MAAM,MAAM,gBAAgB,GAAG,gBAAgB,GAAG,oBAAoB,CAAA;AAEtE,8DAA8D;AAC9D,MAAM,WAAW,eAAe;IAC9B,iEAAiE;IACjE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAChC,2CAA2C;IAC3C,SAAS,CAAC,EAAE,CAAC,EAAE,EAAE,OAAO,KAAK,IAAI,CAAA;CAClC;AAED,mDAAmD;AACnD,MAAM,WAAW,uBAAuB;IACtC,oFAAoF;IACpF,SAAS,EAAE,CAAC,QAAQ,EAAE,gBAAgB,KAAK,eAAe,CAAA;CAC3D;AAID;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,uBAAuB,GAAG,IAAI,GAAG,IAAI,CAErF;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,gBAAgB,GAAG,eAAe,CAOhF;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,eAAe,EAAE,EAAE,EAAE,OAAO,GAAG,IAAI,CAMlF"}
|
|
@@ -1,7 +1,27 @@
|
|
|
1
1
|
/** @file Feature entity — Effector stores and registry for A/B test features with persistent bucketing. */
|
|
2
2
|
import { type EventCallable, type Store } from 'effector';
|
|
3
3
|
import type { Picked } from '../../picked';
|
|
4
|
-
|
|
4
|
+
import type { FeatureValueFor } from '../../schema-registry';
|
|
5
|
+
/** One arm of a feature, as published in the project config. */
|
|
6
|
+
export interface FeatureVariant {
|
|
7
|
+
/** Stable identity. `true` and `false` name the structural arms. */
|
|
8
|
+
key: string;
|
|
9
|
+
/** What the site receives when a visitor lands in this arm. */
|
|
10
|
+
value: boolean | string;
|
|
11
|
+
/** Share of traffic relative to the other arms, reduced by their greatest common divisor. */
|
|
12
|
+
weight: number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* What a feature's arms serve, as published in the project config. A feature registered
|
|
16
|
+
* from SDK code carries neither field, so an absent pair means the shape is unknown.
|
|
17
|
+
*/
|
|
18
|
+
export interface FeatureShape {
|
|
19
|
+
/** What the feature's arms serve. */
|
|
20
|
+
valueType?: 'boolean' | 'text';
|
|
21
|
+
/** The arms a text feature serves. A boolean feature splits on `weight`. */
|
|
22
|
+
variants?: readonly FeatureVariant[];
|
|
23
|
+
}
|
|
24
|
+
export interface Feature extends FeatureShape {
|
|
5
25
|
key: string;
|
|
6
26
|
name: string;
|
|
7
27
|
decide: () => boolean | Promise<boolean> | string | Promise<string>;
|
|
@@ -24,7 +44,7 @@ export interface ResolvedFeature {
|
|
|
24
44
|
key: string;
|
|
25
45
|
storage?: 'local' | 'session';
|
|
26
46
|
}
|
|
27
|
-
export interface FeatureBaseBucket {
|
|
47
|
+
export interface FeatureBaseBucket extends FeatureShape {
|
|
28
48
|
name: string;
|
|
29
49
|
key: string;
|
|
30
50
|
id: string;
|
|
@@ -48,9 +68,15 @@ export interface ResolvedFeatureBucket extends FeatureBaseBucket {
|
|
|
48
68
|
};
|
|
49
69
|
}
|
|
50
70
|
export type FeatureBucket = UnresolvedFeatureBucket | ResolvedFeatureBucket;
|
|
51
|
-
|
|
71
|
+
/**
|
|
72
|
+
* A feature's resolved bucket. `TValue` narrows to a text feature's declared arms when
|
|
73
|
+
* the schema registry is augmented, and stays `string | boolean` otherwise.
|
|
74
|
+
*
|
|
75
|
+
* @param {string | boolean} TValue - The value the feature resolves to.
|
|
76
|
+
*/
|
|
77
|
+
export interface FeatureResult<TValue extends string | boolean = string | boolean> {
|
|
52
78
|
id: string;
|
|
53
|
-
bucket:
|
|
79
|
+
bucket: TValue;
|
|
54
80
|
}
|
|
55
81
|
/** The bucket an evokable feature answers with, or undefined while its feature is unregistered. */
|
|
56
82
|
export type FeatureBucketValue = boolean | string | undefined;
|
|
@@ -70,6 +96,28 @@ export type FeatureBucketValue = boolean | string | undefined;
|
|
|
70
96
|
* ```
|
|
71
97
|
*/
|
|
72
98
|
export declare function parseBucket(value: string): boolean | string;
|
|
99
|
+
/** A `?picked-feature=` override, split into the feature it names and the bucket it forces. */
|
|
100
|
+
export interface FeatureOverride {
|
|
101
|
+
id: string;
|
|
102
|
+
bucket: boolean | string;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Reads one `?picked-feature=<id>:<value>` parameter.
|
|
106
|
+
*
|
|
107
|
+
* Splits on the first colon: the text before it names the feature, and all the text
|
|
108
|
+
* after it is the bucket, colons included. `opening-hours:09:00-17:00` forces
|
|
109
|
+
* `09:00-17:00`. Feature and variant keys are lowercase letters, numbers and hyphens,
|
|
110
|
+
* which is what makes the first colon the boundary.
|
|
111
|
+
*
|
|
112
|
+
* @param {string} param - One `picked-feature` parameter value, without its key.
|
|
113
|
+
* @returns {FeatureOverride | null} The override, or null when the parameter names no feature or forces no value.
|
|
114
|
+
* @example
|
|
115
|
+
* ```typescript
|
|
116
|
+
* parseFeatureOverride('hero-layout:video-hero') // { id: 'hero-layout', bucket: 'video-hero' }
|
|
117
|
+
* parseFeatureOverride('opening-hours:09:00-17:00') // { id: 'opening-hours', bucket: '09:00-17:00' }
|
|
118
|
+
* ```
|
|
119
|
+
*/
|
|
120
|
+
export declare function parseFeatureOverride(param: string): FeatureOverride | null;
|
|
73
121
|
declare const createFeatureIndexFactory: ({ client }: {
|
|
74
122
|
client: Picked;
|
|
75
123
|
}) => {
|
|
@@ -81,7 +129,7 @@ declare const createFeatureIndexFactory: ({ client }: {
|
|
|
81
129
|
getByName: (name: string) => Store<FeatureIndexItem | undefined>;
|
|
82
130
|
listStore: Store<FeatureBucket[]>;
|
|
83
131
|
getEvokableFeature: (featureName: string) => Store<() => Promise<FeatureBucketValue>>;
|
|
84
|
-
getFeatureResult: (featureName:
|
|
132
|
+
getFeatureResult: <K extends string>(featureName: K) => Store<FeatureResult<FeatureValueFor<K>> | undefined>;
|
|
85
133
|
};
|
|
86
134
|
/**
|
|
87
135
|
* Creates a feature index with lifecycle stores and registration logic.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature.d.ts","sourceRoot":"","sources":["../../../../src/entities/feature/feature.ts"],"names":[],"mappings":"AAAA,2GAA2G;AAC3G,OAAO,EAQL,KAAK,aAAa,EAElB,KAAK,KAAK,EACX,MAAM,UAAU,CAAA;AAEjB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"feature.d.ts","sourceRoot":"","sources":["../../../../src/entities/feature/feature.ts"],"names":[],"mappings":"AAAA,2GAA2G;AAC3G,OAAO,EAQL,KAAK,aAAa,EA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C,KAAK,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI,CAa1E;AAED,QAAA,MAAM,yBAAyB,eAA8B;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE;;YAoBzC,MAAM;iBAAW,OAAO;;kBAkQvC,MAAM;sBAqBF,MAAM;;sCA+DU,MAAM,KAAG,KAAK,CAAC,MAAM,OAAO,CAAC,kBAAkB,CAAC,CAAC;uBAoEhE,CAAC,SAAS,MAAM,eAC3B,CAAC,KACb,KAAK,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;CAqBvD,CAAA;AAEF;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,UAAU,CAAC,OAAO,yBAAyB,CAAC,CAAC,CAAC,CAAC,EAC1F,MAAM,EAAE,CAAC,GACR,UAAU,CAAC,OAAO,yBAAyB,CAAC,CAE9C;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,SAAU,MAAM,WAAW,OAAO,YAAY,aAAa,SAEnF,CAAA"}
|
|
@@ -34,6 +34,10 @@ export declare function createPluginEffect(handler: () => void | Promise<void>):
|
|
|
34
34
|
/**
|
|
35
35
|
* Registers a plugin with the client by calling its setup hook and merging any returned config into the plugin index.
|
|
36
36
|
*
|
|
37
|
+
* Every plugin takes an entry, so the index is the roster of what is registered and
|
|
38
|
+
* `client.pluginNames` names all of it. A plugin that returns no config gets an empty
|
|
39
|
+
* one, which is what `getPluginConfig` already answers for a name it does not hold.
|
|
40
|
+
*
|
|
37
41
|
* @param {Picked} client - The Picked client instance.
|
|
38
42
|
* @param {Plugin} plugin - The plugin to register.
|
|
39
43
|
* @param {PluginConfigIndex} plugins - The plugin config index to mutate.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/entities/plugin/plugin.ts"],"names":[],"mappings":"AAAA,wIAAwI;AACxI,OAAO,EAAgB,KAAK,MAAM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AA;CAC5B;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,CAIjG;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,WAAW,WAAY,MAAM,UAAU,MAAM,WAAW,iBAAiB,KAAG,IAOxF,CAAA"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -21,6 +21,6 @@ export type * from './utils/events';
|
|
|
21
21
|
export type * from './utils/search-params';
|
|
22
22
|
export type * from './entities/response/response';
|
|
23
23
|
export { Picked } from './picked';
|
|
24
|
-
export type { ActionKeys, ContentForStep, ExperienceKeys, FeatureKeys, FieldKeys, FieldKeysForStep, FieldValueFor, KnownActionKeys, KnownExperienceKeys, KnownFeatureKeys, KnownFieldKeys, KnownStepKeys, PickedSchemaRegistry, ReferencedContent, StepContentModelsMap, StepKeys, StepLayoutContent, TypedContent, } from './schema-registry';
|
|
24
|
+
export type { ActionKeys, ContentForStep, ExperienceKeys, FeatureKeys, FeatureValueFor, FieldKeys, FieldKeysForStep, FieldValueFor, KnownActionKeys, KnownExperienceKeys, KnownFeatureKeys, KnownFieldKeys, KnownStepKeys, PickedSchemaRegistry, ReferencedContent, StepContentModelsMap, StepKeys, StepLayoutContent, TypedContent, } from './schema-registry';
|
|
25
25
|
export { toTypedContentStore } from './typed-content';
|
|
26
26
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,4GAA4G;AAC5G,cAAc,WAAW,CAAA;AACzB,mBAAmB,UAAU,CAAA;AAC7B,mBAAmB,0BAA0B,CAAA;AAC7C,mBAAmB,gCAAgC,CAAA;AACnD,mBAAmB,4BAA4B,CAAA;AAC/C,mBAAmB,8BAA8B,CAA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CAAA;AAC/C,mBAAmB,wBAAwB,CAAA;AAC3C,mBAAmB,gCAAgC,CAAA;AACnD,mBAAmB,4BAA4B,CAAA;AAC/C,mBAAmB,0BAA0B,CAAA;AAC7C,mBAAmB,gCAAgC,CAAA;AACnD,mBAAmB,4BAA4B,CAAA;AAC/C,mBAAmB,gBAAgB,CAAA;AACnC,mBAAmB,uBAAuB,CAAA;AAC1C,mBAAmB,8BAA8B,CAAA;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,YAAY,EACV,UAAU,EACV,cAAc,EACd,cAAc,EACd,WAAW,EACX,eAAe,EACf,SAAS,EACT,gBAAgB,EAChB,aAAa,EACb,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,oBAAoB,EACpB,iBAAiB,EACjB,oBAAoB,EACpB,QAAQ,EACR,iBAAiB,EACjB,YAAY,GACb,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../../../src/lifecycle/lifecycle.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,OAAO,EAOL,KAAK,MAAM,EACX,KAAK,aAAa,EAElB,KAAK,aAAa,EACnB,MAAM,UAAU,CAAA;AAEjB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../../../src/lifecycle/lifecycle.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,OAAO,EAOL,KAAK,MAAM,EACX,KAAK,aAAa,EAElB,KAAK,aAAa,EACnB,MAAM,UAAU,CAAA;AAEjB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AACvC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