@picked/client 0.0.1-dev.1771981674305 → 0.0.1-dev.1772057362040
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/cjs/index.js +2 -2
- package/dist/cjs/plugins/create-experience/index.js +1 -1
- package/dist/cjs/server/index.js +1 -1
- package/dist/esm/index.js +630 -552
- package/dist/esm/plugins/create-experience/index.js +194 -228
- package/dist/esm/server/index.js +1 -1
- package/dist/experience-instance-5rr_D--s.cjs +1 -0
- package/dist/experience-instance-CLR80xop.js +819 -0
- package/dist/types/client.d.ts +0 -10
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/entities/action/action.d.ts +5 -2
- package/dist/types/entities/action/action.d.ts.map +1 -1
- package/dist/types/entities/component/component.d.ts +1 -2
- package/dist/types/entities/component/component.d.ts.map +1 -1
- package/dist/types/entities/experience/experience.d.ts +2 -2
- package/dist/types/entities/experience/experience.d.ts.map +1 -1
- package/dist/types/entities/experience-instance/experience-instance.d.ts +3 -4
- package/dist/types/entities/experience-instance/experience-instance.d.ts.map +1 -1
- package/dist/types/entities/field/field.d.ts +51 -14
- package/dist/types/entities/field/field.d.ts.map +1 -1
- package/dist/types/entities/plugin/plugin.d.ts +1 -4
- package/dist/types/entities/plugin/plugin.d.ts.map +1 -1
- package/dist/types/entities/response/response.d.ts.map +1 -1
- package/dist/types/exports.d.ts +0 -2
- package/dist/types/exports.d.ts.map +1 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/picked.d.ts +15 -15
- package/dist/types/picked.d.ts.map +1 -1
- package/dist/types/ping.d.ts.map +1 -1
- package/dist/types/plugins/create-experience/create-experience.d.ts +25 -22
- package/dist/types/plugins/create-experience/create-experience.d.ts.map +1 -1
- package/dist/types/utils/get-step-fields.d.ts +2 -1
- package/dist/types/utils/get-step-fields.d.ts.map +1 -1
- package/dist/types/utils/rules-logic.d.ts.map +1 -1
- package/package.json +1 -7
- package/dist/api-CbXfbi_s.js +0 -19
- package/dist/api-DzSCgBQ2.cjs +0 -1
- package/dist/cjs/plugins/dynamic-experiences/index.js +0 -1
- package/dist/esm/plugins/dynamic-experiences/index.js +0 -102
- package/dist/experience-instance-CU_pYPyd.js +0 -820
- package/dist/experience-instance-D_Mwuzb4.cjs +0 -1
- package/dist/types/entities/component/lazyComponent.d.ts +0 -11
- package/dist/types/entities/component/lazyComponent.d.ts.map +0 -1
- package/dist/types/plugins/dynamic-experiences/hash.d.ts +0 -12
- package/dist/types/plugins/dynamic-experiences/hash.d.ts.map +0 -1
- package/dist/types/plugins/dynamic-experiences/index.d.ts +0 -3
- package/dist/types/plugins/dynamic-experiences/index.d.ts.map +0 -1
- package/dist/types/plugins/dynamic-experiences/plugin.d.ts +0 -23
- package/dist/types/plugins/dynamic-experiences/plugin.d.ts.map +0 -1
- package/dist/types/plugins/dynamic-experiences/types.d.ts +0 -15
- package/dist/types/plugins/dynamic-experiences/types.d.ts.map +0 -1
- package/dist/types/utils/api.d.ts +0 -3
- package/dist/types/utils/api.d.ts.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@picked/client",
|
|
3
|
-
"version": "0.0.1-dev.
|
|
3
|
+
"version": "0.0.1-dev.1772057362040",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@withease/factories": "^1.0.5"
|
|
6
6
|
},
|
|
@@ -80,12 +80,6 @@
|
|
|
80
80
|
"import": "./dist/esm/plugins/web-components/index.js",
|
|
81
81
|
"require": "./dist/cjs/plugins/web-components/index.js",
|
|
82
82
|
"default": "./dist/esm/plugins/web-components/index.js"
|
|
83
|
-
},
|
|
84
|
-
"./plugins/dynamic-experiences": {
|
|
85
|
-
"types": "./dist/types/plugins/dynamic-experiences/index.d.ts",
|
|
86
|
-
"import": "./dist/esm/plugins/dynamic-experiences/index.js",
|
|
87
|
-
"require": "./dist/cjs/plugins/dynamic-experiences/index.js",
|
|
88
|
-
"default": "./dist/esm/plugins/dynamic-experiences/index.js"
|
|
89
83
|
}
|
|
90
84
|
},
|
|
91
85
|
"files": [
|
package/dist/api-CbXfbi_s.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
function o(t, n) {
|
|
2
|
-
return new URL(`/api/v1/${n}`, t).toString();
|
|
3
|
-
}
|
|
4
|
-
async function s(t, n) {
|
|
5
|
-
const e = o(t, n);
|
|
6
|
-
return fetch(e);
|
|
7
|
-
}
|
|
8
|
-
async function i(t, n, e, r) {
|
|
9
|
-
const c = o(t, n);
|
|
10
|
-
return fetch(c, {
|
|
11
|
-
method: "POST",
|
|
12
|
-
headers: { "Content-Type": "application/json", ...r },
|
|
13
|
-
body: JSON.stringify(e)
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
export {
|
|
17
|
-
s as g,
|
|
18
|
-
i as p
|
|
19
|
-
};
|
package/dist/api-DzSCgBQ2.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";function o(t,n){return new URL(`/api/v1/${n}`,t).toString()}async function s(t,n){const e=o(t,n);return fetch(e)}async function i(t,n,e,r){const c=o(t,n);return fetch(c,{method:"POST",headers:{"Content-Type":"application/json",...r},body:JSON.stringify(e)})}exports.get=s;exports.post=i;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("../../../api-DzSCgBQ2.cjs"),s=require("../../../logger-BsmHUUw1.cjs");function g(e){let r=2166136261;for(let n=0;n<e.length;n++)r^=e.charCodeAt(n),r=Math.imul(r,16777619);return r>>>0}function d(e,r,n,t){return t<=0?!1:t>=100?!0:g(`${e}:${r}:${n}`)%100<t}function p(e){return typeof e!="object"||e===null||!("id"in e&&"name"in e&&"enabled"in e&&"weight"in e&&"version"in e)?!1:typeof e.id=="string"&&typeof e.name=="string"&&typeof e.enabled=="boolean"&&typeof e.weight=="number"&&typeof e.version=="number"}function f(e){return typeof e!="object"||e===null||!("features"in e)||!Array.isArray(e.features)?!1:e.features.every(p)}function h(e){const r=e.searchParams["preview-token"];if(r&&r.length>0)return r[0]}function _(e){const r=new Set,n=e.searchParams.feature;if(!n)return r;for(const t of n){const i=t.indexOf(":");i>0&&r.add(t.substring(0,i))}return r}function u(e,r,n){const t=_(e),i=e.session?.id;if(!i)throw new Error("Session ID is required for feature registration");for(const o of r.features)t.has(o.id)||m(e,o,n,i)}function m(e,r,n,t){e.registerFeature(r.id,{key:`v${r.version}`,name:r.name,storage:n?"session":"local",decide:()=>r.enabled?d(t,r.id,r.version,r.weight):!1})}function y(){if(typeof __PICKED_PROJECT_CONFIG__>"u")return;let e;if(typeof __PICKED_PROJECT_CONFIG__=="string"?e=JSON.parse(__PICKED_PROJECT_CONFIG__):e=__PICKED_PROJECT_CONFIG__,f(e))return e;s.logger("warn","Build-time project config has invalid shape, falling back to runtime fetch")}async function c(e,r,n){const t=n?`projects/${r}?preview_token=${encodeURIComponent(n)}`:`projects/${r}`;let i;try{i=await l.get(e,t)}catch(a){return s.logger("warn","Failed to fetch project config",a),null}if(!i.ok)return s.logger("warn",`Project config request failed with status ${i.status.toString()}`),null;let o;try{o=await i.json()}catch{return s.logger("warn","Failed to parse project config response"),null}return f(o)?o:(s.logger("warn","Invalid project config response shape"),null)}function P(e){return{name:"dynamic-experiences",setup:r=>{const n=e?.apiUrl??r.apiUrl;return{onStart:async()=>{const t=h(r);if(t){const a=await c(n,r.projectId,t);a&&u(r,a,!0);return}const i=e?.projectConfig??y();if(i){u(r,i,!1);return}const o=await c(n,r.projectId);o&&u(r,o,!1)}}}}}exports.dynamicExperiencesPlugin=P;exports.fetchProject=c;
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import { g as l } from "../../../api-CbXfbi_s.js";
|
|
2
|
-
import { l as s } from "../../../logger-C9a75KZn.js";
|
|
3
|
-
function d(e) {
|
|
4
|
-
let r = 2166136261;
|
|
5
|
-
for (let n = 0; n < e.length; n++)
|
|
6
|
-
r ^= e.charCodeAt(n), r = Math.imul(r, 16777619);
|
|
7
|
-
return r >>> 0;
|
|
8
|
-
}
|
|
9
|
-
function p(e, r, n, t) {
|
|
10
|
-
return t <= 0 ? !1 : t >= 100 ? !0 : d(`${e}:${r}:${n}`) % 100 < t;
|
|
11
|
-
}
|
|
12
|
-
function g(e) {
|
|
13
|
-
return typeof e != "object" || e === null || !("id" in e && "name" in e && "enabled" in e && "weight" in e && "version" in e) ? !1 : typeof e.id == "string" && typeof e.name == "string" && typeof e.enabled == "boolean" && typeof e.weight == "number" && typeof e.version == "number";
|
|
14
|
-
}
|
|
15
|
-
function c(e) {
|
|
16
|
-
return typeof e != "object" || e === null || !("features" in e) || !Array.isArray(e.features) ? !1 : e.features.every(g);
|
|
17
|
-
}
|
|
18
|
-
function h(e) {
|
|
19
|
-
const r = e.searchParams["preview-token"];
|
|
20
|
-
if (r && r.length > 0)
|
|
21
|
-
return r[0];
|
|
22
|
-
}
|
|
23
|
-
function _(e) {
|
|
24
|
-
const r = /* @__PURE__ */ new Set(), n = e.searchParams.feature;
|
|
25
|
-
if (!n)
|
|
26
|
-
return r;
|
|
27
|
-
for (const t of n) {
|
|
28
|
-
const i = t.indexOf(":");
|
|
29
|
-
i > 0 && r.add(t.substring(0, i));
|
|
30
|
-
}
|
|
31
|
-
return r;
|
|
32
|
-
}
|
|
33
|
-
function u(e, r, n) {
|
|
34
|
-
const t = _(e), i = e.session?.id;
|
|
35
|
-
if (!i)
|
|
36
|
-
throw new Error("Session ID is required for feature registration");
|
|
37
|
-
for (const o of r.features)
|
|
38
|
-
t.has(o.id) || m(e, o, n, i);
|
|
39
|
-
}
|
|
40
|
-
function m(e, r, n, t) {
|
|
41
|
-
e.registerFeature(r.id, {
|
|
42
|
-
key: `v${r.version}`,
|
|
43
|
-
name: r.name,
|
|
44
|
-
storage: n ? "session" : "local",
|
|
45
|
-
decide: () => r.enabled ? p(t, r.id, r.version, r.weight) : !1
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
function y() {
|
|
49
|
-
if (typeof __PICKED_PROJECT_CONFIG__ > "u")
|
|
50
|
-
return;
|
|
51
|
-
let e;
|
|
52
|
-
if (typeof __PICKED_PROJECT_CONFIG__ == "string" ? e = JSON.parse(__PICKED_PROJECT_CONFIG__) : e = __PICKED_PROJECT_CONFIG__, c(e))
|
|
53
|
-
return e;
|
|
54
|
-
s("warn", "Build-time project config has invalid shape, falling back to runtime fetch");
|
|
55
|
-
}
|
|
56
|
-
async function f(e, r, n) {
|
|
57
|
-
const t = n ? `projects/${r}?preview_token=${encodeURIComponent(n)}` : `projects/${r}`;
|
|
58
|
-
let i;
|
|
59
|
-
try {
|
|
60
|
-
i = await l(e, t);
|
|
61
|
-
} catch (a) {
|
|
62
|
-
return s("warn", "Failed to fetch project config", a), null;
|
|
63
|
-
}
|
|
64
|
-
if (!i.ok)
|
|
65
|
-
return s("warn", `Project config request failed with status ${i.status.toString()}`), null;
|
|
66
|
-
let o;
|
|
67
|
-
try {
|
|
68
|
-
o = await i.json();
|
|
69
|
-
} catch {
|
|
70
|
-
return s("warn", "Failed to parse project config response"), null;
|
|
71
|
-
}
|
|
72
|
-
return c(o) ? o : (s("warn", "Invalid project config response shape"), null);
|
|
73
|
-
}
|
|
74
|
-
function w(e) {
|
|
75
|
-
return {
|
|
76
|
-
name: "dynamic-experiences",
|
|
77
|
-
setup: (r) => {
|
|
78
|
-
const n = e?.apiUrl ?? r.apiUrl;
|
|
79
|
-
return {
|
|
80
|
-
onStart: async () => {
|
|
81
|
-
const t = h(r);
|
|
82
|
-
if (t) {
|
|
83
|
-
const a = await f(n, r.projectId, t);
|
|
84
|
-
a && u(r, a, !0);
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
const i = e?.projectConfig ?? y();
|
|
88
|
-
if (i) {
|
|
89
|
-
u(r, i, !1);
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
const o = await f(n, r.projectId);
|
|
93
|
-
o && u(r, o, !1);
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
export {
|
|
100
|
-
w as dynamicExperiencesPlugin,
|
|
101
|
-
f as fetchProject
|
|
102
|
-
};
|