@picked/client 0.0.1-dev.1778730134956 → 0.0.1-dev.1780446300503

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 (63) hide show
  1. package/dist/{api-CPRRXVw6.cjs → api-Cqg2gPbP.cjs} +1 -1
  2. package/dist/{api-B-CbCRqb.js → api-qqBYwjhT.js} +1 -1
  3. package/dist/cjs/index.js +2 -2
  4. package/dist/cjs/plugins/dom-observer/index.js +1 -1
  5. package/dist/cjs/plugins/dynamic-experiences/index.js +1 -1
  6. package/dist/cjs/plugins/experience-browser-storage/index.js +1 -1
  7. package/dist/cjs/plugins/history-browser-storage/index.js +1 -1
  8. package/dist/cjs/plugins/responses-browser-storage/index.js +1 -1
  9. package/dist/cjs/plugins/responses-indexeddb/index.js +1 -1
  10. package/dist/cjs/plugins/single-page-app/index.js +1 -1
  11. package/dist/cjs/plugins/web-components/index.js +1 -1
  12. package/dist/cjs/plugins/window-object/index.js +1 -1
  13. package/dist/cjs/server/index.js +1 -1
  14. package/dist/docs/image-optimisation-service.md +6 -6
  15. package/dist/docs/sdk/content-security-policy.md +8 -7
  16. package/dist/docs/sdk/fields.md +2 -2
  17. package/dist/{dom-DGePXPpM.js → dom-DjfSrkpp.js} +7 -7
  18. package/dist/{dom-C3C6Fmwz.cjs → dom-sqnnO-CT.cjs} +1 -1
  19. package/dist/esm/index.js +322 -331
  20. package/dist/esm/plugins/dom-observer/index.js +2 -2
  21. package/dist/esm/plugins/dynamic-experiences/index.js +3 -234
  22. package/dist/esm/plugins/experience-browser-storage/index.js +1 -1
  23. package/dist/esm/plugins/history-browser-storage/index.js +1 -1
  24. package/dist/esm/plugins/responses-browser-storage/index.js +1 -1
  25. package/dist/esm/plugins/responses-indexeddb/index.js +1 -1
  26. package/dist/esm/plugins/single-page-app/index.js +14 -14
  27. package/dist/esm/plugins/web-components/index.js +2 -2
  28. package/dist/esm/plugins/window-object/index.js +1 -1
  29. package/dist/esm/server/index.js +84 -51
  30. package/dist/experience-instance-B2Xb6TAm.cjs +1 -0
  31. package/dist/{experience-instance-BOhvCj_F.js → experience-instance-Brph8SaR.js} +155 -73
  32. package/dist/plugin-7rlBjq6t.js +240 -0
  33. package/dist/plugin-D1FIRtEo.cjs +1 -0
  34. package/dist/preview-bridge-Cv-Fu5Y1.cjs +1 -0
  35. package/dist/preview-bridge-eBbZClad.js +33 -0
  36. package/dist/supports-34OzZK5j.cjs +1 -0
  37. package/dist/{supports-0XIfd4-R.js → supports-BgjwyijI.js} +11 -4
  38. package/dist/types/entities/experience-instance/experience-instance.d.ts +0 -12
  39. package/dist/types/entities/experience-instance/experience-instance.d.ts.map +1 -1
  40. package/dist/types/entities/history/history.d.ts +0 -3
  41. package/dist/types/entities/history/history.d.ts.map +1 -1
  42. package/dist/types/entities/response/response.d.ts +0 -1
  43. package/dist/types/entities/response/response.d.ts.map +1 -1
  44. package/dist/types/lifecycle/condition-selection.d.ts +98 -0
  45. package/dist/types/lifecycle/condition-selection.d.ts.map +1 -0
  46. package/dist/types/lifecycle/lifecycle.d.ts.map +1 -1
  47. package/dist/types/picked.d.ts +19 -4
  48. package/dist/types/picked.d.ts.map +1 -1
  49. package/dist/types/plugins/dynamic-experiences/plugin.d.ts +23 -0
  50. package/dist/types/plugins/dynamic-experiences/plugin.d.ts.map +1 -1
  51. package/dist/types/plugins/dynamic-experiences/types.d.ts +5 -1
  52. package/dist/types/plugins/dynamic-experiences/types.d.ts.map +1 -1
  53. package/dist/types/preview-bridge/index.d.ts +14 -0
  54. package/dist/types/preview-bridge/index.d.ts.map +1 -0
  55. package/dist/types/server/index.d.ts +8 -0
  56. package/dist/types/server/index.d.ts.map +1 -1
  57. package/dist/types/server/serialize.d.ts +67 -0
  58. package/dist/types/server/serialize.d.ts.map +1 -0
  59. package/dist/types/utils/supports.d.ts +8 -0
  60. package/dist/types/utils/supports.d.ts.map +1 -1
  61. package/package.json +2 -2
  62. package/dist/experience-instance-D8yKenBU.cjs +0 -1
  63. package/dist/supports-Dsjg-82e.cjs +0 -1
@@ -0,0 +1,33 @@
1
+ import { n as e } from "./object-DvUDOytC.js";
2
+ import { a as t, f as n } from "./supports-BgjwyijI.js";
3
+ //#region src/preview-bridge/index.ts
4
+ var r = "picked-preview:navigation", i = !1;
5
+ function a() {
6
+ return "*";
7
+ }
8
+ function o() {
9
+ let { href: e, pathname: t, search: n } = window.location, i = {
10
+ type: r,
11
+ href: e,
12
+ pathname: t,
13
+ search: n
14
+ };
15
+ window.parent.postMessage(i, a());
16
+ }
17
+ function s(e) {
18
+ return function(...t) {
19
+ e.apply(this, t), o();
20
+ };
21
+ }
22
+ function c() {
23
+ if (i || !n()) return () => void 0;
24
+ i = !0, o();
25
+ let r = () => {
26
+ o();
27
+ };
28
+ return window.addEventListener("popstate", r), t() && (e(window.history, "pushState", s), e(window.history, "replaceState", s)), () => {
29
+ i = !1, window.removeEventListener("popstate", r);
30
+ };
31
+ }
32
+ //#endregion
33
+ export { c as initPreviewBridge };
@@ -0,0 +1 @@
1
+ var e=Symbol(`Picked`),t=globalThis,n=n=>{t[e]=n};function r(){try{return`location`in t&&!!t.location}catch{return!1}}function i(){try{return`history`in t&&!!t.history}catch{return!1}}function a(){try{return`localStorage`in t&&!!t.localStorage}catch{return!1}}function o(){try{return`sessionStorage`in t&&!!t.sessionStorage}catch{return!1}}function s(){try{return`document`in t&&`cookie`in t.document}catch{return!1}}function c(){try{return`document`in t&&`createElement`in t.document&&`attachShadow`in t.document.createElement(`div`)}catch{return!1}}function l(){try{return`window`in t}catch{return!1}}function u(){try{return l()&&t.top!==t.self}catch{return!0}}function d(){try{return`document`in t}catch{return!1}}function f(){try{return`IntersectionObserver`in t}catch{return!1}}function p(){try{return`customElements`in t&&!!t.customElements}catch{return!1}}function m(){try{return`crypto`in t&&`randomUUID`in t.crypto}catch{return!1}}Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,`d`,{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,`f`,{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,`m`,{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,`p`,{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return c}});
@@ -54,27 +54,34 @@ function l() {
54
54
  }
55
55
  }
56
56
  function u() {
57
+ try {
58
+ return l() && t.top !== t.self;
59
+ } catch {
60
+ return !0;
61
+ }
62
+ }
63
+ function d() {
57
64
  try {
58
65
  return "document" in t;
59
66
  } catch {
60
67
  return !1;
61
68
  }
62
69
  }
63
- function d() {
70
+ function f() {
64
71
  try {
65
72
  return "IntersectionObserver" in t;
66
73
  } catch {
67
74
  return !1;
68
75
  }
69
76
  }
70
- function f() {
77
+ function p() {
71
78
  try {
72
79
  return "customElements" in t && !!t.customElements;
73
80
  } catch {
74
81
  return !1;
75
82
  }
76
83
  }
77
- function p() {
84
+ function m() {
78
85
  try {
79
86
  return "crypto" in t && "randomUUID" in t.crypto;
80
87
  } catch {
@@ -82,4 +89,4 @@ function p() {
82
89
  }
83
90
  }
84
91
  //#endregion
85
- export { d as a, o as c, l as d, t as f, i, c as l, p as n, a as o, n as p, u as r, r as s, s as t, f as u };
92
+ export { i as a, r as c, p as d, l as f, d as i, o as l, n as m, s as n, f as o, t as p, m as r, a as s, u as t, c as u };
@@ -38,18 +38,6 @@ export interface ExperienceInstance {
38
38
  goToPreviousStep: EventCallable<void>;
39
39
  goToStepById: EventCallable<string>;
40
40
  stepsHistoryStore: Store<HistoryEntry[]>;
41
- /**
42
- * Reactive flag indicating whether the user has in-progress state for this experience.
43
- * Derived from `stepsHistoryStore`: `true` once history holds at least two step
44
- * entries (entry step + one progression), `false` at origin or with a single entry.
45
- */
46
- isResumableStore: Store<boolean>;
47
- /**
48
- * Atomically clears this experience's history entries and the responses owned by its
49
- * step nodes. The walk then re-fires from origin because `currentNodeStore` re-derives
50
- * to `null`. Sibling experiences are untouched.
51
- */
52
- restart: EventCallable<void>;
53
41
  /**
54
42
  * Per-instance mount effect. Attached over `componentAndFrameworkStore` so the render call always receives the current resolved component+framework pair.
55
43
  */
@@ -1 +1 @@
1
- {"version":3,"file":"experience-instance.d.ts","sourceRoot":"","sources":["../../../../src/entities/experience-instance/experience-instance.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,OAAO,EAOL,KAAK,MAAM,EACX,KAAK,aAAa,EAGlB,KAAK,KAAK,EACX,MAAM,UAAU,CAAA;AAEjB,OAAO,KAAK,EACV,UAAU,EACV,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,uBAAuB,EACxB,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAClD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAiB1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAItD,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAA;IACV,aAAa,EAAE,UAAU,CAAC,KAAK,CAAC,CAAA;IAChC,YAAY,EAAE,UAAU,CAAC,IAAI,CAAC,CAAA;IAC9B,sGAAsG;IACtG,cAAc,EAAE,MAAM,CAAA;IACtB,WAAW,EAAE,eAAe,CAA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A;IAChC;;;;OAIG;IACH,OAAO,EAAE,aAAa,CAAC,IAAI,CAAC,CAAA;IAC5B;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,CAAA;CACnC;AAED,MAAM,MAAM,uBAAuB,GAAG,UAAU,CAAC,OAAO,6BAA6B,CAAC,CAAA;AACtF,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,WAAW,EAAE,CAAA;IACvB,SAAS,EAAE,gBAAgB,CAAC,WAAW,CAAC,CAAA;CACzC;AAED,QAAA,MAAM,+BAA+B,6CAMhC;IACD,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,eAAe,CAAA;IAC3B,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB,OAAO,CAAC,EAAE,uBAAuB,CAAA;CAClC,uBA6hBF,CAAA;AAED;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CACtC,CAAC,SAAS,UAAU,CAAC,OAAO,+BAA+B,CAAC,CAAC,CAAC,CAAC,EAC/D,MAAM,EAAE,CAAC,GAAG,UAAU,CAAC,OAAO,+BAA+B,CAAC,CAE/D;AAED,QAAA,MAAM,oCAAoC,eAA8B;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE;wBA4H1E,eAAe,UACnB,WAAW,YACT,uBAAuB;8BAmBF,UAAU,CAAC,KAAK,CAAC;4BAiBnB,UAAU,CAAC,IAAI,CAAC;;CAU/C,CAAA;AAEF;;;;;;;;;GASG;AACH,wBAAgB,6BAA6B,CAC3C,CAAC,SAAS,UAAU,CAAC,OAAO,oCAAoC,CAAC,CAAC,CAAC,CAAC,EACpE,MAAM,EAAE,CAAC,GAAG,UAAU,CAAC,OAAO,oCAAoC,CAAC,CAEpE"}
1
+ {"version":3,"file":"experience-instance.d.ts","sourceRoot":"","sources":["../../../../src/entities/experience-instance/experience-instance.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,OAAO,EAOL,KAAK,MAAM,EACX,KAA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+B,CAAC,CAE/D;AAED,QAAA,MAAM,oCAAoC,eAA8B;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE;wBA4H1E,eAAe,UACnB,WAAW,YACT,uBAAuB;8BAmBF,UAAU,CAAC,KAAK,CAAC;4BAiBnB,UAAU,CAAC,IAAI,CAAC;;CAU/C,CAAA;AAEF;;;;;;;;;GASG;AACH,wBAAgB,6BAA6B,CAC3C,CAAC,SAAS,UAAU,CAAC,OAAO,oCAAoC,CAAC,CAAC,CAAC,CAAC,EACpE,MAAM,EAAE,CAAC,GAAG,UAAU,CAAC,OAAO,oCAAoC,CAAC,CAEpE"}
@@ -20,9 +20,6 @@ export declare function createHistory(): {
20
20
  restore: import('effector').EventCallable<{
21
21
  entries: HistoryEntry[];
22
22
  }>;
23
- resetExperience: import('effector').EventCallable<{
24
- experienceId: string;
25
- }>;
26
23
  entriesStore: import('effector').Store<HistoryEntry[]>;
27
24
  };
28
25
  //# sourceMappingURL=history.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../../../src/entities/history/history.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAM9D,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,cAAc,CAAA;IACpB,EAAE,EAAE,MAAM,CAAA;IACV,YAAY,EAAE,MAAM,CAAA;CACrB;AAgGD,wBAAgB,aAAa;;sBA/EsB,MAAM;cAAQ,cAAc;;;sBACzB,MAAM;cAAQ,cAAc;;;uBAC9B,MAAM;;;iBACT,YAAY,EAAE;;;sBACD,MAAM;;;EA6EnE"}
1
+ {"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../../../src/entities/history/history.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAM9D,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,cAAc,CAAA;IACpB,EAAE,EAAE,MAAM,CAAA;IACV,YAAY,EAAE,MAAM,CAAA;CACrB;AA4FD,wBAAgB,aAAa;;sBA3EsB,MAAM;cAAQ,cAAc;;;sBACzB,MAAM;cAAQ,cAAc;;;uBAC9B,MAAM;;;iBACT,YAAY,EAAE;;;EA0E9D"}
@@ -18,7 +18,6 @@ declare const createResponseIndexFactory: ({ client }: {
18
18
  };
19
19
  clearAll: import('effector').EventCallable<void>;
20
20
  clear: import('effector').EventCallable<string>;
21
- clearByExperience: (experienceId: string) => void;
22
21
  commit: (responsesToCommit: CommitResponses) => Promise<{
23
22
  errors: ValidationError[];
24
23
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"response.d.ts","sourceRoot":"","sources":["../../../../src/entities/response/response.ts"],"names":[],"mappings":"AAAA,mGAAmG;AACnG,OAAO,EAAiE,KAAK,KAAK,EAAE,MAAM,UAAU,CAAA;AAEpG,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAGvD,OAAO,EAML,KAAK,eAAe,EACrB,MAAM,uBAAuB,CAAA;AAE9B,YAAY,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAE5D,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAInE,MAAM,MAAM,QAAQ,GAAG,UAAU,CAAA;AAGjC,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,QAAQ,CAAA;CAChB;AAED,QAAA,MAAM,0BAA0B,eAA8B;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE;;mBA6BlD,KAAK,CAAC,KAAK,CAAC,YAAY,QAAQ,GAAG,IAAI;kBACxC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC,aAAa,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AW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,QAAQ,CAAA;CAChB;AAED,QAAA,MAAM,0BAA0B,eAA8B;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE;;mBA6BlD,KAAK,CAAC,KAAK,CAAC,YAAY,QAAQ,GAAG,IAAI;kBACxC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC,aAAa,KAAK,GAAG,IAAI;;;;gCAwK7D,eAAe,KACjC,OAAO,CAAC;QAAE,MAAM,EAAE,eAAe,EAAE,CAAA;KAAE,CAAC;8CAtCpB,eAAe,KACjC,OAAO,CAAC;QAAE,iBAAiB,EAAE,eAAe,CAAC;QAAC,gBAAgB,EAAE,eAAe,EAAE,CAAA;KAAE,CAAC;;;;;;;;uBA8E7D,KAAK,CAAC,IAAI,CAAC,KAAG,KAAK,CAAC,UAAU,CAAC;yBAc7B,KAAK,CAAC,KAAK,CAAC,KAAG,KAAK,CAAC,UAAU,CAAC;gCAezB,KAAK,CAAC,MAAM,CAAC,KAAG,KAAK,CAAC,UAAU,CAAC;CA0BpE,CAAA;AAEF;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,UAAU,CAAC,OAAO,0BAA0B,CAAC,CAAC,CAAC,CAAC,EAC5F,MAAM,EAAE,CAAC,GACR,UAAU,CAAC,OAAO,0BAA0B,CAAC,CAE/C;AAED,mCAAmC;AACnC,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA"}
@@ -0,0 +1,98 @@
1
+ import { Store } from 'effector';
2
+ import { LogicObject, LogicRule, LogicValue } from '../logic-engine';
3
+ import { Picked } from '../picked';
4
+ /** A condition rule that may be json-logic, a raw logic value, or unset. */
5
+ type ConditionRule = LogicRule | LogicValue | undefined;
6
+ /**
7
+ * Produces a stable, key-order-independent string hash of a logic rule for use as a cache key.
8
+ *
9
+ * Object keys are sorted recursively, arrays preserve their order, and `undefined` is
10
+ * normalised to `null`. Equivalent rules with reordered keys hash identically; rules that
11
+ * differ in any value or array order hash differently.
12
+ *
13
+ * @param {ConditionRule} rule - The rule to hash.
14
+ * @returns {string} A deterministic string key for the rule.
15
+ * @example
16
+ * hashRule({ '==': [1, 1] }) // '{"==":[1,1]}'
17
+ */
18
+ export declare function hashRule(rule: ConditionRule): string;
19
+ /**
20
+ * Reactive store of memoized condition-evaluation results, keyed by rule hash.
21
+ */
22
+ export interface ConditionResults {
23
+ /** Reactive store mapping rule hashes to their boolean evaluation result. */
24
+ store: Store<Record<string, boolean>>;
25
+ /** Writes a single hash-to-result entry into the store. */
26
+ set: (payload: {
27
+ hash: string;
28
+ result: boolean;
29
+ }) => void;
30
+ /** Bulk-seeds the store from a snapshot of hash-to-result entries, such as the server snapshot. */
31
+ seed: (results: Record<string, boolean>) => void;
32
+ /** Returns a derived store for a single hash, resolving reactively to late writes. */
33
+ getResult: (hash: string) => Store<boolean | undefined>;
34
+ /** Synchronously reads the current result for a hash, or `undefined` when absent. */
35
+ peek: (hash: string) => boolean | undefined;
36
+ }
37
+ /**
38
+ * Creates a reactive condition-results store keyed by rule hash, mirroring the entity-index
39
+ * factory pattern.
40
+ *
41
+ * @returns {ConditionResults} A condition-results store with set, seed, getResult, and peek.
42
+ * @example
43
+ * const results = createConditionResults()
44
+ * results.set({ hash: 'h1', result: true })
45
+ * results.peek('h1') // true
46
+ */
47
+ export declare function createConditionResults(): ConditionResults;
48
+ /**
49
+ * Evaluates a condition rule with memoization against the client's `conditionResults` store.
50
+ *
51
+ * Every rule (including `undefined`/`null`, empty, and boolean gates) is hashed and its result
52
+ * cached, so callers can read it synchronously via `conditionResults.peek(hashRule(rule))` (which
53
+ * `<Experience>` relies on for slot selection, such as an experience with no condition). A cache hit
54
+ * returns the stored value; a miss resolves the gate (evaluating non-empty logic rules via
55
+ * `evaluateRuleLogic`), writes the result back to the store (propagating reactively), and returns it.
56
+ *
57
+ * Rules that reference an action (a `var` under the `actions` namespace) are never read from or
58
+ * written to the cache: actions have side effects that must re-run on every evaluation, so caching
59
+ * their result would suppress those effects.
60
+ *
61
+ * @param {Picked} client - The Picked client providing the evaluation context and results store.
62
+ * @param {ConditionRule} rule - The condition rule to evaluate.
63
+ * @param {object} [options] - Optional evaluation options.
64
+ * @param {LogicObject} [options.context] - Context overrides merged into the evaluation (e.g. URL location).
65
+ * @returns {Promise<boolean>} Whether the condition resolves truthy.
66
+ * @example
67
+ * const active = await evaluateConditionMemo(client, { '==': [1, 1] })
68
+ */
69
+ export declare function evaluateConditionMemo(client: Picked, rule: ConditionRule, options?: {
70
+ context?: LogicObject;
71
+ }): Promise<boolean>;
72
+ /**
73
+ * Determines whether an experience is active by AND-ing the optional client precondition, the
74
+ * optional client condition, and the experience's own condition through the memoized evaluator.
75
+ *
76
+ * This is the DOM-free analogue of `shouldInitialiseFx` used for slot-based and server-side
77
+ * selection: each unset gate is treated as passing.
78
+ *
79
+ * @param {Picked} client - The Picked client providing the evaluation context and results store.
80
+ * @param {object} experience - The experience to test.
81
+ * @param {LogicRule | LogicValue} [experience.condition] - The experience's decision logic.
82
+ * @param {object} [options] - Optional gate inputs.
83
+ * @param {LogicObject} [options.context] - Context overrides merged into every evaluation.
84
+ * @param {LogicRule | LogicValue} [options.precondition] - The client-level precondition gate.
85
+ * @param {LogicRule | LogicValue} [options.condition] - The client-level condition gate.
86
+ * @returns {Promise<boolean>} Whether the experience is active for the given context.
87
+ * @example
88
+ * const active = await isExperienceActive(client, { condition: exp.condition }, { context })
89
+ */
90
+ export declare function isExperienceActive(client: Picked, experience: {
91
+ condition?: LogicRule | LogicValue;
92
+ }, options?: {
93
+ context?: LogicObject;
94
+ precondition?: LogicRule | LogicValue;
95
+ condition?: LogicRule | LogicValue;
96
+ }): Promise<boolean>;
97
+ export {};
98
+ //# sourceMappingURL=condition-selection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"condition-selection.d.ts","sourceRoot":"","sources":["../../../src/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;IAElD,sDAAsD;IACtD,uBAAuB,EAAE,aAAa,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,CAAA;IAEjE,iFAAiF;IACjF,eAAe,EAAE,aAAa,CAAC,UAAU,CAAC,CAAA;IAC1C,8EAA8E;IAC9E,YAAY,EAAE,aAAa,CAAC,UAAU,CAAC,CAAA;CACxC;AAyOD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAErE"}
@@ -6,6 +6,7 @@ import { AdaptedComponent } from './entities/component/component';
6
6
  import { Framework } from './entities/framework/framework';
7
7
  import { StateSnapshot } from './lifecycle/state-snapshot';
8
8
  import { EvaluateRuleLogicParams } from './lifecycle/rules-logic';
9
+ import { ConditionResults } from './lifecycle/condition-selection';
9
10
  import { LifecycleStage } from './lifecycle/lifecycle';
10
11
  import { Predicate } from './entities/predicate/predicate';
11
12
  import { Feature } from './entities/feature/feature';
@@ -72,9 +73,6 @@ export declare class Picked {
72
73
  restore: EventCallable<{
73
74
  entries: import('.').HistoryEntry[];
74
75
  }>;
75
- resetExperience: EventCallable<{
76
- experienceId: string;
77
- }>;
78
76
  entriesStore: Store<import('.').HistoryEntry[]>;
79
77
  };
80
78
  readonly components: {
@@ -174,7 +172,6 @@ export declare class Picked {
174
172
  };
175
173
  clearAll: EventCallable<void>;
176
174
  clear: EventCallable<string>;
177
- clearByExperience: (experienceId: string) => void;
178
175
  commit: (responsesToCommit: import('.').CommitResponses) => Promise<{
179
176
  errors: import('.').ValidationError[];
180
177
  }>;
@@ -221,6 +218,13 @@ export declare class Picked {
221
218
  experience: import('.').ExperienceInstance;
222
219
  }) => Store<() => ReturnType<Action>>;
223
220
  };
221
+ /**
222
+ * Memoized condition-evaluation results keyed by rule hash. Populated by the
223
+ * server `serialize` selection and the memoized evaluator (`evaluateConditionMemo`),
224
+ * and seeded on the client from the SSR snapshot so first paint reuses the server's
225
+ * selection without re-evaluating.
226
+ */
227
+ readonly conditionResults: ConditionResults;
224
228
  readonly stateSnapshotStore: Store<StateSnapshot>;
225
229
  readonly evaluateRuleLogicFx: Effect<EvaluateRuleLogicParams, unknown, Error>;
226
230
  /** Public trigger — fires the start chain. `await allSettled(client.start, { scope })` resolves once the chain has fully settled. */
@@ -247,6 +251,17 @@ export declare class Picked {
247
251
  context?: Record<string, unknown>;
248
252
  }, string, Error>;
249
253
  constructor(options: CreateClientOptions);
254
+ /**
255
+ * Lazily starts the preview bridge when the client runs inside an iframe in preview mode (a
256
+ * `preview-token` search param is present). The bridge is loaded via a dynamic `import()` so it is
257
+ * code-split out of production bundles and fetched only inside the dashboard preview; failures are
258
+ * swallowed so client creation never depends on it.
259
+ *
260
+ * @returns {void} Nothing.
261
+ * @example
262
+ * this.maybeStartPreviewBridge()
263
+ */
264
+ private maybeStartPreviewBridge;
250
265
  registerFramework: (framework: Framework) => void;
251
266
  registerComponent: (name: string, component: AdaptedComponent) => void;
252
267
  registerPlugin: (plugin: Plugin) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"picked.d.ts","sourceRoot":"","sources":["../../src/picked.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,OAAO,EAGL,KAAK,MAAM,EACX,KAAK,aAAa,EAClB,KAAK,KAAK,EACV,KAAK,aAAa,EACnB,MAAM,UAAU,CAAA;AACjB,OAAO,EAEL,KAAK,UAAU,EACf,KAAK,uBAAuB,EAC7B,MAAM,kCAAkC,CAAA;AACzC,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,iBAAiB,EAAe,MAAM,0BAA0B,CAAA;AAC3F,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,UAAU,CAAA;AACnD,OAAO,EACL,KAAK,gBAAgB,EAGtB,MAAM,gCAAgC,CAAA;AACvC,OAAO,EAEL,KAAK,SAAS,EAEf,MAAM,gCAAgC,CAAA;AAEvC,OAAO,EAA4B,KAAK,aAAa,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CAEzC;IAED,cAAc,GAAI,KAAK,MAAM,EAAE,QAAQ,MAAM,KAAG,IAAI,CAEnD;IAED,kBAAkB,GAAI,YAAY,UAAU,KAAG,IAAI,CAMlD;IAED;;;;;;;;;OASG;IAEH,oBAAoB,GAClB,cAAc,MAAM,EACpB,UAAU,uBAAuB,KAChC,OAAO,CAAC,IAAI,CAAC,CAEf;IACD;;;;;;;;;OASG;IAEH,qBAAqB,GACnB,eAAe,MAAM,EACrB,UAAU,uBAAuB,KAChC,OAAO,CAAC,IAAI,CAAC,CAEf;IAED;;;;;;;;OAQG;IAEH,kBAAkB,GAAU,cAAc,MAAM,KAAG,OAAO,CAAC,IAAI,CAAC,CAE/D;IAED;;;;;;;;OAQG;IAEH,mBAAmB,GAAU,eAAe,MAAM,KAAG,OAAO,CAAC,IAAI,CAAC,CAEjE;IAED,OAAO,CAAC,YAAY;IAsBpB,OAAO,CAAC,aAAa;IA8CrB,OAAO,CAAC,eAAe;IAgBvB,OAAO,CAAC,YAAY;IAgBpB,OAAO,CAAC,eAAe;IAWvB,eAAe,GAAI,YAAY,MAAM,KAAG,iBAAiB,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAE1F;CACF"}
@@ -1,5 +1,28 @@
1
1
  import { Plugin } from '../../entities/plugin/plugin';
2
+ import { Picked } from '../../picked';
2
3
  import { DynamicExperiencesPluginOptions, ExperienceContentResponse, FetchProjectOptions, ProjectConfig } from './types';
4
+ /**
5
+ * Synchronously registers a complete project config with the client: features, conditions,
6
+ * fields, steps, and experiences, in dependency order.
7
+ *
8
+ * Extracted from `dynamicExperiencesPlugin`'s `onStart` so the same registration runs outside
9
+ * the lifecycle (notably from the server `serialize` helper and the SSR provider), where the
10
+ * stores must be populated synchronously before selection or rendering.
11
+ *
12
+ * @param {Picked} client - Picked client instance.
13
+ * @param {ProjectConfig} config - Project configuration to register.
14
+ * @param {object} options - Registration options.
15
+ * @param {boolean} options.isPreview - Whether features use session storage instead of local storage.
16
+ * @param {string} options.sessionId - Current session id, used as the seed for stable feature allocation.
17
+ * @example
18
+ * ```typescript
19
+ * registerProjectConfig(client, config, { isPreview: false, sessionId: 's' })
20
+ * ```
21
+ */
22
+ export declare function registerProjectConfig(client: Picked, config: ProjectConfig, options: {
23
+ isPreview: boolean;
24
+ sessionId: string;
25
+ }): void;
3
26
  /**
4
27
  * Fetches the project configuration from the Picked REST API.
5
28
  *
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/plugins/dynamic-experiences/plugin.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AAK1D,OAAO,KAAK,EAEV,+BAA+B,EAC/B,yBAAyB,EACzB,mBAAmB,EACnB,aAAa,EAId,MAAM,SAAS,CAAA;AAsThB;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,YAAY,CAChC,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAmC/B;AAoBD;;;;;;;;;;;;;;;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,CAsC3C;AAkPD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,CAAC,EAAE,+BAA+B,GAAG,MAAM,CAoC1F"}
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/plugins/dynamic-experiences/plugin.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AAC1D,OAAO,KAAK,EAAE,MAAM,EAAoB,MAAM,cAAc,CAAA;AAI5D,OAAO,KAAK,EAEV,+BAA+B,EAC/B,yBAAyB,EACzB,mBAAmB,EACnB,aAAa,EAId,MAAM,SAAS,CAAA;AA4JhB;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE;IAAE,SAAS,EAAE,OAAO,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GACjD,IAAI,CAMN;AA4JD;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,YAAY,CAChC,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAmC/B;AAoBD;;;;;;;;;;;;;;;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,CAsC3C;AAkPD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,CAAC,EAAE,+BAA+B,GAAG,MAAM,CAgC1F"}
@@ -101,10 +101,14 @@ export interface ContentBlob {
101
101
  * Wire-format response shape for `GET /api/v1/projects/:projectId/experiences/:experienceId/content`.
102
102
  * The response is agnostic of step structure — step ↔ content mapping is encoded in the
103
103
  * project blob via `Step.layoutContentId`.
104
+ *
105
+ * `versionId` is the published workspace version id on the published surface and
106
+ * `null` on the preview surface, where there is no published version (mirroring
107
+ * how the preview project-config payload surfaces `versionId: null`).
104
108
  */
105
109
  export interface ExperienceContentResponse {
106
110
  experienceId: string;
107
- versionId: string;
111
+ versionId: string | null;
108
112
  content: ContentBlob[];
109
113
  }
110
114
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources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I,CAAA;KAC3B,CAAA;CACF"}
@@ -0,0 +1,14 @@
1
+ /** The `postMessage` `type` discriminator for navigation reports sent to the embedding parent frame. */
2
+ export declare const PREVIEW_NAVIGATION_MESSAGE = "picked-preview:navigation";
3
+ /**
4
+ * Starts reporting this frame's URL to the embedding parent frame: posts immediately, then again on
5
+ * every SPA navigation (`history.pushState`/`replaceState` and `popstate`). Listeners are wired at
6
+ * most once per frame, so multiple Picked clients on the same page do not double-report.
7
+ *
8
+ * @returns {() => void} A teardown function that detaches the `popstate` listener and re-arms the bridge.
9
+ * @example
10
+ * const stop = initPreviewBridge()
11
+ * // later, e.g. in a test: stop()
12
+ */
13
+ export declare function initPreviewBridge(): () => void;
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/preview-bridge/index.ts"],"names":[],"mappings":"AAUA,wGAAwG;AACxG,eAAO,MAAM,0BAA0B,8BAA8B,CAAA;AAmErE;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,IAAI,CAwB9C"}
@@ -1,6 +1,12 @@
1
1
  import { Picked } from '../picked';
2
2
  import { ExperienceInstance } from '../entities/experience-instance/experience-instance';
3
3
  import { AdaptedComponent } from '../entities/component/component';
4
+ export { serialize, type PickedSnapshot, type SerializeParams, type SerializeAttributes, type SerializeLocation, type SerializeGetContent, } from './serialize';
5
+ export { createExperienceInstance } from '../entities/experience-instance/experience-instance';
6
+ export type { ExperienceInstance } from '../entities/experience-instance/experience-instance';
7
+ export { registerProjectConfig } from '../plugins/dynamic-experiences/plugin';
8
+ export { hashRule, evaluateConditionMemo, isExperienceActive, } from '../lifecycle/condition-selection';
9
+ export type { ContentBlob, ProjectConfig, ProjectConfigExperience, ExperienceContentResponse, } from '../plugins/dynamic-experiences/types';
4
10
  export interface Renderer<T = AdaptedComponent<string, unknown>> {
5
11
  isValidComponent: (component: AdaptedComponent<string, unknown>) => boolean;
6
12
  render: (component: T, client: Picked, experience: ExperienceInstance) => Promise<{
@@ -14,6 +20,8 @@ export interface Renderer<T = AdaptedComponent<string, unknown>> {
14
20
  * @param {Picked} client - The Picked client instance.
15
21
  * @param {Renderer[]} renderers - Array of available renderers to use.
16
22
  * @returns {Promise<string[]>} A promise resolving to rendered experience HTML strings.
23
+ * @example
24
+ * const html = await render(client, [svelteRenderer])
17
25
  */
18
26
  export declare function render(client: Picked, renderers: Renderer[]): Promise<string[]>;
19
27
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/server/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AACvC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qDAAqD,CAAA;AAE7F,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAA;AAwBvE,MAAM,WAAW,QAAQ,CAAC,CAAC,GAAG,gBAAgB,CAAC,MAAM,EAAE,OAAO,CAAC;IAC7D,gBAAgB,EAAE,CAAC,SAAS,EAAE,gBAAgB,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAA;IAC3E,MAAM,EAAE,CACN,SAAS,EAAE,CAAC,EACZ,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,kBAAkB,KAC3B,OAAO,CAAC;QACX,IAAI,EAAE,MAAM,CAAA;QACZ,IAAI,EAAE,MAAM,CAAA;KACb,CAAC,CAAA;CACH;AAmBD;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAkJ/E"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/server/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AACvC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qDAAqD,CAAA;AAE7F,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAA;AAEvE,OAAO,EACL,SAAS,EACT,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,GACzB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,wBAAwB,EAAE,MAAM,qDAAqD,CAAA;AAC9F,YAAY,EAAE,kBAAkB,EAAE,MAAM,qDAAqD,CAAA;AAC7F,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAA;AAC7E,OAAO,EACL,QAAQ,EACR,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,kCAAkC,CAAA;AACzC,YAAY,EACV,WAAW,EACX,aAAa,EACb,uBAAuB,EACvB,yBAAyB,GAC1B,MAAM,sCAAsC,CAAA;AA0B7C,MAAM,WAAW,QAAQ,CAAC,CAAC,GAAG,gBAAgB,CAAC,MAAM,EAAE,OAAO,CAAC;IAC7D,gBAAgB,EAAE,CAAC,SAAS,EAAE,gBAAgB,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAA;IAC3E,MAAM,EAAE,CACN,SAAS,EAAE,CAAC,EACZ,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,kBAAkB,KAC3B,OAAO,CAAC;QACX,IAAI,EAAE,MAAM,CAAA;QACZ,IAAI,EAAE,MAAM,CAAA;KACb,CAAC,CAAA;CACH;AAmBD;;;;;;;;GAQG;AACH,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAoJ/E"}
@@ -0,0 +1,67 @@
1
+ import { Picked } from '../picked';
2
+ import { ContentBlob, ExperienceContentResponse, ProjectConfig } from '../plugins/dynamic-experiences/types';
3
+ /** Subset of `Location` fields that can be injected into the selection context. */
4
+ export interface SerializeLocation {
5
+ href: string;
6
+ pathname: string;
7
+ search: string;
8
+ hostname: string;
9
+ origin: string;
10
+ protocol: string;
11
+ port: string;
12
+ host: string;
13
+ hash: string;
14
+ }
15
+ /** Optional attributes injected into the selection context (currently the URL). */
16
+ export interface SerializeAttributes {
17
+ location?: Partial<SerializeLocation>;
18
+ }
19
+ /** Customer-supplied content fetcher used in place of the runtime API during serialization. */
20
+ export type SerializeGetContent = (experience: {
21
+ id: string;
22
+ key: string;
23
+ }) => Promise<ExperienceContentResponse | null>;
24
+ /** Parameters for {@link serialize}. */
25
+ export interface SerializeParams {
26
+ /** The project config to register and select against. */
27
+ projectConfig: ProjectConfig;
28
+ /** URL attributes injected into the selection context. */
29
+ attributes?: SerializeAttributes;
30
+ /** Optional content fetcher; falls back to the runtime API when omitted. */
31
+ getContent?: SerializeGetContent;
32
+ }
33
+ /**
34
+ * Plain-JSON SSR snapshot produced by {@link serialize} and consumed by the client provider.
35
+ */
36
+ export interface PickedSnapshot {
37
+ /** The project version the snapshot was selected against, or `null` when unknown. */
38
+ versionId: string | null;
39
+ /** The project config the server selected with (travels for preview parity). */
40
+ projectConfig: ProjectConfig;
41
+ /** Deduped content blobs for the selected experiences. */
42
+ content: ContentBlob[];
43
+ /** Memoized condition-evaluation results keyed by rule hash. */
44
+ conditionResults: Record<string, boolean>;
45
+ }
46
+ /**
47
+ * Registers a project config, selects experiences whose conditions pass for the given URL,
48
+ * fetches content for the selected experiences that reference CMS layout content, and returns
49
+ * a plain-JSON snapshot for SSR hydration.
50
+ *
51
+ * Registration is synchronous (no `client.start()`), so the client's stores are populated
52
+ * before selection. Each experience's own condition is evaluated through the memoized
53
+ * evaluator against the injected URL; client-level precondition/condition are not evaluated
54
+ * here in v1. Content is fetched via the `getContent` override when provided, otherwise via
55
+ * the runtime API, and deduped by blob id.
56
+ *
57
+ * @param {Picked} client - The Picked client to register and select with.
58
+ * @param {SerializeParams} params - Project config, URL attributes, and optional content fetcher.
59
+ * @returns {Promise<PickedSnapshot>} The plain-JSON snapshot of config, content, and condition results.
60
+ * @example
61
+ * const snapshot = await serialize(client, {
62
+ * projectConfig,
63
+ * attributes: { location: { pathname: '/promo' } },
64
+ * })
65
+ */
66
+ export declare function serialize(client: Picked, params: SerializeParams): Promise<PickedSnapshot>;
67
+ //# sourceMappingURL=serialize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serialize.d.ts","sourceRoot":"","sources":["../../../src/server/serialize.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAOvC,OAAO,KAAK,EACV,WAAW,EACX,yBAAyB,EACzB,aAAa,EAEd,MAAM,sCAAsC,CAAA;AAE7C,mFAAmF;AACnF,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;CACb;AAED,mFAAmF;AACnF,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAA;CACtC;AAED,+FAA+F;AAC/F,MAAM,MAAM,mBAAmB,GAAG,CAAC,UAAU,EAAE;IAC7C,EAAE,EAAE,MAAM,CAAA;IACV,GAAG,EAAE,MAAM,CAAA;CACZ,KAAK,OAAO,CAAC,yBAAyB,GAAG,IAAI,CAAC,CAAA;AAE/C,wCAAwC;AACxC,MAAM,WAAW,eAAe;IAC9B,yDAAyD;IACzD,aAAa,EAAE,aAAa,CAAA;IAC5B,0DAA0D;IAC1D,UAAU,CAAC,EAAE,mBAAmB,CAAA;IAChC,4EAA4E;IAC5E,UAAU,CAAC,EAAE,mBAAmB,CAAA;CACjC;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,qFAAqF;IACrF,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,gFAAgF;IAChF,aAAa,EAAE,aAAa,CAAA;IAC5B,0DAA0D;IAC1D,OAAO,EAAE,WAAW,EAAE,CAAA;IACtB,gEAAgE;IAChE,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC1C;AAoCD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,CAoDhG"}
@@ -5,6 +5,14 @@ export declare function supportsSessionStorage(): boolean;
5
5
  export declare function supportsCookies(): boolean;
6
6
  export declare function supportsShadowRoot(): boolean;
7
7
  export declare function supportsWindow(): boolean;
8
+ /**
9
+ * Determines whether the current context runs inside an iframe (its top window differs from itself).
10
+ *
11
+ * @returns {boolean} True when embedded in an iframe.
12
+ * @example
13
+ * isInsideIframe()
14
+ */
15
+ export declare function isInsideIframe(): boolean;
8
16
  export declare function supportsDocument(): boolean;
9
17
  export declare function supportsIntersectionObserver(): boolean;
10
18
  export declare function supportsWebComponents(): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"supports.d.ts","sourceRoot":"","sources":["../../../src/utils/supports.ts"],"names":[],"mappings":"AAEA,wBAAgB,gBAAgB,IAAI,OAAO,CAM1C;AAED,wBAAgB,eAAe,IAAI,OAAO,CAMzC;AAED,wBAAgB,oBAAoB,IAAI,OAAO,CAM9C;AAED,wBAAgB,sBAAsB,IAAI,OAAO,CAMhD;AAED,wBAAgB,eAAe,IAAI,OAAO,CAMzC;AAED,wBAAgB,kBAAkB,IAAI,OAAO,CAU5C;AAED,wBAAgB,cAAc,IAAI,OAAO,CAMxC;AAED,wBAAgB,gBAAgB,IAAI,OAAO,CAM1C;AAED,wBAAgB,4BAA4B,IAAI,OAAO,CAMtD;AAED,wBAAgB,qBAAqB,IAAI,OAAO,CAM/C;AAED,wBAAgB,wBAAwB,IAAI,OAAO,CAMlD"}
1
+ {"version":3,"file":"supports.d.ts","sourceRoot":"","sources":["../../../src/utils/supports.ts"],"names":[],"mappings":"AAGA,wBAAgB,gBAAgB,IAAI,OAAO,CAM1C;AAED,wBAAgB,eAAe,IAAI,OAAO,CAMzC;AAED,wBAAgB,oBAAoB,IAAI,OAAO,CAM9C;AAED,wBAAgB,sBAAsB,IAAI,OAAO,CAMhD;AAED,wBAAgB,eAAe,IAAI,OAAO,CAMzC;AAED,wBAAgB,kBAAkB,IAAI,OAAO,CAU5C;AAED,wBAAgB,cAAc,IAAI,OAAO,CAMxC;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,IAAI,OAAO,CAMxC;AAED,wBAAgB,gBAAgB,IAAI,OAAO,CAM1C;AAED,wBAAgB,4BAA4B,IAAI,OAAO,CAMtD;AAED,wBAAgB,qBAAqB,IAAI,OAAO,CAM/C;AAED,wBAAgB,wBAAwB,IAAI,OAAO,CAMlD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@picked/client",
3
- "version": "0.0.1-dev.1778730134956",
3
+ "version": "0.0.1-dev.1780446300503",
4
4
  "dependencies": {
5
5
  "@withease/factories": "^1.0.5"
6
6
  },
@@ -166,7 +166,7 @@
166
166
  "size-limit": [
167
167
  {
168
168
  "path": "dist/esm/index.js",
169
- "limit": "13.5 kB"
169
+ "limit": "14 kB"
170
170
  },
171
171
  {
172
172
  "path": "dist/esm/server/index.js",
@@ -1 +0,0 @@
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 ee(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 _=(0,n.createDomain)(`experience-instance`),v=(0,r.createFactory)(({client:r,experience:l,target:d,options:p})=>{let v=(0,n.createEvent)(),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=_.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=O.map(e=>e.length>=2),A=D.map(e=>e.at(-1)?.node||null),j=(0,n.combine)(r.steps.listStore,A,(e,t)=>e.find(e=>t&&a(t)&&e.id===t.stepId)||null),M=(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}),N=(0,n.combine)(l.treeStore,A,({nodes:e,edges:t},n)=>n?u(e,t,n):[]),P=(0,n.combine)(l.treeStore,A,({nodes:e,edges:t},n)=>n?m(e,t,n):[-1,-1]),F=(0,n.combine)(l.treeStore,A,({nodes:e,edges:t},n)=>n?f(e,t,n):[-1,-1]),I=_.store(!1),L=(0,n.createApi)(I,{open:()=>!0,close:()=>!1,toggle:e=>!e,set:(e,t)=>t}),R=(0,n.createEffect)(async()=>{r.history.back({experienceId:l.id})}),z=(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})}}),B=(0,n.attach)({source:A,effect:e=>{}}),V=(0,n.attach)({source:l.treeStore,effect:async({nodes:e})=>h(e)}),H=(0,n.attach)({source:l.treeStore,effect:async({nodes:e,edges:t},n)=>{if(s(n))return g(n,e,t)}}),U=(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?ee(!!await e.t(r,s),o.id,t,n):void 0}}),W=(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:Z});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}}}),G=(0,n.createEffect)(e=>{o(e)&&r.experiences.launch({key:e.experienceKey})}),K=(0,n.attach)({source:[A,l.treeStore],effect:async([e,{nodes:t,edges:n}])=>g(e,t,n)}),q=(0,n.attach)({source:[A,l.treeStore],effect:async([e,{nodes:t,edges:n}])=>g(e,t,n)}),J=(0,n.createEffect)(e=>{r.history.push({experienceId:l.id,node:e})}),Y=(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}),X=(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}),Z,te=(0,n.attach)({source:X,effect:e=>{if(!e)return;if(!d){`${l.id}`;return}let n=t.n(d);try{e.framework.render(n,e.component.component,r,Z)}catch{}}});Z=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:X,stateStore:E,isOpenStore:I,open:L.open,close:L.close,toggleOpen:L.toggle,setOpen:L.set,treeStore:l.treeStore,currentNodeStore:A,currentStepStore:j,previousStepStore:M,nextReachableStepNodesStore:N,stepsToOriginStore:P,stepsToLeafStore:F,goToNextStep:y,goToPreviousStep:b,goToStepById:x,stepsHistoryStore:O,isResumableStore:k,restart:S,mountFx:te});let Q=(0,n.createEvent)(),$=(0,n.createEvent)();return(0,n.sample)({clock:A,target:Q}),(0,n.sample)({clock:Q,filter:e=>e===null,target:V}),(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:H,condition:U,step:B,launchExperience:G,action:W,__:(0,n.createEvent)()}}),(0,n.sample)({clock:[U.doneData,H.doneData,V.doneData,q.doneData,K.doneData,W.doneData],filter:Boolean,target:J}),(0,n.sample)({clock:y,target:q}),(0,n.sample)({clock:y,source:j,filter:Boolean,target:r.eventBus.prepend(e=>({type:`step_submit`,step:e,experience:Z}))}),(0,n.sample)({clock:q.done,source:j,filter:Boolean,target:r.eventBus.prepend(e=>({type:`step_submit_success`,step:e,experience:Z}))}),(0,n.sample)({clock:q.fail,source:j,filter:Boolean,target:r.eventBus.prepend(e=>({type:`step_submit_error`,step:e,experience:Z}))}),(0,n.sample)({clock:b,target:R}),(0,n.sample)({clock:x,target:z}),(0,n.sample)({clock:S,fn:()=>({experienceId:l.id}),target:r.history.resetExperience}),(0,n.sample)({clock:S,target:(0,n.createEffect)(()=>{r.responses.clearByExperience(l.id)})}),(0,n.sample)({source:(0,n.combine)([U.pending,H.pending,V.pending,q.pending]),fn:e=>e.some(Boolean)?`transitioning`:`ready`,target:E}),(0,n.sample)({clock:B.doneData,source:j,filter:Boolean,target:r.eventBus.prepend(e=>({type:`step_enter`,step:e,experience:Z}))}),(0,n.sample)({clock:w,target:Y}),(0,n.sample)({source:Y.doneData,fn:Boolean,target:I}),(0,n.sample)({source:A,clock:v,filter:e=>e?s(e):!0,target:K}),(0,n.sample)({source:I,filter:Boolean,target:v}),(0,n.sample)({source:I,filter:Boolean,target:r.eventBus.prepend(()=>({type:`experience_open`,experience:Z}))}),(0,n.sample)({source:I,filter:e=>!e,target:r.eventBus.prepend(()=>({type:`experience_close`,experience:Z}))}),(0,n.sample)({clock:C,target:[w]}),C(),Z});function y(e){return(0,r.invoke)(v,e)}var b=(0,r.createFactory)(({client:e})=>{let r=_.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})=>y({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 x(e){return(0,r.invoke)(b,e)}Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return y}});
@@ -1 +0,0 @@
1
- var e=Symbol(`Picked`),t=globalThis,n=n=>{t[e]=n};function r(){try{return`location`in t&&!!t.location}catch{return!1}}function i(){try{return`history`in t&&!!t.history}catch{return!1}}function a(){try{return`localStorage`in t&&!!t.localStorage}catch{return!1}}function o(){try{return`sessionStorage`in t&&!!t.sessionStorage}catch{return!1}}function s(){try{return`document`in t&&`cookie`in t.document}catch{return!1}}function c(){try{return`document`in t&&`createElement`in t.document&&`attachShadow`in t.document.createElement(`div`)}catch{return!1}}function l(){try{return`window`in t}catch{return!1}}function u(){try{return`document`in t}catch{return!1}}function d(){try{return`IntersectionObserver`in t}catch{return!1}}function f(){try{return`customElements`in t&&!!t.customElements}catch{return!1}}function p(){try{return`crypto`in t&&`randomUUID`in t.crypto}catch{return!1}}Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,`d`,{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,`f`,{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`p`,{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return f}});