@picked/client 0.0.1-dev.1764626732123 → 0.0.1-dev.1764631564450
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/responses-browser-storage/index.js +1 -1
- package/dist/esm/index.js +774 -145
- package/dist/esm/plugins/responses-browser-storage/index.js +22 -23
- package/dist/esm/plugins/single-page-app/index.js +3 -3
- package/dist/esm/plugins/web-components/index.js +1 -1
- package/dist/esm/plugins/window-object/index.js +1 -1
- package/dist/esm/server/index.js +7 -7
- package/dist/{experience-instance-C2AnM2J_.js → experience-instance-CMrX6QA2.js} +7 -7
- package/dist/{supports-DBMT17KZ.js → supports-BjhuLJ8z.js} +10 -10
- package/dist/types/entities/action/action.d.ts +2 -4
- package/dist/types/entities/action/action.d.ts.map +1 -1
- package/dist/types/entities/feature/feature.d.ts +3 -5
- package/dist/types/entities/feature/feature.d.ts.map +1 -1
- package/dist/types/entities/field/field.d.ts +7 -0
- package/dist/types/entities/field/field.d.ts.map +1 -1
- package/dist/types/entities/predicate/predicate.d.ts +5 -4
- package/dist/types/entities/predicate/predicate.d.ts.map +1 -1
- package/dist/types/entities/response/response.d.ts +1 -4
- package/dist/types/entities/response/response.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 +8 -11
- package/dist/types/picked.d.ts.map +1 -1
- package/dist/types/plugins/create-experience/create-experience.d.ts +1 -0
- package/dist/types/plugins/create-experience/create-experience.d.ts.map +1 -1
- package/dist/types/plugins/responses-browser-storage/plugin.d.ts.map +1 -1
- package/dist/types/utils/events.d.ts +3 -0
- package/dist/types/utils/events.d.ts.map +1 -1
- package/package.json +1 -7
- package/dist/cjs/plugins/shopify/index.js +0 -1
- package/dist/esm/plugins/shopify/index.js +0 -123
- package/dist/types/plugins/shopify/global-obj.d.ts +0 -49
- package/dist/types/plugins/shopify/global-obj.d.ts.map +0 -1
- package/dist/types/plugins/shopify/index.d.ts +0 -6
- package/dist/types/plugins/shopify/index.d.ts.map +0 -1
- package/dist/types/plugins/shopify/picked-config.d.ts +0 -103
- package/dist/types/plugins/shopify/picked-config.d.ts.map +0 -1
- package/dist/types/plugins/shopify/plugin.d.ts +0 -3
- package/dist/types/plugins/shopify/plugin.d.ts.map +0 -1
- package/dist/types/plugins/shopify/predicates.d.ts +0 -42
- package/dist/types/plugins/shopify/predicates.d.ts.map +0 -1
- package/dist/user-session-BTaOgTo_.cjs +0 -1
- package/dist/user-session-YEUZkOjt.js +0 -718
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import { a as r } from "../../../supports-DBMT17KZ.js";
|
|
2
|
-
import "../../../user-session-YEUZkOjt.js";
|
|
3
|
-
import "../../../experience-instance-C2AnM2J_.js";
|
|
4
|
-
import "effector";
|
|
5
|
-
function a() {
|
|
6
|
-
if (r())
|
|
7
|
-
return window.pickedConfig;
|
|
8
|
-
}
|
|
9
|
-
function P() {
|
|
10
|
-
var e;
|
|
11
|
-
if (r())
|
|
12
|
-
return (e = a()) == null ? void 0 : e.customer;
|
|
13
|
-
}
|
|
14
|
-
function s() {
|
|
15
|
-
var e;
|
|
16
|
-
if (r())
|
|
17
|
-
return (e = a()) == null ? void 0 : e.product;
|
|
18
|
-
}
|
|
19
|
-
function u() {
|
|
20
|
-
var e;
|
|
21
|
-
if (r())
|
|
22
|
-
return (e = a()) == null ? void 0 : e.collection;
|
|
23
|
-
}
|
|
24
|
-
function b() {
|
|
25
|
-
var e;
|
|
26
|
-
if (r())
|
|
27
|
-
return (e = a()) == null ? void 0 : e.experiments;
|
|
28
|
-
}
|
|
29
|
-
function k() {
|
|
30
|
-
var e, t;
|
|
31
|
-
if (r())
|
|
32
|
-
return (t = (e = a()) == null ? void 0 : e.storefront_api) == null ? void 0 : t.token;
|
|
33
|
-
}
|
|
34
|
-
const o = {
|
|
35
|
-
homepage: /^\/$/,
|
|
36
|
-
page: /(?:^|\/)pages\/[^/]+$/,
|
|
37
|
-
blog: /(?:^|\/)blogs\/(?<blogHandle>[^/]+)\/?$/,
|
|
38
|
-
article: /^\/blogs\/[^/]+\/(?<article>[^/]+)\/?$/,
|
|
39
|
-
cart: /(?:^|\/)cart\/[^/]+$/,
|
|
40
|
-
checkout: /^\/checkout\/.+/,
|
|
41
|
-
appProxy: /^\/(?:a|apps|community|tools)\/(?<proxyTarget>[^/]+)/,
|
|
42
|
-
accountWildcard: /^\/account\/.+/,
|
|
43
|
-
accountLogin: /^\/account\/login(?:\/|$)/,
|
|
44
|
-
accountRegister: /^\/account\/register(?:\/|$)/
|
|
45
|
-
}, n = (e, t) => t ? !!e.exec(t.pathname) : !1, c = (e, t) => {
|
|
46
|
-
if (t) {
|
|
47
|
-
const i = e.exec(t.pathname);
|
|
48
|
-
if (i)
|
|
49
|
-
return i[1];
|
|
50
|
-
}
|
|
51
|
-
}, p = (e) => {
|
|
52
|
-
var t, i;
|
|
53
|
-
switch (e) {
|
|
54
|
-
case "product":
|
|
55
|
-
return ((t = s()) == null ? void 0 : t.handle) ?? !1;
|
|
56
|
-
case "collection":
|
|
57
|
-
return ((i = u()) == null ? void 0 : i.handle) ?? !1;
|
|
58
|
-
default:
|
|
59
|
-
return !1;
|
|
60
|
-
}
|
|
61
|
-
}, g = {
|
|
62
|
-
// Pages
|
|
63
|
-
"is-page": ({ location: e }) => n(o.page, e),
|
|
64
|
-
"get-page-handle": ({ location: e }) => c(o.page, e),
|
|
65
|
-
// Products
|
|
66
|
-
"is-product-page": () => !!p("product"),
|
|
67
|
-
"get-product-handle": () => p("product"),
|
|
68
|
-
// Collections
|
|
69
|
-
"is-collection-page": () => !!p("collection"),
|
|
70
|
-
"get-collection-handle": () => p("collection"),
|
|
71
|
-
// Blogs
|
|
72
|
-
"is-blog-page": ({ location: e }) => n(o.blog, e),
|
|
73
|
-
"get-blog-handle": ({ location: e }) => c(o.blog, e),
|
|
74
|
-
// Blog Articles
|
|
75
|
-
"is-article-page": ({ location: e }) => n(o.article, e),
|
|
76
|
-
"get-article-handle": ({ location: e }) => c(o.article, e),
|
|
77
|
-
// Apps
|
|
78
|
-
"is-app-proxy-page": ({ location: e }) => n(o.appProxy, e),
|
|
79
|
-
"get-app-proxy-handle": ({ location: e }) => c(o.appProxy, e),
|
|
80
|
-
// Account
|
|
81
|
-
"is-account-page": ({ location: e }) => n(o.accountWildcard, e),
|
|
82
|
-
"is-login-page": ({ location: e }) => n(o.accountLogin, e),
|
|
83
|
-
"is-register-page": ({ location: e }) => n(o.accountRegister, e),
|
|
84
|
-
// Cart
|
|
85
|
-
"is-cart-page": ({ location: e }) => n(o.cart, e),
|
|
86
|
-
// Checkout
|
|
87
|
-
"is-checkout-page": ({ location: e }) => n(o.checkout, e),
|
|
88
|
-
// Homepage
|
|
89
|
-
"is-homepage": ({ location: e }) => n(o.homepage, e)
|
|
90
|
-
};
|
|
91
|
-
function l() {
|
|
92
|
-
if (!r() || !window.Shopify)
|
|
93
|
-
throw new Error(
|
|
94
|
-
"Shopify global object not found. This plugin must be used on a Shopify storefront page."
|
|
95
|
-
);
|
|
96
|
-
return window.Shopify;
|
|
97
|
-
}
|
|
98
|
-
function f(e) {
|
|
99
|
-
var t, i;
|
|
100
|
-
return typeof ((i = (t = l()) == null ? void 0 : t.analytics) == null ? void 0 : i.publish) == "function";
|
|
101
|
-
}
|
|
102
|
-
const w = () => ({
|
|
103
|
-
name: "shopify",
|
|
104
|
-
setup: (e) => {
|
|
105
|
-
Object.entries(g).forEach(([t, i]) => {
|
|
106
|
-
e.registerPredicate(`shopify-${t}`, i);
|
|
107
|
-
}), r() && e.eventBus.watch((t) => {
|
|
108
|
-
f() && t.type === "session" && window.Shopify.analytics.publish("picked:session", {
|
|
109
|
-
id: t.id
|
|
110
|
-
});
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
export {
|
|
115
|
-
a as getPickedConfig,
|
|
116
|
-
u as getPickedConfigCollection,
|
|
117
|
-
P as getPickedConfigCustomer,
|
|
118
|
-
b as getPickedConfigExperiments,
|
|
119
|
-
s as getPickedConfigProduct,
|
|
120
|
-
k as getPickedConfigStorefrontApiToken,
|
|
121
|
-
l as getShopify,
|
|
122
|
-
w as shopifyPlugin
|
|
123
|
-
};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
interface EventPayload {
|
|
2
|
-
[key: string]: string | number | boolean | null | undefined | EventPayload | Array<string | number | boolean | null | undefined | EventPayload>;
|
|
3
|
-
}
|
|
4
|
-
export interface Shopify {
|
|
5
|
-
shop: string;
|
|
6
|
-
locale: string;
|
|
7
|
-
currency: {
|
|
8
|
-
active: string;
|
|
9
|
-
rate: string;
|
|
10
|
-
};
|
|
11
|
-
country: string;
|
|
12
|
-
theme: {
|
|
13
|
-
name: string;
|
|
14
|
-
id: number;
|
|
15
|
-
schema_name: string;
|
|
16
|
-
schema_version: string;
|
|
17
|
-
theme_store_id: number | null;
|
|
18
|
-
role: string;
|
|
19
|
-
handle: string;
|
|
20
|
-
style: {
|
|
21
|
-
id: number | null;
|
|
22
|
-
handle: string | null;
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
routes: {
|
|
26
|
-
root: string;
|
|
27
|
-
};
|
|
28
|
-
PaymentButton: {
|
|
29
|
-
isStorefrontPortableWallets: boolean;
|
|
30
|
-
};
|
|
31
|
-
analytics?: {
|
|
32
|
-
publish?: (event: string, payload: EventPayload) => void;
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
declare global {
|
|
36
|
-
interface Window {
|
|
37
|
-
Shopify?: Shopify;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
export declare function getShopify(): Shopify;
|
|
41
|
-
export declare function supportsShopifyAnalytics(w: Window): w is Window & {
|
|
42
|
-
Shopify: {
|
|
43
|
-
analytics: {
|
|
44
|
-
publish: (event: string, payload: EventPayload) => void;
|
|
45
|
-
};
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
export {};
|
|
49
|
-
//# sourceMappingURL=global-obj.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"global-obj.d.ts","sourceRoot":"","sources":["../../../../src/plugins/shopify/global-obj.ts"],"names":[],"mappings":"AAEA,UAAU,YAAY;IACpB,CAAC,GAAG,EAAE,MAAM,GACR,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,SAAS,GACT,YAAY,GACZ,KAAK,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,GAAG,YAAY,CAAC,CAAA;CACvE;AAED,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE;QACR,MAAM,EAAE,MAAM,CAAA;QACd,IAAI,EAAE,MAAM,CAAA;KACb,CAAA;IACD,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE;QACL,IAAI,EAAE,MAAM,CAAA;QACZ,EAAE,EAAE,MAAM,CAAA;QACV,WAAW,EAAE,MAAM,CAAA;QACnB,cAAc,EAAE,MAAM,CAAA;QACtB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;QAC7B,IAAI,EAAE,MAAM,CAAA;QACZ,MAAM,EAAE,MAAM,CAAA;QACd,KAAK,EAAE;YACL,EAAE,EAAE,MAAM,GAAG,IAAI,CAAA;YACjB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;SACtB,CAAA;KACF,CAAA;IACD,MAAM,EAAE;QACN,IAAI,EAAE,MAAM,CAAA;KACb,CAAA;IACD,aAAa,EAAE;QACb,2BAA2B,EAAE,OAAO,CAAA;KACrC,CAAA;IACD,SAAS,CAAC,EAAE;QACV,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,KAAK,IAAI,CAAA;KACzD,CAAA;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,OAAO,CAAC,EAAE,OAAO,CAAA;KAClB;CACF;AAED,wBAAgB,UAAU,YAQzB;AAED,wBAAgB,wBAAwB,CAAC,CAAC,EAAE,MAAM,GAAG,CAAC,IAAI,MAAM,GAAG;IACjE,OAAO,EAAE;QAAE,SAAS,EAAE;YAAE,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,KAAK,IAAI,CAAA;SAAE,CAAA;KAAE,CAAA;CACpF,CAEA"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { shopifyPlugin } from './plugin';
|
|
2
|
-
export { getPickedConfig, getPickedConfigCollection, getPickedConfigCustomer, getPickedConfigExperiments, getPickedConfigProduct, getPickedConfigStorefrontApiToken, } from './picked-config';
|
|
3
|
-
export type * from './picked-config';
|
|
4
|
-
export { getShopify } from './global-obj';
|
|
5
|
-
export type * from './global-obj';
|
|
6
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/shopify/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAGxC,OAAO,EACL,eAAe,EACf,yBAAyB,EACzB,uBAAuB,EACvB,0BAA0B,EAC1B,sBAAsB,EACtB,iCAAiC,GAClC,MAAM,iBAAiB,CAAA;AACxB,mBAAmB,iBAAiB,CAAA;AAGpC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,mBAAmB,cAAc,CAAA"}
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import { CreateClientOptions } from '../../index';
|
|
2
|
-
export interface PickedConfigExperiment {
|
|
3
|
-
enabled: boolean;
|
|
4
|
-
id: string;
|
|
5
|
-
name: string;
|
|
6
|
-
version: number;
|
|
7
|
-
weight: number;
|
|
8
|
-
}
|
|
9
|
-
export type PickedConfigCollection = Partial<{
|
|
10
|
-
title: string;
|
|
11
|
-
id: number;
|
|
12
|
-
handle: string;
|
|
13
|
-
}>;
|
|
14
|
-
export type PickedConfigProductVariant = Partial<{
|
|
15
|
-
available: boolean;
|
|
16
|
-
title: string;
|
|
17
|
-
id: number;
|
|
18
|
-
price: number;
|
|
19
|
-
inventory_quantity: number;
|
|
20
|
-
option1: string;
|
|
21
|
-
}>;
|
|
22
|
-
export type PickedConfigProductCollection = Partial<{
|
|
23
|
-
id: number;
|
|
24
|
-
}>;
|
|
25
|
-
export type MetafieldValue = string | number | boolean | null | undefined;
|
|
26
|
-
export interface MetafieldObject {
|
|
27
|
-
[key: string]: MetafieldValue | MetafieldObject | MetafieldValue[] | MetafieldObject[];
|
|
28
|
-
}
|
|
29
|
-
export type PickedConfigProduct = Partial<{
|
|
30
|
-
available: boolean;
|
|
31
|
-
collections: PickedConfigProductCollection[];
|
|
32
|
-
featured_image: string;
|
|
33
|
-
handle: string;
|
|
34
|
-
id: number;
|
|
35
|
-
metafields: MetafieldObject;
|
|
36
|
-
price: number;
|
|
37
|
-
tags: string[];
|
|
38
|
-
title: string;
|
|
39
|
-
type: string;
|
|
40
|
-
url: string;
|
|
41
|
-
variants: PickedConfigProductVariant[];
|
|
42
|
-
vendor: string;
|
|
43
|
-
}>;
|
|
44
|
-
export type PickedConfigCustomer = Partial<{
|
|
45
|
-
accepts_marketing: boolean;
|
|
46
|
-
email: string;
|
|
47
|
-
first_name: string | null;
|
|
48
|
-
has_account: boolean;
|
|
49
|
-
id: number;
|
|
50
|
-
last_name: string | null;
|
|
51
|
-
orders_count: number;
|
|
52
|
-
phone: string | null;
|
|
53
|
-
tax_exempt: boolean;
|
|
54
|
-
}>;
|
|
55
|
-
export interface ShopifyPickedConfig {
|
|
56
|
-
customer?: PickedConfigCustomer;
|
|
57
|
-
product?: PickedConfigProduct;
|
|
58
|
-
collection?: PickedConfigCollection;
|
|
59
|
-
experiments?: PickedConfigExperiment[];
|
|
60
|
-
storefront_api?: {
|
|
61
|
-
token?: string;
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
declare global {
|
|
65
|
-
interface Window {
|
|
66
|
-
pickedConfig?: Readonly<Partial<CreateClientOptions> & ShopifyPickedConfig>;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
export declare function getPickedConfig(): Readonly<Partial<CreateClientOptions> & ShopifyPickedConfig> | undefined;
|
|
70
|
-
export declare function getPickedConfigCustomer(): Partial<{
|
|
71
|
-
accepts_marketing: boolean;
|
|
72
|
-
email: string;
|
|
73
|
-
first_name: string | null;
|
|
74
|
-
has_account: boolean;
|
|
75
|
-
id: number;
|
|
76
|
-
last_name: string | null;
|
|
77
|
-
orders_count: number;
|
|
78
|
-
phone: string | null;
|
|
79
|
-
tax_exempt: boolean;
|
|
80
|
-
}> | undefined;
|
|
81
|
-
export declare function getPickedConfigProduct(): Partial<{
|
|
82
|
-
available: boolean;
|
|
83
|
-
collections: PickedConfigProductCollection[];
|
|
84
|
-
featured_image: string;
|
|
85
|
-
handle: string;
|
|
86
|
-
id: number;
|
|
87
|
-
metafields: MetafieldObject;
|
|
88
|
-
price: number;
|
|
89
|
-
tags: string[];
|
|
90
|
-
title: string;
|
|
91
|
-
type: string;
|
|
92
|
-
url: string;
|
|
93
|
-
variants: PickedConfigProductVariant[];
|
|
94
|
-
vendor: string;
|
|
95
|
-
}> | undefined;
|
|
96
|
-
export declare function getPickedConfigCollection(): Partial<{
|
|
97
|
-
title: string;
|
|
98
|
-
id: number;
|
|
99
|
-
handle: string;
|
|
100
|
-
}> | undefined;
|
|
101
|
-
export declare function getPickedConfigExperiments(): PickedConfigExperiment[] | undefined;
|
|
102
|
-
export declare function getPickedConfigStorefrontApiToken(): string | undefined;
|
|
103
|
-
//# sourceMappingURL=picked-config.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"picked-config.d.ts","sourceRoot":"","sources":["../../../../src/plugins/shopify/picked-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,E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E,eAAe;WACpB,MAAM;UACP,MAAM,EAAE;WACP,MAAM;UACP,MAAM;SACP,MAAM;cACD,0BAA0B,EAAE;YAC9B,MAAM;eAqDf;AAED,wBAAgB,yBAAyB;WA5FhC,MAAM;QACT,MAAM;YACF,MAAM;eAgGf;AAED,wBAAgB,0BAA0B,yCAMzC;AAED,wBAAgB,iCAAiC,uBAMhD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/plugins/shopify/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AAM1D,eAAO,MAAM,aAAa,QAAO,MA0BhC,CAAA"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { StateSnapshot } from '../../utils/state-snaphot';
|
|
2
|
-
export declare const evaluatePathname: (regexPattern: RegExp, location?: StateSnapshot["location"]) => boolean;
|
|
3
|
-
/**
|
|
4
|
-
* Evaluate handle from path using regex pattern
|
|
5
|
-
*
|
|
6
|
-
* @param regexPattern Regex pattern to extract handle
|
|
7
|
-
* @param location Location object containing pathname
|
|
8
|
-
* @returns handle string or undefined
|
|
9
|
-
*/
|
|
10
|
-
export declare const evaluateHandleByPath: (regexPattern: RegExp, location?: StateSnapshot["location"]) => string | undefined;
|
|
11
|
-
/**
|
|
12
|
-
* Evaluate handle from pickedConfig based on type
|
|
13
|
-
*
|
|
14
|
-
* @param type page type: 'product' | 'collection'
|
|
15
|
-
* @returns handle string or undefined
|
|
16
|
-
*/
|
|
17
|
-
export declare const evaluateHandleByType: (type: "product" | "collection") => string | false;
|
|
18
|
-
interface PredicateArgs {
|
|
19
|
-
location?: StateSnapshot['location'];
|
|
20
|
-
}
|
|
21
|
-
export declare const shopifyPredicates: {
|
|
22
|
-
'is-page': ({ location }: PredicateArgs) => boolean;
|
|
23
|
-
'get-page-handle': ({ location }: PredicateArgs) => string | undefined;
|
|
24
|
-
'is-product-page': () => boolean;
|
|
25
|
-
'get-product-handle': () => string | false;
|
|
26
|
-
'is-collection-page': () => boolean;
|
|
27
|
-
'get-collection-handle': () => string | false;
|
|
28
|
-
'is-blog-page': ({ location }: PredicateArgs) => boolean;
|
|
29
|
-
'get-blog-handle': ({ location }: PredicateArgs) => string | undefined;
|
|
30
|
-
'is-article-page': ({ location }: PredicateArgs) => boolean;
|
|
31
|
-
'get-article-handle': ({ location }: PredicateArgs) => string | undefined;
|
|
32
|
-
'is-app-proxy-page': ({ location }: PredicateArgs) => boolean;
|
|
33
|
-
'get-app-proxy-handle': ({ location }: PredicateArgs) => string | undefined;
|
|
34
|
-
'is-account-page': ({ location }: PredicateArgs) => boolean;
|
|
35
|
-
'is-login-page': ({ location }: PredicateArgs) => boolean;
|
|
36
|
-
'is-register-page': ({ location }: PredicateArgs) => boolean;
|
|
37
|
-
'is-cart-page': ({ location }: PredicateArgs) => boolean;
|
|
38
|
-
'is-checkout-page': ({ location }: PredicateArgs) => boolean;
|
|
39
|
-
'is-homepage': ({ location }: PredicateArgs) => boolean;
|
|
40
|
-
};
|
|
41
|
-
export {};
|
|
42
|
-
//# sourceMappingURL=predicates.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"predicates.d.ts","sourceRoot":"","sources":["../../../../src/plugins/shopify/predicates.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAmB9D,eAAO,MAAM,gBAAgB,GAC3B,cAAc,MAAM,EACpB,WAAW,aAAa,CAAC,UAAU,CAAC,KACnC,OAMF,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,GAC/B,cAAc,MAAM,EACpB,WAAW,aAAa,CAAC,UAAU,CAAC,uBAQrC,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,GAAI,MAAM,SAAS,GAAG,YAAY,mBASlE,CAAA;AAED,UAAU,aAAa;IACrB,QAAQ,CAAC,EAAE,aAAa,CAAC,UAAU,CAAC,CAAA;CACrC;AAED,eAAO,MAAM,iBAAiB;8BAEF,aAAa;sCACL,aAAa;;;;;mCAQhB,aAAa;sCACV,aAAa;sCAEb,aAAa;yCACV,aAAa;wCAGd,aAAa;2CACV,aAAa;sCAGlB,aAAa;oCAEf,aAAa;uCACV,aAAa;mCAGjB,aAAa;uCAET,aAAa;kCAElB,aAAa;CAC5C,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const l=require("effector"),S=require("@withease/factories"),x=require("./experience-instance-BpQMqclI.cjs"),I=require("./logger-BsmHUUw1.cjs"),F=require("./storage-DuRlyFaY.cjs"),T=require("./id-BKIWbSTy.cjs"),C=require("./object-BbFTsGh3.cjs"),j=require("./supports-YvpQZxbh.cjs"),P=l.createDomain("experience"),N=S.createFactory(({client:e,experience:t})=>{const a=P.store(t),d=l.createApi(a,{merge(c,p){return{...c,...p.experience}}}),f=a.map(c=>({name:c.name,decisionLogic:c.decide,targetSelectors:c.targets,initializeOpenLogic:t.initializeOpen})),m=e.components.listStore.map(c=>c.find(p=>p.name===`experience:${t.id}`)||c.find(p=>p.name==="experience"),{skipVoid:!1}),r=a.map(c=>({steps:c.steps,nodes:c.nodes,edges:c.edges,conditionals:c.conditionals})),n=t.actions??[];return{id:t.id,configStore:f,treeStore:r,componentStore:m,actions:n,merge:d.merge}});function q(e){return S.invoke(N,e)}const L=S.createFactory(({client:e})=>{const t=P.store({}),a=l.createApi(t,{register(r,n){return{...r,[n.id]:n}}});function d(r){const n=t.getState()[r.id];if(n){n.merge({experience:r,strategy:"override"});return}const c=q({client:e,experience:r});a.register(c)}const f=t.map(r=>Object.values(r));function m(r){return t.map(n=>n[r],{skipVoid:!1})}return{register:d,getById:m,listStore:f}});function _(e){return S.invoke(L,e)}const U=(e,t)=>{t.register(e)},O=(e,t)=>{const{targetSelectors:a}=t.configStore.getState(),d=x.getTargetElements(a,t.id);d.forEach(({elements:m})=>m.forEach(r=>x.tagTargetElement(r,t.id))),x.createAppHosts(d,t.id).forEach(m=>{e.experienceInstances.spawn(t,m)})},H=async e=>{await Promise.all(e.experiences.listStore.getState().map(async t=>{await z(e,t)&&O(e,t)}))},z=async(e,t)=>{const{decisionLogic:a,targetSelectors:d}=t.configStore.getState();return x.getTargetElements(d,t.id).length<1||d.length===0?!1:a&&x.isRulesLogic(a)?await x.evaluateRuleLogic(e,a)===!0:!0},K=l.createDomain("component"),G=S.createFactory(({client:e,component:t,name:a})=>{const d=e.frameworks.getByName(t.frameworkName);return{name:a,component:t,frameworkStore:d}});function Y(e){return S.invoke(G,e)}const J=S.createFactory(({client:e})=>{const t=K.store({}),a=l.createApi(t,{register(r,n){return{...r,[n.name]:n}}});function d(r,n){t.getState()[r]&&I.logger("warn",`Component '${r}' already registered. Registering again will override the previous registration.`);const p=Y({client:e,name:r,component:n});a.register(p)}const f=t.map(r=>Object.values(r));function m(r){return t.map(n=>n[r],{skipVoid:!1})}return{register:d,getByName:m,listStore:f}});function Q(e){return S.invoke(J,e)}const W=(e,t,a)=>{a.register(e,t)},X=l.createDomain("framework"),Z=S.createFactory(({client:e})=>{const t=X.store({}),a=l.createApi(t,{register(r,n){return{...r,[n.name]:n.framework}}});function d(r,n){t.getState()[r]&&I.logger("warn",`Framework '${r}' already registered. Registering again will override the previous registration.`),a.register({name:r,framework:n})}const f=t.map(r=>Object.values(r));function m(r){return t.map(n=>n[r],{skipVoid:!1})}return{register:d,getByName:m,listStore:f}});function ee(e){return S.invoke(Z,e)}const te=(e,t)=>{t.register(e.name,e)},re=6e3,A=F.createStorageKey("last_ping","global"),ne=e=>`${e}/api/v1/ping`,se=async e=>{try{const t=Date.now(),a=localStorage.getItem(A);if(a&&t-parseInt(a)<re)return!0;const d=ne(e.apiUrl),f={projectId:e.projectId,path:window.location.pathname},m=JSON.stringify(f),r={"Content-Type":"application/json"},n=document.getElementById("picked_script"),c=n==null?void 0:n.dataset.verceltoken;c&&(r["x-vercel-protection-bypass"]=c);const y=(await fetch(d,{method:"POST",headers:r,body:m})).ok;return y&&localStorage.setItem(A,t.toString()),y}catch(t){return I.logger("error",t),!1}};function V(e){const t=typeof window<"u",a={client:e,responses:e.responses.listStore.getState(),fields:e.fields.listStore.getState(),location:t?window.location:void 0,document:t?window.document:void 0,sessionStorage:t?window.sessionStorage:void 0,localStorage:t?window.localStorage:void 0};return Object.freeze(a)}const oe=l.createDomain("predicate"),ie=S.createFactory(({client:e})=>{const t=oe.store({}),a=l.createApi(t,{register(n,c){return{...n,[c.name]:{name:c.name,predicate:c.predicate}}}});function d(n,c){t.getState()[n]&&I.logger("warn",`Predicate '${n}' already registered. Registering again will override the previous registration.`),a.register(Object.freeze({name:n,predicate:c}))}const f=t.map(n=>Object.values(n));function m(n){return t.map(c=>{var p;return(p=c[n])==null?void 0:p.predicate},{skipVoid:!1})}function r(n){const c=l.createStore(()=>{},{skipVoid:!1}),p=l.createEffect(async()=>{const y=m(n).getState();if(!y)return;const w=V(e);return()=>y(w)});return l.sample({source:{responses:e.responses.listStore,fields:e.fields.listStore},target:p}),l.sample({clock:p.doneData,filter:y=>y!==void 0,target:c}),p(),c}return{register:d,getByName:m,listStore:f,getEvokablePredicate:r}});function ae(e){return S.invoke(ie,e)}const ce=(e,t,a)=>{a.register(e,t)},R=l.createDomain("feature"),ue=S.createFactory(({client:e})=>{const t=R.store({}),a=R.store([]),d=l.createApi(t,{register(s,i){return{...s,[i.id]:i.feature}}});function f(s,i){t.getState()[s]&&I.logger("warn",`Feature '${s}' already registered. Registering again will override the previous registration.`);const g={id:s,feature:{...i,id:s}};d.register(Object.freeze({id:s,feature:g}))}const m=l.createEffect(async({id:s,key:i,storage:o="local"})=>{const g=F.createStorageKey(`feature:${s}:${i}`,"global"),v=(o==="session"?F.sessionStore:F.localStore).get(g).boolean();return v===null?null:{id:s,key:i,bucket:v,storage:o}}),r=l.createEffect(s=>{if(!s)return null;const i=F.createStorageKey(`feature:${s.id}:${s.key}`,"global");(s.storage==="session"?F.sessionStore:F.localStore).set(i,s.bucket)}),n=new Map,c=l.attach({source:{allFeaturesStore:t,resolvedFeaturesStore:a},effect:async({allFeaturesStore:s,resolvedFeaturesStore:i},{id:o,decide:g,key:u})=>{const v=i.find(D=>D.id===o&&D.key===u);if(v)return v;const k=s[o];if(!k)throw new Error(`Feature with id '${o}' not found`);const E=n.get(`${o}:${u}`);if(E!==void 0){const D=await E;return{id:k.id,bucket:D,key:u,storage:k.feature.storage}}const h=g();n.set(`${o}:${u}`,h);const M=await h;return{id:k.id,bucket:M,key:u,storage:k.feature.storage}}});l.sample({clock:d.register,fn:s=>{const{id:i,feature:o}=s;return{id:i,key:o.feature.key,storage:o.feature.storage}},target:m}),l.sample({source:t,clock:c.doneData,fn:(s,i)=>{var k;const{id:o,bucket:g,storage:u}=i,v=(k=s[o])==null?void 0:k.feature.key;return v?{key:v,id:o,bucket:g,storage:u}:null},target:r});const p=l.combine({allFeaturesStore:t,resolvedFeaturesStore:a}).map(({allFeaturesStore:s,resolvedFeaturesStore:i})=>Object.values(s).map(o=>{const g=i.find(u=>u.id===o.id&&u.key===o.feature.key);return g?{id:o.id,name:o.feature.name,key:o.feature.key,getBucket:()=>({id:o.id,bucket:g.bucket}),isResolved:!0}:{id:o.id,name:o.feature.name,key:o.feature.key,getBucket:async()=>await c(o.feature),isResolved:!1}}));l.sample({clock:c.doneData,source:{resolvedFeatures:a},filter:({resolvedFeatures:s},{id:i,key:o})=>!s.some(u=>u.id===i&&u.key===o),fn:(s,i)=>i,target:e.eventBus.prepend(s=>({type:"feature_decide",feature:s}))}),l.sample({clock:[m.doneData,c.doneData],source:a,fn:(s,i)=>!i||s.some(g=>g.id===i.id&&g.key===i.key)?s:[...s,i],target:a});function y(s){return p.map(i=>i.find(o=>o.id===s))}function w(s){const i=l.createStore(async()=>{},{skipVoid:!1}),o=l.createEffect(async()=>{const g=y(s).getState();if(g)return async()=>(await g.getBucket()).bucket});return l.sample({source:a,filter:g=>g.some(u=>u.id===s),target:o}),l.sample({clock:o.doneData,filter:g=>g!==void 0,target:i}),o(),i}return{register:f,getById:y,listStore:p,getEvokableFeature:w}});function le(e){return S.invoke(ue,e)}const de=(e,t,a)=>{a.register(e,t)},b=l.createDomain("history");function $(e,t){return{id:T.generateId(`history-entry-${Date.now()}-${Math.random()}}`),node:t,at:Date.now(),experienceId:e}}const ge=S.createFactory(()=>{const e=b.store({entries:[]}),t=b.event(),a=b.event(),d=b.event(),f=b.event();e.on(t,(r,n)=>({entries:[...r.entries,$(n.experienceId,n.node)]})),e.on(a,(r,n)=>({entries:[...r.entries.slice(0,-1),$(n.experienceId,n.node)]})),e.on(f,(r,n)=>n);function m(r,n){const c={lastStepIndex:-1,secondLastStepIndex:-1};for(let p=r.length-1;p>=0;p--){const y=r[p],w=y==null?void 0:y.node;if(!(!w||!x.isStepNode(w))&&!(n&&(y==null?void 0:y.experienceId)!==n))if(c.lastStepIndex===-1)c.lastStepIndex=p;else{c.secondLastStepIndex=p;break}}return c}return e.on(d,(r,n)=>{const{secondLastStepIndex:c}=m(r.entries,n.experienceId),p=c!==-1?r.entries.slice(0,c+1):r.entries;return{...r,entries:p}}),{push:t,replace:a,back:d,restore:f,entriesStore:e.map(r=>r.entries)}});function pe(){return S.invoke(ge)}const fe=l.createDomain("field"),me=S.createFactory(()=>{const e=fe.store({}),t=l.createApi(e,{register(r,n){return{...r,[n.field.id]:n.field}}});function a(r){t.register({field:r})}const d=e.map(r=>Object.values(r));function f(r){return e.map(n=>n[r]||null)}function m(r){return e.map(n=>Object.values(n).find(c=>c.name===r)||null)}return{register:a,getById:f,listStore:d,getByName:m}});function Se(){return S.invoke(me)}const ye=(e,t)=>{t.register(e)},ve=l.createDomain("action"),ke=S.createFactory(()=>{const e=ve.store({}),t=l.createApi(e,{register(r,n){return{...r,[n.name]:{name:n.name,action:n.action}}}});function a(r,n){t.register({name:r,action:n})}const d=e.map(r=>Object.values(r));function f(r){return e.map(n=>n[r],{skipVoid:!1})}function m(r){return e.map(n=>{const c=n[r];return c?c.action:void 0},{skipVoid:!1})}return{register:a,getByName:f,listStore:d,getEvokableAction:m}});function Fe(){return S.invoke(ke)}const we=(e,t,a)=>{a.register(e,t)};function B(e){return typeof e>"u"||e===null||e===""||Array.isArray(e)&&!e.length}const xe=l.createDomain("response"),he=S.createFactory(({client:e})=>{const t=xe.store({}),a=l.createEvent(),d=l.createEvent(),f=l.createApi(t,{register(s,i){return{...s,[i.fieldId]:i.response}},registerBatch(s,i){return{...s,...i}},clear(s,i){const{[i]:o,...g}=s;return g},clearAll(){return{}}});function m(s,i){if(typeof s=="string"){if(i===void 0)throw new Error("Response is required when registering a single field");f.register({fieldId:s,response:i})}else f.registerBatch(s)}async function r(s){const i=[];return await Promise.allSettled(Object.entries(s).map(async([o,g])=>{let u=g;const v=e.fields.getById(o).getState();if(!v){i.push({fieldId:o,userMessage:`Field '${o}' not found`,systemMessage:`No field with ID '${o}' exists. Available field IDs are: ${Object.keys(e.fields.listStore.getState()).join(",")}.`,value:u});return}if(v.multiple&&(typeof u=="string"||typeof u=="number"||typeof u=="boolean")&&(u=[u]),v.validation&&!C.isEmpty(v.validation)&&!B(u)){const k=await x.evaluateRuleLogic(e,v.validation,{$input:u});if(typeof k=="string"){i.push({fieldId:o,userMessage:k,systemMessage:`Field validation resulted in an error: ${k}.`,value:u});return}if(k===!1){i.push({fieldId:o,userMessage:"This field is invalid",systemMessage:"Field validation resulted in an unspecified error.",value:u});return}}if(v.required&&B(u)){i.push({fieldId:o,userMessage:"This field is required",systemMessage:"Field is required.",value:u});return}if(!v.multiple&&Array.isArray(u)&&u.length>1){i.push({fieldId:o,userMessage:"This field expects a single response",systemMessage:"Field expects a single response.",value:u});return}if(v.options){const k=v.options.map(h=>h.value),E=Array.isArray(u)?u:[u];Array.isArray(u)&&(E.every(h=>k.includes(h))||i.push({fieldId:o,userMessage:"This field expects a valid option",systemMessage:`Field expects a valid option. Valid options are: ${k.join(", ")}`,value:u}))}})),{responsesToCommit:s,validationErrors:i}}async function n(s){const{responsesToCommit:i,validationErrors:o}=await r(s);return o.length?{errors:o}:(f.registerBatch(i),{errors:[]})}const c=t.map(s=>s),p=t.map(s=>Object.keys(s).map(o=>({fieldId:o,value:s[o]})));function y(s){const i=e.fields.getById(s),o=t.map(g=>g[s]||null);return l.combine({f:i,r:o},({f:g,r:u})=>u||(g!=null&&g.defaultValue?g.defaultValue:null))}function w(s){const i=e.fields.getByName(s);return l.combine({f:i,s:t},({f:o,s:g})=>{const u=o&&g[o.id]||null;return u||(o!=null&&o.defaultValue?o.defaultValue:null)})}return l.sample({clock:a,target:f.clearAll}),l.sample({clock:d,target:f.clear}),{register:m,clearAll:a,clear:d,commit:n,getResponsesToCommit:r,listStore:p,getAllStore:c,getByFieldId:y,getByFieldName:w}});function be(e){return S.invoke(he,e)}function Ie(){if(j.supportsCryptoRandomUUID())return crypto.randomUUID();const e=Date.now().toString(36),t=Math.random().toString(36).substring(2,15),a=Math.random().toString(36).substring(2,15),d=Math.random().toString(36).substring(2,15);return`${e}-${t}-${a}-${d}`}const Ee=()=>({id:Ie()}),De=F.createStorageKey("session","global"),Ae=()=>{if(!j.supportsLocalStorage())return null;const e=F.localStore.get(De);let t=e.isSet()?e.json():null;return t||(t=Ee(),e.set(t)),t},Re=()=>Ae();exports.createActionIndex=Fe;exports.createComponentIndex=Q;exports.createExperienceIndex=_;exports.createFeatureIndex=le;exports.createFieldIndex=Se;exports.createFrameworkIndex=ee;exports.createHistory=pe;exports.createPredicateIndex=ae;exports.createResponseIndex=be;exports.createStateSnapshot=V;exports.initialiseExperience=O;exports.initialiseExperiences=H;exports.initialiseSession=Re;exports.ping=se;exports.setupAction=we;exports.setupComponent=W;exports.setupExperience=U;exports.setupFeature=de;exports.setupField=ye;exports.setupFramework=te;exports.setupPredicate=ce;
|