@faststore/core 3.0.20 → 3.0.21
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/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +90 -89
- package/.next/cache/.tsbuildinfo +1 -1
- package/.next/cache/eslint/.cache_abdhua +1 -0
- package/.next/cache/next-server.js.nft.json +1 -0
- package/.next/cache/webpack/client-development/0.pack +0 -0
- package/.next/cache/webpack/client-development/1.pack +0 -0
- package/.next/cache/webpack/client-development/2.pack +0 -0
- package/.next/cache/webpack/client-development/index.pack +0 -0
- package/.next/cache/webpack/client-development/index.pack.old +0 -0
- package/.next/cache/webpack/client-production/0.pack +0 -0
- package/.next/cache/webpack/client-production/1.pack +0 -0
- package/.next/cache/webpack/client-production/2.pack +0 -0
- package/.next/cache/webpack/client-production/index.pack +0 -0
- package/.next/cache/webpack/client-production/index.pack.old +0 -0
- package/.next/cache/webpack/server-development/0.pack +0 -0
- package/.next/cache/webpack/server-development/1.pack +0 -0
- package/.next/cache/webpack/server-development/2.pack +0 -0
- package/.next/cache/webpack/server-development/3.pack +0 -0
- package/.next/cache/webpack/server-development/4.pack +0 -0
- package/.next/cache/webpack/server-development/index.pack +0 -0
- package/.next/cache/webpack/server-development/index.pack.old +0 -0
- package/.next/cache/webpack/server-production/0.pack +0 -0
- package/.next/cache/webpack/server-production/1.pack +0 -0
- package/.next/cache/webpack/server-production/2.pack +0 -0
- package/.next/cache/webpack/server-production/index.pack +0 -0
- package/.next/cache/webpack/server-production/index.pack.old +0 -0
- package/.next/images-manifest.json +1 -1
- package/.next/next-server.js.nft.json +1 -1
- package/.next/prerender-manifest.json +1 -1
- package/.next/react-loadable-manifest.json +18 -18
- package/.next/required-server-files.json +1 -1
- package/.next/routes-manifest.json +1 -1
- package/.next/server/chunks/117.js +430 -0
- package/.next/server/chunks/177.js +125 -0
- package/.next/server/chunks/183.js +122 -0
- package/.next/server/chunks/184.js +61 -0
- package/.next/server/chunks/289.js +240 -0
- package/.next/server/chunks/312.js +678 -0
- package/.next/server/chunks/350.js +2834 -0
- package/.next/server/chunks/386.js +200 -0
- package/.next/server/chunks/390.js +550 -0
- package/.next/server/chunks/398.js +611 -0
- package/.next/server/chunks/404.js +434 -1
- package/.next/server/chunks/53.js +61 -0
- package/.next/server/chunks/57.js +434 -1
- package/.next/server/chunks/574.js +145 -0
- package/.next/server/chunks/576.js +122 -0
- package/.next/server/chunks/585.js +640 -0
- package/.next/server/chunks/676.js +32 -0
- package/.next/server/chunks/693.js +58 -1
- package/.next/server/chunks/732.js +1881 -0
- package/.next/server/chunks/74.js +4066 -0
- package/.next/server/chunks/779.js +58 -1
- package/.next/server/chunks/825.js +4074 -0
- package/.next/server/chunks/854.js +72 -0
- package/.next/server/chunks/859.js +957 -4
- package/.next/server/chunks/863.js +111 -0
- package/.next/server/chunks/979.js +1305 -0
- package/.next/server/chunks/98.js +163 -0
- package/.next/server/chunks/988.js +211 -0
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/.next/server/pages/404.js +391 -1
- package/.next/server/pages/404.js.nft.json +1 -1
- package/.next/server/pages/500.js +395 -1
- package/.next/server/pages/500.js.nft.json +1 -1
- package/.next/server/pages/[...slug].js +1076 -1
- package/.next/server/pages/[...slug].js.nft.json +1 -1
- package/.next/server/pages/[slug]/p.js +2265 -1
- package/.next/server/pages/[slug]/p.js.nft.json +1 -1
- package/.next/server/pages/_app.js +301 -1
- package/.next/server/pages/_app.js.nft.json +1 -1
- package/.next/server/pages/_document.js +363 -1
- package/.next/server/pages/_document.js.nft.json +1 -1
- package/.next/server/pages/_error.js +164 -1
- package/.next/server/pages/_error.js.nft.json +1 -1
- package/.next/server/pages/account.js +370 -1
- package/.next/server/pages/account.js.nft.json +1 -1
- package/.next/server/pages/api/graphql.js +2999 -1
- package/.next/server/pages/api/graphql.js.nft.json +1 -1
- package/.next/server/pages/api/health/live.js +31 -1
- package/.next/server/pages/api/health/live.js.nft.json +1 -1
- package/.next/server/pages/api/health/ready.js +31 -1
- package/.next/server/pages/api/health/ready.js.nft.json +1 -1
- package/.next/server/pages/api/preview.js +137 -1
- package/.next/server/pages/api/preview.js.nft.json +1 -1
- package/.next/server/pages/checkout.js +370 -1
- package/.next/server/pages/checkout.js.nft.json +1 -1
- package/.next/server/pages/en-US/404.html +2 -2
- package/.next/server/pages/en-US/404.json +1 -1
- package/.next/server/pages/en-US/500.html +2 -2
- package/.next/server/pages/en-US/500.json +1 -1
- package/.next/server/pages/en-US/account.html +2 -2
- package/.next/server/pages/en-US/account.json +1 -1
- package/.next/server/pages/en-US/checkout.html +2 -2
- package/.next/server/pages/en-US/checkout.json +1 -1
- package/.next/server/pages/en-US/login.html +2 -2
- package/.next/server/pages/en-US/login.json +1 -1
- package/.next/server/pages/en-US/s.html +2 -2
- package/.next/server/pages/en-US/s.json +1 -1
- package/.next/server/pages/en-US.html +5 -5
- package/.next/server/pages/en-US.json +1 -1
- package/.next/server/pages/index.js +439 -1
- package/.next/server/pages/index.js.nft.json +1 -1
- package/.next/server/pages/login.js +382 -1
- package/.next/server/pages/login.js.nft.json +1 -1
- package/.next/server/pages/s.js +554 -1
- package/.next/server/pages/s.js.nft.json +1 -1
- package/.next/server/pages-manifest.json +18 -1
- package/.next/server/webpack-api-runtime.js +229 -1
- package/.next/server/webpack-runtime.js +229 -1
- package/.next/static/HI-kc1kjNIbFyFsZCeDEA/_buildManifest.js +1 -0
- package/.next/static/chunks/223-cb77217cce52d45c.js +1 -0
- package/.next/static/chunks/251.1c79f06f2a2814b1.js +1 -0
- package/.next/static/chunks/386.d01e0db26c523f0f.js +1 -0
- package/.next/static/chunks/400-d4daabcd57b2ea80.js +1 -0
- package/.next/static/chunks/469-7259b855711d4ad3.js +1 -0
- package/.next/static/chunks/574.70612be06fd1365f.js +1 -0
- package/.next/static/chunks/585.4c5d40fc6a72a611.js +1 -0
- package/.next/static/chunks/651.7142f31ce1e052b3.js +1 -0
- package/.next/static/chunks/741.52f7fb873418346f.js +1 -0
- package/.next/static/chunks/783-fbcb7a3216c40744.js +1 -0
- package/.next/static/chunks/800.ee4f8b9622001e8c.js +1 -0
- package/.next/static/chunks/98.40c7e17d9de4eb8f.js +1 -0
- package/.next/static/chunks/988.afda042dd9ba11d1.js +1 -0
- package/.next/static/chunks/framework-dfd14d7ce6600b03.js +1 -0
- package/.next/static/chunks/main-e4e873ee741162eb.js +1 -0
- package/.next/static/chunks/pages/404-2240f0b22db2d370.js +1 -0
- package/.next/static/chunks/pages/500-c0580e3299329874.js +1 -0
- package/.next/static/chunks/pages/[...slug]-3eed3497c887fae5.js +1 -0
- package/.next/static/chunks/pages/[slug]/p-e1df08570f34a0d8.js +1 -0
- package/.next/static/chunks/pages/_app-30b9666307e4b3b1.js +1 -0
- package/.next/static/chunks/pages/_error-319451dea77827a6.js +1 -0
- package/.next/static/chunks/pages/account-b35bcbef719765f3.js +1 -0
- package/.next/static/chunks/pages/checkout-55bd56ade4408cbe.js +1 -0
- package/.next/static/chunks/pages/index-2506749e45c335bf.js +1 -0
- package/.next/static/chunks/pages/login-3f94bff1503b4fdc.js +1 -0
- package/.next/static/chunks/pages/s-2374cff2e39ed624.js +1 -0
- package/.next/static/chunks/webpack-af94306e71c4459d.js +1 -0
- package/.next/static/css/29868543c76bc6fd.css +1 -0
- package/.next/static/css/527e334fa69cf40a.css +1 -0
- package/.next/static/css/{b9d9ba1b04f3160d.css → 6a7fdc5a21fbead5.css} +1 -1
- package/.next/static/css/723835bce380750d.css +1 -0
- package/.next/static/css/{d586715f4f707df4.css → a2eefb25a4608343.css} +1 -1
- package/.next/static/css/{e32410b31c666cb2.css → cb7d1fcea42fab9c.css} +1 -1
- package/.next/static/css/d7bbfbd552f407e9.css +1 -0
- package/.next/static/css/{2980acad3f8e1028.css → df588bb98c0b0ca6.css} +1 -1
- package/.next/static/css/dfbdb0f27fd64782.css +1 -0
- package/.next/static/css/e84fc497732ea596.css +1 -0
- package/.next/trace +80 -91
- package/.turbo/turbo-build.log +1 -1
- package/.turbo/turbo-dev.log +45 -0
- package/@generated/gql.ts +4 -4
- package/@generated/graphql.ts +54 -12
- package/package.json +3 -3
- package/src/components/product/ProductCard/ProductCard.tsx +7 -0
- package/src/components/sections/ProductDetails/ProductDetails.tsx +7 -0
- package/.next/cache/config.json +0 -7
- package/.next/cache/eslint/.cache_1gneedd +0 -1
- package/.next/next-minimal-server.js.nft.json +0 -1
- package/.next/prerender-manifest.js +0 -1
- package/.next/server/chunks/119.js +0 -1
- package/.next/server/chunks/12.js +0 -1
- package/.next/server/chunks/187.js +0 -1
- package/.next/server/chunks/202.js +0 -1
- package/.next/server/chunks/24.js +0 -1
- package/.next/server/chunks/242.js +0 -1
- package/.next/server/chunks/247.js +0 -1
- package/.next/server/chunks/344.js +0 -1
- package/.next/server/chunks/414.js +0 -1
- package/.next/server/chunks/484.js +0 -1
- package/.next/server/chunks/493.js +0 -1
- package/.next/server/chunks/498.js +0 -1
- package/.next/server/chunks/540.js +0 -1
- package/.next/server/chunks/624.js +0 -1
- package/.next/server/chunks/640.js +0 -6
- package/.next/server/chunks/646.js +0 -280
- package/.next/server/chunks/659.js +0 -9
- package/.next/server/chunks/679.js +0 -1
- package/.next/server/chunks/694.js +0 -1
- package/.next/server/chunks/82.js +0 -8
- package/.next/server/chunks/857.js +0 -1
- package/.next/server/chunks/881.js +0 -1
- package/.next/server/chunks/917.js +0 -1
- package/.next/server/chunks/936.js +0 -1
- package/.next/server/chunks/96.js +0 -1
- package/.next/server/chunks/997.js +0 -1
- package/.next/server/functions-config-manifest.json +0 -1
- package/.next/server/next-font-manifest.js +0 -1
- package/.next/server/next-font-manifest.json +0 -1
- package/.next/static/chunks/104-4f83b1d87ad36358.js +0 -1
- package/.next/static/chunks/161-b39fe2f79ff7bc85.js +0 -1
- package/.next/static/chunks/202.c7d8a71173edecfb.js +0 -1
- package/.next/static/chunks/217.01bc0ad07edd6f1b.js +0 -1
- package/.next/static/chunks/247.6f1391104a867395.js +0 -1
- package/.next/static/chunks/484.b82b73b1d8c37e02.js +0 -1
- package/.next/static/chunks/540.6c62d2536d42a1e0.js +0 -1
- package/.next/static/chunks/575-853fb8b1ba4ce8c4.js +0 -14
- package/.next/static/chunks/624.d3de62b4562a33f3.js +0 -1
- package/.next/static/chunks/629-c74f247bd29420a5.js +0 -1
- package/.next/static/chunks/65.da22595d53beae76.js +0 -1
- package/.next/static/chunks/758.b53ee01b506973e0.js +0 -1
- package/.next/static/chunks/857.d2299cfe995af21d.js +0 -1
- package/.next/static/chunks/framework-8e279965036b6169.js +0 -33
- package/.next/static/chunks/main-6f63f6746cc029db.js +0 -1
- package/.next/static/chunks/pages/404-1334d11ab8467b3d.js +0 -1
- package/.next/static/chunks/pages/500-449c5bd51f98423f.js +0 -1
- package/.next/static/chunks/pages/[...slug]-bcaf61b01157d8cb.js +0 -1
- package/.next/static/chunks/pages/[slug]/p-5fb8fe2c80ec1608.js +0 -1
- package/.next/static/chunks/pages/_app-ad8623e78bc5b766.js +0 -68
- package/.next/static/chunks/pages/_error-fbf331a03642b495.js +0 -1
- package/.next/static/chunks/pages/account-dbc5c028225cd1ac.js +0 -1
- package/.next/static/chunks/pages/checkout-29ae2c37eaf172e1.js +0 -1
- package/.next/static/chunks/pages/index-cd109119d65df8e3.js +0 -1
- package/.next/static/chunks/pages/login-c4d2c856008df5ac.js +0 -1
- package/.next/static/chunks/pages/s-26e475975386c51a.js +0 -1
- package/.next/static/chunks/webpack-b4a2fdf4ef127bb7.js +0 -1
- package/.next/static/css/0d45c82d8887a269.css +0 -1
- package/.next/static/css/211c7542af66d8b4.css +0 -1
- package/.next/static/css/4c4d90eb8cb1d2b7.css +0 -1
- package/.next/static/css/821a5219786be653.css +0 -1
- package/.next/static/css/96e3fddf695d6aa9.css +0 -1
- package/.next/static/css/cff9aafa16fccc9c.css +0 -1
- package/.next/static/rG9HjHHbItuqOEnXtbNZ5/_buildManifest.js +0 -1
- package/.turbo/turbo-lint.log +0 -2
- package/.turbo/turbo-test.log +0 -23
- package/@generated/graphql/persisted.json +0 -13
- package/@generated/graphql/schema.graphql +0 -1053
- package/@generated/persisted-documents.json +0 -13
- package/@generated/schema.graphql +0 -1055
- /package/.next/static/{rG9HjHHbItuqOEnXtbNZ5 → HI-kc1kjNIbFyFsZCeDEA}/_ssgManifest.js +0 -0
|
@@ -1 +1,434 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.id = 57;
|
|
3
|
+
exports.ids = [57];
|
|
4
|
+
exports.modules = {
|
|
5
|
+
|
|
6
|
+
/***/ 3057:
|
|
7
|
+
/***/ ((module) => {
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Copyright (c) 2019-present, GraphQL Foundation
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the MIT license found in the
|
|
15
|
+
* LICENSE file in the root directory of this source tree.
|
|
16
|
+
*
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
// A Function, which when given an Array of keys, returns a Promise of an Array
|
|
20
|
+
// of values or Errors.
|
|
21
|
+
// Optionally turn off batching or caching or provide a cache key function or a
|
|
22
|
+
// custom cache instance.
|
|
23
|
+
// If a custom cache is provided, it must be of this type (a subset of ES6 Map).
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* A `DataLoader` creates a public API for loading data from a particular
|
|
27
|
+
* data back-end with unique keys such as the `id` column of a SQL table or
|
|
28
|
+
* document name in a MongoDB database, given a batch loading function.
|
|
29
|
+
*
|
|
30
|
+
* Each `DataLoader` instance contains a unique memoized cache. Use caution when
|
|
31
|
+
* used in long-lived applications or those which serve many users with
|
|
32
|
+
* different access permissions and consider creating a new instance per
|
|
33
|
+
* web request.
|
|
34
|
+
*/
|
|
35
|
+
var DataLoader =
|
|
36
|
+
/*#__PURE__*/
|
|
37
|
+
function () {
|
|
38
|
+
function DataLoader(batchLoadFn, options) {
|
|
39
|
+
if (typeof batchLoadFn !== 'function') {
|
|
40
|
+
throw new TypeError('DataLoader must be constructed with a function which accepts ' + ("Array<key> and returns Promise<Array<value>>, but got: " + batchLoadFn + "."));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
this._batchLoadFn = batchLoadFn;
|
|
44
|
+
this._maxBatchSize = getValidMaxBatchSize(options);
|
|
45
|
+
this._batchScheduleFn = getValidBatchScheduleFn(options);
|
|
46
|
+
this._cacheKeyFn = getValidCacheKeyFn(options);
|
|
47
|
+
this._cacheMap = getValidCacheMap(options);
|
|
48
|
+
this._batch = null;
|
|
49
|
+
} // Private
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
var _proto = DataLoader.prototype;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Loads a key, returning a `Promise` for the value represented by that key.
|
|
56
|
+
*/
|
|
57
|
+
_proto.load = function load(key) {
|
|
58
|
+
if (key === null || key === undefined) {
|
|
59
|
+
throw new TypeError('The loader.load() function must be called with a value, ' + ("but got: " + String(key) + "."));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
var batch = getCurrentBatch(this);
|
|
63
|
+
var cacheMap = this._cacheMap;
|
|
64
|
+
|
|
65
|
+
var cacheKey = this._cacheKeyFn(key); // If caching and there is a cache-hit, return cached Promise.
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
if (cacheMap) {
|
|
69
|
+
var cachedPromise = cacheMap.get(cacheKey);
|
|
70
|
+
|
|
71
|
+
if (cachedPromise) {
|
|
72
|
+
var cacheHits = batch.cacheHits || (batch.cacheHits = []);
|
|
73
|
+
return new Promise(function (resolve) {
|
|
74
|
+
cacheHits.push(function () {
|
|
75
|
+
resolve(cachedPromise);
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
} // Otherwise, produce a new Promise for this key, and enqueue it to be
|
|
80
|
+
// dispatched along with the current batch.
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
batch.keys.push(key);
|
|
84
|
+
var promise = new Promise(function (resolve, reject) {
|
|
85
|
+
batch.callbacks.push({
|
|
86
|
+
resolve: resolve,
|
|
87
|
+
reject: reject
|
|
88
|
+
});
|
|
89
|
+
}); // If caching, cache this promise.
|
|
90
|
+
|
|
91
|
+
if (cacheMap) {
|
|
92
|
+
cacheMap.set(cacheKey, promise);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return promise;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Loads multiple keys, promising an array of values:
|
|
99
|
+
*
|
|
100
|
+
* var [ a, b ] = await myLoader.loadMany([ 'a', 'b' ]);
|
|
101
|
+
*
|
|
102
|
+
* This is similar to the more verbose:
|
|
103
|
+
*
|
|
104
|
+
* var [ a, b ] = await Promise.all([
|
|
105
|
+
* myLoader.load('a'),
|
|
106
|
+
* myLoader.load('b')
|
|
107
|
+
* ]);
|
|
108
|
+
*
|
|
109
|
+
* However it is different in the case where any load fails. Where
|
|
110
|
+
* Promise.all() would reject, loadMany() always resolves, however each result
|
|
111
|
+
* is either a value or an Error instance.
|
|
112
|
+
*
|
|
113
|
+
* var [ a, b, c ] = await myLoader.loadMany([ 'a', 'b', 'badkey' ]);
|
|
114
|
+
* // c instanceof Error
|
|
115
|
+
*
|
|
116
|
+
*/
|
|
117
|
+
;
|
|
118
|
+
|
|
119
|
+
_proto.loadMany = function loadMany(keys) {
|
|
120
|
+
if (!isArrayLike(keys)) {
|
|
121
|
+
throw new TypeError('The loader.loadMany() function must be called with Array<key> ' + ("but got: " + keys + "."));
|
|
122
|
+
} // Support ArrayLike by using only minimal property access
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
var loadPromises = [];
|
|
126
|
+
|
|
127
|
+
for (var i = 0; i < keys.length; i++) {
|
|
128
|
+
loadPromises.push(this.load(keys[i])["catch"](function (error) {
|
|
129
|
+
return error;
|
|
130
|
+
}));
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
return Promise.all(loadPromises);
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Clears the value at `key` from the cache, if it exists. Returns itself for
|
|
137
|
+
* method chaining.
|
|
138
|
+
*/
|
|
139
|
+
;
|
|
140
|
+
|
|
141
|
+
_proto.clear = function clear(key) {
|
|
142
|
+
var cacheMap = this._cacheMap;
|
|
143
|
+
|
|
144
|
+
if (cacheMap) {
|
|
145
|
+
var cacheKey = this._cacheKeyFn(key);
|
|
146
|
+
|
|
147
|
+
cacheMap["delete"](cacheKey);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
return this;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Clears the entire cache. To be used when some event results in unknown
|
|
154
|
+
* invalidations across this particular `DataLoader`. Returns itself for
|
|
155
|
+
* method chaining.
|
|
156
|
+
*/
|
|
157
|
+
;
|
|
158
|
+
|
|
159
|
+
_proto.clearAll = function clearAll() {
|
|
160
|
+
var cacheMap = this._cacheMap;
|
|
161
|
+
|
|
162
|
+
if (cacheMap) {
|
|
163
|
+
cacheMap.clear();
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
return this;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Adds the provided key and value to the cache. If the key already
|
|
170
|
+
* exists, no change is made. Returns itself for method chaining.
|
|
171
|
+
*
|
|
172
|
+
* To prime the cache with an error at a key, provide an Error instance.
|
|
173
|
+
*/
|
|
174
|
+
;
|
|
175
|
+
|
|
176
|
+
_proto.prime = function prime(key, value) {
|
|
177
|
+
var cacheMap = this._cacheMap;
|
|
178
|
+
|
|
179
|
+
if (cacheMap) {
|
|
180
|
+
var cacheKey = this._cacheKeyFn(key); // Only add the key if it does not already exist.
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
if (cacheMap.get(cacheKey) === undefined) {
|
|
184
|
+
// Cache a rejected promise if the value is an Error, in order to match
|
|
185
|
+
// the behavior of load(key).
|
|
186
|
+
var promise;
|
|
187
|
+
|
|
188
|
+
if (value instanceof Error) {
|
|
189
|
+
promise = Promise.reject(value); // Since this is a case where an Error is intentionally being primed
|
|
190
|
+
// for a given key, we want to disable unhandled promise rejection.
|
|
191
|
+
|
|
192
|
+
promise["catch"](function () {});
|
|
193
|
+
} else {
|
|
194
|
+
promise = Promise.resolve(value);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
cacheMap.set(cacheKey, promise);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
return this;
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
return DataLoader;
|
|
205
|
+
}(); // Private: Enqueue a Job to be executed after all "PromiseJobs" Jobs.
|
|
206
|
+
//
|
|
207
|
+
// ES6 JavaScript uses the concepts Job and JobQueue to schedule work to occur
|
|
208
|
+
// after the current execution context has completed:
|
|
209
|
+
// http://www.ecma-international.org/ecma-262/6.0/#sec-jobs-and-job-queues
|
|
210
|
+
//
|
|
211
|
+
// Node.js uses the `process.nextTick` mechanism to implement the concept of a
|
|
212
|
+
// Job, maintaining a global FIFO JobQueue for all Jobs, which is flushed after
|
|
213
|
+
// the current call stack ends.
|
|
214
|
+
//
|
|
215
|
+
// When calling `then` on a Promise, it enqueues a Job on a specific
|
|
216
|
+
// "PromiseJobs" JobQueue which is flushed in Node as a single Job on the
|
|
217
|
+
// global JobQueue.
|
|
218
|
+
//
|
|
219
|
+
// DataLoader batches all loads which occur in a single frame of execution, but
|
|
220
|
+
// should include in the batch all loads which occur during the flushing of the
|
|
221
|
+
// "PromiseJobs" JobQueue after that same execution frame.
|
|
222
|
+
//
|
|
223
|
+
// In order to avoid the DataLoader dispatch Job occuring before "PromiseJobs",
|
|
224
|
+
// A Promise Job is created with the sole purpose of enqueuing a global Job,
|
|
225
|
+
// ensuring that it always occurs after "PromiseJobs" ends.
|
|
226
|
+
//
|
|
227
|
+
// Node.js's job queue is unique. Browsers do not have an equivalent mechanism
|
|
228
|
+
// for enqueuing a job to be performed after promise microtasks and before the
|
|
229
|
+
// next macrotask. For browser environments, a macrotask is used (via
|
|
230
|
+
// setImmediate or setTimeout) at a potential performance penalty.
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
var enqueuePostPromiseJob = typeof process === 'object' && typeof process.nextTick === 'function' ? function (fn) {
|
|
234
|
+
if (!resolvedPromise) {
|
|
235
|
+
resolvedPromise = Promise.resolve();
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
resolvedPromise.then(function () {
|
|
239
|
+
process.nextTick(fn);
|
|
240
|
+
});
|
|
241
|
+
} : typeof setImmediate === 'function' ? function (fn) {
|
|
242
|
+
setImmediate(fn);
|
|
243
|
+
} : function (fn) {
|
|
244
|
+
setTimeout(fn);
|
|
245
|
+
}; // Private: cached resolved Promise instance
|
|
246
|
+
|
|
247
|
+
var resolvedPromise; // Private: Describes a batch of requests
|
|
248
|
+
|
|
249
|
+
// Private: Either returns the current batch, or creates and schedules a
|
|
250
|
+
// dispatch of a new batch for the given loader.
|
|
251
|
+
function getCurrentBatch(loader) {
|
|
252
|
+
// If there is an existing batch which has not yet dispatched and is within
|
|
253
|
+
// the limit of the batch size, then return it.
|
|
254
|
+
var existingBatch = loader._batch;
|
|
255
|
+
|
|
256
|
+
if (existingBatch !== null && !existingBatch.hasDispatched && existingBatch.keys.length < loader._maxBatchSize && (!existingBatch.cacheHits || existingBatch.cacheHits.length < loader._maxBatchSize)) {
|
|
257
|
+
return existingBatch;
|
|
258
|
+
} // Otherwise, create a new batch for this loader.
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
var newBatch = {
|
|
262
|
+
hasDispatched: false,
|
|
263
|
+
keys: [],
|
|
264
|
+
callbacks: []
|
|
265
|
+
}; // Store it on the loader so it may be reused.
|
|
266
|
+
|
|
267
|
+
loader._batch = newBatch; // Then schedule a task to dispatch this batch of requests.
|
|
268
|
+
|
|
269
|
+
loader._batchScheduleFn(function () {
|
|
270
|
+
dispatchBatch(loader, newBatch);
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
return newBatch;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
function dispatchBatch(loader, batch) {
|
|
277
|
+
// Mark this batch as having been dispatched.
|
|
278
|
+
batch.hasDispatched = true; // If there's nothing to load, resolve any cache hits and return early.
|
|
279
|
+
|
|
280
|
+
if (batch.keys.length === 0) {
|
|
281
|
+
resolveCacheHits(batch);
|
|
282
|
+
return;
|
|
283
|
+
} // Call the provided batchLoadFn for this loader with the batch's keys and
|
|
284
|
+
// with the loader as the `this` context.
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
var batchPromise = loader._batchLoadFn(batch.keys); // Assert the expected response from batchLoadFn
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
if (!batchPromise || typeof batchPromise.then !== 'function') {
|
|
291
|
+
return failedDispatch(loader, batch, new TypeError('DataLoader must be constructed with a function which accepts ' + 'Array<key> and returns Promise<Array<value>>, but the function did ' + ("not return a Promise: " + String(batchPromise) + ".")));
|
|
292
|
+
} // Await the resolution of the call to batchLoadFn.
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
batchPromise.then(function (values) {
|
|
296
|
+
// Assert the expected resolution from batchLoadFn.
|
|
297
|
+
if (!isArrayLike(values)) {
|
|
298
|
+
throw new TypeError('DataLoader must be constructed with a function which accepts ' + 'Array<key> and returns Promise<Array<value>>, but the function did ' + ("not return a Promise of an Array: " + String(values) + "."));
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
if (values.length !== batch.keys.length) {
|
|
302
|
+
throw new TypeError('DataLoader must be constructed with a function which accepts ' + 'Array<key> and returns Promise<Array<value>>, but the function did ' + 'not return a Promise of an Array of the same length as the Array ' + 'of keys.' + ("\n\nKeys:\n" + String(batch.keys)) + ("\n\nValues:\n" + String(values)));
|
|
303
|
+
} // Resolve all cache hits in the same micro-task as freshly loaded values.
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
resolveCacheHits(batch); // Step through values, resolving or rejecting each Promise in the batch.
|
|
307
|
+
|
|
308
|
+
for (var i = 0; i < batch.callbacks.length; i++) {
|
|
309
|
+
var value = values[i];
|
|
310
|
+
|
|
311
|
+
if (value instanceof Error) {
|
|
312
|
+
batch.callbacks[i].reject(value);
|
|
313
|
+
} else {
|
|
314
|
+
batch.callbacks[i].resolve(value);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
})["catch"](function (error) {
|
|
318
|
+
failedDispatch(loader, batch, error);
|
|
319
|
+
});
|
|
320
|
+
} // Private: do not cache individual loads if the entire batch dispatch fails,
|
|
321
|
+
// but still reject each request so they do not hang.
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
function failedDispatch(loader, batch, error) {
|
|
325
|
+
// Cache hits are resolved, even though the batch failed.
|
|
326
|
+
resolveCacheHits(batch);
|
|
327
|
+
|
|
328
|
+
for (var i = 0; i < batch.keys.length; i++) {
|
|
329
|
+
loader.clear(batch.keys[i]);
|
|
330
|
+
batch.callbacks[i].reject(error);
|
|
331
|
+
}
|
|
332
|
+
} // Private: Resolves the Promises for any cache hits in this batch.
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
function resolveCacheHits(batch) {
|
|
336
|
+
if (batch.cacheHits) {
|
|
337
|
+
for (var i = 0; i < batch.cacheHits.length; i++) {
|
|
338
|
+
batch.cacheHits[i]();
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
} // Private: given the DataLoader's options, produce a valid max batch size.
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
function getValidMaxBatchSize(options) {
|
|
345
|
+
var shouldBatch = !options || options.batch !== false;
|
|
346
|
+
|
|
347
|
+
if (!shouldBatch) {
|
|
348
|
+
return 1;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
var maxBatchSize = options && options.maxBatchSize;
|
|
352
|
+
|
|
353
|
+
if (maxBatchSize === undefined) {
|
|
354
|
+
return Infinity;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
if (typeof maxBatchSize !== 'number' || maxBatchSize < 1) {
|
|
358
|
+
throw new TypeError("maxBatchSize must be a positive number: " + maxBatchSize);
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
return maxBatchSize;
|
|
362
|
+
} // Private
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
function getValidBatchScheduleFn(options) {
|
|
366
|
+
var batchScheduleFn = options && options.batchScheduleFn;
|
|
367
|
+
|
|
368
|
+
if (batchScheduleFn === undefined) {
|
|
369
|
+
return enqueuePostPromiseJob;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
if (typeof batchScheduleFn !== 'function') {
|
|
373
|
+
throw new TypeError("batchScheduleFn must be a function: " + batchScheduleFn);
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
return batchScheduleFn;
|
|
377
|
+
} // Private: given the DataLoader's options, produce a cache key function.
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
function getValidCacheKeyFn(options) {
|
|
381
|
+
var cacheKeyFn = options && options.cacheKeyFn;
|
|
382
|
+
|
|
383
|
+
if (cacheKeyFn === undefined) {
|
|
384
|
+
return function (key) {
|
|
385
|
+
return key;
|
|
386
|
+
};
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
if (typeof cacheKeyFn !== 'function') {
|
|
390
|
+
throw new TypeError("cacheKeyFn must be a function: " + cacheKeyFn);
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
return cacheKeyFn;
|
|
394
|
+
} // Private: given the DataLoader's options, produce a CacheMap to be used.
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
function getValidCacheMap(options) {
|
|
398
|
+
var shouldCache = !options || options.cache !== false;
|
|
399
|
+
|
|
400
|
+
if (!shouldCache) {
|
|
401
|
+
return null;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
var cacheMap = options && options.cacheMap;
|
|
405
|
+
|
|
406
|
+
if (cacheMap === undefined) {
|
|
407
|
+
return new Map();
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
if (cacheMap !== null) {
|
|
411
|
+
var cacheFunctions = ['get', 'set', 'delete', 'clear'];
|
|
412
|
+
var missingFunctions = cacheFunctions.filter(function (fnName) {
|
|
413
|
+
return cacheMap && typeof cacheMap[fnName] !== 'function';
|
|
414
|
+
});
|
|
415
|
+
|
|
416
|
+
if (missingFunctions.length !== 0) {
|
|
417
|
+
throw new TypeError('Custom cacheMap missing methods: ' + missingFunctions.join(', '));
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
return cacheMap;
|
|
422
|
+
} // Private
|
|
423
|
+
|
|
424
|
+
|
|
425
|
+
function isArrayLike(x) {
|
|
426
|
+
return typeof x === 'object' && x !== null && typeof x.length === 'number' && (x.length === 0 || x.length > 0 && Object.prototype.hasOwnProperty.call(x, x.length - 1));
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
module.exports = DataLoader;
|
|
430
|
+
|
|
431
|
+
/***/ })
|
|
432
|
+
|
|
433
|
+
};
|
|
434
|
+
;
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.id = 574;
|
|
3
|
+
exports.ids = [574];
|
|
4
|
+
exports.modules = {
|
|
5
|
+
|
|
6
|
+
/***/ 3574:
|
|
7
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
8
|
+
|
|
9
|
+
// ESM COMPAT FLAG
|
|
10
|
+
__webpack_require__.r(__webpack_exports__);
|
|
11
|
+
|
|
12
|
+
// EXPORTS
|
|
13
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
14
|
+
"default": () => (/* binding */ search)
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
// EXTERNAL MODULE: ./faststore.config.js
|
|
18
|
+
var faststore_config = __webpack_require__(7183);
|
|
19
|
+
var faststore_config_default = /*#__PURE__*/__webpack_require__.n(faststore_config);
|
|
20
|
+
;// CONCATENATED MODULE: ./src/utils/getCookie.ts
|
|
21
|
+
function getCookie(name) {
|
|
22
|
+
const cookieString = decodeURIComponent(document.cookie);
|
|
23
|
+
const cookies = cookieString.split(';');
|
|
24
|
+
|
|
25
|
+
for (const cookie of cookies) {
|
|
26
|
+
const [cookieName, cookieValue] = cookie.trim().split('=');
|
|
27
|
+
|
|
28
|
+
if (cookieName === name) {
|
|
29
|
+
return cookieValue;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return undefined; // Cookie not found
|
|
34
|
+
}
|
|
35
|
+
;// CONCATENATED MODULE: ./src/sdk/analytics/platform/vtex/search.ts
|
|
36
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
37
|
+
|
|
38
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
39
|
+
|
|
40
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* More info at: https://www.notion.so/vtexhandbook/Event-API-Documentation-48eee26730cf4d7f80f8fd7262231f84
|
|
44
|
+
*/
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
const THIRTY_MINUTES_S = 30 * 60;
|
|
48
|
+
const ONE_YEAR_S = 365 * 24 * 3600;
|
|
49
|
+
|
|
50
|
+
const randomUUID = () => typeof crypto.randomUUID === 'function' ? crypto.randomUUID() : (Math.random() * 1e6).toFixed(0);
|
|
51
|
+
|
|
52
|
+
const createCookie = (key, expiresSecond) => {
|
|
53
|
+
// Setting the domain attribute specifies which host can receive it; we need it to make the cookies available on the `secure` subdomain.
|
|
54
|
+
// Although https://developer.mozilla.org/en-US/docs/Web/API/Document/cookie mentioned leading dot (.) is not needed and ignored. I couldn't set the cookies without it.
|
|
55
|
+
const urlDomain = `.${new URL((faststore_config_default()).storeUrl).hostname}`;
|
|
56
|
+
return () => {
|
|
57
|
+
const isExpired = getCookie(key) === undefined;
|
|
58
|
+
|
|
59
|
+
if (isExpired) {
|
|
60
|
+
const value = randomUUID();
|
|
61
|
+
document.cookie = `${key}=${value}; max-age=${expiresSecond}; domain=${urlDomain}; path=/;`; // Setting the `path=/` makes the cookie accessible on any path of the domain/subdomain
|
|
62
|
+
|
|
63
|
+
return value;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return getCookie(key);
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const user = {
|
|
71
|
+
anonymous: createCookie('vtex-faststore-anonymous', ONE_YEAR_S),
|
|
72
|
+
session: createCookie('vtex-faststore-session', THIRTY_MINUTES_S)
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const sendEvent = options => fetch(`https://sp.vtex.com/event-api/v1/${(faststore_config_default()).api.storeId}/event`, {
|
|
76
|
+
method: 'POST',
|
|
77
|
+
body: JSON.stringify(_objectSpread(_objectSpread({}, options), {}, {
|
|
78
|
+
userAgent: navigator.userAgent,
|
|
79
|
+
anonymous: user.anonymous(),
|
|
80
|
+
session: user.session()
|
|
81
|
+
})),
|
|
82
|
+
headers: {
|
|
83
|
+
'content-type': 'application/json'
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
const isFullTextSearch = url => typeof url.searchParams.get('q') === 'string' && /^\/s(\/)?$/g.test(url.pathname);
|
|
88
|
+
|
|
89
|
+
const handleEvent = event => {
|
|
90
|
+
switch (event.name) {
|
|
91
|
+
case 'search_select_item':
|
|
92
|
+
{
|
|
93
|
+
const url = new URL(event.params.url);
|
|
94
|
+
|
|
95
|
+
if (!isFullTextSearch(url)) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
for (const item of event.params.items ?? []) {
|
|
100
|
+
const productId = item.item_id ?? item.item_variant;
|
|
101
|
+
const position = item.index;
|
|
102
|
+
|
|
103
|
+
if (productId && position) {
|
|
104
|
+
sendEvent({
|
|
105
|
+
type: 'search.click',
|
|
106
|
+
productId,
|
|
107
|
+
position,
|
|
108
|
+
url: url.href,
|
|
109
|
+
text: url.searchParams.get('q') ?? '<empty>'
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
case 'intelligent_search_query':
|
|
118
|
+
{
|
|
119
|
+
sendEvent({
|
|
120
|
+
type: 'search.query',
|
|
121
|
+
url: event.params.url,
|
|
122
|
+
text: event.params.term,
|
|
123
|
+
misspelled: event.params.isTermMisspelled,
|
|
124
|
+
match: event.params.totalCount,
|
|
125
|
+
operator: event.params.logicalOperator,
|
|
126
|
+
locale: event.params.locale
|
|
127
|
+
});
|
|
128
|
+
break;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
default:
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
setInterval(() => sendEvent({
|
|
136
|
+
type: 'session.ping'
|
|
137
|
+
}), 60 * 1e3
|
|
138
|
+
/* One minute */
|
|
139
|
+
);
|
|
140
|
+
/* harmony default export */ const search = (handleEvent);
|
|
141
|
+
|
|
142
|
+
/***/ })
|
|
143
|
+
|
|
144
|
+
};
|
|
145
|
+
;
|