@picked/shopify 0.0.1-dev.1764090824933 → 0.0.1-dev.1764096269522

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 r=require("../../request-TZ1Wihiu.cjs");function c(t){return r.get(`products/${t}.js`)}function o(t,e,n){return r.get(`recommendations/products.json?product_id=${t}&limit=${e}&intent=${n}`)}function s(t){return r.get(`search/suggest.json?q=${t}`)}function u(){return r.get("cart.js")}function i(t){const e=Array.isArray(t)?{items:t}:{items:[t]};return r.post("cart/add.js",e)}function d(t){return r.post("cart/update.js",{...t})}function g(t,e,n){return r.post("cart/change.js",{line:t,quantity:e,properties:n})}function p(){return r.post("cart/clear.js",{})}function h(t){const e=new URLSearchParams;return Object.entries(t).forEach(([n,a])=>{e.append(`shipping_address[${n}]`,a)}),r.get(`cart/shipping_rates.json?${e.toString()}`)}exports.addToCart=i;exports.changeCart=g;exports.clearCart=p;exports.getCart=u;exports.getPredictiveSearch=s;exports.getProduct=c;exports.getProductRecommendations=o;exports.getShippingRates=h;exports.updateCart=d;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../../request-3iRvPhXG.cjs");function c(t){return r.get(`products/${t}.js`)}function o(t,e,n){return r.get(`recommendations/products.json?product_id=${t}&limit=${e}&intent=${n}`)}function s(t){return r.get(`search/suggest.json?q=${t}`)}function u(){return r.get("cart.js")}function i(t){const e=Array.isArray(t)?{items:t}:{items:[t]};return r.post("cart/add.js",e)}function d(t){return r.post("cart/update.js",{...t})}function g(t,e,n){return r.post("cart/change.js",{line:t,quantity:e,properties:n})}function p(){return r.post("cart/clear.js",{})}function h(t){const e=new URLSearchParams;return Object.entries(t).forEach(([n,a])=>{e.append(`shipping_address[${n}]`,a)}),r.get(`cart/shipping_rates.json?${e.toString()}`)}exports.addToCart=i;exports.changeCart=g;exports.clearCart=p;exports.getCart=u;exports.getPredictiveSearch=s;exports.getProduct=c;exports.getProductRecommendations=o;exports.getShippingRates=h;exports.updateCart=d;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../request-TZ1Wihiu.cjs");async function n(t){const{collection:o}=await e.get(`collections/${t}.json`);return{collection:o}}async function l(t,o=20){const{products:c}=await e.get(`collections/${t}/products.json?limit=${o}`);return{products:c}}exports.getCollection=n;exports.getCollectionProducts=l;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../request-3iRvPhXG.cjs");async function n(t){const{collection:o}=await e.get(`collections/${t}.json`);return{collection:o}}async function l(t,o=20){const{products:c}=await e.get(`collections/${t}/products.json?limit=${o}`);return{products:c}}exports.getCollection=n;exports.getCollectionProducts=l;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("@picked/client"),c=require("../../../picked-config-OpJ03CX7.cjs"),r=require("../../../global-obj-Cvtghh3D.cjs"),t={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(?:\/|$)/},i=(e,o)=>o?!!e.exec(o.pathname):!1,n=(e,o)=>{if(o){const a=e.exec(o.pathname);if(a)return a[1]}},g=e=>{var o,a;switch(e){case"product":return((o=c.getPickedConfigProduct())==null?void 0:o.handle)??!1;case"collection":return((a=c.getPickedConfigCollection())==null?void 0:a.handle)??!1;default:return!1}},l={"is-page":({location:e})=>i(t.page,e),"get-page-handle":({location:e})=>n(t.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})=>i(t.blog,e),"get-blog-handle":({location:e})=>n(t.blog,e),"is-article-page":({location:e})=>i(t.article,e),"get-article-handle":({location:e})=>n(t.article,e),"is-app-proxy-page":({location:e})=>i(t.appProxy,e),"get-app-proxy-handle":({location:e})=>n(t.appProxy,e),"is-account-page":({location:e})=>i(t.accountWildcard,e),"is-login-page":({location:e})=>i(t.accountLogin,e),"is-register-page":({location:e})=>i(t.accountRegister,e),"is-cart-page":({location:e})=>i(t.cart,e),"is-checkout-page":({location:e})=>i(t.checkout,e),"is-homepage":({location:e})=>i(t.homepage,e)},p=()=>({name:"shopify",setup:e=>{Object.entries(l).forEach(([o,a])=>{e.registerPredicate(`shopify-${o}`,a)}),s.supportsWindow()&&e.eventBus.watch(o=>{r.supportsShopifyAnalytics()&&o.type==="session"&&globalThis.window.Shopify.analytics.publish("picked:session",{id:o.id})})}});exports.getPickedConfig=c.getPickedConfig;exports.getPickedConfigCollection=c.getPickedConfigCollection;exports.getPickedConfigCustomer=c.getPickedConfigCustomer;exports.getPickedConfigExperiments=c.getPickedConfigExperiments;exports.getPickedConfigFeatureExperiments=c.getPickedConfigFeatureExperiments;exports.getPickedConfigProduct=c.getPickedConfigProduct;exports.getPickedConfigStorefrontApiToken=c.getPickedConfigStorefrontApiToken;exports.getShopify=r.getShopify;exports.shopifyPlugin=p;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("@picked/client"),u=require("../../ajax-api/index.js"),a=require("../../../picked-config-OpJ03CX7.cjs"),p=require("../../../global-obj-Cvtghh3D.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(?:\/|$)/},c=(e,o)=>o?!!e.exec(o.pathname):!1,r=(e,o)=>{if(o){const t=e.exec(o.pathname);if(t)return t[1]}},g=e=>{var o,t;switch(e){case"product":return((o=a.getPickedConfigProduct())==null?void 0:o.handle)??!1;case"collection":return((t=a.getPickedConfigCollection())==null?void 0:t.handle)??!1;default:return!1}},d={"is-page":({location:e})=>c(i.page,e),"get-page-handle":({location:e})=>r(i.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(i.blog,e),"get-blog-handle":({location:e})=>r(i.blog,e),"is-article-page":({location:e})=>c(i.article,e),"get-article-handle":({location:e})=>r(i.article,e),"is-app-proxy-page":({location:e})=>c(i.appProxy,e),"get-app-proxy-handle":({location:e})=>r(i.appProxy,e),"is-account-page":({location:e})=>c(i.accountWildcard,e),"is-login-page":({location:e})=>c(i.accountLogin,e),"is-register-page":({location:e})=>c(i.accountRegister,e),"is-cart-page":({location:e})=>c(i.cart,e),"is-checkout-page":({location:e})=>c(i.checkout,e),"is-homepage":({location:e})=>c(i.homepage,e)};function f(e,o){let t;return(...n)=>{const s=()=>{t=void 0,e(...n)};clearTimeout(t),t=setTimeout(s,o)}}const h=()=>({name:"shopify",setup:e=>{if(Object.entries(d).forEach(([o,t])=>{e.registerPredicate(`shopify-${o}`,t)}),l.supportsWindow()){const o=f(u.updateCart,500);let t={};e.eventBus.watch(n=>{if(p.supportsShopifyAnalytics()){if(n.type==="session"&&(globalThis.window.Shopify.analytics.publish("picked:session",{id:n.id}),t["picked.id"]=n.id),n.type==="feature_decide"){const s=`picked.feature:${n.feature.id}`;t[s]=n.feature.bucket?"true":"false"}o({attributes:t})}})}}});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=p.getShopify;exports.shopifyPlugin=h;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../request-TZ1Wihiu.cjs");exports.getRequest=e.get;exports.postRequest=e.post;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../request-3iRvPhXG.cjs");exports.getRequest=e.get;exports.postRequest=e.post;
@@ -1,4 +1,4 @@
1
- import { g as e, p as a } from "../../request-CdrE2oln.js";
1
+ import { g as e, p as a } from "../../request-CgVZHVbc.js";
2
2
  function s(t) {
3
3
  return e(`products/${t}.js`);
4
4
  }
@@ -1,4 +1,4 @@
1
- import { g as c } from "../../request-CdrE2oln.js";
1
+ import { g as c } from "../../request-CgVZHVbc.js";
2
2
  async function s(o) {
3
3
  const { collection: t } = await c(`collections/${o}.json`);
4
4
  return { collection: t };
@@ -1,9 +1,10 @@
1
- import { supportsWindow as n } from "@picked/client";
2
- import { a as r, b as p } from "../../../picked-config-DcKNgPpy.js";
3
- import { c as P, d as k, e as x, f as b, g as C } from "../../../picked-config-DcKNgPpy.js";
4
- import { s as g } from "../../../global-obj-Qsw8OZYk.js";
5
- import { g as B } from "../../../global-obj-Qsw8OZYk.js";
6
- const a = {
1
+ import { supportsWindow as p } 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-Qsw8OZYk.js";
6
+ import { g as S } from "../../../global-obj-Qsw8OZYk.js";
7
+ const o = {
7
8
  homepage: /^\/$/,
8
9
  page: /(?:^|\/)pages\/(?<pageHandle>[^/]+)\/?$/,
9
10
  blog: /(?:^|\/)blogs\/(?<blogHandle>[^/]+)\/?$/,
@@ -14,26 +15,26 @@ const a = {
14
15
  accountWildcard: /^\/account\/.+/,
15
16
  accountLogin: /^\/account\/login(?:\/|$)/,
16
17
  accountRegister: /^\/account\/register(?:\/|$)/
17
- }, t = (e, o) => o ? !!e.exec(o.pathname) : !1, i = (e, o) => {
18
- if (o) {
19
- const c = e.exec(o.pathname);
20
- if (c)
21
- return c[1];
18
+ }, i = (e, a) => a ? !!e.exec(a.pathname) : !1, r = (e, a) => {
19
+ if (a) {
20
+ const t = e.exec(a.pathname);
21
+ if (t)
22
+ return t[1];
22
23
  }
23
24
  }, s = (e) => {
24
- var o, c;
25
+ var a, t;
25
26
  switch (e) {
26
27
  case "product":
27
- return ((o = p()) == null ? void 0 : o.handle) ?? !1;
28
+ return ((a = u()) == null ? void 0 : a.handle) ?? !1;
28
29
  case "collection":
29
- return ((c = r()) == null ? void 0 : c.handle) ?? !1;
30
+ return ((t = l()) == null ? void 0 : t.handle) ?? !1;
30
31
  default:
31
32
  return !1;
32
33
  }
33
- }, l = {
34
+ }, f = {
34
35
  // Pages
35
- "is-page": ({ location: e }) => t(a.page, e),
36
- "get-page-handle": ({ location: e }) => i(a.page, e),
36
+ "is-page": ({ location: e }) => i(o.page, e),
37
+ "get-page-handle": ({ location: e }) => r(o.page, e),
37
38
  // Products
38
39
  "is-product-page": () => !!s("product"),
39
40
  "get-product-handle": () => s("product"),
@@ -41,44 +42,64 @@ const a = {
41
42
  "is-collection-page": () => !!s("collection"),
42
43
  "get-collection-handle": () => s("collection"),
43
44
  // Blogs
44
- "is-blog-page": ({ location: e }) => t(a.blog, e),
45
- "get-blog-handle": ({ location: e }) => i(a.blog, e),
45
+ "is-blog-page": ({ location: e }) => i(o.blog, e),
46
+ "get-blog-handle": ({ location: e }) => r(o.blog, e),
46
47
  // Blog Articles
47
- "is-article-page": ({ location: e }) => t(a.article, e),
48
- "get-article-handle": ({ location: e }) => i(a.article, e),
48
+ "is-article-page": ({ location: e }) => i(o.article, e),
49
+ "get-article-handle": ({ location: e }) => r(o.article, e),
49
50
  // Apps
50
- "is-app-proxy-page": ({ location: e }) => t(a.appProxy, e),
51
- "get-app-proxy-handle": ({ location: e }) => i(a.appProxy, e),
51
+ "is-app-proxy-page": ({ location: e }) => i(o.appProxy, e),
52
+ "get-app-proxy-handle": ({ location: e }) => r(o.appProxy, e),
52
53
  // Account
53
- "is-account-page": ({ location: e }) => t(a.accountWildcard, e),
54
- "is-login-page": ({ location: e }) => t(a.accountLogin, e),
55
- "is-register-page": ({ location: e }) => t(a.accountRegister, e),
54
+ "is-account-page": ({ location: e }) => i(o.accountWildcard, e),
55
+ "is-login-page": ({ location: e }) => i(o.accountLogin, e),
56
+ "is-register-page": ({ location: e }) => i(o.accountRegister, e),
56
57
  // Cart
57
- "is-cart-page": ({ location: e }) => t(a.cart, e),
58
+ "is-cart-page": ({ location: e }) => i(o.cart, e),
58
59
  // Checkout
59
- "is-checkout-page": ({ location: e }) => t(a.checkout, e),
60
+ "is-checkout-page": ({ location: e }) => i(o.checkout, e),
60
61
  // Homepage
61
- "is-homepage": ({ location: e }) => t(a.homepage, e)
62
- }, h = () => ({
62
+ "is-homepage": ({ location: e }) => i(o.homepage, e)
63
+ };
64
+ function h(e, a) {
65
+ let t;
66
+ return (...c) => {
67
+ const n = () => {
68
+ t = void 0, e(...c);
69
+ };
70
+ clearTimeout(t), t = setTimeout(n, a);
71
+ };
72
+ }
73
+ const P = () => ({
63
74
  name: "shopify",
64
75
  setup: (e) => {
65
- Object.entries(l).forEach(([o, c]) => {
66
- e.registerPredicate(`shopify-${o}`, c);
67
- }), n() && e.eventBus.watch((o) => {
68
- g() && o.type === "session" && globalThis.window.Shopify.analytics.publish("picked:session", {
69
- id: o.id
76
+ if (Object.entries(f).forEach(([a, t]) => {
77
+ e.registerPredicate(`shopify-${a}`, t);
78
+ }), p()) {
79
+ const a = h(g, 500);
80
+ let t = {};
81
+ e.eventBus.watch((c) => {
82
+ if (d()) {
83
+ if (c.type === "session" && (globalThis.window.Shopify.analytics.publish("picked:session", {
84
+ id: c.id
85
+ }), t["picked.id"] = c.id), c.type === "feature_decide") {
86
+ const n = `picked.feature:${c.feature.id}`;
87
+ t[n] = c.feature.bucket ? "true" : "false";
88
+ }
89
+ a({ attributes: t });
90
+ }
70
91
  });
71
- });
92
+ }
72
93
  }
73
94
  });
74
95
  export {
75
- P as getPickedConfig,
76
- r as getPickedConfigCollection,
77
- k as getPickedConfigCustomer,
78
- x as getPickedConfigExperiments,
79
- b as getPickedConfigFeatureExperiments,
80
- p as getPickedConfigProduct,
81
- C as getPickedConfigStorefrontApiToken,
82
- B as getShopify,
83
- h as shopifyPlugin
96
+ $ as getPickedConfig,
97
+ l as getPickedConfigCollection,
98
+ B as getPickedConfigCustomer,
99
+ T as getPickedConfigExperiments,
100
+ w as getPickedConfigFeatureExperiments,
101
+ u as getPickedConfigProduct,
102
+ E as getPickedConfigStorefrontApiToken,
103
+ S as getShopify,
104
+ P as shopifyPlugin
84
105
  };
@@ -1,4 +1,4 @@
1
- import { g as t, p as o } from "../../request-CdrE2oln.js";
1
+ import { g as t, p as o } from "../../request-CgVZHVbc.js";
2
2
  export {
3
3
  t as getRequest,
4
4
  o as postRequest
@@ -0,0 +1 @@
1
+ "use strict";require("@picked/client");const s=require("./global-obj-Cvtghh3D.cjs");function r(){const t=s.getShopify();return new URL(`${globalThis.window.location.origin}${t.routes.root}`)}async function i(t){const n=new URL(t,r()),o=await fetch(n.toString());if(!o.ok)throw new Error(o.statusText);return o.json()}async function c(t,n){const o=new URL(t,r()),e=await fetch(o.toString(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!e.ok)throw new Error(e.statusText);return e.json()}exports.get=i;exports.post=c;
@@ -0,0 +1,28 @@
1
+ import "@picked/client";
2
+ import { g as e } from "./global-obj-Qsw8OZYk.js";
3
+ function s() {
4
+ const t = e();
5
+ return new URL(`${globalThis.window.location.origin}${t.routes.root}`);
6
+ }
7
+ async function c(t) {
8
+ const n = new URL(t, s()), o = await fetch(n.toString());
9
+ if (!o.ok)
10
+ throw new Error(o.statusText);
11
+ return o.json();
12
+ }
13
+ async function p(t, n) {
14
+ const o = new URL(t, s()), r = await fetch(o.toString(), {
15
+ method: "POST",
16
+ headers: {
17
+ "Content-Type": "application/json"
18
+ },
19
+ body: JSON.stringify(n)
20
+ });
21
+ if (!r.ok)
22
+ throw new Error(r.statusText);
23
+ return r.json();
24
+ }
25
+ export {
26
+ c as g,
27
+ p
28
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/plugins/shopify/plugin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAU,MAAM,gBAAgB,CAAA;AAIpD,eAAO,MAAM,aAAa,QAAO,MA0BhC,CAAA"}
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/plugins/shopify/plugin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAU,MAAM,gBAAgB,CAAA;AAMpD,eAAO,MAAM,aAAa,QAAO,MAyChC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export default function debounce<T extends (...args: any[]) => void>(func: T, wait: number): (...args: Parameters<T>) => void;
2
+ //# sourceMappingURL=debounce.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debounce.d.ts","sourceRoot":"","sources":["../../../src/utils/debounce.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,IAGhF,GAAG,MAAM,UAAU,CAAC,CAAC,CAAC,KAAG,IAAI,CAStC"}
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.1764090824933",
4
+ "version": "0.0.1-dev.1764096269522",
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.1764090824933",
66
+ "@picked/client": "0.0.1-dev.1764096269522",
67
67
  "@shopify/storefront-api-client": "^1.0.9",
68
68
  "effector": "^23.3.0"
69
69
  },
@@ -1,28 +0,0 @@
1
- import "@picked/client";
2
- import { g as e } from "./global-obj-Qsw8OZYk.js";
3
- function r() {
4
- const t = e();
5
- return new URL(`https://${t.shop}${t.routes.root}`);
6
- }
7
- async function p(t) {
8
- const n = new URL(t, r()), o = await fetch(n.toString());
9
- if (!o.ok)
10
- throw new Error(o.statusText);
11
- return o.json();
12
- }
13
- async function c(t, n) {
14
- const o = new URL(t, r()), s = await fetch(o.toString(), {
15
- method: "POST",
16
- headers: {
17
- "Content-Type": "application/json"
18
- },
19
- body: JSON.stringify(n)
20
- });
21
- if (!s.ok)
22
- throw new Error(s.statusText);
23
- return s.json();
24
- }
25
- export {
26
- p as g,
27
- c as p
28
- };
@@ -1 +0,0 @@
1
- "use strict";require("@picked/client");const r=require("./global-obj-Cvtghh3D.cjs");function s(){const t=r.getShopify();return new URL(`https://${t.shop}${t.routes.root}`)}async function i(t){const n=new URL(t,s()),o=await fetch(n.toString());if(!o.ok)throw new Error(o.statusText);return o.json()}async function c(t,n){const o=new URL(t,s()),e=await fetch(o.toString(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!e.ok)throw new Error(e.statusText);return e.json()}exports.get=i;exports.post=c;