@picked/shopify 0.0.1-dev.1764916608146 → 0.0.1-dev.1764952778408

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 k=require("@picked/client"),f=require("../../ajax-api/index.js"),n=require("../../../picked-config-DfcDhMyM.cjs"),y=require("../../../global-obj-OziQiQ8j.cjs");function P(e,t){let o,c;return(...d)=>(c&&c.reject(new Error("Debounced")),new Promise((a,r)=>{c={resolve:a,reject:r};const l=async()=>{o=void 0;try{const g=await e(...d);c==null||c.resolve(g)}catch(g){c==null||c.reject(g)}finally{c=null}};clearTimeout(o),o=setTimeout(l,t)}))}const 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(?:\/|$)/},s=(e,t)=>t?!!e.exec(t.pathname):!1,p=(e,t)=>{if(t){const o=e.exec(t.pathname);if(o)return o[1]}},u=e=>{var t,o;switch(e){case"product":return((t=n.getPickedConfigProduct())==null?void 0:t.handle)??!1;case"collection":return((o=n.getPickedConfigCollection())==null?void 0:o.handle)??!1;default:return!1}},b={"is-page":({location:e})=>s(i.page,e),"get-page-handle":({location:e})=>p(i.page,e),"is-product-page":()=>!!u("product"),"get-product-handle":()=>u("product"),"is-collection-page":()=>!!u("collection"),"get-collection-handle":()=>u("collection"),"is-blog-page":({location:e})=>s(i.blog,e),"get-blog-handle":({location:e})=>p(i.blog,e),"is-article-page":({location:e})=>s(i.article,e),"get-article-handle":({location:e})=>p(i.article,e),"is-app-proxy-page":({location:e})=>s(i.appProxy,e),"get-app-proxy-handle":({location:e})=>p(i.appProxy,e),"is-account-page":({location:e})=>s(i.accountWildcard,e),"is-login-page":({location:e})=>s(i.accountLogin,e),"is-register-page":({location:e})=>s(i.accountRegister,e),"is-cart-page":({location:e})=>s(i.cart,e),"is-checkout-page":({location:e})=>s(i.checkout,e),"is-homepage":({location:e})=>s(i.homepage,e)},m=e=>new Promise(t=>{setTimeout(t,e)}),C=()=>({name:"shopify",setup:e=>{let t={},o=0;const c=async()=>{if(o>=3)return;o++,await f.updateCart({attributes:t}),await m(2e3);const a=await f.getCart();for(const[r,l]of Object.entries(t))if(a.attributes[r]!==l)return c()},d=P(async()=>(o=0,c()),50);Object.entries(b).forEach(([a,r])=>{e.registerPredicate(`shopify-${a}`,r)}),k.supportsWindow()&&e.eventBus.watch(a=>{if(y.supportsShopifyAnalytics()&&(a.type==="session"&&globalThis.window.Shopify.analytics.publish("picked:session",{id:a.id}),a.type==="experience_initialize"||a.type==="feature_decide"||a.type==="initialize"||a.type==="session"||a.type==="user_decide")){const r=e.session;if(r){const l={"picked.id":r.id};typeof r.isUser<"u"&&(l["picked.is_user"]=r.isUser?"true":"false"),e.features.listStore.getState().forEach(g=>{if(g.isResolved){const h=g.getBucket();l[`picked.features.${g.id}`]=`${h.bucket}`}}),t={...t,...l},d()}}})}});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=y.getShopify;exports.shopifyPlugin=C;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("@picked/client"),f=require("../../ajax-api/index.js"),n=require("../../../picked-config-DfcDhMyM.cjs"),y=require("../../../global-obj-OziQiQ8j.cjs");function P(e,t){let o,c;return(...d)=>(c&&c.reject(new Error("Debounced")),new Promise((a,r)=>{c={resolve:a,reject:r};const l=async()=>{o=void 0;try{const g=await e(...d);c==null||c.resolve(g)}catch(g){c==null||c.reject(g)}finally{c=null}};clearTimeout(o),o=setTimeout(l,t)}))}const 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(?:\/|$)/},s=(e,t)=>t?!!e.exec(t.pathname):!1,p=(e,t)=>{if(t){const o=e.exec(t.pathname);if(o)return o[1]}},u=e=>{var t,o;switch(e){case"product":return((t=n.getPickedConfigProduct())==null?void 0:t.handle)??!1;case"collection":return((o=n.getPickedConfigCollection())==null?void 0:o.handle)??!1;default:return!1}},b={"is-page":({location:e})=>s(i.page,e),"get-page-handle":({location:e})=>p(i.page,e),"is-product-page":()=>!!u("product"),"get-product-handle":()=>u("product"),"is-collection-page":()=>!!u("collection"),"get-collection-handle":()=>u("collection"),"is-blog-page":({location:e})=>s(i.blog,e),"get-blog-handle":({location:e})=>p(i.blog,e),"is-article-page":({location:e})=>s(i.article,e),"get-article-handle":({location:e})=>p(i.article,e),"is-app-proxy-page":({location:e})=>s(i.appProxy,e),"get-app-proxy-handle":({location:e})=>p(i.appProxy,e),"is-account-page":({location:e})=>s(i.accountWildcard,e),"is-login-page":({location:e})=>s(i.accountLogin,e),"is-register-page":({location:e})=>s(i.accountRegister,e),"is-cart-page":({location:e})=>s(i.cart,e),"is-checkout-page":({location:e})=>s(i.checkout,e),"is-homepage":({location:e})=>s(i.homepage,e)},m=e=>new Promise(t=>{setTimeout(t,e)}),C=()=>({name:"shopify",setup:e=>{let t={},o=0;const c=async()=>{if(o>=3)return;o++,await f.updateCart({attributes:t}),await m(2e3);const a=await f.getCart();for(const[r,l]of Object.entries(t))if(a.attributes[r]!==l)return c()},d=P(async()=>(o=0,c()),50);Object.entries(b).forEach(([a,r])=>{e.registerPredicate(`shopify-${a}`,r)}),k.supportsWindow()&&e.eventBus.watch(a=>{if(y.supportsShopifyAnalytics()&&(a.type==="session"&&globalThis.window.Shopify.analytics.publish("picked:session",{id:a.id}),a.type==="experience_initialize"||a.type==="feature_decide"||a.type==="initialize"||a.type==="session"||a.type==="user_decide")){const r=e.session;if(r){const l={"picked.id":r.id};typeof r.isUser<"u"&&(l["picked.is_user"]=r.isUser?"true":"false"),e.features.listStore.getState().forEach(g=>{if(g.isResolved){const h=g.getBucket();l[`picked.features.${g.id}`]=`${h.bucket}`}}),t={...t,...l},d().catch(()=>{})}}})}});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=y.getShopify;exports.shopifyPlugin=C;
@@ -1,7 +1,7 @@
1
1
  import { supportsWindow as f } from "@picked/client";
2
2
  import { updateCart as y, getCart as h } from "../../ajax-api/index.js";
3
3
  import { a as m, b } from "../../../picked-config-B69J6txs.js";
4
- import { c as j, d as H, e as R, f as _, g as v } from "../../../picked-config-B69J6txs.js";
4
+ import { c as j, d as H, e as R, f as _, g as W } from "../../../picked-config-B69J6txs.js";
5
5
  import { s as k } from "../../../global-obj-DQ6S7d00.js";
6
6
  import { g as z } from "../../../global-obj-DQ6S7d00.js";
7
7
  function P(e, t) {
@@ -113,7 +113,8 @@ const a = {
113
113
  }), t = {
114
114
  ...t,
115
115
  ...n
116
- }, g();
116
+ }, g().catch(() => {
117
+ });
117
118
  }
118
119
  }
119
120
  });
@@ -126,7 +127,7 @@ export {
126
127
  R as getPickedConfigExperiments,
127
128
  _ as getPickedConfigFeatureExperiments,
128
129
  b as getPickedConfigProduct,
129
- v as getPickedConfigStorefrontApiToken,
130
+ W as getPickedConfigStorefrontApiToken,
130
131
  z as getShopify,
131
132
  E as shopifyPlugin
132
133
  };
@@ -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;AAYpD,eAAO,MAAM,aAAa,QAAO,MAuFhC,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;AAYpD,eAAO,MAAM,aAAa,QAAO,MAyFhC,CAAA"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@picked/shopify",
3
3
  "description": "Shopify plugin for @picked/client",
4
- "version": "0.0.1-dev.1764916608146",
4
+ "version": "0.0.1-dev.1764952778408",
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.1764916608146",
66
+ "@picked/client": "0.0.1-dev.1764952778408",
67
67
  "@shopify/storefront-api-client": "^1.0.9",
68
68
  "effector": "^23.3.0"
69
69
  },