@picked/shopify 0.0.19-next.1 → 0.0.19-next.2

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.
Files changed (53) hide show
  1. package/dist/cjs/ajax-api/index.js +1 -0
  2. package/dist/cjs/index.js +1 -1
  3. package/dist/cjs/json-api/index.js +1 -0
  4. package/dist/cjs/plugins/shopify/index.js +1 -0
  5. package/dist/cjs/storefront-api/index.js +1 -0
  6. package/dist/cjs/utils/index.js +1 -0
  7. package/dist/esm/ajax-api/index.js +45 -0
  8. package/dist/esm/index.js +1 -22
  9. package/dist/esm/json-api/index.js +13 -0
  10. package/dist/esm/plugins/shopify/index.js +103 -0
  11. package/dist/esm/storefront-api/index.js +25 -0
  12. package/dist/esm/utils/index.js +5 -0
  13. package/dist/global-obj-DQ6S7d00.js +16 -0
  14. package/dist/global-obj-OziQiQ8j.cjs +1 -0
  15. package/dist/picked-config-DcKNgPpy.js +62 -0
  16. package/dist/picked-config-OpJ03CX7.cjs +1 -0
  17. package/dist/request-BDRiW21G.js +28 -0
  18. package/dist/request-CGjDeJdr.cjs +1 -0
  19. package/dist/types/ajax-api/index.d.ts +22 -0
  20. package/dist/types/ajax-api/index.d.ts.map +1 -0
  21. package/dist/types/ajax-api/types.d.ts +254 -0
  22. package/dist/types/ajax-api/types.d.ts.map +1 -0
  23. package/dist/types/index.d.ts +1 -2
  24. package/dist/types/index.d.ts.map +1 -1
  25. package/dist/types/json-api/index.d.ts +8 -0
  26. package/dist/types/json-api/index.d.ts.map +1 -0
  27. package/dist/types/json-api/types.d.ts +66 -0
  28. package/dist/types/json-api/types.d.ts.map +1 -0
  29. package/dist/types/plugins/shopify/global-obj.d.ts +10 -0
  30. package/dist/types/plugins/shopify/global-obj.d.ts.map +1 -0
  31. package/dist/types/plugins/shopify/index.d.ts +5 -0
  32. package/dist/types/plugins/shopify/index.d.ts.map +1 -0
  33. package/dist/types/plugins/shopify/picked-config.d.ts +49 -0
  34. package/dist/types/plugins/shopify/picked-config.d.ts.map +1 -0
  35. package/dist/types/plugins/shopify/plugin.d.ts +3 -0
  36. package/dist/types/plugins/shopify/plugin.d.ts.map +1 -0
  37. package/dist/types/plugins/shopify/predicates.d.ts +42 -0
  38. package/dist/types/plugins/shopify/predicates.d.ts.map +1 -0
  39. package/dist/types/plugins/shopify/types.d.ts +106 -0
  40. package/dist/types/plugins/shopify/types.d.ts.map +1 -0
  41. package/dist/types/storefront-api/index.d.ts +8 -0
  42. package/dist/types/storefront-api/index.d.ts.map +1 -0
  43. package/dist/types/storefront-api/types.d.ts +4 -0
  44. package/dist/types/storefront-api/types.d.ts.map +1 -0
  45. package/dist/types/types.d.ts +4 -0
  46. package/dist/types/types.d.ts.map +1 -0
  47. package/dist/types/utils/debounce.d.ts +2 -0
  48. package/dist/types/utils/debounce.d.ts.map +1 -0
  49. package/dist/types/utils/index.d.ts +2 -0
  50. package/dist/types/utils/index.d.ts.map +1 -0
  51. package/dist/types/utils/request.d.ts +3 -0
  52. package/dist/types/utils/request.d.ts.map +1 -0
  53. package/package.json +37 -7
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../../request-CGjDeJdr.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;
package/dist/cjs/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("@picked/client/plugins/shopify"),n=require("@shopify/storefront-api-client");function i(r){const o=t.getShopify();if(!o)throw new Error("Shopify window object not found. This plugin must be used on a Shopify storefront page");const e=t.getPickedConfigStorefrontApiToken();if(!e)throw new Error("Shopify Storefront API token not found. Ensure the Picked Script is enabled on your Shopify storefront");return n.createStorefrontApiClient({storeDomain:o.shop,apiVersion:r.apiVersion,publicAccessToken:e})}exports.createStorefrontApiClient=i;
1
+ "use strict";
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../request-CGjDeJdr.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;
@@ -0,0 +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;
@@ -0,0 +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;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../request-CGjDeJdr.cjs");exports.getRequest=e.get;exports.postRequest=e.post;
@@ -0,0 +1,45 @@
1
+ import { g as e, p as a } from "../../request-BDRiW21G.js";
2
+ function s(t) {
3
+ return e(`products/${t}.js`);
4
+ }
5
+ function u(t, r, n) {
6
+ return e(
7
+ `recommendations/products.json?product_id=${t}&limit=${r}&intent=${n}`
8
+ );
9
+ }
10
+ function i(t) {
11
+ return e(`search/suggest.json?q=${t}`);
12
+ }
13
+ function d() {
14
+ return e("cart.js");
15
+ }
16
+ function p(t) {
17
+ const r = Array.isArray(t) ? { items: t } : { items: [t] };
18
+ return a("cart/add.js", r);
19
+ }
20
+ function g(t) {
21
+ return a("cart/update.js", { ...t });
22
+ }
23
+ function f(t, r, n) {
24
+ return a("cart/change.js", { line: t, quantity: r, properties: n });
25
+ }
26
+ function j() {
27
+ return a("cart/clear.js", {});
28
+ }
29
+ function h(t) {
30
+ const r = new URLSearchParams();
31
+ return Object.entries(t).forEach(([n, c]) => {
32
+ r.append(`shipping_address[${n}]`, c);
33
+ }), e(`cart/shipping_rates.json?${r.toString()}`);
34
+ }
35
+ export {
36
+ p as addToCart,
37
+ f as changeCart,
38
+ j as clearCart,
39
+ d as getCart,
40
+ i as getPredictiveSearch,
41
+ s as getProduct,
42
+ u as getProductRecommendations,
43
+ h as getShippingRates,
44
+ g as updateCart
45
+ };
package/dist/esm/index.js CHANGED
@@ -1,22 +1 @@
1
- import { getShopify as r, getPickedConfigStorefrontApiToken as n } from "@picked/client/plugins/shopify";
2
- import { createStorefrontApiClient as i } from "@shopify/storefront-api-client";
3
- function s(t) {
4
- const o = r();
5
- if (!o)
6
- throw new Error(
7
- "Shopify window object not found. This plugin must be used on a Shopify storefront page"
8
- );
9
- const e = n();
10
- if (!e)
11
- throw new Error(
12
- "Shopify Storefront API token not found. Ensure the Picked Script is enabled on your Shopify storefront"
13
- );
14
- return i({
15
- storeDomain: o.shop,
16
- apiVersion: t.apiVersion,
17
- publicAccessToken: e
18
- });
19
- }
20
- export {
21
- s as createStorefrontApiClient
22
- };
1
+
@@ -0,0 +1,13 @@
1
+ import { g as c } from "../../request-BDRiW21G.js";
2
+ async function s(o) {
3
+ const { collection: t } = await c(`collections/${o}.json`);
4
+ return { collection: t };
5
+ }
6
+ async function e(o, t = 20) {
7
+ const { products: n } = await c(`collections/${o}/products.json?limit=${t}`);
8
+ return { products: n };
9
+ }
10
+ export {
11
+ s as getCollection,
12
+ e as getCollectionProducts
13
+ };
@@ -0,0 +1,103 @@
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) {
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 = {
17
+ homepage: /^\/$/,
18
+ page: /(?:^|\/)pages\/(?<pageHandle>[^/]+)\/?$/,
19
+ blog: /(?:^|\/)blogs\/(?<blogHandle>[^/]+)\/?$/,
20
+ article: /^\/blogs\/[^/]+\/(?<article>[^/]+)\/?$/,
21
+ cart: /(?:^|\/)cart\/[^/]+$/,
22
+ checkout: /^\/checkout\/.+/,
23
+ appProxy: /^\/(?:a|apps|community|tools)\/(?<proxyTarget>[^/]+)/,
24
+ accountWildcard: /^\/account\/.+/,
25
+ accountLogin: /^\/account\/login(?:\/|$)/,
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);
30
+ if (t)
31
+ return t[1];
32
+ }
33
+ }, s = (e) => {
34
+ var a, t;
35
+ switch (e) {
36
+ case "product":
37
+ return ((a = u()) == null ? void 0 : a.handle) ?? !1;
38
+ case "collection":
39
+ return ((t = l()) == null ? void 0 : t.handle) ?? !1;
40
+ default:
41
+ return !1;
42
+ }
43
+ }, h = {
44
+ // Pages
45
+ "is-page": ({ location: e }) => c(o.page, e),
46
+ "get-page-handle": ({ location: e }) => r(o.page, e),
47
+ // Products
48
+ "is-product-page": () => !!s("product"),
49
+ "get-product-handle": () => s("product"),
50
+ // Collections
51
+ "is-collection-page": () => !!s("collection"),
52
+ "get-collection-handle": () => s("collection"),
53
+ // Blogs
54
+ "is-blog-page": ({ location: e }) => c(o.blog, e),
55
+ "get-blog-handle": ({ location: e }) => r(o.blog, e),
56
+ // Blog Articles
57
+ "is-article-page": ({ location: e }) => c(o.article, e),
58
+ "get-article-handle": ({ location: e }) => r(o.article, e),
59
+ // Apps
60
+ "is-app-proxy-page": ({ location: e }) => c(o.appProxy, e),
61
+ "get-app-proxy-handle": ({ location: e }) => r(o.appProxy, e),
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),
66
+ // Cart
67
+ "is-cart-page": ({ location: e }) => c(o.cart, e),
68
+ // Checkout
69
+ "is-checkout-page": ({ location: e }) => c(o.checkout, e),
70
+ // Homepage
71
+ "is-homepage": ({ location: e }) => c(o.homepage, e)
72
+ }, P = () => ({
73
+ name: "shopify",
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";
86
+ }
87
+ i.type === "user_decide" && (t["picked.is_user"] = `${i.value}`), a({ attributes: t });
88
+ }
89
+ });
90
+ }
91
+ }
92
+ });
93
+ export {
94
+ $ as getPickedConfig,
95
+ l as getPickedConfigCollection,
96
+ B as getPickedConfigCustomer,
97
+ T as getPickedConfigExperiments,
98
+ w as getPickedConfigFeatureExperiments,
99
+ u as getPickedConfigProduct,
100
+ E as getPickedConfigStorefrontApiToken,
101
+ S as getShopify,
102
+ P as shopifyPlugin
103
+ };
@@ -0,0 +1,25 @@
1
+ import { createStorefrontApiClient as e } from "@shopify/storefront-api-client";
2
+ import "@picked/client";
3
+ import { g as n } from "../../picked-config-DcKNgPpy.js";
4
+ import { g as i } from "../../global-obj-DQ6S7d00.js";
5
+ function S(t) {
6
+ const r = i(), o = n();
7
+ if (!o)
8
+ throw new Error(
9
+ "Shopify Storefront API token not found. Ensure the Picked Script is enabled on your Shopify storefront"
10
+ );
11
+ return e({
12
+ storeDomain: r.shop,
13
+ apiVersion: t.apiVersion,
14
+ publicAccessToken: o
15
+ });
16
+ }
17
+ const a = () => {
18
+ if (!client)
19
+ throw new Error("Storefront API client not found");
20
+ return client;
21
+ };
22
+ export {
23
+ S as createStorefrontApiClient,
24
+ a as getStorefrontApiClient
25
+ };
@@ -0,0 +1,5 @@
1
+ import { g as t, p as o } from "../../request-BDRiW21G.js";
2
+ export {
3
+ t as getRequest,
4
+ o as postRequest
5
+ };
@@ -0,0 +1,16 @@
1
+ import { supportsWindow as i } from "@picked/client";
2
+ function n() {
3
+ if (!i() || !globalThis.window.Shopify)
4
+ throw new Error(
5
+ "Shopify global object not found. This plugin must be used on a Shopify storefront page."
6
+ );
7
+ return globalThis.window.Shopify;
8
+ }
9
+ function s(t) {
10
+ var o;
11
+ return typeof ((o = n().analytics) == null ? void 0 : o.publish) == "function";
12
+ }
13
+ export {
14
+ n as g,
15
+ s
16
+ };
@@ -0,0 +1 @@
1
+ "use strict";const t=require("@picked/client");function i(){if(!t.supportsWindow()||!globalThis.window.Shopify)throw new Error("Shopify global object not found. This plugin must be used on a Shopify storefront page.");return globalThis.window.Shopify}function n(s){var o;return typeof((o=i().analytics)==null?void 0:o.publish)=="function"}exports.getShopify=i;exports.supportsShopifyAnalytics=n;
@@ -0,0 +1,62 @@
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
+ };
@@ -0,0 +1 @@
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;
@@ -0,0 +1,28 @@
1
+ import "@picked/client";
2
+ import { g as e } from "./global-obj-DQ6S7d00.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
+ };
@@ -0,0 +1 @@
1
+ "use strict";require("@picked/client");const s=require("./global-obj-OziQiQ8j.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,22 @@
1
+ import { ShopifyAjaxApiCart, ShopifyAjaxApiProduct, ShopifyAjaxApiShippingRate, ShopifyAjaxApiProductRecommendations, ShopifyAjaxApiPredictiveSearchResult } from './types';
2
+ export declare function getProduct<T = ShopifyAjaxApiProduct>(handle: string): Promise<T>;
3
+ export declare function getProductRecommendations(productId: string, limit: number, intent: 'related' | 'complementary'): Promise<ShopifyAjaxApiProductRecommendations>;
4
+ export declare function getPredictiveSearch(query: string): Promise<ShopifyAjaxApiPredictiveSearchResult>;
5
+ export declare function getCart(): Promise<ShopifyAjaxApiCart>;
6
+ export declare function addToCart<T>(items: T[]): Promise<ShopifyAjaxApiCart>;
7
+ export declare function updateCart(updates: {
8
+ updates?: Record<string, number | string>;
9
+ discount?: string;
10
+ note?: string;
11
+ attributes?: Record<string, string>;
12
+ }): Promise<ShopifyAjaxApiCart>;
13
+ export declare function changeCart(line: number, quantity: number, properties?: Record<string, string>): Promise<ShopifyAjaxApiCart>;
14
+ export declare function clearCart(): Promise<ShopifyAjaxApiCart>;
15
+ export declare function getShippingRates(shippingAddress: {
16
+ zip: string;
17
+ country: string;
18
+ province: string;
19
+ }): Promise<{
20
+ shipping_rates: Array<ShopifyA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AAKD,wBAAgB,SAAS,IAAI,OAAO,CAAC,kBAAkB,CAAC,CAEvD;AAKD,wBAAgB,gBAAgB,CAAC,eAAe,EAAE;IAChD,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,MAAM,CAAA;CACjB,GAAG,OAAO,CAAC;IACV,cAAc,EAAE,KAAK,CAAC,0BAA0B,CAAC,CAAA;CAClD,CAAC,CAQD"}
@@ -0,0 +1,254 @@
1
+ export interface ShopifyAjaxApiProduct {
2
+ id: number;
3
+ title: string;
4
+ handle: string;
5
+ description: string | null;
6
+ published_at: string;
7
+ created_at: string;
8
+ vendor: string;
9
+ type: string;
10
+ tags: string[];
11
+ price: number;
12
+ price_min: number;
13
+ price_max: number;
14
+ available: boolean;
15
+ price_varies: boolean;
16
+ compare_at_price: number | null;
17
+ compare_at_price_min: number;
18
+ compare_at_price_max: number;
19
+ compare_at_price_varies: boolean;
20
+ variants: ShopifyAjaxApiProductVariant[];
21
+ images: string[];
22
+ featured_image: string | null;
23
+ options: ShopifyAjaxApiProductOption[];
24
+ url: string;
25
+ media?: ShopifyAjaxApiProductMedia[];
26
+ requires_selling_plan: boolean;
27
+ selling_plan_groups: ShopifyAjaxApiSellingPlanGroup[];
28
+ }
29
+ export interface ShopifyAjaxApiProductMedia {
30
+ alt: string | null;
31
+ id: number;
32
+ position: number;
33
+ preview_image: {
34
+ aspect_ratio: number;
35
+ height: number;
36
+ width: number;
37
+ src: string;
38
+ };
39
+ sources?: Array<{
40
+ format: string;
41
+ height: number;
42
+ mime_type: string;
43
+ url: string;
44
+ width: number;
45
+ }>;
46
+ aspect_ratio: number;
47
+ height: number;
48
+ media_type: string;
49
+ src: string;
50
+ width: number;
51
+ }
52
+ export interface ShopifyAjaxApiProductVariant {
53
+ id: number;
54
+ title: string;
55
+ options: string[];
56
+ option1: string | null;
57
+ option2: string | null;
58
+ option3: string | null;
59
+ price: number;
60
+ weight: number;
61
+ compare_at_price: number | null;
62
+ inventory_management: string;
63
+ inventory_quantity: number;
64
+ available: boolean;
65
+ sku: string | null;
66
+ requires_shipping: boolean;
67
+ taxable: boolean;
68
+ barcode: string | null;
69
+ name: string;
70
+ public_title: string | null;
71
+ quantity_rule: ShopifyAjaxApiQuantityRule;
72
+ quantity_price_breaks?: ShopifyAjaxApiProductVariantQuantityPriceBreak[];
73
+ requires_selling_plan: boolean;
74
+ selling_plan_allocations: ShopifyAjaxApiSellingPlanAllocation[];
75
+ featured_image: string | null;
76
+ }
77
+ export interface ShopifyAjaxApiProductVariantQuantityPriceBreak {
78
+ quantity: number;
79
+ price: number;
80
+ }
81
+ export interface ShopifyAjaxApiSellingPlanAllocation {
82
+ price_adjustments: Array<{
83
+ position: number;
84
+ price: number;
85
+ }>;
86
+ price: number;
87
+ compare_at_price: number;
88
+ per_delivery_price: number;
89
+ selling_plan_id: number;
90
+ selling_plan_group_id: string;
91
+ }
92
+ export interface ShopifyAjaxApiProductOption {
93
+ name: string;
94
+ position: number;
95
+ values: string[];
96
+ }
97
+ export interface ShopifyAjaxApiSellingPlanGroup {
98
+ id: string;
99
+ name: string;
100
+ options: Array<{
101
+ name: string;
102
+ position: number;
103
+ values: string[];
104
+ }>;
105
+ selling_plans: ShopifyAjaxApiSellingPlan[];
106
+ app_id: string;
107
+ }
108
+ export interface ShopifyAjaxApiSellingPlan {
109
+ id: number;
110
+ name: string;
111
+ description: string | null;
112
+ options: Array<{
113
+ name: string;
114
+ position: number;
115
+ value: string;
116
+ }>;
117
+ recurring_deliveries: boolean;
118
+ price_adjustments: Array<{
119
+ order_count: number | null;
120
+ position: number;
121
+ value_type: string;
122
+ value: number;
123
+ }>;
124
+ }
125
+ export interface ShopifyAjaxApiQuantityRule {
126
+ min: number;
127
+ max: number | null;
128
+ increment: number;
129
+ }
130
+ export interface ShopifyAjaxApiShippingRate {
131
+ name: string;
132
+ price: string;
133
+ source: string;
134
+ delivery_range: string[];
135
+ delivery_days: number;
136
+ delivery_date: string | null;
137
+ currency: string;
138
+ }
139
+ export interface ShopifyAjaxApiCart {
140
+ token: string;
141
+ note: string | null;
142
+ attributes: Record<string, string>;
143
+ original_total_price: number;
144
+ total_price: number;
145
+ total_discount: number;
146
+ total_weight: number;
147
+ item_count: number;
148
+ items: ShopifyAjaxApiCartItem[];
149
+ requires_shipping: boolean;
150
+ currency: string;
151
+ items_subtotal_price: number;
152
+ cart_level_discount_applications: Array<ShopifyAjaxApiCartLevelDiscountApplication>;
153
+ }
154
+ export interface ShopifyAjaxApiCartLevelDiscountApplication {
155
+ type: string;
156
+ key?: string;
157
+ value: string;
158
+ value_type: string;
159
+ allocation_method?: string;
160
+ target_selection: string;
161
+ target_type: string;
162
+ title: string;
163
+ total_allocated_amount: number;
164
+ description?: string | null;
165
+ }
166
+ export interface ShopifyAjaxApiCartItem {
167
+ id: number;
168
+ quantity: number;
169
+ properties: Record<string, string> | null;
170
+ variant_id: number;
171
+ key: string;
172
+ title: string;
173
+ price: number;
174
+ original_price: number;
175
+ discounted_price: number;
176
+ line_price: number;
177
+ original_line_price: number;
178
+ total_discount: number;
179
+ discounts: Array<{
180
+ amount: number;
181
+ title: string;
182
+ }>;
183
+ sku: string | null;
184
+ grams: number;
185
+ vendor: string;
186
+ taxable: boolean;
187
+ product_id: number;
188
+ product_has_only_default_variant: boolean;
189
+ gift_card: boolean;
190
+ final_price: number;
191
+ final_line_price: number;
192
+ url: string;
193
+ featured_image: ShopifyAjaxApiImage | null;
194
+ image: string;
195
+ handle: string;
196
+ requires_shipping: boolean;
197
+ product_type: string;
198
+ product_title: string;
199
+ variant_title: string;
200
+ variant_options: string[];
201
+ options_with_values: Array<{
202
+ name: string;
203
+ value: string;
204
+ }>;
205
+ selling_plan_allocation?: Record<string, string>;
206
+ }
207
+ export interface ShopifyAjaxApiProductRecommendations {
208
+ intent: 'related' | 'complementary';
209
+ products: ShopifyAjaxApiProduct[];
210
+ }
211
+ export interface ShopifyAjaxApiPredictiveSearchResult {
212
+ resources: {
213
+ results: {
214
+ products: ShopifyAjaxApiPredictiveSearchProduct[];
215
+ };
216
+ };
217
+ }
218
+ export interface ShopifyAjaxApiPredictiveSearchProduct {
219
+ available: boolean;
220
+ body: string;
221
+ compare_at_price_max: number;
222
+ compare_at_price_min: number;
223
+ handle: string;
224
+ id: number;
225
+ image: string;
226
+ price: number;
227
+ price_max: number;
228
+ price_min: number;
229
+ tags: string[];
230
+ title: string;
231
+ type: string;
232
+ url: string;
233
+ variants: ShopifyAjaxApiPredictiveSearchVariant[];
234
+ vendor: string;
235
+ featured_image?: ShopifyAjaxApiImage | null;
236
+ }
237
+ export interface ShopifyAjaxApiPredictiveSearchVariant {
238
+ available: boolean;
239
+ compare_at_price: number | null;
240
+ id: number;
241
+ image: string;
242
+ price: number;
243
+ title: string;
244
+ url: string;
245
+ featured_image?: ShopifyAjaxApiImage | null;
246
+ }
247
+ export interface ShopifyAjaxApiImage {
248
+ alt: string;
249
+ aspect_ratio: number;
250
+ height: number;
251
+ url: string;
252
+ width: number;
253
+ }
254
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/ajax-api/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,qBAAqB;IACpC,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,YAAY,EAAE,MAAM,CAAA;IACpB,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,EAAE,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,OAAO,CAAA;IAClB,YAAY,EAAE,OAAO,CAAA;IACrB,gBAAgB,EAAE,MAAM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,EAAE,MAAM,CAAA;IAC5B,oBAAoB,EAAE,MAAM,CAAA;IAE5B,MAAM,EAAE,MAAM,CAAA;IACd,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IAEb,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IAEjB,IAAI,EAAE,MAAM,EAAE,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,QAAQ,EAAE,qCAAqC,EAAE,CAAA;IACjD,MAAM,EAAE,MAAM,CAAA;IAEd,cAAc,CAAC,EAAE,mBAAmB,GAAG,IAAI,CAAA;CAC5C;AAED,MAAM,WAAW,qCAAqC;IACpD,SAAS,EAAE,OAAO,CAAA;IAClB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IAEb,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,EAAE,MAAM,CAAA;IAEX,cAAc,CAAC,EAAE,mBAAmB,GAAG,IAAI,CAAA;CAC5C;AAED,MAAM,WAAW,mBAAmB;IAClC,GAAG,EAAE,MAAM,CAAA;IACX,YAAY,EAAE,MAAM,CAAA;IACpB,MAAM,EAAE,MAAM,CAAA;IACd,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;CACd"}
@@ -1,3 +1,2 @@
1
- import { createStorefrontApiClient as _createStorefrontApiClient } from '@shopify/storefront-api-client';
2
- export declare function createStorefrontApiClient(options: Pick<Parameters<typeof _createStorefrontApiClient>[0], 'apiVersion'>): import('@shopify/storefront-api-client').StorefrontApiClient;
1
+ export type * from './types';
3
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,IAAI,0BAA0B,EAAE,MAAM,gCAAgC,CAAA;AAExG,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC,OAAO,0BAA0B,CAAC,CAAC,CAAC,CAAC,EAAE,YAAY,CAAC,gEAsB9E"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,SAAS,CAAA"}
@@ -0,0 +1,8 @@
1
+ import { ShopifyJsonApiCollection, ShopifyJsonApiCollectionProduct } from './types';
2
+ export declare function getCollection(handle: string): Promise<{
3
+ collection: ShopifyJsonApiCollection;
4
+ }>;
5
+ export declare function getCollectionProducts(handle: string, limit?: number): Promise<{
6
+ products: ShopifyJsonApiCollectionProduct[];
7
+ }>;
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/json-api/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,+BAA+B,EAAE,MAAM,SAAS,CAAA;AAExF,wBAAsB,aAAa,CACjC,MAAM,EAAE,MAAM,GACb,OAAO,CAAC;IAAE,UAAU,EAAE,wBAAwB,CAAA;CAAE,CAAC,CAGnD;AAED,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,MAAM,EACd,KAAK,GAAE,MAAW,GACjB,OAAO,CAAC;IACT,QAAQ,EAAE,+BAA+B,EAAE,CAAA;CAC5C,CAAC,CAGD"}
@@ -0,0 +1,66 @@
1
+ export interface ShopifyJsonApiCollection {
2
+ id: number;
3
+ handle: string;
4
+ title: string;
5
+ updated_at: string;
6
+ published_at: string;
7
+ description: string;
8
+ products_count: number;
9
+ image: {
10
+ id: number;
11
+ created_at: string;
12
+ alt: string | null;
13
+ src: string;
14
+ };
15
+ }
16
+ export interface ShopifyJsonApiCollectionProduct {
17
+ id: number;
18
+ title: string;
19
+ body_html?: string;
20
+ vendor: string;
21
+ product_type: string;
22
+ created_at: string;
23
+ handle: string;
24
+ updated_at: string;
25
+ published_at: string;
26
+ tags: string[];
27
+ variants: ShopifyJsonApiCollectionProductVariant[];
28
+ images: ShopifyJsonApiCollectionProductImage[];
29
+ options: ShopifyJsonApiProductOption[];
30
+ }
31
+ export interface ShopifyJsonApiCollectionProductVariant {
32
+ id: number;
33
+ title: string;
34
+ option1: string;
35
+ option2: string;
36
+ option3: string | null;
37
+ sku: string;
38
+ requires_shipping: boolean;
39
+ taxable: boolean;
40
+ featured_image: string | null;
41
+ available: boolean;
42
+ price: string;
43
+ grams: number;
44
+ compare_at_price: string | null;
45
+ position: number;
46
+ product_id: number;
47
+ created_at: string;
48
+ updated_at: string;
49
+ }
50
+ export interface ShopifyJsonApiCollectionProductImage {
51
+ id: number;
52
+ position: number;
53
+ product_id: number;
54
+ created_at: string;
55
+ updated_at: string;
56
+ variant_ids: number[];
57
+ width: number;
58
+ height: number;
59
+ src: string;
60
+ }
61
+ export interface ShopifyJsonApiProductOption {
62
+ name: string;
63
+ position: number;
64
+ values: string[];
65
+ }
66
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/json-api/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,wBAAwB;IACvC,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,MAAM,CAAA;IAClB,YAAY,EAAE,MAAM,CAAA;IACpB,WAAW,EAAE,MAAM,CAAA;IACnB,cAAc,EAAE,MAAM,CAAA;IACtB,KAAK,EAAE;QACL,EAAE,EAAE,MAAM,CAAA;QACV,UAAU,EAAE,MAAM,CAAA;QAClB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;QAClB,GAAG,EAAE,MAAM,CAAA;KACZ,CAAA;CAC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,MAAM,EAAE,CAAA;IACrB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,GAAG,EAAE,MAAM,CAAA;CACZ;AAED,MAAM,WAAW,2BAA2B;IAC1C,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,EAAE,CAAA;CACjB"}
@@ -0,0 +1,10 @@
1
+ import { EventPayload } from './types';
2
+ export declare function getShopify(): import('./types').Shopify;
3
+ export declare function supportsShopifyAnalytics(w: Window): w is Window & {
4
+ Shopify: {
5
+ analytics: {
6
+ publish: (event: string, payload: EventPayload) => void;
7
+ };
8
+ };
9
+ };
10
+ //# sourceMappingURL=global-obj.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"global-obj.d.ts","sourceRoot":"","sources":["../../../../src/plugins/shopify/global-obj.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAE3C,wBAAgB,UAAU,8BAQzB;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"}
@@ -0,0 +1,5 @@
1
+ export { shopifyPlugin } from './plugin';
2
+ export { getPickedConfig, getPickedConfigCollection, getPickedConfigCustomer, getPickedConfigExperiments, getPickedConfigFeatureExperiments, getPickedConfigProduct, getPickedConfigStorefrontApiToken, } from './picked-config';
3
+ export { getShopify } from './global-obj';
4
+ export type { PickedConfigCollection, PickedConfigCustomer, PickedConfigExperiment, PickedConfigProduct, PickedConfigProductCollection, PickedConfigProductVariant, Shopify, ShopifyPickedConfig, } from './types';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/shopify/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC,OAAO,EACL,eAAe,EACf,yBAAyB,EACzB,uBAAuB,EACvB,0BAA0B,EAC1B,iCAAiC,EACjC,sBAAsB,EACtB,iCAAiC,GAClC,MAAM,iBAAiB,CAAA;AAExB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAEzC,YAAY,EACV,sBAAsB,EACtB,oBAAoB,EACpB,sBAAsB,EACtB,mBAAmB,EACnB,6BAA6B,EAC7B,0BAA0B,EAC1B,OAAO,EACP,mBAAmB,GACpB,MAAM,SAAS,CAAA"}
@@ -0,0 +1,49 @@
1
+ import { CreateClientOptions } from '@picked/client';
2
+ import { MetafieldObject, PickedConfigExperiment, PickedConfigProduct, ShopifyPickedConfig } from './types';
3
+ export declare function getPickedConfig<P = PickedConfigProduct>(): Readonly<Partial<CreateClientOptions> & ShopifyPickedConfig<P>> | undefined;
4
+ export declare function getPickedConfigCustomer(): Partial<{
5
+ accepts_marketing: boolean;
6
+ email: string;
7
+ first_name: string | null;
8
+ has_account: boolean;
9
+ id: number;
10
+ last_name: string | null;
11
+ metafields: MetafieldObject;
12
+ orders_count: number;
13
+ phone: string | null;
14
+ tax_exempt: boolean;
15
+ }> | undefined;
16
+ export declare function getPickedConfigProduct<T = MetafieldObject>(): Partial<{
17
+ available: boolean;
18
+ collections: Partial<{
19
+ id: number;
20
+ }>[];
21
+ featured_image: string;
22
+ handle: string;
23
+ id: number;
24
+ metafields: T;
25
+ price: number;
26
+ tags: string[];
27
+ title: string;
28
+ type: string;
29
+ url: string;
30
+ variants: Partial<{
31
+ available: boolean;
32
+ title: string;
33
+ id: number;
34
+ price: number;
35
+ inventory_quantity: number;
36
+ option1: string;
37
+ }>[];
38
+ vendor: string;
39
+ }> | undefined;
40
+ export declare function getPickedConfigCollection(): Partial<{
41
+ title: string;
42
+ id: number;
43
+ handle: string;
44
+ metafields: MetafieldObject;
45
+ }> | undefined;
46
+ export declare function getPickedConfigExperiments(): PickedConfigExperiment[] | undefined;
47
+ export declare function getPickedConfigStorefrontApiToken(): string | undefined;
48
+ export declare function getPickedConfigFeatureExperiments(): CreateClientOptions['features'];
49
+ //# sourceMappingURL=picked-config.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,3 @@
1
+ import { Plugin } from '@picked/client';
2
+ export declare const shopifyPlugin: () => Plugin;
3
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,42 @@
1
+ import { StateSnapshot } from '@picked/client';
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"predicates.d.ts","sourceRoot":"","sources":["../../../../src/plugins/shopify/predicates.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAmBnD,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"}
@@ -0,0 +1,106 @@
1
+ import { CreateClientOptions } from '@picked/client';
2
+ declare global {
3
+ interface Window {
4
+ pickedConfig?: Readonly<Partial<CreateClientOptions> & ShopifyPickedConfig<PickedConfigProduct>>;
5
+ Shopify?: Shopify;
6
+ }
7
+ }
8
+ export interface Shopify {
9
+ shop: string;
10
+ locale: string;
11
+ currency: {
12
+ active: string;
13
+ rate: string;
14
+ };
15
+ country: string;
16
+ theme: {
17
+ name: string;
18
+ id: number;
19
+ schema_name: string;
20
+ schema_version: string;
21
+ theme_store_id: number | null;
22
+ role: string;
23
+ handle: string;
24
+ style: {
25
+ id: number | null;
26
+ handle: string | null;
27
+ };
28
+ };
29
+ routes: {
30
+ root: string;
31
+ };
32
+ PaymentButton: {
33
+ isStorefrontPortableWallets: boolean;
34
+ };
35
+ analytics?: {
36
+ publish?: (event: string, payload: EventPayload) => void;
37
+ };
38
+ }
39
+ export interface EventPayload {
40
+ [key: string]: string | number | boolean | null | undefined | EventPayload | Array<string | number | boolean | null | undefined | EventPayload>;
41
+ }
42
+ export interface PickedConfigExperiment {
43
+ enabled: boolean;
44
+ id: string;
45
+ name: string;
46
+ version: number;
47
+ weight: number;
48
+ }
49
+ export type PickedConfigCollection = Partial<{
50
+ title: string;
51
+ id: number;
52
+ handle: string;
53
+ metafields: MetafieldObject;
54
+ }>;
55
+ export type PickedConfigProductVariant = Partial<{
56
+ available: boolean;
57
+ title: string;
58
+ id: number;
59
+ price: number;
60
+ inventory_quantity: number;
61
+ option1: string;
62
+ }>;
63
+ export type PickedConfigProductCollection = Partial<{
64
+ id: number;
65
+ }>;
66
+ export type MetafieldValue = string | number | boolean | null | undefined;
67
+ export interface MetafieldObject {
68
+ [key: string]: MetafieldValue | MetafieldObject | MetafieldValue[] | MetafieldObject[];
69
+ }
70
+ export type PickedConfigProduct<T = MetafieldObject> = Partial<{
71
+ available: boolean;
72
+ collections: PickedConfigProductCollection[];
73
+ featured_image: string;
74
+ handle: string;
75
+ id: number;
76
+ metafields: T;
77
+ price: number;
78
+ tags: string[];
79
+ title: string;
80
+ type: string;
81
+ url: string;
82
+ variants: PickedConfigProductVariant[];
83
+ vendor: string;
84
+ }>;
85
+ export type PickedConfigCustomer = Partial<{
86
+ accepts_marketing: boolean;
87
+ email: string;
88
+ first_name: string | null;
89
+ has_account: boolean;
90
+ id: number;
91
+ last_name: string | null;
92
+ metafields: MetafieldObject;
93
+ orders_count: number;
94
+ phone: string | null;
95
+ tax_exempt: boolean;
96
+ }>;
97
+ export interface ShopifyPickedConfig<P = PickedConfigProduct> {
98
+ customer?: PickedConfigCustomer;
99
+ product?: P;
100
+ collection?: PickedConfigCollection;
101
+ experiments?: PickedConfigExperiment[];
102
+ storefront_api?: {
103
+ token?: string;
104
+ };
105
+ }
106
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/plugins/shopify/types.ts"],"names":[],"mappings":"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;IACb,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,EAAE,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,QAAQ,EAAE,0BAA0B,EAAE,CAAA;IACtC,MAAM,EAAE,MAAM,CAAA;CACf,CAAC,CAAA;AAEF,MAAM,MAAM,oBAAoB,GAAG,OAAO,CAAC;IACzC,iBAAiB,EAAE,OAAO,CAAA;IAC1B,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,WAAW,EAAE,OAAO,CAAA;IACpB,EAAE,EAAE,MAAM,CAAA;IACV,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,UAAU,EAAE,eAAe,CAAA;IAC3B,YAAY,EAAE,MAAM,CAAA;IACpB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,UAAU,EAAE,OAAO,CAAA;CACpB,CAAC,CAAA;AAEF,MAAM,WAAW,mBAAmB,CAAC,CAAC,GAAG,mBAAmB;IAC1D,QAAQ,CAAC,EAAE,oBAAoB,CAAA;IAC/B,OAAO,CAAC,EAAE,CAAC,CAAA;IACX,UAAU,CAAC,EAAE,sBAAsB,CAAA;IACnC,WAAW,CAAC,EAAE,sBAAsB,EAAE,CAAA;IACtC,cAAc,CAAC,EAAE;QACf,KAAK,CAAC,EAAE,MAAM,CAAA;KACf,CAAA;CACF"}
@@ -0,0 +1,8 @@
1
+ import { createStorefrontApiClient as _createStorefrontApiClient } from '@shopify/storefront-api-client';
2
+ import { ShopifyStorefrontApiClient } from './types';
3
+ declare global {
4
+ const client: ShopifyStorefrontApiClient | undefined;
5
+ }
6
+ export declare function createStorefrontApiClient(options: Pick<Parameters<typeof _createStorefrontApiClient>[0], 'apiVersion'>): import('@shopify/storefront-api-client').StorefrontApiClient;
7
+ export declare const getStorefrontApiClient: () => ShopifyStorefrontApiClient;
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/storefront-api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,IAAI,0BAA0B,EAAE,MAAM,gCAAgC,CAAA;AAExG,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAA;AAEzD,OAAO,CAAC,MAAM,CAAC;IACb,MAAM,MAAM,EAAE,0BAA0B,GAAG,SAAS,CAAA;CACrD;AAED,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC,OAAO,0BAA0B,CAAC,CAAC,CAAC,CAAC,EAAE,YAAY,CAAC,gEAiB9E;AAED,eAAO,MAAM,sBAAsB,kCAMlC,CAAA"}
@@ -0,0 +1,4 @@
1
+ export interface ShopifyStorefrontApiClient {
2
+ request: <T>(query: string, variables?: Record<string, object>, options?: RequestInit) => Promise<T>;
3
+ }
4
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/storefront-api/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,CAAC,CAAC,EACT,KAAK,EAAE,MAAM,EACb,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAClC,OAAO,CAAC,EAAE,WAAW,KAClB,OAAO,CAAC,CAAC,CAAC,CAAA;CAChB"}
@@ -0,0 +1,4 @@
1
+ export type * from './ajax-api/types';
2
+ export type * from './json-api/types';
3
+ export type * from './storefront-api/types';
4
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,mBAAmB,kBAAkB,CAAA;AACrC,mBAAmB,kBAAkB,CAAA;AACrC,mBAAmB,wBAAwB,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":"AACA,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"}
@@ -0,0 +1,2 @@
1
+ export { get as getRequest, post as postRequest } from './request';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,IAAI,UAAU,EAAE,IAAI,IAAI,WAAW,EAAE,MAAM,WAAW,CAAA"}
@@ -0,0 +1,3 @@
1
+ export declare function get(pathname: string): Promise<any>;
2
+ export declare function post(pathname: string, data: unknown): Promise<any>;
3
+ //# sourceMappingURL=request.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../../src/utils/request.ts"],"names":[],"mappings":"AAOA,wBAAsB,GAAG,CAAC,QAAQ,EAAE,MAAM,gBAQzC;AAED,wBAAsB,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,gBAgBzD"}
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.19-next.1",
4
+ "version": "0.0.19-next.2",
5
5
  "dependencies": {},
6
6
  "devDependencies": {
7
7
  "@picked/client": "workspace:*",
@@ -11,7 +11,7 @@
11
11
  "@shopify/storefront-api-client": "^1.0.9",
12
12
  "@types/jsdom": "^21.1.7",
13
13
  "@types/node": "^22",
14
- "@vitest/coverage-v8": "^3.2.3",
14
+ "@vitest/coverage-v8": "^3.2.4",
15
15
  "effector": "^23.3.0",
16
16
  "tsup": "^8.5.0",
17
17
  "tsx": "^4.20.3",
@@ -25,6 +25,36 @@
25
25
  "import": "./dist/esm/index.js",
26
26
  "require": "./dist/cjs/index.js",
27
27
  "default": "./dist/esm/index.js"
28
+ },
29
+ "./utils": {
30
+ "types": "./dist/types/utils/index.d.ts",
31
+ "import": "./dist/esm/utils/index.js",
32
+ "require": "./dist/cjs/utils/index.js",
33
+ "default": "./dist/esm/utils/index.js"
34
+ },
35
+ "./ajax-api": {
36
+ "types": "./dist/types/ajax-api/index.d.ts",
37
+ "import": "./dist/esm/ajax-api/index.js",
38
+ "require": "./dist/cjs/ajax-api/index.js",
39
+ "default": "./dist/esm/ajax-api/index.js"
40
+ },
41
+ "./json-api": {
42
+ "types": "./dist/types/json-api/index.d.ts",
43
+ "import": "./dist/esm/json-api/index.js",
44
+ "require": "./dist/cjs/json-api/index.js",
45
+ "default": "./dist/esm/json-api/index.js"
46
+ },
47
+ "./storefront-api": {
48
+ "types": "./dist/types/storefront-api/index.d.ts",
49
+ "import": "./dist/esm/storefront-api/index.js",
50
+ "require": "./dist/cjs/storefront-api/index.js",
51
+ "default": "./dist/esm/storefront-api/index.js"
52
+ },
53
+ "./plugins/shopify": {
54
+ "types": "./dist/types/plugins/shopify/index.d.ts",
55
+ "import": "./dist/esm/plugins/shopify/index.js",
56
+ "require": "./dist/cjs/plugins/shopify/index.js",
57
+ "default": "./dist/esm/plugins/shopify/index.js"
28
58
  }
29
59
  },
30
60
  "files": [
@@ -33,22 +63,22 @@
33
63
  "main": "./dist/cjs/index.js",
34
64
  "module": "./dist/esm/index.js",
35
65
  "peerDependencies": {
36
- "@picked/client": "0.0.19-next.1",
66
+ "@picked/client": "0.0.19-next.2",
37
67
  "@shopify/storefront-api-client": "^1.0.9",
38
68
  "effector": "^23.3.0"
39
69
  },
40
70
  "private": false,
41
71
  "scripts": {
42
- "_test": "vitest run",
43
- "_test:coverage": "vitest run --coverage",
44
- "_test:packaged-types": "attw --pack",
45
- "_test:watch": "vitest",
46
72
  "build": "vite build",
47
73
  "dev": "vite build --watch",
48
74
  "lint": "eslint .",
49
75
  "lint-files": "eslint",
50
76
  "lint:format": "eslint . --fix",
51
77
  "lint:report": "eslint . -o './.reports/eslint.json' -f json || true",
78
+ "test": "vitest run",
79
+ "test:coverage": "vitest run --coverage",
80
+ "test:packaged-types": "attw --pack",
81
+ "test:watch": "vitest",
52
82
  "type-check": "tsc -p . --noEmit"
53
83
  },
54
84
  "type": "module",