@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.
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/plugins/create-experience/index.js +1 -1
- package/dist/cjs/plugins/experience-browser-storage/index.js +1 -0
- package/dist/cjs/plugins/history-browser-storage/index.js +1 -0
- package/dist/cjs/plugins/responses-browser-storage/index.js +1 -0
- package/dist/cjs/plugins/{responses-indexeddb-plugin → responses-indexeddb}/index.js +1 -1
- package/dist/cjs/plugins/shopify/index.js +1 -1
- package/dist/cjs/plugins/single-page-app/index.js +1 -1
- package/dist/cjs/plugins/web-components/index.js +1 -0
- package/dist/cjs/plugins/window-object/index.js +1 -1
- package/dist/cjs/server/index.js +1 -1
- package/dist/esm/index.js +555 -443
- package/dist/esm/plugins/create-experience/index.js +172 -103
- package/dist/esm/plugins/experience-browser-storage/index.js +39 -0
- package/dist/esm/plugins/{history-browserstorage-plugin → history-browser-storage}/index.js +2 -2
- package/dist/esm/plugins/responses-browser-storage/index.js +41 -0
- package/dist/esm/plugins/{responses-indexeddb-plugin → responses-indexeddb}/index.js +24 -21
- package/dist/esm/plugins/shopify/index.js +38 -28
- package/dist/esm/plugins/single-page-app/index.js +3 -3
- package/dist/esm/plugins/web-components/index.js +21 -0
- package/dist/esm/plugins/window-object/index.js +1 -1
- package/dist/esm/server/index.js +1 -1
- package/dist/experience-instance-Bs9t-zff.js +777 -0
- package/dist/experience-instance-COUhADSj.cjs +1 -0
- package/dist/storage-Cb_71y48.js +94 -0
- package/dist/storage-DuRlyFaY.cjs +1 -0
- package/dist/{supports-BvrzQAVk.js → supports-BjhuLJ8z.js} +27 -11
- package/dist/supports-YvpQZxbh.cjs +1 -0
- package/dist/types/client.d.ts +26 -0
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/entities/action/action.d.ts +15 -0
- package/dist/types/entities/action/action.d.ts.map +1 -0
- package/dist/types/entities/experience/experience.d.ts +19 -6
- package/dist/types/entities/experience/experience.d.ts.map +1 -1
- package/dist/types/entities/experience-instance/experience-instance.d.ts +13 -10
- package/dist/types/entities/experience-instance/experience-instance.d.ts.map +1 -1
- package/dist/types/entities/feature/feature.d.ts +5 -2
- package/dist/types/entities/feature/feature.d.ts.map +1 -1
- package/dist/types/entities/field/field.d.ts +27 -19
- package/dist/types/entities/field/field.d.ts.map +1 -1
- package/dist/types/entities/history/history.d.ts.map +1 -1
- package/dist/types/entities/predicate/predicate.d.ts +1 -1
- package/dist/types/entities/predicate/predicate.d.ts.map +1 -1
- package/dist/types/entities/response/response.d.ts +8 -0
- package/dist/types/entities/response/response.d.ts.map +1 -1
- package/dist/types/exports.d.ts +2 -0
- package/dist/types/exports.d.ts.map +1 -1
- package/dist/types/picked.d.ts +28 -10
- package/dist/types/picked.d.ts.map +1 -1
- package/dist/types/plugins/create-experience/create-experience.d.ts +48 -13
- package/dist/types/plugins/create-experience/create-experience.d.ts.map +1 -1
- package/dist/types/plugins/experience-browser-storage/index.d.ts.map +1 -0
- package/dist/types/plugins/experience-browser-storage/plugin.d.ts.map +1 -0
- package/dist/types/plugins/history-browser-storage/index.d.ts.map +1 -0
- package/dist/types/plugins/history-browser-storage/plugin.d.ts.map +1 -0
- package/dist/types/plugins/responses-browser-storage/index.d.ts.map +1 -0
- package/dist/types/plugins/responses-browser-storage/plugin.d.ts.map +1 -0
- package/dist/types/plugins/responses-indexeddb/index.d.ts.map +1 -0
- package/dist/types/plugins/responses-indexeddb/plugin.d.ts.map +1 -0
- package/dist/types/plugins/shopify/plugin.d.ts.map +1 -1
- package/dist/types/plugins/shopify/utils.d.ts +21 -0
- package/dist/types/plugins/shopify/utils.d.ts.map +1 -0
- package/dist/types/plugins/web-components/index.d.ts +2 -0
- package/dist/types/plugins/web-components/index.d.ts.map +1 -0
- package/dist/types/plugins/web-components/plugin.d.ts +3 -0
- package/dist/types/plugins/web-components/plugin.d.ts.map +1 -0
- package/dist/types/utils/dom.d.ts +5 -5
- package/dist/types/utils/dom.d.ts.map +1 -1
- package/dist/types/utils/events.d.ts +29 -24
- package/dist/types/utils/events.d.ts.map +1 -1
- package/dist/types/utils/get-step-fields.d.ts +4 -0
- package/dist/types/utils/get-step-fields.d.ts.map +1 -0
- package/dist/types/utils/nodes.d.ts +2 -1
- package/dist/types/utils/nodes.d.ts.map +1 -1
- package/dist/types/utils/storage.d.ts +3 -0
- package/dist/types/utils/storage.d.ts.map +1 -1
- package/dist/types/utils/supports.d.ts +2 -0
- package/dist/types/utils/supports.d.ts.map +1 -1
- package/dist/types/utils/user-session.d.ts +5 -0
- package/dist/types/utils/user-session.d.ts.map +1 -0
- package/package.json +32 -26
- package/dist/cjs/plugins/experience-browserstorage-plugin/index.js +0 -1
- package/dist/cjs/plugins/history-browserstorage-plugin/index.js +0 -1
- package/dist/cjs/plugins/responses-browserstorage-plugin/index.js +0 -1
- package/dist/esm/plugins/experience-browserstorage-plugin/index.js +0 -38
- package/dist/esm/plugins/responses-browserstorage-plugin/index.js +0 -36
- package/dist/experience-instance-6ZKZS7dF.cjs +0 -1
- package/dist/experience-instance-BA0EXYg5.js +0 -712
- package/dist/storage-BPJwmlva.cjs +0 -1
- package/dist/storage-D87xFySf.js +0 -85
- package/dist/supports-C0y3-V5V.cjs +0 -1
- package/dist/types/plugins/experience-browserstorage-plugin/index.d.ts.map +0 -1
- package/dist/types/plugins/experience-browserstorage-plugin/plugin.d.ts.map +0 -1
- package/dist/types/plugins/history-browserstorage-plugin/index.d.ts.map +0 -1
- package/dist/types/plugins/history-browserstorage-plugin/plugin.d.ts.map +0 -1
- package/dist/types/plugins/responses-browserstorage-plugin/index.d.ts.map +0 -1
- package/dist/types/plugins/responses-browserstorage-plugin/plugin.d.ts.map +0 -1
- package/dist/types/plugins/responses-indexeddb-plugin/index.d.ts.map +0 -1
- package/dist/types/plugins/responses-indexeddb-plugin/plugin.d.ts.map +0 -1
- /package/dist/types/plugins/{experience-browserstorage-plugin → experience-browser-storage}/index.d.ts +0 -0
- /package/dist/types/plugins/{experience-browserstorage-plugin → experience-browser-storage}/plugin.d.ts +0 -0
- /package/dist/types/plugins/{history-browserstorage-plugin → history-browser-storage}/index.d.ts +0 -0
- /package/dist/types/plugins/{history-browserstorage-plugin → history-browser-storage}/plugin.d.ts +0 -0
- /package/dist/types/plugins/{responses-browserstorage-plugin → responses-browser-storage}/index.d.ts +0 -0
- /package/dist/types/plugins/{responses-browserstorage-plugin → responses-browser-storage}/plugin.d.ts +0 -0
- /package/dist/types/plugins/{responses-indexeddb-plugin → responses-indexeddb}/index.d.ts +0 -0
- /package/dist/types/plugins/{responses-indexeddb-plugin → responses-indexeddb}/plugin.d.ts +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { createEffect as
|
|
1
|
+
import { createEffect as d, sample as p } from "effector";
|
|
2
2
|
const x = "picked";
|
|
3
|
-
async function
|
|
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
|
|
52
|
+
const u = "responses", w = { storeName: u, keyPath: "fieldId" }, I = () => ({
|
|
53
53
|
name: "responses-indexdb-plugin",
|
|
54
54
|
setup: (r) => {
|
|
55
|
-
const o =
|
|
56
|
-
const t = await
|
|
57
|
-
(c, { fieldId:
|
|
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 =
|
|
61
|
+
}), a = d(
|
|
62
62
|
async (t) => {
|
|
63
63
|
t.forEach((s) => {
|
|
64
|
-
|
|
65
|
-
y(e,
|
|
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 =
|
|
72
|
-
const t = await
|
|
73
|
-
await S(t,
|
|
74
|
-
}), i =
|
|
75
|
-
const s = await
|
|
76
|
-
await b(s,
|
|
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
|
-
|
|
78
|
+
p({
|
|
79
79
|
source: r.eventBus,
|
|
80
80
|
filter: (t) => t.type === "initialized",
|
|
81
81
|
target: o
|
|
82
|
-
}),
|
|
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) =>
|
|
87
|
-
|
|
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
|
-
}),
|
|
93
|
+
}), p({
|
|
91
94
|
clock: r.responses.clearAll,
|
|
92
95
|
target: n
|
|
93
|
-
}),
|
|
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>[^/]+)(?:\/|$)/,
|
|
15
|
-
if (
|
|
16
|
-
const
|
|
17
|
-
if (
|
|
18
|
-
return
|
|
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
|
-
},
|
|
21
|
+
}, s = {
|
|
21
22
|
// Pages
|
|
22
|
-
"is-page": ({ location: e }) =>
|
|
23
|
-
"get-page-handle": ({ location: 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 }) =>
|
|
26
|
-
"get-product-handle": ({ location: 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 }) =>
|
|
29
|
-
"get-collection-handle": ({ location: 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 }) =>
|
|
32
|
-
"get-blog-handle": ({ location: 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 }) =>
|
|
35
|
-
"get-article-handle": ({ location: 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 }) =>
|
|
38
|
-
"get-app-proxy-handle": ({ location: 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 }) =>
|
|
41
|
-
"is-login-page": ({ location: e }) =>
|
|
42
|
-
"is-register-page": ({ location: 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 }) =>
|
|
45
|
+
"is-cart-page": ({ location: e }) => t(a.cart, e),
|
|
45
46
|
// Checkout
|
|
46
|
-
"is-checkout-page": ({ location: e }) =>
|
|
47
|
+
"is-checkout-page": ({ location: e }) => t(a.checkout, e),
|
|
47
48
|
// Homepage
|
|
48
|
-
"is-homepage": ({ location: e }) =>
|
|
49
|
-
}
|
|
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(
|
|
53
|
-
e.registerPredicate(`shopify-${
|
|
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
|
-
|
|
68
|
+
g as shopifyPlugin
|
|
59
69
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a as f, G as c,
|
|
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
|
|
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
|
-
|
|
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
|
+
};
|
package/dist/esm/server/index.js
CHANGED
|
@@ -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-
|
|
2
|
+
import { h as F } from "../../experience-instance-Bs9t-zff.js";
|
|
3
3
|
function R() {
|
|
4
4
|
let c, p;
|
|
5
5
|
return {
|