@picked/client 0.0.13 → 0.0.14-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.
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/plugins/shopify/index.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/plugins/shopify/index.js +68 -47
- package/dist/types/plugins/shopify/global-obj.d.ts +33 -12
- package/dist/types/plugins/shopify/global-obj.d.ts.map +1 -1
- package/dist/types/plugins/shopify/index.d.ts +3 -1
- package/dist/types/plugins/shopify/index.d.ts.map +1 -1
- package/dist/types/plugins/shopify/picked-config.d.ts +19 -12
- package/dist/types/plugins/shopify/picked-config.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var m=Object.defineProperty;var y=(i,e,t)=>e in i?m(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var o=(i,e,t)=>y(i,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";var m=Object.defineProperty;var y=(i,e,t)=>e in i?m(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var o=(i,e,t)=>y(i,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../user-session-D-l-VMTb.cjs"),d=require("../logger-BsmHUUw1.cjs"),l=require("../experience-instance-B2l_MG7I.cjs"),S=require("effector"),c=require("../supports-YvpQZxbh.cjs"),u=require("../storage-DuRlyFaY.cjs"),w=(i,e,t)=>{const s=e.name,r=e.setup(i);if(r){const a=t[s]??{};t[s]=Object.freeze({...a,...r})}};function I(i){const e=typeof window<"u",t={client:i,responses:i.responses.listStore.getState(),fields:i.fields.listStore.getState(),location:e?window.location:void 0,document:e?window.document:void 0,sessionStorage:e?window.sessionStorage:void 0,localStorage:e?window.localStorage:void 0};return Object.freeze(t)}const v=()=>S.createEvent(),P=()=>"0.0.14-next.1";function x(){if(c.supportsDocument()){const i=[document.currentScript,document.getElementById("picked_script"),document.getElementById("picked"),document.getElementById("cvly"),document.getElementById("cvly-x")];for(const e of i)if(e!=null&&e.dataset.api)return e.dataset.api}return"https://api.picked.app"}function k(){if(!c.supportsWindow())return{};const i=new URLSearchParams(window.location.search),e={},t=new Set;for(const[r]of i.entries())r.startsWith("picked-")&&t.add(r);for(const r of t){const a=r.replace("picked-","");e[a]=i.getAll(r)}const s=u.createStorageKey("s");if(t.size>0)u.sessionStore.set(s,e);else{const r=u.sessionStore.get(s);if(r)return r.json()||{}}return e}class h{constructor(e){o(this,"options");o(this,"isReady",!1);o(this,"project");o(this,"plugins",{});o(this,"eventBus",v());o(this,"organizationId");o(this,"projectId");o(this,"apiUrl");o(this,"session");o(this,"searchParams",k());o(this,"history",n.createHistory());o(this,"components",n.createComponentIndex({client:this}));o(this,"experienceInstances",l.createExperienceInstanceIndex({client:this}));o(this,"experiences",n.createExperienceIndex({client:this}));o(this,"frameworks",n.createFrameworkIndex({client:this}));o(this,"predicates",n.createPredicateIndex({client:this}));o(this,"features",n.createFeatureIndex({client:this}));o(this,"responses",n.createResponseIndex({client:this}));o(this,"fields",n.createFieldIndex());o(this,"actions",n.createActionIndex());d.logger("info","Picked client initializing."),this.organizationId=e.organizationId,this.projectId=e.projectId,this.options=Object.freeze(e),this.apiUrl=e.apiUrl||x(),this.session=n.initialiseSession(),this.setupPlugins(),this.setupFeatures(),this.setupPredicates(),this.setupActions(),this.eventBus({type:"initialized",version:P()}),d.logger("info","Picked client initialized.")}start(){n.ping(this),(async()=>{c.supportsDocument()&&(document.body&&n.initialiseExperiences(this),await l.domInteractive(),await n.initialiseExperiences(this),this.eventBus({type:"ready"}),this.isReady=!0,this.session&&this.eventBus({type:"session",...this.session}))})()}registerFramework(e){n.setupFramework(e,this.frameworks)}registerComponent(e,t){n.setupComponent(e,t,this.components)}registerPlugin(e){w(this,e,this.plugins)}registerFeature(e,t){n.setupFeature(e,t,this.features)}registerPredicate(e,t){n.setupPredicate(e,t,this.predicates)}registerField(e){n.setupField(e,this.fields)}registerAction(e,t){n.setupAction(e,t,this.actions)}registerExperience(e){e.component&&n.setupComponent(`experience:${e.id}`,e.component,this.components),n.setupExperience(e,this.experiences)}getStateSnapshot(){return I(this)}async launchExperienceById(e){const t=this.experiences.getById(e).getState();if(!t){d.logger("warn",`Experience with id '${e}' not found.`);return}n.initialiseExperience(this,t)}setupPlugins(){var e;(e=this.options.plugins)==null||e.forEach(t=>{if(Array.isArray(t)){t.forEach(r=>{this.registerPlugin(r)});return}const s=typeof t=="function"?t():t;if(Array.isArray(s)){s.forEach(r=>this.registerPlugin(r));return}this.registerPlugin(s)})}setupFeatures(){const e=this.options.features;e&&(Object.entries(e).forEach(([t,s])=>{const r=typeof s=="function"?s():s;this.registerFeature(t,r)}),this.searchParams.feature&&this.searchParams.feature.forEach(t=>{try{const[s,r]=t.split(":");if(!s||!r)return;let a=r;a==="true"&&(a=!0),a==="false"&&(a=!1),this.registerFeature(s,{key:`${a}`,name:s,decide:()=>a,storage:"session"})}catch{}}))}setupPredicates(){const e=this.options.predicates;e&&Object.entries(e).forEach(([t,s])=>{if(typeof s!="function"){d.logger("warn",`Predicate "${t}" is not a function.`);return}this.registerPredicate(t,s)})}setupActions(){const e=this.options.actions;e&&Object.entries(e).forEach(([t,s])=>{if(typeof s!="function"){d.logger("warn",`Action "${t}" is not a function.`);return}this.registerAction(t,s)})}getPluginConfig(e){return this.plugins[e]??{}}}o(h,"logger",d.logger);function f(i){var e;return((e=i.options)==null?void 0:e.some(t=>"condition"in t))??!1}function E(i){return i.some(e=>e.condition||f(e))}async function C(i,e){return e.length===0||!E(e)?e:(await Promise.all(e.map(async s=>{if(!(s.condition?await l.evaluateRuleLogic(i,s.condition):!0))return null;if(!s.options||!f(s))return s;const g=(await Promise.all(s.options.map(async p=>p.condition?await l.evaluateRuleLogic(i,p.condition)?p:null:p))).filter(p=>p!==null);return g.length===s.options.length?s:g.length===0?null:{...s,options:g}}))).filter(s=>s!==null)}const R=i=>{const e=new h(i);return c.bindClient(e),e};exports.evaluateRuleLogic=l.evaluateRuleLogic;exports.isPickedRoot=l.isPickedRoot;exports.supportsCookies=c.supportsCookies;exports.supportsCryptoRandomUUID=c.supportsCryptoRandomUUID;exports.supportsDocument=c.supportsDocument;exports.supportsHistory=c.supportsHistory;exports.supportsIntersectionObserver=c.supportsIntersectionObserver;exports.supportsLocalStorage=c.supportsLocalStorage;exports.supportsLocation=c.supportsLocation;exports.supportsSessionStorage=c.supportsSessionStorage;exports.supportsShadowRoot=c.supportsShadowRoot;exports.supportsWebComponents=c.supportsWebComponents;exports.supportsWindow=c.supportsWindow;exports.createStorageKey=u.createStorageKey;exports.localStore=u.localStore;exports.sessionStore=u.sessionStore;exports.subscribe=u.subscribe;exports.Picked=h;exports.createClient=R;exports.getStepFields=C;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../../../supports-YvpQZxbh.cjs");require("../../../user-session-D-l-VMTb.cjs");require("../../../experience-instance-B2l_MG7I.cjs");require("effector");function c(){if(!r.supportsWindow()||!window.pickedConfig)throw new Error("Picked config not found. Ensure the Picked Script is enabled on your Shopify storefront");return window.pickedConfig}function d(){if(r.supportsWindow())return c().customer}function s(){if(r.supportsWindow())return c().product}function u(){if(r.supportsWindow())return c().collection}function l(){if(r.supportsWindow())return c().experiments}function f(){var e;if(r.supportsWindow())return(e=c().storefront_api)==null?void 0:e.token}const t={homepage:/^\/$/,page:/(?:^|\/)pages\/[^/]+$/,blog:/(?:^|\/)blogs\/(?<blogHandle>[^/]+)\/?$/,article:/^\/blogs\/[^/]+\/(?<article>[^/]+)\/?$/,cart:/(?:^|\/)cart\/[^/]+$/,checkout:/^\/checkout\/.+/,appProxy:/^\/(?:a|apps|community|tools)\/(?<proxyTarget>[^/]+)/,accountWildcard:/^\/account\/.+/,accountLogin:/^\/account\/login(?:\/|$)/,accountRegister:/^\/account\/register(?:\/|$)/},n=(e,o)=>o?!!e.exec(o.pathname):!1,a=(e,o)=>{if(o){const i=e.exec(o.pathname);if(i)return i[1]}},p=e=>{var o,i;switch(e){case"product":return((o=s())==null?void 0:o.handle)??!1;case"collection":return((i=u())==null?void 0:i.handle)??!1;default:return!1}},h={"is-page":({location:e})=>n(t.page,e),"get-page-handle":({location:e})=>a(t.page,e),"is-product-page":()=>!!p("product"),"get-product-handle":()=>p("product"),"is-collection-page":()=>!!p("collection"),"get-collection-handle":()=>p("collection"),"is-blog-page":({location:e})=>n(t.blog,e),"get-blog-handle":({location:e})=>a(t.blog,e),"is-article-page":({location:e})=>n(t.article,e),"get-article-handle":({location:e})=>a(t.article,e),"is-app-proxy-page":({location:e})=>n(t.appProxy,e),"get-app-proxy-handle":({location:e})=>a(t.appProxy,e),"is-account-page":({location:e})=>n(t.accountWildcard,e),"is-login-page":({location:e})=>n(t.accountLogin,e),"is-register-page":({location:e})=>n(t.accountRegister,e),"is-cart-page":({location:e})=>n(t.cart,e),"is-checkout-page":({location:e})=>n(t.checkout,e),"is-homepage":({location:e})=>n(t.homepage,e)};function g(){if(!r.supportsWindow()||!window.Shopify)throw new Error("Shopify global object not found. This plugin must be used on a Shopify storefront page.");return window.Shopify}function y(e){var o,i;return typeof((i=(o=g())==null?void 0:o.analytics)==null?void 0:i.publish)=="function"}const P=()=>({name:"shopify",setup:e=>{Object.entries(h).forEach(([o,i])=>{e.registerPredicate(`shopify-${o}`,i)}),r.supportsWindow()&&e.eventBus.watch(o=>{y()&&o.type==="session"&&window.Shopify.analytics.publish("picked:session",{id:o.id})})}});exports.getPickedConfig=c;exports.getPickedConfigCollection=u;exports.getPickedConfigCustomer=d;exports.getPickedConfigExperiments=l;exports.getPickedConfigProduct=s;exports.getPickedConfigStorefrontApiToken=f;exports.getShopify=g;exports.shopifyPlugin=P;
|
package/dist/esm/index.js
CHANGED
|
@@ -1,21 +1,34 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as r } from "../../../supports-DBMT17KZ.js";
|
|
2
2
|
import "../../../user-session-Ht0ayuo5.js";
|
|
3
3
|
import "../../../experience-instance-CeuHLrdL.js";
|
|
4
4
|
import "effector";
|
|
5
|
-
function
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
function c() {
|
|
6
|
+
if (!r() || !window.pickedConfig)
|
|
7
|
+
throw new Error(
|
|
8
|
+
"Picked config not found. Ensure the Picked Script is enabled on your Shopify storefront"
|
|
9
|
+
);
|
|
10
|
+
return window.pickedConfig;
|
|
11
|
+
}
|
|
12
|
+
function w() {
|
|
13
|
+
if (r())
|
|
14
|
+
return c().customer;
|
|
9
15
|
}
|
|
10
16
|
function s() {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return (e = window.pickedConfig) == null ? void 0 : e.collection;
|
|
17
|
+
if (r())
|
|
18
|
+
return c().product;
|
|
14
19
|
}
|
|
15
|
-
function
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
20
|
+
function u() {
|
|
21
|
+
if (r())
|
|
22
|
+
return c().collection;
|
|
23
|
+
}
|
|
24
|
+
function k() {
|
|
25
|
+
if (r())
|
|
26
|
+
return c().experiments;
|
|
27
|
+
}
|
|
28
|
+
function P() {
|
|
29
|
+
var e;
|
|
30
|
+
if (r())
|
|
31
|
+
return (e = c().storefront_api) == null ? void 0 : e.token;
|
|
19
32
|
}
|
|
20
33
|
const t = {
|
|
21
34
|
homepage: /^\/$/,
|
|
@@ -28,74 +41,82 @@ const t = {
|
|
|
28
41
|
accountWildcard: /^\/account\/.+/,
|
|
29
42
|
accountLogin: /^\/account\/login(?:\/|$)/,
|
|
30
43
|
accountRegister: /^\/account\/register(?:\/|$)/
|
|
31
|
-
},
|
|
44
|
+
}, n = (e, o) => o ? !!e.exec(o.pathname) : !1, a = (e, o) => {
|
|
32
45
|
if (o) {
|
|
33
46
|
const i = e.exec(o.pathname);
|
|
34
47
|
if (i)
|
|
35
48
|
return i[1];
|
|
36
49
|
}
|
|
37
|
-
},
|
|
50
|
+
}, p = (e) => {
|
|
38
51
|
var o, i;
|
|
39
52
|
switch (e) {
|
|
40
53
|
case "product":
|
|
41
|
-
return ((o =
|
|
54
|
+
return ((o = s()) == null ? void 0 : o.handle) ?? !1;
|
|
42
55
|
case "collection":
|
|
43
|
-
return ((i =
|
|
56
|
+
return ((i = u()) == null ? void 0 : i.handle) ?? !1;
|
|
44
57
|
default:
|
|
45
58
|
return !1;
|
|
46
59
|
}
|
|
47
|
-
},
|
|
60
|
+
}, g = {
|
|
48
61
|
// Pages
|
|
49
|
-
"is-page": ({ location: e }) =>
|
|
50
|
-
"get-page-handle": ({ location: e }) =>
|
|
62
|
+
"is-page": ({ location: e }) => n(t.page, e),
|
|
63
|
+
"get-page-handle": ({ location: e }) => a(t.page, e),
|
|
51
64
|
// Products
|
|
52
|
-
"is-product-page": () => !!
|
|
53
|
-
"get-product-handle": () =>
|
|
65
|
+
"is-product-page": () => !!p("product"),
|
|
66
|
+
"get-product-handle": () => p("product"),
|
|
54
67
|
// Collections
|
|
55
|
-
"is-collection-page": () => !!
|
|
56
|
-
"get-collection-handle": () =>
|
|
68
|
+
"is-collection-page": () => !!p("collection"),
|
|
69
|
+
"get-collection-handle": () => p("collection"),
|
|
57
70
|
// Blogs
|
|
58
|
-
"is-blog-page": ({ location: e }) =>
|
|
59
|
-
"get-blog-handle": ({ location: e }) =>
|
|
71
|
+
"is-blog-page": ({ location: e }) => n(t.blog, e),
|
|
72
|
+
"get-blog-handle": ({ location: e }) => a(t.blog, e),
|
|
60
73
|
// Blog Articles
|
|
61
|
-
"is-article-page": ({ location: e }) =>
|
|
62
|
-
"get-article-handle": ({ location: e }) =>
|
|
74
|
+
"is-article-page": ({ location: e }) => n(t.article, e),
|
|
75
|
+
"get-article-handle": ({ location: e }) => a(t.article, e),
|
|
63
76
|
// Apps
|
|
64
|
-
"is-app-proxy-page": ({ location: e }) =>
|
|
65
|
-
"get-app-proxy-handle": ({ location: e }) =>
|
|
77
|
+
"is-app-proxy-page": ({ location: e }) => n(t.appProxy, e),
|
|
78
|
+
"get-app-proxy-handle": ({ location: e }) => a(t.appProxy, e),
|
|
66
79
|
// Account
|
|
67
|
-
"is-account-page": ({ location: e }) =>
|
|
68
|
-
"is-login-page": ({ location: e }) =>
|
|
69
|
-
"is-register-page": ({ location: e }) =>
|
|
80
|
+
"is-account-page": ({ location: e }) => n(t.accountWildcard, e),
|
|
81
|
+
"is-login-page": ({ location: e }) => n(t.accountLogin, e),
|
|
82
|
+
"is-register-page": ({ location: e }) => n(t.accountRegister, e),
|
|
70
83
|
// Cart
|
|
71
|
-
"is-cart-page": ({ location: e }) =>
|
|
84
|
+
"is-cart-page": ({ location: e }) => n(t.cart, e),
|
|
72
85
|
// Checkout
|
|
73
|
-
"is-checkout-page": ({ location: e }) =>
|
|
86
|
+
"is-checkout-page": ({ location: e }) => n(t.checkout, e),
|
|
74
87
|
// Homepage
|
|
75
|
-
"is-homepage": ({ location: e }) =>
|
|
88
|
+
"is-homepage": ({ location: e }) => n(t.homepage, e)
|
|
76
89
|
};
|
|
77
|
-
function
|
|
78
|
-
if (
|
|
79
|
-
|
|
90
|
+
function l() {
|
|
91
|
+
if (!r() || !window.Shopify)
|
|
92
|
+
throw new Error(
|
|
93
|
+
"Shopify global object not found. This plugin must be used on a Shopify storefront page."
|
|
94
|
+
);
|
|
95
|
+
return window.Shopify;
|
|
80
96
|
}
|
|
81
|
-
function
|
|
97
|
+
function f(e) {
|
|
82
98
|
var o, i;
|
|
83
|
-
return typeof ((i = (o =
|
|
99
|
+
return typeof ((i = (o = l()) == null ? void 0 : o.analytics) == null ? void 0 : i.publish) == "function";
|
|
84
100
|
}
|
|
85
|
-
const
|
|
101
|
+
const b = () => ({
|
|
86
102
|
name: "shopify",
|
|
87
103
|
setup: (e) => {
|
|
88
|
-
Object.entries(
|
|
104
|
+
Object.entries(g).forEach(([o, i]) => {
|
|
89
105
|
e.registerPredicate(`shopify-${o}`, i);
|
|
90
|
-
}),
|
|
91
|
-
|
|
106
|
+
}), r() && e.eventBus.watch((o) => {
|
|
107
|
+
f() && o.type === "session" && window.Shopify.analytics.publish("picked:session", {
|
|
92
108
|
id: o.id
|
|
93
109
|
});
|
|
94
110
|
});
|
|
95
111
|
}
|
|
96
112
|
});
|
|
97
113
|
export {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
w as
|
|
114
|
+
c as getPickedConfig,
|
|
115
|
+
u as getPickedConfigCollection,
|
|
116
|
+
w as getPickedConfigCustomer,
|
|
117
|
+
k as getPickedConfigExperiments,
|
|
118
|
+
s as getPickedConfigProduct,
|
|
119
|
+
P as getPickedConfigStorefrontApiToken,
|
|
120
|
+
l as getShopify,
|
|
121
|
+
b as shopifyPlugin
|
|
101
122
|
};
|
|
@@ -1,22 +1,43 @@
|
|
|
1
1
|
interface EventPayload {
|
|
2
2
|
[key: string]: string | number | boolean | null | undefined | EventPayload | Array<string | number | boolean | null | undefined | EventPayload>;
|
|
3
3
|
}
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
export interface Shopify {
|
|
5
|
+
shop: string;
|
|
6
|
+
locale: string;
|
|
7
|
+
currency: {
|
|
8
|
+
active: string;
|
|
9
|
+
rate: string;
|
|
10
|
+
};
|
|
11
|
+
country: string;
|
|
12
|
+
theme: {
|
|
13
|
+
name: string;
|
|
14
|
+
id: number;
|
|
15
|
+
schema_name: string;
|
|
16
|
+
schema_version: string;
|
|
17
|
+
theme_store_id: number | null;
|
|
18
|
+
role: string;
|
|
19
|
+
handle: string;
|
|
20
|
+
style: {
|
|
21
|
+
id: number | null;
|
|
22
|
+
handle: string | null;
|
|
11
23
|
};
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
24
|
+
};
|
|
25
|
+
routes: {
|
|
26
|
+
root: string;
|
|
27
|
+
};
|
|
28
|
+
PaymentButton: {
|
|
29
|
+
isStorefrontPortableWallets: boolean;
|
|
30
|
+
};
|
|
15
31
|
analytics?: {
|
|
16
32
|
publish?: (event: string, payload: EventPayload) => void;
|
|
17
33
|
};
|
|
18
|
-
|
|
19
|
-
|
|
34
|
+
}
|
|
35
|
+
declare global {
|
|
36
|
+
interface Window {
|
|
37
|
+
Shopify?: Shopify;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export declare function getShopify(): Shopify;
|
|
20
41
|
export declare function supportsShopifyAnalytics(w: Window): w is Window & {
|
|
21
42
|
Shopify: {
|
|
22
43
|
analytics: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"global-obj.d.ts","sourceRoot":"","sources":["../../../../src/plugins/shopify/global-obj.ts"],"names":[],"mappings":"AAEA,UAAU,YAAY;IACpB,CAAC,GAAG,EAAE,MAAM,GACR,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,SAAS,GACT,YAAY,GACZ,KAAK,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,GAAG,YAAY,CAAC,CAAA;CACvE;AAED,OAAO,
|
|
1
|
+
{"version":3,"file":"global-obj.d.ts","sourceRoot":"","sources":["../../../../src/plugins/shopify/global-obj.ts"],"names":[],"mappings":"AAEA,UAAU,YAAY;IACpB,CAAC,GAAG,EAAE,MAAM,GACR,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,SAAS,GACT,YAAY,GACZ,KAAK,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,GAAG,YAAY,CAAC,CAAA;CACvE;AAED,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE;QACR,MAAM,EAAE,MAAM,CAAA;QACd,IAAI,EAAE,MAAM,CAAA;KACb,CAAA;IACD,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE;QACL,IAAI,EAAE,MAAM,CAAA;QACZ,EAAE,EAAE,MAAM,CAAA;QACV,WAAW,EAAE,MAAM,CAAA;QACnB,cAAc,EAAE,MAAM,CAAA;QACtB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;QAC7B,IAAI,EAAE,MAAM,CAAA;QACZ,MAAM,EAAE,MAAM,CAAA;QACd,KAAK,EAAE;YACL,EAAE,EAAE,MAAM,GAAG,IAAI,CAAA;YACjB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;SACtB,CAAA;KACF,CAAA;IACD,MAAM,EAAE;QACN,IAAI,EAAE,MAAM,CAAA;KACb,CAAA;IACD,aAAa,EAAE;QACb,2BAA2B,EAAE,OAAO,CAAA;KACrC,CAAA;IACD,SAAS,CAAC,EAAE;QACV,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,KAAK,IAAI,CAAA;KACzD,CAAA;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,OAAO,CAAC,EAAE,OAAO,CAAA;KAClB;CACF;AAED,wBAAgB,UAAU,YAQzB;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"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export { shopifyPlugin } from './plugin';
|
|
2
|
-
export { getPickedConfigStorefrontApiToken } from './picked-config';
|
|
2
|
+
export { getPickedConfig, getPickedConfigCollection, getPickedConfigCustomer, getPickedConfigExperiments, getPickedConfigProduct, getPickedConfigStorefrontApiToken, } from './picked-config';
|
|
3
|
+
export type * from './picked-config';
|
|
3
4
|
export { getShopify } from './global-obj';
|
|
5
|
+
export type * from './global-obj';
|
|
4
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +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;AAGxC,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/shopify/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAGxC,OAAO,EACL,eAAe,EACf,yBAAyB,EACzB,uBAAuB,EACvB,0BAA0B,EAC1B,sBAAsB,EACtB,iCAAiC,GAClC,MAAM,iBAAiB,CAAA;AACxB,mBAAmB,iBAAiB,CAAA;AAGpC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,mBAAmB,cAAc,CAAA"}
|
|
@@ -22,19 +22,24 @@ export type PickedConfigProductVariant = Partial<{
|
|
|
22
22
|
export type PickedConfigProductCollection = Partial<{
|
|
23
23
|
id: number;
|
|
24
24
|
}>;
|
|
25
|
+
export type MetafieldValue = string | number | boolean | null | undefined;
|
|
26
|
+
export interface MetafieldObject {
|
|
27
|
+
[key: string]: MetafieldValue | MetafieldObject | MetafieldValue[] | MetafieldObject[];
|
|
28
|
+
}
|
|
25
29
|
export type PickedConfigProduct = Partial<{
|
|
26
30
|
available: boolean;
|
|
27
31
|
collections: PickedConfigProductCollection[];
|
|
28
|
-
title: string;
|
|
29
|
-
id: number;
|
|
30
|
-
handle: string;
|
|
31
32
|
featured_image: string;
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
handle: string;
|
|
34
|
+
id: number;
|
|
35
|
+
metafields: MetafieldObject;
|
|
34
36
|
price: number;
|
|
35
37
|
tags: string[];
|
|
38
|
+
title: string;
|
|
39
|
+
type: string;
|
|
40
|
+
url: string;
|
|
36
41
|
variants: PickedConfigProductVariant[];
|
|
37
|
-
|
|
42
|
+
vendor: string;
|
|
38
43
|
}>;
|
|
39
44
|
export type PickedConfigCustomer = Partial<{
|
|
40
45
|
accepts_marketing: boolean;
|
|
@@ -61,6 +66,7 @@ declare global {
|
|
|
61
66
|
pickedConfig?: Readonly<Partial<CreateClientOptions> & ShopifyPickedConfig>;
|
|
62
67
|
}
|
|
63
68
|
}
|
|
69
|
+
export declare function getPickedConfig(): Readonly<Partial<CreateClientOptions> & ShopifyPickedConfig>;
|
|
64
70
|
export declare function getPickedConfigCustomer(): Partial<{
|
|
65
71
|
accepts_marketing: boolean;
|
|
66
72
|
email: string;
|
|
@@ -75,16 +81,17 @@ export declare function getPickedConfigCustomer(): Partial<{
|
|
|
75
81
|
export declare function getPickedConfigProduct(): Partial<{
|
|
76
82
|
available: boolean;
|
|
77
83
|
collections: PickedConfigProductCollection[];
|
|
78
|
-
title: string;
|
|
79
|
-
id: number;
|
|
80
|
-
handle: string;
|
|
81
84
|
featured_image: string;
|
|
82
|
-
|
|
83
|
-
|
|
85
|
+
handle: string;
|
|
86
|
+
id: number;
|
|
87
|
+
metafields: MetafieldObject;
|
|
84
88
|
price: number;
|
|
85
89
|
tags: string[];
|
|
90
|
+
title: string;
|
|
91
|
+
type: string;
|
|
92
|
+
url: string;
|
|
86
93
|
variants: PickedConfigProductVariant[];
|
|
87
|
-
|
|
94
|
+
vendor: string;
|
|
88
95
|
}> | undefined;
|
|
89
96
|
export declare function getPickedConfigCollection(): Partial<{
|
|
90
97
|
title: string;
|
|
@@ -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,aAAa,CAAA;AAGtD,MAAM,WAAW,sBAAsB;IAErC,OAAO,EAAE,OAAO,CAAA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