@picked/client 0.0.1-dev.1756875690387 → 0.0.1-dev.1762750479117

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 (107) hide show
  1. package/dist/cjs/index.js +1 -1
  2. package/dist/cjs/plugins/create-experience/index.js +1 -1
  3. package/dist/cjs/plugins/experience-browser-storage/index.js +1 -0
  4. package/dist/cjs/plugins/history-browser-storage/index.js +1 -0
  5. package/dist/cjs/plugins/responses-browser-storage/index.js +1 -0
  6. package/dist/cjs/plugins/{responses-indexeddb-plugin → responses-indexeddb}/index.js +1 -1
  7. package/dist/cjs/plugins/shopify/index.js +1 -1
  8. package/dist/cjs/plugins/single-page-app/index.js +1 -1
  9. package/dist/cjs/plugins/web-components/index.js +1 -0
  10. package/dist/cjs/plugins/window-object/index.js +1 -1
  11. package/dist/cjs/server/index.js +1 -1
  12. package/dist/esm/index.js +555 -443
  13. package/dist/esm/plugins/create-experience/index.js +172 -103
  14. package/dist/esm/plugins/experience-browser-storage/index.js +39 -0
  15. package/dist/esm/plugins/{history-browserstorage-plugin → history-browser-storage}/index.js +2 -2
  16. package/dist/esm/plugins/responses-browser-storage/index.js +41 -0
  17. package/dist/esm/plugins/{responses-indexeddb-plugin → responses-indexeddb}/index.js +24 -21
  18. package/dist/esm/plugins/shopify/index.js +38 -28
  19. package/dist/esm/plugins/single-page-app/index.js +3 -3
  20. package/dist/esm/plugins/web-components/index.js +21 -0
  21. package/dist/esm/plugins/window-object/index.js +1 -1
  22. package/dist/esm/server/index.js +1 -1
  23. package/dist/experience-instance-Bs9t-zff.js +777 -0
  24. package/dist/experience-instance-COUhADSj.cjs +1 -0
  25. package/dist/storage-Cb_71y48.js +94 -0
  26. package/dist/storage-DuRlyFaY.cjs +1 -0
  27. package/dist/{supports-BvrzQAVk.js → supports-BjhuLJ8z.js} +27 -11
  28. package/dist/supports-YvpQZxbh.cjs +1 -0
  29. package/dist/types/client.d.ts +26 -0
  30. package/dist/types/client.d.ts.map +1 -1
  31. package/dist/types/entities/action/action.d.ts +15 -0
  32. package/dist/types/entities/action/action.d.ts.map +1 -0
  33. package/dist/types/entities/experience/experience.d.ts +19 -6
  34. package/dist/types/entities/experience/experience.d.ts.map +1 -1
  35. package/dist/types/entities/experience-instance/experience-instance.d.ts +13 -10
  36. package/dist/types/entities/experience-instance/experience-instance.d.ts.map +1 -1
  37. package/dist/types/entities/feature/feature.d.ts +5 -2
  38. package/dist/types/entities/feature/feature.d.ts.map +1 -1
  39. package/dist/types/entities/field/field.d.ts +27 -19
  40. package/dist/types/entities/field/field.d.ts.map +1 -1
  41. package/dist/types/entities/history/history.d.ts.map +1 -1
  42. package/dist/types/entities/predicate/predicate.d.ts +1 -1
  43. package/dist/types/entities/predicate/predicate.d.ts.map +1 -1
  44. package/dist/types/entities/response/response.d.ts +8 -0
  45. package/dist/types/entities/response/response.d.ts.map +1 -1
  46. package/dist/types/exports.d.ts +2 -0
  47. package/dist/types/exports.d.ts.map +1 -1
  48. package/dist/types/picked.d.ts +28 -10
  49. package/dist/types/picked.d.ts.map +1 -1
  50. package/dist/types/plugins/create-experience/create-experience.d.ts +48 -13
  51. package/dist/types/plugins/create-experience/create-experience.d.ts.map +1 -1
  52. package/dist/types/plugins/experience-browser-storage/index.d.ts.map +1 -0
  53. package/dist/types/plugins/experience-browser-storage/plugin.d.ts.map +1 -0
  54. package/dist/types/plugins/history-browser-storage/index.d.ts.map +1 -0
  55. package/dist/types/plugins/history-browser-storage/plugin.d.ts.map +1 -0
  56. package/dist/types/plugins/responses-browser-storage/index.d.ts.map +1 -0
  57. package/dist/types/plugins/responses-browser-storage/plugin.d.ts.map +1 -0
  58. package/dist/types/plugins/responses-indexeddb/index.d.ts.map +1 -0
  59. package/dist/types/plugins/responses-indexeddb/plugin.d.ts.map +1 -0
  60. package/dist/types/plugins/shopify/plugin.d.ts.map +1 -1
  61. package/dist/types/plugins/shopify/utils.d.ts +21 -0
  62. package/dist/types/plugins/shopify/utils.d.ts.map +1 -0
  63. package/dist/types/plugins/web-components/index.d.ts +2 -0
  64. package/dist/types/plugins/web-components/index.d.ts.map +1 -0
  65. package/dist/types/plugins/web-components/plugin.d.ts +3 -0
  66. package/dist/types/plugins/web-components/plugin.d.ts.map +1 -0
  67. package/dist/types/utils/dom.d.ts +5 -5
  68. package/dist/types/utils/dom.d.ts.map +1 -1
  69. package/dist/types/utils/events.d.ts +29 -24
  70. package/dist/types/utils/events.d.ts.map +1 -1
  71. package/dist/types/utils/get-step-fields.d.ts +4 -0
  72. package/dist/types/utils/get-step-fields.d.ts.map +1 -0
  73. package/dist/types/utils/nodes.d.ts +2 -1
  74. package/dist/types/utils/nodes.d.ts.map +1 -1
  75. package/dist/types/utils/storage.d.ts +3 -0
  76. package/dist/types/utils/storage.d.ts.map +1 -1
  77. package/dist/types/utils/supports.d.ts +2 -0
  78. package/dist/types/utils/supports.d.ts.map +1 -1
  79. package/dist/types/utils/user-session.d.ts +5 -0
  80. package/dist/types/utils/user-session.d.ts.map +1 -0
  81. package/package.json +32 -26
  82. package/dist/cjs/plugins/experience-browserstorage-plugin/index.js +0 -1
  83. package/dist/cjs/plugins/history-browserstorage-plugin/index.js +0 -1
  84. package/dist/cjs/plugins/responses-browserstorage-plugin/index.js +0 -1
  85. package/dist/esm/plugins/experience-browserstorage-plugin/index.js +0 -38
  86. package/dist/esm/plugins/responses-browserstorage-plugin/index.js +0 -36
  87. package/dist/experience-instance-6ZKZS7dF.cjs +0 -1
  88. package/dist/experience-instance-BA0EXYg5.js +0 -712
  89. package/dist/storage-BPJwmlva.cjs +0 -1
  90. package/dist/storage-D87xFySf.js +0 -85
  91. package/dist/supports-C0y3-V5V.cjs +0 -1
  92. package/dist/types/plugins/experience-browserstorage-plugin/index.d.ts.map +0 -1
  93. package/dist/types/plugins/experience-browserstorage-plugin/plugin.d.ts.map +0 -1
  94. package/dist/types/plugins/history-browserstorage-plugin/index.d.ts.map +0 -1
  95. package/dist/types/plugins/history-browserstorage-plugin/plugin.d.ts.map +0 -1
  96. package/dist/types/plugins/responses-browserstorage-plugin/index.d.ts.map +0 -1
  97. package/dist/types/plugins/responses-browserstorage-plugin/plugin.d.ts.map +0 -1
  98. package/dist/types/plugins/responses-indexeddb-plugin/index.d.ts.map +0 -1
  99. package/dist/types/plugins/responses-indexeddb-plugin/plugin.d.ts.map +0 -1
  100. /package/dist/types/plugins/{experience-browserstorage-plugin → experience-browser-storage}/index.d.ts +0 -0
  101. /package/dist/types/plugins/{experience-browserstorage-plugin → experience-browser-storage}/plugin.d.ts +0 -0
  102. /package/dist/types/plugins/{history-browserstorage-plugin → history-browser-storage}/index.d.ts +0 -0
  103. /package/dist/types/plugins/{history-browserstorage-plugin → history-browser-storage}/plugin.d.ts +0 -0
  104. /package/dist/types/plugins/{responses-browserstorage-plugin → responses-browser-storage}/index.d.ts +0 -0
  105. /package/dist/types/plugins/{responses-browserstorage-plugin → responses-browser-storage}/plugin.d.ts +0 -0
  106. /package/dist/types/plugins/{responses-indexeddb-plugin → responses-indexeddb}/index.d.ts +0 -0
  107. /package/dist/types/plugins/{responses-indexeddb-plugin → responses-indexeddb}/plugin.d.ts +0 -0
@@ -1,6 +1,6 @@
1
- import { createEffect as u, sample as d } from "effector";
1
+ import { createEffect as d, sample as p } from "effector";
2
2
  const x = "picked";
3
- async function p(r) {
3
+ async function m(r) {
4
4
  const { storeName: o, version: a = 1, keyPath: n = "id" } = r;
5
5
  return new Promise((i, t) => {
6
6
  const s = indexedDB.open(x, a);
@@ -49,48 +49,51 @@ async function S(r, o) {
49
49
  };
50
50
  });
51
51
  }
52
- const l = "responses", m = { storeName: l, keyPath: "fieldId" }, I = () => ({
52
+ const u = "responses", w = { storeName: u, keyPath: "fieldId" }, I = () => ({
53
53
  name: "responses-indexdb-plugin",
54
54
  setup: (r) => {
55
- const o = u(async () => {
56
- const t = await p(m), e = (await g(t, l)).reduce(
57
- (c, { fieldId: w, value: f }) => (c[w] = f, c),
55
+ const o = d(async () => {
56
+ const t = await m(w), e = (await g(t, u)).reduce(
57
+ (c, { fieldId: l, value: f }) => (c[l] = f, c),
58
58
  {}
59
59
  );
60
60
  await r.responses.commit(e);
61
- }), a = u(
61
+ }), a = d(
62
62
  async (t) => {
63
63
  t.forEach((s) => {
64
- p(m).then((e) => {
65
- y(e, l, s);
64
+ m(w).then((e) => {
65
+ y(e, u, s);
66
66
  }).catch((e) => {
67
67
  console.error("Failed to store response in IndexedDB:", e);
68
68
  });
69
69
  });
70
70
  }
71
- ), n = u(async () => {
72
- const t = await p(m);
73
- await S(t, l);
74
- }), i = u(async (t) => {
75
- const s = await p(m);
76
- await b(s, l, t);
71
+ ), n = d(async () => {
72
+ const t = await m(w);
73
+ await S(t, u);
74
+ }), i = d(async (t) => {
75
+ const s = await m(w);
76
+ await b(s, u, t);
77
77
  });
78
- d({
78
+ p({
79
79
  source: r.eventBus,
80
80
  filter: (t) => t.type === "initialized",
81
81
  target: o
82
- }), d({
82
+ }), p({
83
83
  clock: r.responses.listStore,
84
84
  source: { responses: r.responses.listStore, fields: r.fields.listStore },
85
85
  fn: ({ responses: t, fields: s }) => {
86
- const e = s.filter((c) => !c.policies.doNotStoreValue);
87
- return t.filter((c) => e.some((w) => w.id === c.fieldId));
86
+ const e = s.filter((c) => {
87
+ var l;
88
+ return !((l = c.policies) != null && l.doNotStoreValue);
89
+ });
90
+ return t.filter((c) => e.some((l) => l.id === c.fieldId));
88
91
  },
89
92
  target: a
90
- }), d({
93
+ }), p({
91
94
  clock: r.responses.clearAll,
92
95
  target: n
93
- }), d({
96
+ }), p({
94
97
  clock: r.responses.clear,
95
98
  target: i
96
99
  });
@@ -1,3 +1,4 @@
1
+ import { a as p } from "../../../supports-BjhuLJ8z.js";
1
2
  const a = {
2
3
  homepage: /^\/$/,
3
4
  productPage: /(?:^|\/)products\/(?<productHandle>[^/]+)\/?$/,
@@ -11,49 +12,58 @@ const a = {
11
12
  accountWildcard: /^\/account\/.+/,
12
13
  accountLogin: /^\/account\/login(?:\/|$)/,
13
14
  accountRegister: /^\/account\/register(?:\/|$)/
14
- }, n = /^\/collections\/(?<collectionHandle>[^/]+)(?:\/|$)/, c = (e, t) => t ? !!e.exec(t.pathname) : !1, o = (e, t) => {
15
- if (t) {
16
- const p = e.exec(t.pathname);
17
- if (p)
18
- return p[1];
15
+ }, n = /^\/collections\/(?<collectionHandle>[^/]+)(?:\/|$)/, t = (e, o) => o ? !!e.exec(o.pathname) : !1, i = (e, o) => {
16
+ if (o) {
17
+ const c = e.exec(o.pathname);
18
+ if (c)
19
+ return c[1];
19
20
  }
20
- }, g = {
21
+ }, s = {
21
22
  // Pages
22
- "is-page": ({ location: e }) => c(a.page, e),
23
- "get-page-handle": ({ location: e }) => o(a.page, e),
23
+ "is-page": ({ location: e }) => t(a.page, e),
24
+ "get-page-handle": ({ location: e }) => i(a.page, e),
24
25
  // Products
25
- "is-product-page": ({ location: e }) => c(a.productPage, e),
26
- "get-product-handle": ({ location: e }) => o(a.productPage, e),
26
+ "is-product-page": ({ location: e }) => t(a.productPage, e),
27
+ "get-product-handle": ({ location: e }) => i(a.productPage, e),
27
28
  // Collections
28
- "is-collection-page": ({ location: e }) => c(a.collection, e),
29
- "get-collection-handle": ({ location: e }) => o(n, e),
29
+ "is-collection-page": ({ location: e }) => t(a.collection, e),
30
+ "get-collection-handle": ({ location: e }) => i(n, e),
30
31
  // Blogs
31
- "is-blog-page": ({ location: e }) => c(a.blog, e),
32
- "get-blog-handle": ({ location: e }) => o(a.blog, e),
32
+ "is-blog-page": ({ location: e }) => t(a.blog, e),
33
+ "get-blog-handle": ({ location: e }) => i(a.blog, e),
33
34
  // Blog Articles
34
- "is-article-page": ({ location: e }) => c(a.article, e),
35
- "get-article-handle": ({ location: e }) => o(a.article, e),
35
+ "is-article-page": ({ location: e }) => t(a.article, e),
36
+ "get-article-handle": ({ location: e }) => i(a.article, e),
36
37
  // Apps
37
- "is-app-proxy-page": ({ location: e }) => c(a.appProxy, e),
38
- "get-app-proxy-handle": ({ location: e }) => o(a.appProxy, e),
38
+ "is-app-proxy-page": ({ location: e }) => t(a.appProxy, e),
39
+ "get-app-proxy-handle": ({ location: e }) => i(a.appProxy, e),
39
40
  // Account
40
- "is-account-page": ({ location: e }) => c(a.accountWildcard, e),
41
- "is-login-page": ({ location: e }) => c(a.accountLogin, e),
42
- "is-register-page": ({ location: e }) => c(a.accountRegister, e),
41
+ "is-account-page": ({ location: e }) => t(a.accountWildcard, e),
42
+ "is-login-page": ({ location: e }) => t(a.accountLogin, e),
43
+ "is-register-page": ({ location: e }) => t(a.accountRegister, e),
43
44
  // Cart
44
- "is-cart-page": ({ location: e }) => c(a.cart, e),
45
+ "is-cart-page": ({ location: e }) => t(a.cart, e),
45
46
  // Checkout
46
- "is-checkout-page": ({ location: e }) => c(a.checkout, e),
47
+ "is-checkout-page": ({ location: e }) => t(a.checkout, e),
47
48
  // Homepage
48
- "is-homepage": ({ location: e }) => c(a.homepage, e)
49
- }, r = () => ({
49
+ "is-homepage": ({ location: e }) => t(a.homepage, e)
50
+ };
51
+ function r(e) {
52
+ var o, c;
53
+ return typeof ((c = (o = e.Shopify) == null ? void 0 : o.analytics) == null ? void 0 : c.publish) == "function";
54
+ }
55
+ const g = () => ({
50
56
  name: "shopify",
51
57
  setup: (e) => {
52
- Object.entries(g).forEach(([t, p]) => {
53
- e.registerPredicate(`shopify-${t}`, p);
58
+ Object.entries(s).forEach(([o, c]) => {
59
+ e.registerPredicate(`shopify-${o}`, c);
60
+ }), p() && e.eventBus.watch((o) => {
61
+ r(window) && o.type === "session" && window.Shopify.analytics.publish("picked:session", {
62
+ id: o.id
63
+ });
54
64
  });
55
65
  }
56
66
  });
57
67
  export {
58
- r as shopifyPlugin
68
+ g as shopifyPlugin
59
69
  };
@@ -1,8 +1,8 @@
1
- import { a as f, G as c, d as m } from "../../../supports-BvrzQAVk.js";
1
+ import { a as f, G as c, f as m } from "../../../supports-BjhuLJ8z.js";
2
2
  import { p as a } from "../../../object-JwZ58NOH.js";
3
3
  const o = c;
4
4
  let s;
5
- const y = (r) => ({
5
+ const d = (r) => ({
6
6
  name: "single-page-app",
7
7
  setup: (n) => {
8
8
  r.instrumentHistory && f() && h(() => {
@@ -33,5 +33,5 @@ function h(r) {
33
33
  a(o.history, "pushState", n), a(o.history, "replaceState", n);
34
34
  }
35
35
  export {
36
- y as singlePageAppPlugin
36
+ d as singlePageAppPlugin
37
37
  };
@@ -0,0 +1,21 @@
1
+ import { a as s, k as i } from "../../../supports-BjhuLJ8z.js";
2
+ const p = () => ({
3
+ name: "web-components",
4
+ setup: (e) => {
5
+ if (!s() || !i())
6
+ return;
7
+ const n = "picked-root";
8
+ if (window.customElements.get(n))
9
+ return;
10
+ class o extends HTMLElement {
11
+ connectedCallback() {
12
+ const t = this.getAttribute("experience-id");
13
+ e.isReady && t && e.launchExperienceById(t);
14
+ }
15
+ }
16
+ window.customElements.define(n, o);
17
+ }
18
+ });
19
+ export {
20
+ p as webComponentsPlugin
21
+ };
@@ -1,4 +1,4 @@
1
- import { a as i } from "../../../supports-BvrzQAVk.js";
1
+ import { a as i } from "../../../supports-BjhuLJ8z.js";
2
2
  const t = () => ({
3
3
  name: "window",
4
4
  setup: (o) => {
@@ -1,5 +1,5 @@
1
1
  import { createEvent as i, createStore as v, createEffect as C, sample as n, attach as S } from "effector";
2
- import { h as F } from "../../experience-instance-BA0EXYg5.js";
2
+ import { h as F } from "../../experience-instance-Bs9t-zff.js";
3
3
  function R() {
4
4
  let c, p;
5
5
  return {