@picked/shopify 0.0.1-dev.1764896242714 → 0.0.1-dev.1764898426031
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/plugins/shopify/index.js +1 -1
- package/dist/cjs/storefront-api/index.js +1 -1
- package/dist/esm/plugins/shopify/index.js +63 -69
- package/dist/esm/storefront-api/index.js +1 -1
- package/dist/picked-config-BEFhVeAZ.cjs +1 -0
- package/dist/picked-config-DfW6lJWR.js +70 -0
- package/dist/types/plugins/shopify/picked-config.d.ts.map +1 -1
- package/dist/types/plugins/shopify/plugin.d.ts.map +1 -1
- package/package.json +2 -2
- package/dist/picked-config-DcKNgPpy.js +0 -62
- package/dist/picked-config-OpJ03CX7.cjs +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("@picked/client"),g=require("../../ajax-api/index.js"),a=require("../../../picked-config-BEFhVeAZ.cjs"),s=require("../../../global-obj-OziQiQ8j.cjs"),i={homepage:/^\/$/,page:/(?:^|\/)pages\/(?<pageHandle>[^/]+)\/?$/,blog:/(?:^|\/)blogs\/(?<blogHandle>[^/]+)\/?$/,article:/^\/blogs\/[^/]+\/(?<article>[^/]+)\/?$/,cart:/(?:^|\/)cart\/[^/]+$/,checkout:/^\/checkout\/.+/,appProxy:/^\/(?:a|apps|community|tools)\/(?<proxyTarget>[^/]+)/,accountWildcard:/^\/account\/.+/,accountLogin:/^\/account\/login(?:\/|$)/,accountRegister:/^\/account\/register(?:\/|$)/},o=(e,t)=>t?!!e.exec(t.pathname):!1,r=(e,t)=>{if(t){const c=e.exec(t.pathname);if(c)return c[1]}},n=e=>{var t,c;switch(e){case"product":return((t=a.getPickedConfigProduct())==null?void 0:t.handle)??!1;case"collection":return((c=a.getPickedConfigCollection())==null?void 0:c.handle)??!1;default:return!1}},l={"is-page":({location:e})=>o(i.page,e),"get-page-handle":({location:e})=>r(i.page,e),"is-product-page":()=>!!n("product"),"get-product-handle":()=>n("product"),"is-collection-page":()=>!!n("collection"),"get-collection-handle":()=>n("collection"),"is-blog-page":({location:e})=>o(i.blog,e),"get-blog-handle":({location:e})=>r(i.blog,e),"is-article-page":({location:e})=>o(i.article,e),"get-article-handle":({location:e})=>r(i.article,e),"is-app-proxy-page":({location:e})=>o(i.appProxy,e),"get-app-proxy-handle":({location:e})=>r(i.appProxy,e),"is-account-page":({location:e})=>o(i.accountWildcard,e),"is-login-page":({location:e})=>o(i.accountLogin,e),"is-register-page":({location:e})=>o(i.accountRegister,e),"is-cart-page":({location:e})=>o(i.cart,e),"is-checkout-page":({location:e})=>o(i.checkout,e),"is-homepage":({location:e})=>o(i.homepage,e)},d=()=>({name:"shopify",setup:e=>{Object.entries(l).forEach(([t,c])=>{e.registerPredicate(`shopify-${t}`,c)}),p.supportsWindow()&&e.eventBus.watch(t=>{s.supportsShopifyAnalytics()&&(t.type==="session"&&(globalThis.window.Shopify.analytics.publish("picked:session",{id:t.id}),g.updateCart({attributes:{"picked.id":t.id}})),t.type==="feature_decide"&&g.updateCart({attributes:{[`picked.features.${t.feature.id}`]:`${t.feature.bucket}`}}),t.type==="user_decide"&&g.updateCart({attributes:{"picked.is_user":t.value?"true":"false"}}))})}});exports.getPickedConfig=a.getPickedConfig;exports.getPickedConfigCollection=a.getPickedConfigCollection;exports.getPickedConfigCustomer=a.getPickedConfigCustomer;exports.getPickedConfigExperiments=a.getPickedConfigExperiments;exports.getPickedConfigFeatureExperiments=a.getPickedConfigFeatureExperiments;exports.getPickedConfigProduct=a.getPickedConfigProduct;exports.getPickedConfigStorefrontApiToken=a.getPickedConfigStorefrontApiToken;exports.getShopify=s.getShopify;exports.shopifyPlugin=d;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("@shopify/storefront-api-client");require("@picked/client");const n=require("../../picked-config-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("@shopify/storefront-api-client");require("@picked/client");const n=require("../../picked-config-BEFhVeAZ.cjs"),i=require("../../global-obj-OziQiQ8j.cjs");function f(t){const o=i.getShopify(),e=n.getPickedConfigStorefrontApiToken();if(!e)throw new Error("Shopify Storefront API token not found. Ensure the Picked Script is enabled on your Shopify storefront");return r.createStorefrontApiClient({storeDomain:o.shop,apiVersion:t.apiVersion,publicAccessToken:e})}const c=()=>{if(!client)throw new Error("Storefront API client not found");return client};exports.createStorefrontApiClient=f;exports.getStorefrontApiClient=c;
|
|
@@ -1,19 +1,10 @@
|
|
|
1
|
-
import { supportsWindow as
|
|
2
|
-
import { updateCart as
|
|
3
|
-
import { a as
|
|
4
|
-
import { c as
|
|
5
|
-
import { s as
|
|
6
|
-
import { g as
|
|
7
|
-
|
|
8
|
-
let t;
|
|
9
|
-
return (...i) => {
|
|
10
|
-
const p = () => {
|
|
11
|
-
t = void 0, e(...i);
|
|
12
|
-
};
|
|
13
|
-
clearTimeout(t), t = setTimeout(p, a);
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
const o = {
|
|
1
|
+
import { supportsWindow as p } from "@picked/client";
|
|
2
|
+
import { updateCart as s } from "../../ajax-api/index.js";
|
|
3
|
+
import { a as n, b as g } from "../../../picked-config-DfW6lJWR.js";
|
|
4
|
+
import { c as P, d as x, e as C, f as $, g as B } from "../../../picked-config-DfW6lJWR.js";
|
|
5
|
+
import { s as l } from "../../../global-obj-DQ6S7d00.js";
|
|
6
|
+
import { g as E } from "../../../global-obj-DQ6S7d00.js";
|
|
7
|
+
const a = {
|
|
17
8
|
homepage: /^\/$/,
|
|
18
9
|
page: /(?:^|\/)pages\/(?<pageHandle>[^/]+)\/?$/,
|
|
19
10
|
blog: /(?:^|\/)blogs\/(?<blogHandle>[^/]+)\/?$/,
|
|
@@ -24,80 +15,83 @@ const o = {
|
|
|
24
15
|
accountWildcard: /^\/account\/.+/,
|
|
25
16
|
accountLogin: /^\/account\/login(?:\/|$)/,
|
|
26
17
|
accountRegister: /^\/account\/register(?:\/|$)/
|
|
27
|
-
},
|
|
28
|
-
if (
|
|
29
|
-
const
|
|
30
|
-
if (
|
|
31
|
-
return
|
|
18
|
+
}, o = (e, t) => t ? !!e.exec(t.pathname) : !1, c = (e, t) => {
|
|
19
|
+
if (t) {
|
|
20
|
+
const i = e.exec(t.pathname);
|
|
21
|
+
if (i)
|
|
22
|
+
return i[1];
|
|
32
23
|
}
|
|
33
|
-
},
|
|
34
|
-
var
|
|
24
|
+
}, r = (e) => {
|
|
25
|
+
var t, i;
|
|
35
26
|
switch (e) {
|
|
36
27
|
case "product":
|
|
37
|
-
return ((
|
|
28
|
+
return ((t = g()) == null ? void 0 : t.handle) ?? !1;
|
|
38
29
|
case "collection":
|
|
39
|
-
return ((
|
|
30
|
+
return ((i = n()) == null ? void 0 : i.handle) ?? !1;
|
|
40
31
|
default:
|
|
41
32
|
return !1;
|
|
42
33
|
}
|
|
43
|
-
},
|
|
34
|
+
}, u = {
|
|
44
35
|
// Pages
|
|
45
|
-
"is-page": ({ location: e }) =>
|
|
46
|
-
"get-page-handle": ({ location: e }) =>
|
|
36
|
+
"is-page": ({ location: e }) => o(a.page, e),
|
|
37
|
+
"get-page-handle": ({ location: e }) => c(a.page, e),
|
|
47
38
|
// Products
|
|
48
|
-
"is-product-page": () => !!
|
|
49
|
-
"get-product-handle": () =>
|
|
39
|
+
"is-product-page": () => !!r("product"),
|
|
40
|
+
"get-product-handle": () => r("product"),
|
|
50
41
|
// Collections
|
|
51
|
-
"is-collection-page": () => !!
|
|
52
|
-
"get-collection-handle": () =>
|
|
42
|
+
"is-collection-page": () => !!r("collection"),
|
|
43
|
+
"get-collection-handle": () => r("collection"),
|
|
53
44
|
// Blogs
|
|
54
|
-
"is-blog-page": ({ location: e }) =>
|
|
55
|
-
"get-blog-handle": ({ location: e }) =>
|
|
45
|
+
"is-blog-page": ({ location: e }) => o(a.blog, e),
|
|
46
|
+
"get-blog-handle": ({ location: e }) => c(a.blog, e),
|
|
56
47
|
// Blog Articles
|
|
57
|
-
"is-article-page": ({ location: e }) =>
|
|
58
|
-
"get-article-handle": ({ location: e }) =>
|
|
48
|
+
"is-article-page": ({ location: e }) => o(a.article, e),
|
|
49
|
+
"get-article-handle": ({ location: e }) => c(a.article, e),
|
|
59
50
|
// Apps
|
|
60
|
-
"is-app-proxy-page": ({ location: e }) =>
|
|
61
|
-
"get-app-proxy-handle": ({ location: e }) =>
|
|
51
|
+
"is-app-proxy-page": ({ location: e }) => o(a.appProxy, e),
|
|
52
|
+
"get-app-proxy-handle": ({ location: e }) => c(a.appProxy, e),
|
|
62
53
|
// Account
|
|
63
|
-
"is-account-page": ({ location: e }) =>
|
|
64
|
-
"is-login-page": ({ location: e }) =>
|
|
65
|
-
"is-register-page": ({ location: e }) =>
|
|
54
|
+
"is-account-page": ({ location: e }) => o(a.accountWildcard, e),
|
|
55
|
+
"is-login-page": ({ location: e }) => o(a.accountLogin, e),
|
|
56
|
+
"is-register-page": ({ location: e }) => o(a.accountRegister, e),
|
|
66
57
|
// Cart
|
|
67
|
-
"is-cart-page": ({ location: e }) =>
|
|
58
|
+
"is-cart-page": ({ location: e }) => o(a.cart, e),
|
|
68
59
|
// Checkout
|
|
69
|
-
"is-checkout-page": ({ location: e }) =>
|
|
60
|
+
"is-checkout-page": ({ location: e }) => o(a.checkout, e),
|
|
70
61
|
// Homepage
|
|
71
|
-
"is-homepage": ({ location: e }) =>
|
|
72
|
-
},
|
|
62
|
+
"is-homepage": ({ location: e }) => o(a.homepage, e)
|
|
63
|
+
}, y = () => ({
|
|
73
64
|
name: "shopify",
|
|
74
65
|
setup: (e) => {
|
|
75
|
-
|
|
76
|
-
e.registerPredicate(`shopify-${
|
|
77
|
-
}),
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}), t["picked.id"] = i.id), i.type === "feature_decide") {
|
|
84
|
-
const p = `picked.features.${i.feature.id}`;
|
|
85
|
-
t[p] = i.feature.bucket ? "true" : "false";
|
|
86
|
-
}
|
|
87
|
-
i.type === "user_decide" && (t["picked.is_user"] = `${i.value}`), a({ attributes: t });
|
|
66
|
+
Object.entries(u).forEach(([t, i]) => {
|
|
67
|
+
e.registerPredicate(`shopify-${t}`, i);
|
|
68
|
+
}), p() && e.eventBus.watch((t) => {
|
|
69
|
+
l() && (t.type === "session" && (globalThis.window.Shopify.analytics.publish("picked:session", {
|
|
70
|
+
id: t.id
|
|
71
|
+
}), s({
|
|
72
|
+
attributes: {
|
|
73
|
+
"picked.id": t.id
|
|
88
74
|
}
|
|
89
|
-
})
|
|
90
|
-
|
|
75
|
+
})), t.type === "feature_decide" && s({
|
|
76
|
+
attributes: {
|
|
77
|
+
[`picked.features.${t.feature.id}`]: `${t.feature.bucket}`
|
|
78
|
+
}
|
|
79
|
+
}), t.type === "user_decide" && s({
|
|
80
|
+
attributes: {
|
|
81
|
+
"picked.is_user": t.value ? "true" : "false"
|
|
82
|
+
}
|
|
83
|
+
}));
|
|
84
|
+
});
|
|
91
85
|
}
|
|
92
86
|
});
|
|
93
87
|
export {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
88
|
+
P as getPickedConfig,
|
|
89
|
+
n as getPickedConfigCollection,
|
|
90
|
+
x as getPickedConfigCustomer,
|
|
91
|
+
C as getPickedConfigExperiments,
|
|
92
|
+
$ as getPickedConfigFeatureExperiments,
|
|
93
|
+
g as getPickedConfigProduct,
|
|
94
|
+
B as getPickedConfigStorefrontApiToken,
|
|
95
|
+
E as getShopify,
|
|
96
|
+
y as shopifyPlugin
|
|
103
97
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createStorefrontApiClient as e } from "@shopify/storefront-api-client";
|
|
2
2
|
import "@picked/client";
|
|
3
|
-
import { g as n } from "../../picked-config-
|
|
3
|
+
import { g as n } from "../../picked-config-DfW6lJWR.js";
|
|
4
4
|
import { g as i } from "../../global-obj-DQ6S7d00.js";
|
|
5
5
|
function S(t) {
|
|
6
6
|
const r = i(), o = n();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const n=require("@picked/client");function i(){if(n.supportsWindow())return globalThis.window.pickedConfig}function s(){var e;if(n.supportsWindow())return(e=i())==null?void 0:e.customer}function d(){var e;if(n.supportsWindow())return(e=i())==null?void 0:e.product}function f(){var e;if(n.supportsWindow())return(e=i())==null?void 0:e.collection}function u(){var e;if(n.supportsWindow())return(e=i())==null?void 0:e.experiments}function g(){var e,o;if(n.supportsWindow())return(o=(e=i())==null?void 0:e.storefront_api)==null?void 0:o.token}function p(){const e=n.createStorageKey("shopify-plugin-experiment-roll"),o=n.localStore.get(e);try{const t=o.json();if(typeof t=="number")return t}catch{}const r=Math.random()*100;return o.set(r),r}function l(){const e=u();if(!e)return{};const o=p();try{return e.reduce((r,t)=>{const c=r?{...r}:{};return t.enabled&&(c[t.id]={name:t.name,key:t.version.toString(),decide:()=>o<t.weight}),c},{})}catch{return{}}}exports.getPickedConfig=i;exports.getPickedConfigCollection=f;exports.getPickedConfigCustomer=s;exports.getPickedConfigExperiments=u;exports.getPickedConfigFeatureExperiments=l;exports.getPickedConfigProduct=d;exports.getPickedConfigStorefrontApiToken=g;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { supportsWindow as r, createStorageKey as u, localStore as f } from "@picked/client";
|
|
2
|
+
function i() {
|
|
3
|
+
if (r())
|
|
4
|
+
return globalThis.window.pickedConfig;
|
|
5
|
+
}
|
|
6
|
+
function a() {
|
|
7
|
+
var e;
|
|
8
|
+
if (r())
|
|
9
|
+
return (e = i()) == null ? void 0 : e.customer;
|
|
10
|
+
}
|
|
11
|
+
function l() {
|
|
12
|
+
var e;
|
|
13
|
+
if (r())
|
|
14
|
+
return (e = i()) == null ? void 0 : e.product;
|
|
15
|
+
}
|
|
16
|
+
function p() {
|
|
17
|
+
var e;
|
|
18
|
+
if (r())
|
|
19
|
+
return (e = i()) == null ? void 0 : e.collection;
|
|
20
|
+
}
|
|
21
|
+
function s() {
|
|
22
|
+
var e;
|
|
23
|
+
if (r())
|
|
24
|
+
return (e = i()) == null ? void 0 : e.experiments;
|
|
25
|
+
}
|
|
26
|
+
function k() {
|
|
27
|
+
var e, n;
|
|
28
|
+
if (r())
|
|
29
|
+
return (n = (e = i()) == null ? void 0 : e.storefront_api) == null ? void 0 : n.token;
|
|
30
|
+
}
|
|
31
|
+
function d() {
|
|
32
|
+
const e = u("shopify-plugin-experiment-roll"), n = f.get(e);
|
|
33
|
+
try {
|
|
34
|
+
const t = n.json();
|
|
35
|
+
if (typeof t == "number") return t;
|
|
36
|
+
} catch {
|
|
37
|
+
}
|
|
38
|
+
const o = Math.random() * 100;
|
|
39
|
+
return n.set(o), o;
|
|
40
|
+
}
|
|
41
|
+
function C() {
|
|
42
|
+
const e = s();
|
|
43
|
+
if (!e)
|
|
44
|
+
return {};
|
|
45
|
+
const n = d();
|
|
46
|
+
try {
|
|
47
|
+
return e.reduce(
|
|
48
|
+
(o, t) => {
|
|
49
|
+
const c = o ? { ...o } : {};
|
|
50
|
+
return t.enabled && (c[t.id] = {
|
|
51
|
+
name: t.name,
|
|
52
|
+
key: t.version.toString(),
|
|
53
|
+
decide: () => n < t.weight
|
|
54
|
+
}), c;
|
|
55
|
+
},
|
|
56
|
+
{}
|
|
57
|
+
);
|
|
58
|
+
} catch {
|
|
59
|
+
return {};
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
export {
|
|
63
|
+
p as a,
|
|
64
|
+
l as b,
|
|
65
|
+
i as c,
|
|
66
|
+
a as d,
|
|
67
|
+
s as e,
|
|
68
|
+
C as f,
|
|
69
|
+
k as g
|
|
70
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"picked-config.d.ts","sourceRoot":"","sources":["../../../../src/plugins/shopify/picked-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAEzD,OAAO,KAAK,EACV,eAAe,EACf,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,SAAS,CAAA;AAEhB,wBAAgB,eAAe,CAAC,CAAC,GAAG,mBAAmB,iFAStD;AAED,wBAAgB,uBAAuB;;;;;;;;;;;eAMtC;AAED,wBAAgB,sBAAsB,CAAC,CAAC,GAAG,eAAe;;;;;;;;;;;;;;;;;;;;;;;eAMzD;AAED,wBAAgB,yBAAyB;;;;;eAMxC;AAED,wBAAgB,0BAA0B,yCAMzC;AAED,wBAAgB,iCAAiC,uBAMhD;
|
|
1
|
+
{"version":3,"file":"picked-config.d.ts","sourceRoot":"","sources":["../../../../src/plugins/shopify/picked-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAEzD,OAAO,KAAK,EACV,eAAe,EACf,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,SAAS,CAAA;AAEhB,wBAAgB,eAAe,CAAC,CAAC,GAAG,mBAAmB,iFAStD;AAED,wBAAgB,uBAAuB;;;;;;;;;;;eAMtC;AAED,wBAAgB,sBAAsB,CAAC,CAAC,GAAG,eAAe;;;;;;;;;;;;;;;;;;;;;;;eAMzD;AAED,wBAAgB,yBAAyB;;;;;eAMxC;AAED,wBAAgB,0BAA0B,yCAMzC;AAED,wBAAgB,iCAAiC,uBAMhD;AAoBD,wBAAgB,iCAAiC,IAAI,mBAAmB,CAAC,UAAU,CAAC,CAiCnF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/plugins/shopify/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAU,MAAM,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/plugins/shopify/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAU,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAMpD,eAAO,MAAM,aAAa,QAAO,MAqDhC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@picked/shopify",
|
|
3
3
|
"description": "Shopify plugin for @picked/client",
|
|
4
|
-
"version": "0.0.1-dev.
|
|
4
|
+
"version": "0.0.1-dev.1764898426031",
|
|
5
5
|
"dependencies": {},
|
|
6
6
|
"devDependencies": {
|
|
7
7
|
"@picked/client": "workspace:*",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"main": "./dist/cjs/index.js",
|
|
64
64
|
"module": "./dist/esm/index.js",
|
|
65
65
|
"peerDependencies": {
|
|
66
|
-
"@picked/client": "0.0.1-dev.
|
|
66
|
+
"@picked/client": "0.0.1-dev.1764898426031",
|
|
67
67
|
"@shopify/storefront-api-client": "^1.0.9",
|
|
68
68
|
"effector": "^23.3.0"
|
|
69
69
|
},
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { supportsWindow as e } from "@picked/client";
|
|
2
|
-
function i() {
|
|
3
|
-
if (e())
|
|
4
|
-
return globalThis.window.pickedConfig;
|
|
5
|
-
}
|
|
6
|
-
function d() {
|
|
7
|
-
var t;
|
|
8
|
-
if (e())
|
|
9
|
-
return (t = i()) == null ? void 0 : t.customer;
|
|
10
|
-
}
|
|
11
|
-
function s() {
|
|
12
|
-
var t;
|
|
13
|
-
if (e())
|
|
14
|
-
return (t = i()) == null ? void 0 : t.product;
|
|
15
|
-
}
|
|
16
|
-
function g() {
|
|
17
|
-
var t;
|
|
18
|
-
if (e())
|
|
19
|
-
return (t = i()) == null ? void 0 : t.collection;
|
|
20
|
-
}
|
|
21
|
-
function c() {
|
|
22
|
-
var t;
|
|
23
|
-
if (e())
|
|
24
|
-
return (t = i()) == null ? void 0 : t.experiments;
|
|
25
|
-
}
|
|
26
|
-
function a() {
|
|
27
|
-
var t, r;
|
|
28
|
-
if (e())
|
|
29
|
-
return (r = (t = i()) == null ? void 0 : t.storefront_api) == null ? void 0 : r.token;
|
|
30
|
-
}
|
|
31
|
-
function k() {
|
|
32
|
-
const t = c();
|
|
33
|
-
if (!t)
|
|
34
|
-
return {};
|
|
35
|
-
try {
|
|
36
|
-
return t.reduce(
|
|
37
|
-
(r, n) => {
|
|
38
|
-
const o = r ? { ...r } : {};
|
|
39
|
-
return n.enabled && (o[n.id] = {
|
|
40
|
-
name: n.name,
|
|
41
|
-
key: n.version.toString(),
|
|
42
|
-
decide: () => {
|
|
43
|
-
const u = Math.random() * 100;
|
|
44
|
-
return n.weight > 0 && n.weight >= u;
|
|
45
|
-
}
|
|
46
|
-
}), o;
|
|
47
|
-
},
|
|
48
|
-
{}
|
|
49
|
-
);
|
|
50
|
-
} catch {
|
|
51
|
-
return {};
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
export {
|
|
55
|
-
g as a,
|
|
56
|
-
s as b,
|
|
57
|
-
i as c,
|
|
58
|
-
d,
|
|
59
|
-
c as e,
|
|
60
|
-
k as f,
|
|
61
|
-
a as g
|
|
62
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const i=require("@picked/client");function n(){if(i.supportsWindow())return globalThis.window.pickedConfig}function d(){var e;if(i.supportsWindow())return(e=n())==null?void 0:e.customer}function f(){var e;if(i.supportsWindow())return(e=n())==null?void 0:e.product}function g(){var e;if(i.supportsWindow())return(e=n())==null?void 0:e.collection}function u(){var e;if(i.supportsWindow())return(e=n())==null?void 0:e.experiments}function s(){var e,o;if(i.supportsWindow())return(o=(e=n())==null?void 0:e.storefront_api)==null?void 0:o.token}function k(){const e=u();if(!e)return{};try{return e.reduce((o,t)=>{const r=o?{...o}:{};return t.enabled&&(r[t.id]={name:t.name,key:t.version.toString(),decide:()=>{const c=Math.random()*100;return t.weight>0&&t.weight>=c}}),r},{})}catch{return{}}}exports.getPickedConfig=n;exports.getPickedConfigCollection=g;exports.getPickedConfigCustomer=d;exports.getPickedConfigExperiments=u;exports.getPickedConfigFeatureExperiments=k;exports.getPickedConfigProduct=f;exports.getPickedConfigStorefrontApiToken=s;
|