@picked/shopify 0.0.22 → 0.0.23-next.1

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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("@picked/client"),u=require("../../ajax-api/index.js"),n=require("../../../picked-config-OpJ03CX7.cjs"),p=require("../../../global-obj-OziQiQ8j.cjs");function d(e,i){let t;return(...c)=>{const s=()=>{t=void 0,e(...c)};clearTimeout(t),t=setTimeout(s,i)}}const o={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(?:\/|$)/},a=(e,i)=>i?!!e.exec(i.pathname):!1,r=(e,i)=>{if(i){const t=e.exec(i.pathname);if(t)return t[1]}},g=e=>{var i,t;switch(e){case"product":return((i=n.getPickedConfigProduct())==null?void 0:i.handle)??!1;case"collection":return((t=n.getPickedConfigCollection())==null?void 0:t.handle)??!1;default:return!1}},f={"is-page":({location:e})=>a(o.page,e),"get-page-handle":({location:e})=>r(o.page,e),"is-product-page":()=>!!g("product"),"get-product-handle":()=>g("product"),"is-collection-page":()=>!!g("collection"),"get-collection-handle":()=>g("collection"),"is-blog-page":({location:e})=>a(o.blog,e),"get-blog-handle":({location:e})=>r(o.blog,e),"is-article-page":({location:e})=>a(o.article,e),"get-article-handle":({location:e})=>r(o.article,e),"is-app-proxy-page":({location:e})=>a(o.appProxy,e),"get-app-proxy-handle":({location:e})=>r(o.appProxy,e),"is-account-page":({location:e})=>a(o.accountWildcard,e),"is-login-page":({location:e})=>a(o.accountLogin,e),"is-register-page":({location:e})=>a(o.accountRegister,e),"is-cart-page":({location:e})=>a(o.cart,e),"is-checkout-page":({location:e})=>a(o.checkout,e),"is-homepage":({location:e})=>a(o.homepage,e)},h=()=>({name:"shopify",setup:e=>{if(Object.entries(f).forEach(([i,t])=>{e.registerPredicate(`shopify-${i}`,t)}),l.supportsWindow()){const i=d(u.updateCart,500),t={};e.eventBus.watch(c=>{if(p.supportsShopifyAnalytics()){if(c.type==="session"&&(globalThis.window.Shopify.analytics.publish("picked:session",{id:c.id}),t["picked.id"]=c.id),c.type==="feature_decide"){const s=`picked.features.${c.feature.id}`;t[s]=c.feature.bucket?"true":"false"}c.type==="user_decide"&&(t["picked.is_user"]=`${c.value}`),i({attributes:t})}})}}});exports.getPickedConfig=n.getPickedConfig;exports.getPickedConfigCollection=n.getPickedConfigCollection;exports.getPickedConfigCustomer=n.getPickedConfigCustomer;exports.getPickedConfigExperiments=n.getPickedConfigExperiments;exports.getPickedConfigFeatureExperiments=n.getPickedConfigFeatureExperiments;exports.getPickedConfigProduct=n.getPickedConfigProduct;exports.getPickedConfigStorefrontApiToken=n.getPickedConfigStorefrontApiToken;exports.getShopify=p.getShopify;exports.shopifyPlugin=h;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("@picked/client"),f=require("../../ajax-api/index.js"),a=require("../../../picked-config-DfcDhMyM.cjs"),l=require("../../../global-obj-OziQiQ8j.cjs");function h(e,i){let t;return(...n)=>{const s=()=>{t=void 0,e(...n)};clearTimeout(t),t=setTimeout(s,i)}}const o={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(?:\/|$)/},c=(e,i)=>i?!!e.exec(i.pathname):!1,r=(e,i)=>{if(i){const t=e.exec(i.pathname);if(t)return t[1]}},g=e=>{var i,t;switch(e){case"product":return((i=a.getPickedConfigProduct())==null?void 0:i.handle)??!1;case"collection":return((t=a.getPickedConfigCollection())==null?void 0:t.handle)??!1;default:return!1}},k={"is-page":({location:e})=>c(o.page,e),"get-page-handle":({location:e})=>r(o.page,e),"is-product-page":()=>!!g("product"),"get-product-handle":()=>g("product"),"is-collection-page":()=>!!g("collection"),"get-collection-handle":()=>g("collection"),"is-blog-page":({location:e})=>c(o.blog,e),"get-blog-handle":({location:e})=>r(o.blog,e),"is-article-page":({location:e})=>c(o.article,e),"get-article-handle":({location:e})=>r(o.article,e),"is-app-proxy-page":({location:e})=>c(o.appProxy,e),"get-app-proxy-handle":({location:e})=>r(o.appProxy,e),"is-account-page":({location:e})=>c(o.accountWildcard,e),"is-login-page":({location:e})=>c(o.accountLogin,e),"is-register-page":({location:e})=>c(o.accountRegister,e),"is-cart-page":({location:e})=>c(o.cart,e),"is-checkout-page":({location:e})=>c(o.checkout,e),"is-homepage":({location:e})=>c(o.homepage,e)},P=()=>({name:"shopify",setup:e=>{if(Object.entries(k).forEach(([i,t])=>{e.registerPredicate(`shopify-${i}`,t)}),u.supportsWindow()){const i=h(f.updateCart,50);e.eventBus.watch(t=>{if(l.supportsShopifyAnalytics()&&(t.type==="session"&&globalThis.window.Shopify.analytics.publish("picked:session",{id:t.id}),t.type==="feature_decide"||t.type==="session")){const n=e.session;if(n){const s={"picked.id":n.id};typeof n.isUser<"u"&&(s["picked.is_user"]=n.isUser?"true":"false"),e.features.listStore.getState().forEach(p=>{if(p.isResolved){const d=p.getBucket();s[`picked.features.${p.id}`]=`${d.bucket}`}}),i({attributes:s})}}})}}});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=l.getShopify;exports.shopifyPlugin=P;
@@ -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-OpJ03CX7.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
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("@shopify/storefront-api-client");require("@picked/client");const n=require("../../picked-config-DfcDhMyM.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,19 @@
1
- import { supportsWindow as n } from "@picked/client";
2
- import { updateCart as g } from "../../ajax-api/index.js";
3
- import { a as l, b as u } from "../../../picked-config-DcKNgPpy.js";
4
- import { c as $, d as B, e as T, f as w, g as E } from "../../../picked-config-DcKNgPpy.js";
5
- import { s as d } from "../../../global-obj-DQ6S7d00.js";
6
- import { g as S } from "../../../global-obj-DQ6S7d00.js";
7
- function f(e, a) {
1
+ import { supportsWindow as l } from "@picked/client";
2
+ import { updateCart as u } from "../../ajax-api/index.js";
3
+ import { a as d, b as f } from "../../../picked-config-B69J6txs.js";
4
+ import { c as E, d as S, e as T, f as w, g as H } from "../../../picked-config-B69J6txs.js";
5
+ import { s as h } from "../../../global-obj-DQ6S7d00.js";
6
+ import { g as v } from "../../../global-obj-DQ6S7d00.js";
7
+ function m(e, o) {
8
8
  let t;
9
- return (...i) => {
10
- const p = () => {
11
- t = void 0, e(...i);
9
+ return (...c) => {
10
+ const s = () => {
11
+ t = void 0, e(...c);
12
12
  };
13
- clearTimeout(t), t = setTimeout(p, a);
13
+ clearTimeout(t), t = setTimeout(s, o);
14
14
  };
15
15
  }
16
- const o = {
16
+ const a = {
17
17
  homepage: /^\/$/,
18
18
  page: /(?:^|\/)pages\/(?<pageHandle>[^/]+)\/?$/,
19
19
  blog: /(?:^|\/)blogs\/(?<blogHandle>[^/]+)\/?$/,
@@ -24,80 +24,89 @@ const o = {
24
24
  accountWildcard: /^\/account\/.+/,
25
25
  accountLogin: /^\/account\/login(?:\/|$)/,
26
26
  accountRegister: /^\/account\/register(?:\/|$)/
27
- }, c = (e, a) => a ? !!e.exec(a.pathname) : !1, r = (e, a) => {
28
- if (a) {
29
- const t = e.exec(a.pathname);
27
+ }, i = (e, o) => o ? !!e.exec(o.pathname) : !1, r = (e, o) => {
28
+ if (o) {
29
+ const t = e.exec(o.pathname);
30
30
  if (t)
31
31
  return t[1];
32
32
  }
33
- }, s = (e) => {
34
- var a, t;
33
+ }, n = (e) => {
34
+ var o, t;
35
35
  switch (e) {
36
36
  case "product":
37
- return ((a = u()) == null ? void 0 : a.handle) ?? !1;
37
+ return ((o = f()) == null ? void 0 : o.handle) ?? !1;
38
38
  case "collection":
39
- return ((t = l()) == null ? void 0 : t.handle) ?? !1;
39
+ return ((t = d()) == null ? void 0 : t.handle) ?? !1;
40
40
  default:
41
41
  return !1;
42
42
  }
43
- }, h = {
43
+ }, y = {
44
44
  // Pages
45
- "is-page": ({ location: e }) => c(o.page, e),
46
- "get-page-handle": ({ location: e }) => r(o.page, e),
45
+ "is-page": ({ location: e }) => i(a.page, e),
46
+ "get-page-handle": ({ location: e }) => r(a.page, e),
47
47
  // Products
48
- "is-product-page": () => !!s("product"),
49
- "get-product-handle": () => s("product"),
48
+ "is-product-page": () => !!n("product"),
49
+ "get-product-handle": () => n("product"),
50
50
  // Collections
51
- "is-collection-page": () => !!s("collection"),
52
- "get-collection-handle": () => s("collection"),
51
+ "is-collection-page": () => !!n("collection"),
52
+ "get-collection-handle": () => n("collection"),
53
53
  // Blogs
54
- "is-blog-page": ({ location: e }) => c(o.blog, e),
55
- "get-blog-handle": ({ location: e }) => r(o.blog, e),
54
+ "is-blog-page": ({ location: e }) => i(a.blog, e),
55
+ "get-blog-handle": ({ location: e }) => r(a.blog, e),
56
56
  // Blog Articles
57
- "is-article-page": ({ location: e }) => c(o.article, e),
58
- "get-article-handle": ({ location: e }) => r(o.article, e),
57
+ "is-article-page": ({ location: e }) => i(a.article, e),
58
+ "get-article-handle": ({ location: e }) => r(a.article, e),
59
59
  // Apps
60
- "is-app-proxy-page": ({ location: e }) => c(o.appProxy, e),
61
- "get-app-proxy-handle": ({ location: e }) => r(o.appProxy, e),
60
+ "is-app-proxy-page": ({ location: e }) => i(a.appProxy, e),
61
+ "get-app-proxy-handle": ({ location: e }) => r(a.appProxy, e),
62
62
  // Account
63
- "is-account-page": ({ location: e }) => c(o.accountWildcard, e),
64
- "is-login-page": ({ location: e }) => c(o.accountLogin, e),
65
- "is-register-page": ({ location: e }) => c(o.accountRegister, e),
63
+ "is-account-page": ({ location: e }) => i(a.accountWildcard, e),
64
+ "is-login-page": ({ location: e }) => i(a.accountLogin, e),
65
+ "is-register-page": ({ location: e }) => i(a.accountRegister, e),
66
66
  // Cart
67
- "is-cart-page": ({ location: e }) => c(o.cart, e),
67
+ "is-cart-page": ({ location: e }) => i(a.cart, e),
68
68
  // Checkout
69
- "is-checkout-page": ({ location: e }) => c(o.checkout, e),
69
+ "is-checkout-page": ({ location: e }) => i(a.checkout, e),
70
70
  // Homepage
71
- "is-homepage": ({ location: e }) => c(o.homepage, e)
72
- }, P = () => ({
71
+ "is-homepage": ({ location: e }) => i(a.homepage, e)
72
+ }, C = () => ({
73
73
  name: "shopify",
74
74
  setup: (e) => {
75
- if (Object.entries(h).forEach(([a, t]) => {
76
- e.registerPredicate(`shopify-${a}`, t);
77
- }), n()) {
78
- const a = f(g, 500), t = {};
79
- e.eventBus.watch((i) => {
80
- if (d()) {
81
- if (i.type === "session" && (globalThis.window.Shopify.analytics.publish("picked:session", {
82
- id: i.id
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";
75
+ if (Object.entries(y).forEach(([o, t]) => {
76
+ e.registerPredicate(`shopify-${o}`, t);
77
+ }), l()) {
78
+ const o = m(u, 50);
79
+ e.eventBus.watch((t) => {
80
+ if (h() && (t.type === "session" && globalThis.window.Shopify.analytics.publish("picked:session", {
81
+ id: t.id
82
+ }), t.type === "feature_decide" || t.type === "session")) {
83
+ const c = e.session;
84
+ if (c) {
85
+ const s = {
86
+ "picked.id": c.id
87
+ };
88
+ typeof c.isUser < "u" && (s["picked.is_user"] = c.isUser ? "true" : "false"), e.features.listStore.getState().forEach((p) => {
89
+ if (p.isResolved) {
90
+ const g = p.getBucket();
91
+ s[`picked.features.${p.id}`] = `${g.bucket}`;
92
+ }
93
+ }), o({
94
+ attributes: s
95
+ });
86
96
  }
87
- i.type === "user_decide" && (t["picked.is_user"] = `${i.value}`), a({ attributes: t });
88
97
  }
89
98
  });
90
99
  }
91
100
  }
92
101
  });
93
102
  export {
94
- $ as getPickedConfig,
95
- l as getPickedConfigCollection,
96
- B as getPickedConfigCustomer,
103
+ E as getPickedConfig,
104
+ d as getPickedConfigCollection,
105
+ S as getPickedConfigCustomer,
97
106
  T as getPickedConfigExperiments,
98
107
  w as getPickedConfigFeatureExperiments,
99
- u as getPickedConfigProduct,
100
- E as getPickedConfigStorefrontApiToken,
101
- S as getShopify,
102
- P as shopifyPlugin
108
+ f as getPickedConfigProduct,
109
+ H as getPickedConfigStorefrontApiToken,
110
+ v as getShopify,
111
+ C as shopifyPlugin
103
112
  };
@@ -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-DcKNgPpy.js";
3
+ import { g as n } from "../../picked-config-B69J6txs.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,70 @@
1
+ import { supportsWindow as n, createStorageKey as u, localStore as f } from "@picked/client";
2
+ function i() {
3
+ if (n())
4
+ return globalThis.window.pickedConfig;
5
+ }
6
+ function a() {
7
+ var t;
8
+ if (n())
9
+ return (t = i()) == null ? void 0 : t.customer;
10
+ }
11
+ function l() {
12
+ var t;
13
+ if (n())
14
+ return (t = i()) == null ? void 0 : t.product;
15
+ }
16
+ function k() {
17
+ var t;
18
+ if (n())
19
+ return (t = i()) == null ? void 0 : t.collection;
20
+ }
21
+ function s() {
22
+ var t;
23
+ if (n())
24
+ return (t = i()) == null ? void 0 : t.experiments;
25
+ }
26
+ function p() {
27
+ var t, r;
28
+ if (n())
29
+ return (r = (t = i()) == null ? void 0 : t.storefront_api) == null ? void 0 : r.token;
30
+ }
31
+ function d() {
32
+ const t = u("shopify-roll"), r = f.get(t);
33
+ try {
34
+ const e = r.json();
35
+ if (typeof e == "number") return e;
36
+ } catch {
37
+ }
38
+ const o = Math.random() * 100;
39
+ return r.set(o), o;
40
+ }
41
+ function C() {
42
+ const t = s();
43
+ if (!t)
44
+ return {};
45
+ const r = d();
46
+ try {
47
+ return t.reduce(
48
+ (o, e) => {
49
+ const c = o ? { ...o } : {};
50
+ return e.enabled && (c[e.id] = {
51
+ name: e.name,
52
+ key: e.version.toString(),
53
+ decide: () => r < e.weight
54
+ }), c;
55
+ },
56
+ {}
57
+ );
58
+ } catch {
59
+ return {};
60
+ }
61
+ }
62
+ export {
63
+ k as a,
64
+ l as b,
65
+ i as c,
66
+ a as d,
67
+ s as e,
68
+ C as f,
69
+ p as g
70
+ };
@@ -0,0 +1 @@
1
+ "use strict";const o=require("@picked/client");function i(){if(o.supportsWindow())return globalThis.window.pickedConfig}function s(){var e;if(o.supportsWindow())return(e=i())==null?void 0:e.customer}function d(){var e;if(o.supportsWindow())return(e=i())==null?void 0:e.product}function f(){var e;if(o.supportsWindow())return(e=i())==null?void 0:e.collection}function u(){var e;if(o.supportsWindow())return(e=i())==null?void 0:e.experiments}function g(){var e,n;if(o.supportsWindow())return(n=(e=i())==null?void 0:e.storefront_api)==null?void 0:n.token}function p(){const e=o.createStorageKey("shopify-roll"),n=o.localStore.get(e);try{const t=n.json();if(typeof t=="number")return t}catch{}const r=Math.random()*100;return n.set(r),r}function l(){const e=u();if(!e)return{};const n=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:()=>n<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;
@@ -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;AAED,wBAAgB,iCAAiC,IAAI,mBAAmB,CAAC,UAAU,CAAC,CAkCnF"}
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;AAOpD,eAAO,MAAM,aAAa,QAAO,MA8ChC,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;AAOpD,eAAO,MAAM,aAAa,QAAO,MAuDhC,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.22",
4
+ "version": "0.0.23-next.1",
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.22",
66
+ "@picked/client": "0.0.23-next.1",
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;