@picked/shopify 0.0.1-dev.1789541668638 → 0.0.13
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 -0
- package/dist/esm/index.js +22 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +24 -102
- package/dist/.tsbuildinfo +0 -1
- package/dist/ajax-api-TzqQuV55.js +0 -239
- package/dist/ajax-api-xrCwcyZw.cjs +0 -1
- package/dist/cjs/ajax-api/index.js +0 -1
- package/dist/cjs/json-api/index.js +0 -1
- package/dist/cjs/picked-app/index.js +0 -1
- package/dist/cjs/plugins/shopify/index.js +0 -1
- package/dist/cjs/storefront-api/index.js +0 -10
- package/dist/cjs/utils/index.js +0 -1
- package/dist/esm/ajax-api/index.js +0 -2
- package/dist/esm/json-api/index.js +0 -12
- package/dist/esm/picked-app/index.js +0 -10
- package/dist/esm/plugins/shopify/index.js +0 -2
- package/dist/esm/storefront-api/index.js +0 -30
- package/dist/esm/utils/index.js +0 -2
- package/dist/types/ajax-api/index.d.ts +0 -22
- package/dist/types/ajax-api/index.d.ts.map +0 -1
- package/dist/types/ajax-api/types.d.ts +0 -259
- package/dist/types/ajax-api/types.d.ts.map +0 -1
- package/dist/types/json-api/index.d.ts +0 -8
- package/dist/types/json-api/index.d.ts.map +0 -1
- package/dist/types/json-api/types.d.ts +0 -66
- package/dist/types/json-api/types.d.ts.map +0 -1
- package/dist/types/picked-app/index.d.ts +0 -15
- package/dist/types/picked-app/index.d.ts.map +0 -1
- package/dist/types/plugins/shopify/global-obj.d.ts +0 -10
- package/dist/types/plugins/shopify/global-obj.d.ts.map +0 -1
- package/dist/types/plugins/shopify/index.d.ts +0 -5
- package/dist/types/plugins/shopify/index.d.ts.map +0 -1
- package/dist/types/plugins/shopify/picked-config.d.ts +0 -87
- package/dist/types/plugins/shopify/picked-config.d.ts.map +0 -1
- package/dist/types/plugins/shopify/plugin.d.ts +0 -14
- package/dist/types/plugins/shopify/plugin.d.ts.map +0 -1
- package/dist/types/plugins/shopify/predicates.d.ts +0 -42
- package/dist/types/plugins/shopify/predicates.d.ts.map +0 -1
- package/dist/types/plugins/shopify/types.d.ts +0 -105
- package/dist/types/plugins/shopify/types.d.ts.map +0 -1
- package/dist/types/storefront-api/index.d.ts +0 -9
- package/dist/types/storefront-api/index.d.ts.map +0 -1
- package/dist/types/storefront-api/types.d.ts +0 -14
- package/dist/types/storefront-api/types.d.ts.map +0 -1
- package/dist/types/types.d.ts +0 -4
- package/dist/types/types.d.ts.map +0 -1
- package/dist/types/utils/debounce.d.ts +0 -3
- package/dist/types/utils/debounce.d.ts.map +0 -1
- package/dist/types/utils/index.d.ts +0 -2
- package/dist/types/utils/index.d.ts.map +0 -1
- package/dist/types/utils/request.d.ts +0 -3
- package/dist/types/utils/request.d.ts.map +0 -1
package/dist/cjs/index.js
CHANGED
|
@@ -0,0 +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;
|
package/dist/esm/index.js
CHANGED
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
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;
|
|
2
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
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"}
|
package/package.json
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@picked/shopify",
|
|
3
3
|
"description": "Shopify plugin for @picked/client",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.13",
|
|
5
|
+
"dependencies": {},
|
|
5
6
|
"devDependencies": {
|
|
6
7
|
"@picked/client": "workspace:*",
|
|
7
8
|
"@repo/eslint-config": "workspace:*",
|
|
8
9
|
"@repo/typescript-config": "workspace:*",
|
|
9
|
-
"@rollup/plugin-replace": "^6.0.
|
|
10
|
-
"@shopify/storefront-api-client": "^1.0.
|
|
11
|
-
"@size-limit/preset-small-lib": "^12.1.0",
|
|
10
|
+
"@rollup/plugin-replace": "^6.0.2",
|
|
11
|
+
"@shopify/storefront-api-client": "^1.0.9",
|
|
12
12
|
"@types/jsdom": "^21.1.7",
|
|
13
|
-
"@types/node": "^
|
|
14
|
-
"@vitest/coverage-v8": "^
|
|
15
|
-
"effector": "^23.
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"vite": "^
|
|
20
|
-
"vitest": "^
|
|
13
|
+
"@types/node": "^22",
|
|
14
|
+
"@vitest/coverage-v8": "^3.2.3",
|
|
15
|
+
"effector": "^23.3.0",
|
|
16
|
+
"tsup": "^8.5.0",
|
|
17
|
+
"tsx": "^4.20.3",
|
|
18
|
+
"vite": "^6.4.1",
|
|
19
|
+
"vite-plugin-dts": "^4.5.4",
|
|
20
|
+
"vitest": "^3.2.4"
|
|
21
21
|
},
|
|
22
22
|
"exports": {
|
|
23
23
|
".": {
|
|
@@ -25,110 +25,32 @@
|
|
|
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
|
-
"./picked-app": {
|
|
48
|
-
"types": "./dist/types/picked-app/index.d.ts",
|
|
49
|
-
"import": "./dist/esm/picked-app/index.js",
|
|
50
|
-
"require": "./dist/cjs/picked-app/index.js",
|
|
51
|
-
"default": "./dist/esm/picked-app/index.js"
|
|
52
|
-
},
|
|
53
|
-
"./storefront-api": {
|
|
54
|
-
"types": "./dist/types/storefront-api/index.d.ts",
|
|
55
|
-
"import": "./dist/esm/storefront-api/index.js",
|
|
56
|
-
"require": "./dist/cjs/storefront-api/index.js",
|
|
57
|
-
"default": "./dist/esm/storefront-api/index.js"
|
|
58
|
-
},
|
|
59
|
-
"./plugins/shopify": {
|
|
60
|
-
"types": "./dist/types/plugins/shopify/index.d.ts",
|
|
61
|
-
"import": "./dist/esm/plugins/shopify/index.js",
|
|
62
|
-
"require": "./dist/cjs/plugins/shopify/index.js",
|
|
63
|
-
"default": "./dist/esm/plugins/shopify/index.js"
|
|
64
28
|
}
|
|
65
29
|
},
|
|
66
30
|
"files": [
|
|
67
31
|
"dist"
|
|
68
32
|
],
|
|
69
|
-
"knip": {
|
|
70
|
-
"ignoreBinaries": [
|
|
71
|
-
"eslint",
|
|
72
|
-
"jscpd",
|
|
73
|
-
"knip",
|
|
74
|
-
"tsgo"
|
|
75
|
-
]
|
|
76
|
-
},
|
|
77
33
|
"main": "./dist/cjs/index.js",
|
|
78
34
|
"module": "./dist/esm/index.js",
|
|
79
35
|
"peerDependencies": {
|
|
80
|
-
"@picked/client": "0.0.
|
|
81
|
-
"@shopify/storefront-api-client": "^1.0.
|
|
82
|
-
"effector": "^23.
|
|
36
|
+
"@picked/client": "0.0.13",
|
|
37
|
+
"@shopify/storefront-api-client": "^1.0.9",
|
|
38
|
+
"effector": "^23.3.0"
|
|
83
39
|
},
|
|
84
40
|
"private": false,
|
|
85
41
|
"scripts": {
|
|
86
|
-
"
|
|
87
|
-
"
|
|
88
|
-
"
|
|
89
|
-
"
|
|
90
|
-
"
|
|
91
|
-
"
|
|
42
|
+
"_test": "vitest run",
|
|
43
|
+
"_test:coverage": "vitest run --coverage",
|
|
44
|
+
"_test:packaged-types": "attw --pack",
|
|
45
|
+
"_test:watch": "vitest",
|
|
46
|
+
"build": "vite build",
|
|
47
|
+
"dev": "vite build --watch",
|
|
48
|
+
"lint": "eslint .",
|
|
92
49
|
"lint-files": "eslint",
|
|
93
50
|
"lint:format": "eslint . --fix",
|
|
94
|
-
"lint:report": "eslint .
|
|
95
|
-
"
|
|
96
|
-
"test": "vitest run",
|
|
97
|
-
"test:coverage": "../../scripts/vitest-coverage.sh",
|
|
98
|
-
"test:packaged-types": "attw --pack",
|
|
99
|
-
"test:watch": "vitest",
|
|
100
|
-
"type-check": "tsgo -p . --noEmit"
|
|
51
|
+
"lint:report": "eslint . -o './.reports/eslint.json' -f json || true",
|
|
52
|
+
"type-check": "tsc -p . --noEmit"
|
|
101
53
|
},
|
|
102
|
-
"size-limit": [
|
|
103
|
-
{
|
|
104
|
-
"path": "dist/esm/index.js",
|
|
105
|
-
"limit": "10 kB"
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
"path": "dist/esm/utils/index.js",
|
|
109
|
-
"limit": "5 kB"
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
"path": "dist/esm/ajax-api/index.js",
|
|
113
|
-
"limit": "5 kB"
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
"path": "dist/esm/json-api/index.js",
|
|
117
|
-
"limit": "5 kB"
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
"path": "dist/esm/picked-app/index.js",
|
|
121
|
-
"limit": "5 kB"
|
|
122
|
-
},
|
|
123
|
-
{
|
|
124
|
-
"path": "dist/esm/storefront-api/index.js",
|
|
125
|
-
"limit": "5 kB"
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
"path": "dist/esm/plugins/shopify/index.js",
|
|
129
|
-
"limit": "5 kB"
|
|
130
|
-
}
|
|
131
|
-
],
|
|
132
54
|
"type": "module",
|
|
133
55
|
"types": "./dist/types/index.d.ts"
|
|
134
56
|
}
|
package/dist/.tsbuildinfo
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":"7.0.0-dev.20260707.2","root":[[64,68],[123,133],[149,150]],"packageJsons":["../../../node_modules/.pnpm/@shopify+graphql-client@1.4.2/node_modules/@shopify/graphql-client/package.json","../../../node_modules/.pnpm/@shopify+storefront-api-client@1.0.10/node_modules/@shopify/storefront-api-client/package.json","../../../node_modules/.pnpm/effector@23.4.4/node_modules/effector/package.json","../../client/package.json","../../delivery-api-client/package.json","../package.json"],"missingPackageJsons":["../../../node_modules/.pnpm/@shopify+graphql-client@1.4.2/node_modules/@shopify/graphql-client/dist/package.json","../../../node_modules/.pnpm/@shopify+graphql-client@1.4.2/node_modules/@shopify/graphql-client/dist/ts/api-client-utilities/package.json","../../../node_modules/.pnpm/@shopify+graphql-client@1.4.2/node_modules/@shopify/graphql-client/dist/ts/graphql-client/package.json","../../../node_modules/.pnpm/@shopify+graphql-client@1.4.2/node_modules/@shopify/graphql-client/dist/ts/package.json","../../../node_modules/.pnpm/@shopify+storefront-api-client@1.0.10/node_modules/@shopify/storefront-api-client/dist/package.json","../../../node_modules/.pnpm/@shopify+storefront-api-client@1.0.10/node_modules/@shopify/storefront-api-client/dist/ts/package.json"],"fileNames":["lib.es5.d.ts","lib.es2015.d.ts","lib.es2016.d.ts","lib.es2017.d.ts","lib.es2018.d.ts","lib.es2019.d.ts","lib.es2020.d.ts","lib.es2021.d.ts","lib.es2022.d.ts","lib.es2023.d.ts","lib.dom.d.ts","lib.dom.iterable.d.ts","lib.es2015.core.d.ts","lib.es2015.collection.d.ts","lib.es2015.generator.d.ts","lib.es2015.iterable.d.ts","lib.es2015.promise.d.ts","lib.es2015.proxy.d.ts","lib.es2015.reflect.d.ts","lib.es2015.symbol.d.ts","lib.es2015.symbol.wellknown.d.ts","lib.es2016.array.include.d.ts","lib.es2016.intl.d.ts","lib.es2017.arraybuffer.d.ts","lib.es2017.date.d.ts","lib.es2017.object.d.ts","lib.es2017.sharedmemory.d.ts","lib.es2017.string.d.ts","lib.es2017.intl.d.ts","lib.es2017.typedarrays.d.ts","lib.es2018.asyncgenerator.d.ts","lib.es2018.asynciterable.d.ts","lib.es2018.intl.d.ts","lib.es2018.promise.d.ts","lib.es2018.regexp.d.ts","lib.es2019.array.d.ts","lib.es2019.object.d.ts","lib.es2019.string.d.ts","lib.es2019.symbol.d.ts","lib.es2019.intl.d.ts","lib.es2020.bigint.d.ts","lib.es2020.date.d.ts","lib.es2020.promise.d.ts","lib.es2020.sharedmemory.d.ts","lib.es2020.string.d.ts","lib.es2020.symbol.wellknown.d.ts","lib.es2020.intl.d.ts","lib.es2020.number.d.ts","lib.es2021.promise.d.ts","lib.es2021.string.d.ts","lib.es2021.weakref.d.ts","lib.es2021.intl.d.ts","lib.es2022.array.d.ts","lib.es2022.error.d.ts","lib.es2022.intl.d.ts","lib.es2022.object.d.ts","lib.es2022.string.d.ts","lib.es2022.regexp.d.ts","lib.es2023.array.d.ts","lib.es2023.collection.d.ts","lib.es2023.intl.d.ts","lib.decorators.d.ts","lib.decorators.legacy.d.ts","../src/ajax-api/types.ts","../src/json-api/types.ts","../src/storefront-api/types.ts","../src/types.ts","../src/index.ts","../../../node_modules/.pnpm/effector@23.4.4/node_modules/effector/index.d.ts","../../delivery-api-client/dist/types/client-headers.d.ts","../../delivery-api-client/dist/types/project-config.d.ts","../../delivery-api-client/dist/types/types.d.ts","../../delivery-api-client/dist/types/fetch.d.ts","../../delivery-api-client/dist/types/index.d.ts","../../client/dist/types/entities/component/lazyComponent.d.ts","../../client/dist/types/entities/component/component.d.ts","../../client/dist/types/logic-engine.d.ts","../../client/dist/types/entities/condition/condition.d.ts","../../client/dist/types/entities/content/content.d.ts","../../client/dist/types/entities/step/step.d.ts","../../client/dist/types/entities/history/history.d.ts","../../client/dist/types/entities/experience-instance/experience-instance.d.ts","../../client/dist/types/entities/framework/framework.d.ts","../../client/dist/types/utils/node-tree/node-adjacency.d.ts","../../client/dist/types/utils/node-tree/node-tree-index.d.ts","../../client/dist/types/entities/experience/experience.d.ts","../../client/dist/types/entities/plugin/plugin.d.ts","../../client/dist/types/utils/logger.d.ts","../../client/dist/types/lifecycle/rules-logic.d.ts","../../client/dist/types/lifecycle/condition-selection.d.ts","../../client/dist/types/lifecycle/lifecycle.d.ts","../../client/dist/types/entities/field/policies.d.ts","../../client/dist/types/entities/field/field.d.ts","../../client/dist/types/schema-registry.d.ts","../../client/dist/types/entities/feature/feature.d.ts","../../client/dist/types/entities/response/response-validation.d.ts","../../client/dist/types/entities/response/response.d.ts","../../client/dist/types/entities/session/session.d.ts","../../client/dist/types/utils/events.d.ts","../../client/dist/types/plugins/dynamic-experiences/types.d.ts","../../client/dist/types/entities/action/action.d.ts","../../client/dist/types/utils/user-timing.d.ts","../../client/dist/types/data-source/request-observer.d.ts","../../client/dist/types/utils/client-telemetry.d.ts","../../client/dist/types/picked.d.ts","../../client/dist/types/lifecycle/state-snapshot.d.ts","../../client/dist/types/entities/predicate/predicate.d.ts","../../client/dist/types/client.d.ts","../../client/dist/types/utils/dom.d.ts","../../client/dist/types/utils/rehydrate-scripts.d.ts","../../client/dist/types/utils/html-asset-value.d.ts","../../client/dist/types/utils/preview-session.d.ts","../../client/dist/types/utils/inert-script-report.d.ts","../../client/dist/types/utils/supports.d.ts","../../client/dist/types/utils/storage.d.ts","../../client/dist/types/utils/rules-logic.d.ts","../../client/dist/types/utils/picked-config.d.ts","../../client/dist/types/entities/content/reference.d.ts","../../client/dist/types/exports.d.ts","../../client/dist/types/utils/search-params.d.ts","../../client/dist/types/typed-content.d.ts","../../client/dist/types/index.d.ts","../src/utils/debounce.ts","../src/plugins/shopify/types.ts","../src/plugins/shopify/picked-config.ts","../src/plugins/shopify/predicates.ts","../src/plugins/shopify/global-obj.ts","../src/plugins/shopify/plugin.ts","../src/plugins/shopify/index.ts","../src/utils/request.ts","../src/ajax-api/index.ts","../src/json-api/index.ts","../src/picked-app/index.ts","../../../node_modules/.pnpm/@shopify+graphql-client@1.4.2/node_modules/@shopify/graphql-client/dist/ts/graphql-client/types.d.ts","../../../node_modules/.pnpm/@shopify+graphql-client@1.4.2/node_modules/@shopify/graphql-client/dist/ts/graphql-client/graphql-client.d.ts","../../../node_modules/.pnpm/@shopify+graphql-client@1.4.2/node_modules/@shopify/graphql-client/dist/ts/graphql-client/index.d.ts","../../../node_modules/.pnpm/@shopify+graphql-client@1.4.2/node_modules/@shopify/graphql-client/dist/ts/graphql-client/utilities.d.ts","../../../node_modules/.pnpm/@shopify+graphql-client@1.4.2/node_modules/@shopify/graphql-client/dist/ts/api-client-utilities/operation-types.d.ts","../../../node_modules/.pnpm/@shopify+graphql-client@1.4.2/node_modules/@shopify/graphql-client/dist/ts/api-client-utilities/types.d.ts","../../../node_modules/.pnpm/@shopify+graphql-client@1.4.2/node_modules/@shopify/graphql-client/dist/ts/api-client-utilities/validations.d.ts","../../../node_modules/.pnpm/@shopify+graphql-client@1.4.2/node_modules/@shopify/graphql-client/dist/ts/api-client-utilities/api-versions.d.ts","../../../node_modules/.pnpm/@shopify+graphql-client@1.4.2/node_modules/@shopify/graphql-client/dist/ts/graphql-client/http-fetch.d.ts","../../../node_modules/.pnpm/@shopify+graphql-client@1.4.2/node_modules/@shopify/graphql-client/dist/ts/api-client-utilities/utilities.d.ts","../../../node_modules/.pnpm/@shopify+graphql-client@1.4.2/node_modules/@shopify/graphql-client/dist/ts/api-client-utilities/index.d.ts","../../../node_modules/.pnpm/@shopify+graphql-client@1.4.2/node_modules/@shopify/graphql-client/dist/ts/index.d.ts","../../../node_modules/.pnpm/@shopify+storefront-api-client@1.0.10/node_modules/@shopify/storefront-api-client/dist/ts/types.d.ts","../../../node_modules/.pnpm/@shopify+storefront-api-client@1.0.10/node_modules/@shopify/storefront-api-client/dist/ts/storefront-api-client.d.ts","../../../node_modules/.pnpm/@shopify+storefront-api-client@1.0.10/node_modules/@shopify/storefront-api-client/dist/ts/index.d.ts","../src/storefront-api/index.ts","../src/utils/index.ts"],"fileInfos":[{"version":"16934abaab7026ac114da441aabea1a0","affectsGlobalScope":true,"impliedNodeFormat":1},"d4306fb2e47f74835e8674ffac07d76f","e437c5c1302869326c3bb93da85bbbcf","e4324975a566567b21d350615f1fc6ac","333b1b9a2a9ac3b8497dba5c63b5ba50","6cffacd662b6eb5fa7a36aa2ea366bfa","b4c34f9c23304dbef2d23698637ed638","e5cb86a5fc491796ecd1d2dd348d208f","feb6c6fb19cdb246a5d8acb36a6901c7","9443a7f109277ffaa79d893ed2549995",{"version":"aae8996e8b5684814785a42cbbefcd79","affectsGlobalScope":true,"impliedNodeFormat":1},"abad6dd56cc8caf095c165df8124d237",{"version":"926204c28cd3d073865348473ae28d2e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"f25e42c801b2cb3cf2b39792006a9beb","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"6344b55f26a4e81d9608777dbfb877dd","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"3c0ed28e53d3695b363e256ec1c023fd","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4c2761daba7f17141c25baa0821ac5da","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b87656acabd63e69379ff6ffcfe52fc7","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"597469522da047a5af5222cc6989f405","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"1708ea4d34dc37fadadc63ca01127e80","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"55d97a8c6fbf34a30450a7b1e5f7a298","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0ee05eb59426d33e374226d8dcfa708b","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"e347c14030993906efcfbb88915b6a05","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b0231263857c9b6a03641acdc9280ceb","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"3b15c4a83b598cacb4067676e6f0abed","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b417d97b7934cef63b1889abec0bbfbf","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"09a6cf4032ebba60ce22a501e663f881","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"2b056277dd138e8f5650fc04e20eaa8d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"e22cc07e3f3cc242ba52fa3f8ea1fc58","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"2c45da767a1bfbb220848df1bc4029e4","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b44c3e0fbaf2130cdcf6ac38b120ffa1","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b612fb5cf8e5d964b92063a75207632a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"02705151a5e1551b9162a9ed8ab763f7","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"41025e398be9215d32e4337335da8f0b","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"52684c2b1f353a5538e4f275182a54cd","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"6dedb6a4f90d1df3a6fbe5693e44886c","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ca3f36fe3562c07e0f0d71c2bebd3f6d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"409974d6129befbb8226ddd1c6558568","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4d9cfde2a1ae1b4925f1f9bc10848e5d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"7e1daecc66dd564144e3bb1a0266b5fd","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"a8e1d9bb35fd0637f2f9fd2b2a54f2ec","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4f168501772a6543182765bfd5f2fbfe","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"a19c80aad1b2162103496f5ba293a732","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b69afa63cd5d059851c78adb2856ee09","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ae2fc5d954e9b0f5feee3d481b953c27","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"1cfd3091a071d8b6feec15277643bafe","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"1da2c1f258970fd3cc91184f69e91a9d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"a0d87491913d843139e0c993650a3235","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4ef72aa378127e7b7abba915b0110b1e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"3ec74c6a7d4463f0254db3a74cf75646","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"84c2bdfa470d075526cce6322d81b0b6","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0b3844c2b8c73e4e1ab91431411cad11","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4fc71cf4a15b8d99675a31df77f26e07","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d1b49564ddaeca3df5b6dbae925d2242","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"6a25be566d60ccfc2d6e8b7bfdeefa83","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8a20e27646985dfd58c57ca6566553dd","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"9969f02ad3cdcbf4f709405cda44167f","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"9c9be4792a7a4f42c15ae7360bf28779","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8cf777fe00349b71ee9c4b6f3fe7fd19","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"74f96bc192530c9723f572bfff3d3078","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"1df91c56b25955c56387426f378173c5","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"f64453cbf9671f28158677fa5c43967a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"33f317af5428801f944a478d2c1e38e5","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"44ec192ecdb7d1b1a46e310ed6fecd0d","signature":"2a1d897b99dc8db742f899e71ff4bc2b","impliedNodeFormat":1},{"version":"588f0deb0d66e5e94a5c226258f5491d","signature":"609748ba5a6ac9bd1d7ed09deb3a3983","impliedNodeFormat":1},{"version":"6a54066fbee30a8de87c1ffb172a3a96","signature":"7b41f07aac2c3d22482c40434d459812","impliedNodeFormat":1},{"version":"f9fa2a82b71981290fa66cd23b432c60","signature":"65768f510c037971aa58d265cfcc57c8","impliedNodeFormat":1},{"version":"9b4d425f4b00d5c483b9b457eb60c104","signature":"3696f8d0ec84ff48464003547c0b23b2","impliedNodeFormat":1},"4d30d5ec0ec1f3784ba6050d307a4db5","f992571afa109506b5288c980ee5e498","92cbb6decf8c82a331122af1bce37a01","fd2de4e9a55a224bf1ce7bce26095e7e","bd6bd1ac3925d2a2668e7b21bedc2e04","4e0b255a79e3812707be53462ca6dbd0","c693b09dcd6d7e0986763de264a6456e","331eba2c930bea66378f3e58658b17fb","2417555c1e04f6e895c47040aa7d56a0","8520fb9b295b10dd7d5bd1805eb6dc05","257aa345e35665cec2f78afe005faa9e","990bc7054c18efd1fc19e21df19fb00a","5859a130c0b0cb8b9661e2cdc0ac0cd0","3490cb20f25902f9390bb41a7399f899","239b4ca55b42b39d96c24ce761c9f16a","dfc59183e57d6443f70056b89829d55a","0a58cbf05d0e83b5cfb3ed153151750d","abec219c1f6d1906d0213d4de502da45","e1873fe7af9ce55a5d1b5b9a3bc39a9d","b7ca911c22ea11fd08f4643020b1450d","e2125552fa2b9ddfbc8bb60bdac55c97","486d01fd3c94ebd16f84f6536f6f1c91","5356e38ea582e02b409e424a26d5ecc8","1984ab6f3dafbd4102e956997fe2352c","a7a8153236751bd356a79bb30c89af69","b729cdd66d48009bd747ae01cc6aadd1","ec84b27f9dded8ef584c7249da37ea94","dbff577bf4b6d09d2e3fc5744979029e","885a241e00ad3913a5a55b95e51424a0","cf5eeae444c70998a0a5b5481d5fedf2","4b663cbfa79328782290b845f0c65368","5078543fccf3ee78c3a83e0c4fe37992","d9a3195225b0ff4294742beac832d252","9cd895bcf53f393578205f2f79afb8b3","5133cb8bac6d95b120ad7c931560f3d2","5d7eb5ba82878b9badbe908f8fcdd7e9","65ee15eeeccd17a086995c2aeafc04db","9b7f6365fa9ad8d272d6953ee99c7a20","ca5b5f0c47153cfb8d1b3b27192fbce7","2334480ba8cdeb26e4a37ab752120fb9","6d4649cdd413dd635ac0ca0b37d452cc",{"version":"4198eb85452f1ee8650e3525ebc56405","affectsGlobalScope":true,"impliedNodeFormat":1},"a51a8e6599581e605aa01164b2aecf58","698b1018d1c18af70f8828dcf86dfb3f","8378623bb64e556c9c62d37b214e3f2a","f1b6fd6b86d263291725f1e6450c7a0f","a860181621c15a4495aea811188f6ade","e6121cb2079cbef49f8cabb771b096d4",{"version":"3c818c69e25524502fb01cdd4eb204ff","affectsGlobalScope":true,"impliedNodeFormat":1},"457028a15a800a0101897207083230b4","cc41693ad3e7b61f34fa2d31e30dbc50","b8e788852f3cd20f765e510e73bb9200","afd6901aba52f49ca5ffe7dd427c90ff","af1c8c3945deb33180a66049151249f2",{"version":"55c7d4301a1b8831ae2dd4db52884ddb","signature":"c71a52cd7a11bebd076a13bdd151eef1","impliedNodeFormat":1},{"version":"210f531e9db83cc9814327038c68c565","signature":"a2f48913b6b0ce598592e8a3cc6ec327","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"6907274c235c806dbbdd5acd7c0a5094","signature":"068fe66ca212cb4032fa773d3017ce1c","impliedNodeFormat":1},{"version":"12ed0905db473972803f72200c983fa8","signature":"3c5148301db2be45392202e1e41e66c3","impliedNodeFormat":1},{"version":"ef0593995bfc3d4d9a6b2cf495b36404","signature":"4ee5067285a1049cd1cdc6371cbc1c57","impliedNodeFormat":1},{"version":"13efd8fda840cd642c852940dbd94105","signature":"37b329bbe218ac69e0086acbea2f9e2f","impliedNodeFormat":1},{"version":"2caac142ca8821ba6bef29bc89897828","signature":"a131aa9968d7378dca3f8e84dea626db","impliedNodeFormat":1},{"version":"167ca7f8735988347dca29b722b5f39a","signature":"365296a5484c2d4681bf2cff3aa6cbb3","impliedNodeFormat":1},{"version":"c33545d2510f240120d90e89711e3290","signature":"284d09781436f5456079ccf8f12355c3","impliedNodeFormat":1},{"version":"bd8da0b965b44e7052b442f77d83cf9d","signature":"374da215c64c1129a5ba0f22a7d3a002","impliedNodeFormat":1},{"version":"5bedbae4cabd4e3b6c8e981e1279cfa7","signature":"34d1d3b0aa0cf4b03df413359da00880","impliedNodeFormat":1},"0c16c5c8945b669a2f394c521168f0a6","c0688009894a734236f474af9a6a4a44","55e8c9f61285b02cb2f1fa8caad4e903","2f3e243d1a65b1cfc603a1b4b2aaddf5","cc0127c0ef1eacaeba0c3a10bd4822b0","b3dd56db02a04535796c784d405a2fa5","5dc876ab5501402f445d966acb7150a1","0dfd2926c02532d4c971abc3b09ca099","bf1f0b8bf04ebc0c3363571439b431cd","04e24265382a2ad28abec81de53a2a79","a5b0fe2c360fb9b73b8e4d918f0dc3e5","539e7bfdc5109c6e6c6e03ac71435a6f","62e248d144b53eff0d45d95f427bbe7e","4f0729689a0e8a33fbb38b4f2c24ee2b","82e30764088aebadc1981d8ec29925dd",{"version":"458ff060e80380db683415b9386e4f86","signature":"16d61563ec9c66121adab8b78a3c385c","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"27f184c542395ff07f1acd2937abae2a","signature":"f0c394972d8721da6499f2e24a565e62","impliedNodeFormat":1}],"fileIdsList":[[137,139,140,141,142,143],[134,138],[134,139],[139],[134],[134,135],[136,144],[145,146,147],[146],[145],[76,77,87,93,95,101,107],[69,82,105,106],[69,75,105,122],[69,77],[69],[69,79],[69,76,80,81,83,86,105],[69,76,77,78,80,83,85,105],[69,94,105],[69,77,92],[69,76,82,105],[69,86],[69,105],[69,105,106],[77,93],[69,93,94,96,105],[75,86,87,105,108,109,110,111,112,113,114,115,116,117,118],[75,76,78,79,80,81,82,83,86,87,92,93,94,95,97,99,101,105,106,107,108,118,119,120,121],[69,77,78,105],[69,77,105],[69,93,105],[69,74,76,78,79,80,83,86,87,88,89,90,91,93,94,95,98,99,100,101,102,104,106,107,108,119,122],[74],[79,93],[69,79,94],[103],[86],[69,80,82,95,97,98],[84,86],[108],[77,105],[82],[72],[70,72,73],[71],[64,130],[67],[65,130],[130],[122,124],[124,125,127,128],[69,122,123,126,127,131],[122,125],[66,129,148],[64,65,66],[129]],"options":{"composite":true,"emitDeclarationOnly":true,"declaration":true,"declarationDir":"./types","declarationMap":true,"module":99,"noUncheckedIndexedAccess":true,"outDir":"./","rootDir":"../src","skipLibCheck":true,"strict":true,"target":10,"tsBuildInfoFile":"./.tsbuildinfo","esModuleInterop":true},"referencedMap":[[144,1],[139,2],[143,3],[140,4],[135,5],[142,5],[136,6],[145,7],[148,8],[147,9],[146,10],[108,11],[101,12],[76,13],[78,14],[79,15],[118,16],[82,17],[86,18],[95,19],[93,20],[83,21],[81,22],[87,23],[107,24],[96,25],[97,26],[98,15],[80,16],[119,27],[122,28],[90,29],[91,30],[89,30],[106,31],[105,32],[100,33],[94,34],[121,35],[104,36],[109,37],[99,38],[84,37],[85,39],[117,40],[116,41],[115,42],[73,43],[74,44],[72,45],[131,46],[68,47],[132,48],[133,49],[127,50],[129,51],[125,50],[128,52],[126,53],[149,54],[67,55],[150,49],[130,56]],"latestChangedDtsFile":"./types/utils/index.d.ts"}
|
|
@@ -1,239 +0,0 @@
|
|
|
1
|
-
import { createStorageKey as e, getPickedConfig as t, localStore as n, supportsWindow as r } from "@picked/client";
|
|
2
|
-
import { attach as i, createEffect as a, sample as o } from "effector";
|
|
3
|
-
//#region src/utils/debounce.ts
|
|
4
|
-
function s(e, t) {
|
|
5
|
-
let n, r;
|
|
6
|
-
return (...i) => (r && r.reject(/* @__PURE__ */ Error("Debounced")), new Promise((a, o) => {
|
|
7
|
-
r = {
|
|
8
|
-
resolve: a,
|
|
9
|
-
reject: o
|
|
10
|
-
}, clearTimeout(n), n = setTimeout(async () => {
|
|
11
|
-
n = void 0;
|
|
12
|
-
try {
|
|
13
|
-
let t = await e(...i);
|
|
14
|
-
r?.resolve(t);
|
|
15
|
-
} catch (e) {
|
|
16
|
-
r?.reject(e);
|
|
17
|
-
} finally {
|
|
18
|
-
r = null;
|
|
19
|
-
}
|
|
20
|
-
}, t);
|
|
21
|
-
}));
|
|
22
|
-
}
|
|
23
|
-
//#endregion
|
|
24
|
-
//#region src/plugins/shopify/picked-config.ts
|
|
25
|
-
function c() {
|
|
26
|
-
if (r()) return t();
|
|
27
|
-
}
|
|
28
|
-
function l() {
|
|
29
|
-
if (r()) return c()?.customer;
|
|
30
|
-
}
|
|
31
|
-
function u() {
|
|
32
|
-
if (r()) return c()?.product;
|
|
33
|
-
}
|
|
34
|
-
function d() {
|
|
35
|
-
if (r()) return c()?.collection;
|
|
36
|
-
}
|
|
37
|
-
function f() {
|
|
38
|
-
if (r()) return c()?.experiments;
|
|
39
|
-
}
|
|
40
|
-
function p() {
|
|
41
|
-
if (r()) return c()?.storefront_api?.token;
|
|
42
|
-
}
|
|
43
|
-
function m() {
|
|
44
|
-
let t = e("shopify-roll"), r = n.get(t);
|
|
45
|
-
try {
|
|
46
|
-
let e = r.json();
|
|
47
|
-
if (typeof e == "number") return e;
|
|
48
|
-
} catch {}
|
|
49
|
-
let i = Math.random() * 100;
|
|
50
|
-
return r.set(i), i;
|
|
51
|
-
}
|
|
52
|
-
function h() {
|
|
53
|
-
let e = f();
|
|
54
|
-
if (!e) return {};
|
|
55
|
-
let t = m();
|
|
56
|
-
try {
|
|
57
|
-
return e.reduce((e, n) => {
|
|
58
|
-
let r = e ? { ...e } : {};
|
|
59
|
-
return n.enabled && (r[n.id] = {
|
|
60
|
-
name: n.name,
|
|
61
|
-
key: n.version.toString(),
|
|
62
|
-
enabled: n.enabled,
|
|
63
|
-
weight: n.weight,
|
|
64
|
-
decide: () => t < n.weight
|
|
65
|
-
}), r;
|
|
66
|
-
}, {});
|
|
67
|
-
} catch {
|
|
68
|
-
return {};
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
//#endregion
|
|
72
|
-
//#region src/plugins/shopify/predicates.ts
|
|
73
|
-
var g = {
|
|
74
|
-
homepage: /^\/$/,
|
|
75
|
-
productPage: /(?:^|\/)products\/(?<productHandle>[^/]+)\/?$/,
|
|
76
|
-
collection: /^\/collections\/[^/]+\/?$/,
|
|
77
|
-
page: /(?:^|\/)pages\/(?<pageHandle>[^/]+)\/?$/,
|
|
78
|
-
blog: /(?:^|\/)blogs\/(?<blogHandle>[^/]+)\/?$/,
|
|
79
|
-
article: /^\/blogs\/[^/]+\/(?<article>[^/]+)\/?$/,
|
|
80
|
-
cart: /(?:^|\/)cart\/[^/]+$/,
|
|
81
|
-
checkout: /^\/checkout\/.+/,
|
|
82
|
-
appProxy: /^\/(?:a|apps|community|tools)\/(?<proxyTarget>[^/]+)/,
|
|
83
|
-
accountWildcard: /^\/account\/.+/,
|
|
84
|
-
accountLogin: /^\/account\/login(?:\/|$)/,
|
|
85
|
-
accountRegister: /^\/account\/register(?:\/|$)/,
|
|
86
|
-
accountRecover: /^\/account\/login#recover$/
|
|
87
|
-
}, _ = (e, t) => t ? !!e.exec(t.pathname) : !1, v = (e, t) => {
|
|
88
|
-
if (t) {
|
|
89
|
-
let n = e.exec(t.pathname);
|
|
90
|
-
if (n) return n[1];
|
|
91
|
-
}
|
|
92
|
-
}, y = (e) => {
|
|
93
|
-
switch (e) {
|
|
94
|
-
case "product": return u()?.handle ?? !1;
|
|
95
|
-
case "collection": return d()?.handle ?? !1;
|
|
96
|
-
default: return !1;
|
|
97
|
-
}
|
|
98
|
-
}, b = {
|
|
99
|
-
"is-page": ({ location: e }) => _(g.page, e),
|
|
100
|
-
"get-page-handle": ({ location: e }) => v(g.page, e),
|
|
101
|
-
"is-product-page": () => !!y("product"),
|
|
102
|
-
"get-product-handle": () => y("product"),
|
|
103
|
-
"is-collection-page": () => !!y("collection"),
|
|
104
|
-
"get-collection-handle": () => y("collection"),
|
|
105
|
-
"is-blog-page": ({ location: e }) => _(g.blog, e),
|
|
106
|
-
"get-blog-handle": ({ location: e }) => v(g.blog, e),
|
|
107
|
-
"is-article-page": ({ location: e }) => _(g.article, e),
|
|
108
|
-
"get-article-handle": ({ location: e }) => v(g.article, e),
|
|
109
|
-
"is-app-proxy-page": ({ location: e }) => _(g.appProxy, e),
|
|
110
|
-
"get-app-proxy-handle": ({ location: e }) => v(g.appProxy, e),
|
|
111
|
-
"is-account-page": ({ location: e }) => _(g.accountWildcard, e),
|
|
112
|
-
"is-login-page": ({ location: e }) => _(g.accountLogin, e),
|
|
113
|
-
"is-register-page": ({ location: e }) => _(g.accountRegister, e),
|
|
114
|
-
"is-cart-page": ({ location: e }) => _(g.cart, e),
|
|
115
|
-
"is-checkout-page": ({ location: e }) => _(g.checkout, e),
|
|
116
|
-
"is-homepage": ({ location: e }) => _(g.homepage, e)
|
|
117
|
-
};
|
|
118
|
-
//#endregion
|
|
119
|
-
//#region src/plugins/shopify/global-obj.ts
|
|
120
|
-
function x() {
|
|
121
|
-
if (!r() || !globalThis.window.Shopify) throw Error("Shopify global object not found. This plugin must be used on a Shopify storefront page.");
|
|
122
|
-
return globalThis.window.Shopify;
|
|
123
|
-
}
|
|
124
|
-
function S(e) {
|
|
125
|
-
return typeof x().analytics?.publish == "function";
|
|
126
|
-
}
|
|
127
|
-
//#endregion
|
|
128
|
-
//#region src/plugins/shopify/plugin.ts
|
|
129
|
-
var C = (e) => new Promise((t) => {
|
|
130
|
-
setTimeout(t, e);
|
|
131
|
-
}), w = /* @__PURE__ */ new Set([
|
|
132
|
-
"experience_initialize",
|
|
133
|
-
"feature_decide",
|
|
134
|
-
"initialize",
|
|
135
|
-
"session",
|
|
136
|
-
"user_decide"
|
|
137
|
-
]), T = () => ({
|
|
138
|
-
name: "shopify",
|
|
139
|
-
setup: (e) => {
|
|
140
|
-
let t = {}, n = 0, c = async () => {
|
|
141
|
-
if (n >= 3) return;
|
|
142
|
-
n++, await P({ attributes: t }), await C(2e3);
|
|
143
|
-
let e = await M();
|
|
144
|
-
for (let [n, r] of Object.entries(t)) if (e.attributes[n] !== r) return c();
|
|
145
|
-
}, l = s(async () => (n = 0, c()), 50);
|
|
146
|
-
if (Object.entries(b).forEach(([t, n]) => {
|
|
147
|
-
e.registerPredicate(`shopify-${t}`, n);
|
|
148
|
-
}), !r()) return;
|
|
149
|
-
let u = e.session.store.map((e) => e.id), d = e.session.store.map((e) => e.isUser, { skipVoid: !1 }), f = a((e) => {
|
|
150
|
-
e.type === "session" && S(globalThis.window) && globalThis.window.Shopify.analytics.publish("picked:session", { id: e.id });
|
|
151
|
-
}), p = i({
|
|
152
|
-
source: {
|
|
153
|
-
sessionId: u,
|
|
154
|
-
isUser: d,
|
|
155
|
-
features: e.features.listStore
|
|
156
|
-
},
|
|
157
|
-
effect: ({ sessionId: e, isUser: n, features: r }) => {
|
|
158
|
-
if (!S(globalThis.window) || !e) return;
|
|
159
|
-
let i = { "picked.id": e };
|
|
160
|
-
n !== void 0 && (i["picked.is_user"] = n ? "true" : "false"), r.forEach((e) => {
|
|
161
|
-
if (e.isResolved) {
|
|
162
|
-
let t = e.getBucket();
|
|
163
|
-
i[`picked.features.${e.id}`] = `${t.bucket}`;
|
|
164
|
-
}
|
|
165
|
-
}), t = {
|
|
166
|
-
...t,
|
|
167
|
-
...i
|
|
168
|
-
}, l().catch(() => {});
|
|
169
|
-
}
|
|
170
|
-
});
|
|
171
|
-
o({
|
|
172
|
-
clock: e.eventBus,
|
|
173
|
-
filter: (e) => e.type === "session",
|
|
174
|
-
target: f
|
|
175
|
-
}), o({
|
|
176
|
-
clock: e.eventBus,
|
|
177
|
-
filter: (e) => w.has(e.type),
|
|
178
|
-
target: p
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
});
|
|
182
|
-
//#endregion
|
|
183
|
-
//#region src/utils/request.ts
|
|
184
|
-
function E() {
|
|
185
|
-
let e = x();
|
|
186
|
-
return new URL(`${globalThis.window.location.origin}${e.routes.root}`);
|
|
187
|
-
}
|
|
188
|
-
async function D(e) {
|
|
189
|
-
let t = new URL(e, E()), n = await fetch(t.toString());
|
|
190
|
-
if (!n.ok) throw Error(n.statusText);
|
|
191
|
-
return n.json();
|
|
192
|
-
}
|
|
193
|
-
async function O(e, t) {
|
|
194
|
-
let n = new URL(e, E()), r = await fetch(n.toString(), {
|
|
195
|
-
method: "POST",
|
|
196
|
-
headers: { "Content-Type": "application/json" },
|
|
197
|
-
body: JSON.stringify(t)
|
|
198
|
-
});
|
|
199
|
-
if (!r.ok) throw Error(r.statusText);
|
|
200
|
-
return r.json();
|
|
201
|
-
}
|
|
202
|
-
//#endregion
|
|
203
|
-
//#region src/ajax-api/index.ts
|
|
204
|
-
function k(e) {
|
|
205
|
-
return D(`products/${e}.js`);
|
|
206
|
-
}
|
|
207
|
-
function A(e, t, n) {
|
|
208
|
-
return D(`recommendations/products.json?product_id=${e}&limit=${t}&intent=${n}`);
|
|
209
|
-
}
|
|
210
|
-
function j(e) {
|
|
211
|
-
return D(`search/suggest.json?q=${e}`);
|
|
212
|
-
}
|
|
213
|
-
function M() {
|
|
214
|
-
return D("cart.js");
|
|
215
|
-
}
|
|
216
|
-
function N(e) {
|
|
217
|
-
return O("cart/add.js", Array.isArray(e) ? { items: e } : { items: [e] });
|
|
218
|
-
}
|
|
219
|
-
function P(e) {
|
|
220
|
-
return O("cart/update.js", { ...e });
|
|
221
|
-
}
|
|
222
|
-
function F(e, t, n) {
|
|
223
|
-
return O("cart/change.js", {
|
|
224
|
-
line: e,
|
|
225
|
-
quantity: t,
|
|
226
|
-
properties: n
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
|
-
function I() {
|
|
230
|
-
return O("cart/clear.js", {});
|
|
231
|
-
}
|
|
232
|
-
function L(e) {
|
|
233
|
-
let t = new URLSearchParams();
|
|
234
|
-
return Object.entries(e).forEach(([e, n]) => {
|
|
235
|
-
t.append(`shipping_address[${e}]`, n);
|
|
236
|
-
}), D(`cart/shipping_rates.json?${t.toString()}`);
|
|
237
|
-
}
|
|
238
|
-
//#endregion
|
|
239
|
-
export { f as _, j as a, p as b, L as c, O as d, T as f, l as g, d as h, M as i, P as l, c as m, F as n, k as o, x as p, I as r, A as s, N as t, D as u, h as v, u as y };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
let e=require("@picked/client"),t=require("effector");function n(e,t){let n,r;return(...i)=>(r&&r.reject(Error(`Debounced`)),new Promise((a,o)=>{r={resolve:a,reject:o},clearTimeout(n),n=setTimeout(async()=>{n=void 0;try{let t=await e(...i);r?.resolve(t)}catch(e){r?.reject(e)}finally{r=null}},t)}))}function r(){if((0,e.supportsWindow)())return(0,e.getPickedConfig)()}function i(){if((0,e.supportsWindow)())return r()?.customer}function a(){if((0,e.supportsWindow)())return r()?.product}function o(){if((0,e.supportsWindow)())return r()?.collection}function s(){if((0,e.supportsWindow)())return r()?.experiments}function c(){if((0,e.supportsWindow)())return r()?.storefront_api?.token}function l(){let t=(0,e.createStorageKey)(`shopify-roll`),n=e.localStore.get(t);try{let e=n.json();if(typeof e==`number`)return e}catch{}let r=Math.random()*100;return n.set(r),r}function u(){let e=s();if(!e)return{};let t=l();try{return e.reduce((e,n)=>{let r=e?{...e}:{};return n.enabled&&(r[n.id]={name:n.name,key:n.version.toString(),enabled:n.enabled,weight:n.weight,decide:()=>t<n.weight}),r},{})}catch{return{}}}var d={homepage:/^\/$/,productPage:/(?:^|\/)products\/(?<productHandle>[^/]+)\/?$/,collection:/^\/collections\/[^/]+\/?$/,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(?:\/|$)/,accountRecover:/^\/account\/login#recover$/},f=(e,t)=>t?!!e.exec(t.pathname):!1,p=(e,t)=>{if(t){let n=e.exec(t.pathname);if(n)return n[1]}},m=e=>{switch(e){case`product`:return a()?.handle??!1;case`collection`:return o()?.handle??!1;default:return!1}},h={"is-page":({location:e})=>f(d.page,e),"get-page-handle":({location:e})=>p(d.page,e),"is-product-page":()=>!!m(`product`),"get-product-handle":()=>m(`product`),"is-collection-page":()=>!!m(`collection`),"get-collection-handle":()=>m(`collection`),"is-blog-page":({location:e})=>f(d.blog,e),"get-blog-handle":({location:e})=>p(d.blog,e),"is-article-page":({location:e})=>f(d.article,e),"get-article-handle":({location:e})=>p(d.article,e),"is-app-proxy-page":({location:e})=>f(d.appProxy,e),"get-app-proxy-handle":({location:e})=>p(d.appProxy,e),"is-account-page":({location:e})=>f(d.accountWildcard,e),"is-login-page":({location:e})=>f(d.accountLogin,e),"is-register-page":({location:e})=>f(d.accountRegister,e),"is-cart-page":({location:e})=>f(d.cart,e),"is-checkout-page":({location:e})=>f(d.checkout,e),"is-homepage":({location:e})=>f(d.homepage,e)};function g(){if(!(0,e.supportsWindow)()||!globalThis.window.Shopify)throw Error(`Shopify global object not found. This plugin must be used on a Shopify storefront page.`);return globalThis.window.Shopify}function _(e){return typeof g().analytics?.publish==`function`}var v=e=>new Promise(t=>{setTimeout(t,e)}),y=new Set([`experience_initialize`,`feature_decide`,`initialize`,`session`,`user_decide`]),b=()=>({name:`shopify`,setup:r=>{let i={},a=0,o=async()=>{if(a>=3)return;a++,await k({attributes:i}),await v(2e3);let e=await D();for(let[t,n]of Object.entries(i))if(e.attributes[t]!==n)return o()},s=n(async()=>(a=0,o()),50);if(Object.entries(h).forEach(([e,t])=>{r.registerPredicate(`shopify-${e}`,t)}),!(0,e.supportsWindow)())return;let c=r.session.store.map(e=>e.id),l=r.session.store.map(e=>e.isUser,{skipVoid:!1}),u=(0,t.createEffect)(e=>{e.type===`session`&&_(globalThis.window)&&globalThis.window.Shopify.analytics.publish(`picked:session`,{id:e.id})}),d=(0,t.attach)({source:{sessionId:c,isUser:l,features:r.features.listStore},effect:({sessionId:e,isUser:t,features:n})=>{if(!_(globalThis.window)||!e)return;let r={"picked.id":e};t!==void 0&&(r[`picked.is_user`]=t?`true`:`false`),n.forEach(e=>{if(e.isResolved){let t=e.getBucket();r[`picked.features.${e.id}`]=`${t.bucket}`}}),i={...i,...r},s().catch(()=>{})}});(0,t.sample)({clock:r.eventBus,filter:e=>e.type===`session`,target:u}),(0,t.sample)({clock:r.eventBus,filter:e=>y.has(e.type),target:d})}});function x(){let e=g();return new URL(`${globalThis.window.location.origin}${e.routes.root}`)}async function S(e){let t=new URL(e,x()),n=await fetch(t.toString());if(!n.ok)throw Error(n.statusText);return n.json()}async function C(e,t){let n=new URL(e,x()),r=await fetch(n.toString(),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(!r.ok)throw Error(r.statusText);return r.json()}function w(e){return S(`products/${e}.js`)}function T(e,t,n){return S(`recommendations/products.json?product_id=${e}&limit=${t}&intent=${n}`)}function E(e){return S(`search/suggest.json?q=${e}`)}function D(){return S(`cart.js`)}function O(e){return C(`cart/add.js`,Array.isArray(e)?{items:e}:{items:[e]})}function k(e){return C(`cart/update.js`,{...e})}function A(e,t,n){return C(`cart/change.js`,{line:e,quantity:t,properties:n})}function j(){return C(`cart/clear.js`,{})}function M(e){let t=new URLSearchParams;return Object.entries(e).forEach(([e,n])=>{t.append(`shipping_address[${e}]`,n)}),S(`cart/shipping_rates.json?${t.toString()}`)}Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return k}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return a}});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../ajax-api-xrCwcyZw.cjs");exports.addToCart=e.t,exports.changeCart=e.n,exports.clearCart=e.r,exports.getCart=e.i,exports.getPredictiveSearch=e.a,exports.getProduct=e.o,exports.getProductRecommendations=e.s,exports.getShippingRates=e.c,exports.updateCart=e.l;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../ajax-api-xrCwcyZw.cjs");async function t(t){let{collection:n}=await e.u(`collections/${t}.json`);return{collection:n}}async function n(t,n=20){let{products:r}=await e.u(`collections/${t}/products.json?limit=${n}`);return{products:r}}exports.getCollection=t,exports.getCollectionProducts=n;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../ajax-api-xrCwcyZw.cjs");async function t(t){return e.u(`apps/picked/api/products/${t}/metafields`)}async function n(t){return e.u(`apps/picked/api/collections/${t}/metafields`)}exports.getCollectionMetadata=n,exports.getProductMetadata=t;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../../ajax-api-xrCwcyZw.cjs");exports.getPickedConfig=e.m,exports.getPickedConfigCollection=e.h,exports.getPickedConfigCustomer=e.g,exports.getPickedConfigExperiments=e._,exports.getPickedConfigFeatureExperiments=e.v,exports.getPickedConfigProduct=e.y,exports.getPickedConfigStorefrontApiToken=e.b,exports.getShopify=e.p,exports.shopifyPlugin=e.f;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../ajax-api-xrCwcyZw.cjs");let t=require("@shopify/storefront-api-client");function n(n){let r=e.p(),i=e.b();if(!i)throw Error(`Shopify Storefront API token not found. Ensure the Picked Script is enabled on your Shopify storefront`);return(0,t.createStorefrontApiClient)({storeDomain:r.shop,apiVersion:n.apiVersion,publicAccessToken:i})}var r=()=>{if(!client)throw Error(`Storefront API client not found`);return client};async function i(e,t){if(!e)throw Error(`Cart token is required to apply discount codes`);let n=r(),i={cartId:`gid://shopify/Cart/${e}`,discountCodes:t},a=await n.request(`
|
|
2
|
-
mutation cartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]) {
|
|
3
|
-
cartDiscountCodesUpdate(cartId: $cartId, discountCodes: $discountCodes) {
|
|
4
|
-
userErrors {
|
|
5
|
-
field
|
|
6
|
-
message
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
`,{variables:i});if(a.data.cartDiscountCodesUpdate.userErrors.length>0){let e=a.data.cartDiscountCodesUpdate.userErrors.map(e=>e.message).join(`, `);throw Error(`Discount code application failed: ${e}`)}return a}exports.cartDiscountCodesUpdate=i,exports.createStorefrontApiClient=n,exports.getStorefrontApiClient=r;
|
package/dist/cjs/utils/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../ajax-api-xrCwcyZw.cjs");exports.getRequest=e.u,exports.postRequest=e.d;
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, t as c } from "../../ajax-api-TzqQuV55.js";
|
|
2
|
-
export { c as addToCart, i as changeCart, o as clearCart, n as getCart, e as getPredictiveSearch, a as getProduct, s as getProductRecommendations, t as getShippingRates, r as updateCart };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { u as e } from "../../ajax-api-TzqQuV55.js";
|
|
2
|
-
//#region src/json-api/index.ts
|
|
3
|
-
async function t(t) {
|
|
4
|
-
let { collection: n } = await e(`collections/${t}.json`);
|
|
5
|
-
return { collection: n };
|
|
6
|
-
}
|
|
7
|
-
async function n(t, n = 20) {
|
|
8
|
-
let { products: r } = await e(`collections/${t}/products.json?limit=${n}`);
|
|
9
|
-
return { products: r };
|
|
10
|
-
}
|
|
11
|
-
//#endregion
|
|
12
|
-
export { t as getCollection, n as getCollectionProducts };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { u as e } from "../../ajax-api-TzqQuV55.js";
|
|
2
|
-
//#region src/picked-app/index.ts
|
|
3
|
-
async function t(t) {
|
|
4
|
-
return e(`apps/picked/api/products/${t}/metafields`);
|
|
5
|
-
}
|
|
6
|
-
async function n(t) {
|
|
7
|
-
return e(`apps/picked/api/collections/${t}/metafields`);
|
|
8
|
-
}
|
|
9
|
-
//#endregion
|
|
10
|
-
export { n as getCollectionMetadata, t as getProductMetadata };
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { _ as e, b as t, f as n, g as r, h as i, m as a, p as o, v as s, y as c } from "../../../ajax-api-TzqQuV55.js";
|
|
2
|
-
export { a as getPickedConfig, i as getPickedConfigCollection, r as getPickedConfigCustomer, e as getPickedConfigExperiments, s as getPickedConfigFeatureExperiments, c as getPickedConfigProduct, t as getPickedConfigStorefrontApiToken, o as getShopify, n as shopifyPlugin };
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { b as e, p as t } from "../../ajax-api-TzqQuV55.js";
|
|
2
|
-
import { createStorefrontApiClient as n } from "@shopify/storefront-api-client";
|
|
3
|
-
//#region src/storefront-api/index.ts
|
|
4
|
-
function r(r) {
|
|
5
|
-
let i = t(), a = e();
|
|
6
|
-
if (!a) throw Error("Shopify Storefront API token not found. Ensure the Picked Script is enabled on your Shopify storefront");
|
|
7
|
-
return n({
|
|
8
|
-
storeDomain: i.shop,
|
|
9
|
-
apiVersion: r.apiVersion,
|
|
10
|
-
publicAccessToken: a
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
var i = () => {
|
|
14
|
-
if (!client) throw Error("Storefront API client not found");
|
|
15
|
-
return client;
|
|
16
|
-
};
|
|
17
|
-
async function a(e, t) {
|
|
18
|
-
if (!e) throw Error("Cart token is required to apply discount codes");
|
|
19
|
-
let n = i(), r = {
|
|
20
|
-
cartId: `gid://shopify/Cart/${e}`,
|
|
21
|
-
discountCodes: t
|
|
22
|
-
}, a = await n.request("\n mutation cartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]) {\n cartDiscountCodesUpdate(cartId: $cartId, discountCodes: $discountCodes) {\n userErrors {\n field\n message\n }\n }\n }\n ", { variables: r });
|
|
23
|
-
if (a.data.cartDiscountCodesUpdate.userErrors.length > 0) {
|
|
24
|
-
let e = a.data.cartDiscountCodesUpdate.userErrors.map((e) => e.message).join(", ");
|
|
25
|
-
throw Error(`Discount code application failed: ${e}`);
|
|
26
|
-
}
|
|
27
|
-
return a;
|
|
28
|
-
}
|
|
29
|
-
//#endregion
|
|
30
|
-
export { a as cartDiscountCodesUpdate, r as createStorefrontApiClient, i as getStorefrontApiClient };
|
package/dist/esm/utils/index.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { 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<ShopifyAjaxApiShippingRate>;
|
|
21
|
-
}>;
|
|
22
|
-
//# sourceMappingURL=index.d.ts.map
|