@plasmicpkgs/commerce-saleor 0.0.111 → 0.0.113

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"commerce-saleor.esm.js","sources":["../src/const.ts","../../../../node_modules/regenerator-runtime/runtime.js","../src/utils/get-sort-variables.ts","../src/utils/handle-fetch-response.ts","../src/utils/get-search-variables.ts","../src/utils/get-checkout-id.ts","../src/utils/fragments/product.ts","../src/utils/fragments/checkout-details.ts","../src/utils/mutations/checkout-create.ts","../src/utils/mutations/checkout-line-add.ts","../src/utils/mutations/checkout-line-update.ts","../src/utils/mutations/checkout-line-remove.ts","../src/utils/checkout-create.ts","../src/utils/normalize.ts","../src/utils/throw-user-errors.ts","../src/utils/checkout-to-cart.ts","../src/utils/customer-token.ts","../src/utils/queries/collection-many.ts","../src/utils/queries/product-one-by-slug.ts","../src/utils/queries/product-many.ts","../src/utils/queries/collection-one.ts","../src/utils/queries/checkout-one.ts","../src/utils/queries/get-all-product-vendors-query.ts","../src/cart/use-cart.tsx","../src/cart/use-add-item.tsx","../src/cart/use-remove-item.tsx","../src/cart/use-update-item.tsx","../src/site/use-categories.tsx","../src/site/use-brands.tsx","../src/product/use-search.tsx","../src/utils/queries/product-one-by-id.ts","../src/product/use-product.tsx","../src/fetcher.ts","../src/provider.ts","../src/saleor.tsx","../src/registerCommerceProvider.tsx","../src/index.tsx"],"sourcesContent":["/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src\n Changes: Removed api_url \n*/\n\nexport const API_CHANNEL = 'default-channel'\nexport const CHECKOUT_ID_COOKIE = 'saleor.CheckoutID'\nexport const SALEOR_TOKEN = 'saleor.Token'\nexport const SALEOR_CRSF_TOKEN = 'saleor.CSRFToken'\n","/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nvar runtime = (function (exports) {\n \"use strict\";\n\n var Op = Object.prototype;\n var hasOwn = Op.hasOwnProperty;\n var undefined; // More compressible than void 0.\n var $Symbol = typeof Symbol === \"function\" ? Symbol : {};\n var iteratorSymbol = $Symbol.iterator || \"@@iterator\";\n var asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\";\n var toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\";\n\n function define(obj, key, value) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n return obj[key];\n }\n try {\n // IE 8 has a broken Object.defineProperty that only works on DOM objects.\n define({}, \"\");\n } catch (err) {\n define = function(obj, key, value) {\n return obj[key] = value;\n };\n }\n\n function wrap(innerFn, outerFn, self, tryLocsList) {\n // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.\n var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;\n var generator = Object.create(protoGenerator.prototype);\n var context = new Context(tryLocsList || []);\n\n // The ._invoke method unifies the implementations of the .next,\n // .throw, and .return methods.\n generator._invoke = makeInvokeMethod(innerFn, self, context);\n\n return generator;\n }\n exports.wrap = wrap;\n\n // Try/catch helper to minimize deoptimizations. Returns a completion\n // record like context.tryEntries[i].completion. This interface could\n // have been (and was previously) designed to take a closure to be\n // invoked without arguments, but in all the cases we care about we\n // already have an existing method we want to call, so there's no need\n // to create a new function object. We can even get away with assuming\n // the method takes exactly one argument, since that happens to be true\n // in every case, so we don't have to touch the arguments object. The\n // only additional allocation required is the completion record, which\n // has a stable shape and so hopefully should be cheap to allocate.\n function tryCatch(fn, obj, arg) {\n try {\n return { type: \"normal\", arg: fn.call(obj, arg) };\n } catch (err) {\n return { type: \"throw\", arg: err };\n }\n }\n\n var GenStateSuspendedStart = \"suspendedStart\";\n var GenStateSuspendedYield = \"suspendedYield\";\n var GenStateExecuting = \"executing\";\n var GenStateCompleted = \"completed\";\n\n // Returning this object from the innerFn has the same effect as\n // breaking out of the dispatch switch statement.\n var ContinueSentinel = {};\n\n // Dummy constructor functions that we use as the .constructor and\n // .constructor.prototype properties for functions that return Generator\n // objects. For full spec compliance, you may wish to configure your\n // minifier not to mangle the names of these two functions.\n function Generator() {}\n function GeneratorFunction() {}\n function GeneratorFunctionPrototype() {}\n\n // This is a polyfill for %IteratorPrototype% for environments that\n // don't natively support it.\n var IteratorPrototype = {};\n define(IteratorPrototype, iteratorSymbol, function () {\n return this;\n });\n\n var getProto = Object.getPrototypeOf;\n var NativeIteratorPrototype = getProto && getProto(getProto(values([])));\n if (NativeIteratorPrototype &&\n NativeIteratorPrototype !== Op &&\n hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {\n // This environment has a native %IteratorPrototype%; use it instead\n // of the polyfill.\n IteratorPrototype = NativeIteratorPrototype;\n }\n\n var Gp = GeneratorFunctionPrototype.prototype =\n Generator.prototype = Object.create(IteratorPrototype);\n GeneratorFunction.prototype = GeneratorFunctionPrototype;\n define(Gp, \"constructor\", GeneratorFunctionPrototype);\n define(GeneratorFunctionPrototype, \"constructor\", GeneratorFunction);\n GeneratorFunction.displayName = define(\n GeneratorFunctionPrototype,\n toStringTagSymbol,\n \"GeneratorFunction\"\n );\n\n // Helper for defining the .next, .throw, and .return methods of the\n // Iterator interface in terms of a single ._invoke method.\n function defineIteratorMethods(prototype) {\n [\"next\", \"throw\", \"return\"].forEach(function(method) {\n define(prototype, method, function(arg) {\n return this._invoke(method, arg);\n });\n });\n }\n\n exports.isGeneratorFunction = function(genFun) {\n var ctor = typeof genFun === \"function\" && genFun.constructor;\n return ctor\n ? ctor === GeneratorFunction ||\n // For the native GeneratorFunction constructor, the best we can\n // do is to check its .name property.\n (ctor.displayName || ctor.name) === \"GeneratorFunction\"\n : false;\n };\n\n exports.mark = function(genFun) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);\n } else {\n genFun.__proto__ = GeneratorFunctionPrototype;\n define(genFun, toStringTagSymbol, \"GeneratorFunction\");\n }\n genFun.prototype = Object.create(Gp);\n return genFun;\n };\n\n // Within the body of any async function, `await x` is transformed to\n // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test\n // `hasOwn.call(value, \"__await\")` to determine if the yielded value is\n // meant to be awaited.\n exports.awrap = function(arg) {\n return { __await: arg };\n };\n\n function AsyncIterator(generator, PromiseImpl) {\n function invoke(method, arg, resolve, reject) {\n var record = tryCatch(generator[method], generator, arg);\n if (record.type === \"throw\") {\n reject(record.arg);\n } else {\n var result = record.arg;\n var value = result.value;\n if (value &&\n typeof value === \"object\" &&\n hasOwn.call(value, \"__await\")) {\n return PromiseImpl.resolve(value.__await).then(function(value) {\n invoke(\"next\", value, resolve, reject);\n }, function(err) {\n invoke(\"throw\", err, resolve, reject);\n });\n }\n\n return PromiseImpl.resolve(value).then(function(unwrapped) {\n // When a yielded Promise is resolved, its final value becomes\n // the .value of the Promise<{value,done}> result for the\n // current iteration.\n result.value = unwrapped;\n resolve(result);\n }, function(error) {\n // If a rejected Promise was yielded, throw the rejection back\n // into the async generator function so it can be handled there.\n return invoke(\"throw\", error, resolve, reject);\n });\n }\n }\n\n var previousPromise;\n\n function enqueue(method, arg) {\n function callInvokeWithMethodAndArg() {\n return new PromiseImpl(function(resolve, reject) {\n invoke(method, arg, resolve, reject);\n });\n }\n\n return previousPromise =\n // If enqueue has been called before, then we want to wait until\n // all previous Promises have been resolved before calling invoke,\n // so that results are always delivered in the correct order. If\n // enqueue has not been called before, then it is important to\n // call invoke immediately, without waiting on a callback to fire,\n // so that the async generator function has the opportunity to do\n // any necessary setup in a predictable way. This predictability\n // is why the Promise constructor synchronously invokes its\n // executor callback, and why async functions synchronously\n // execute code before the first await. Since we implement simple\n // async functions in terms of async generators, it is especially\n // important to get this right, even though it requires care.\n previousPromise ? previousPromise.then(\n callInvokeWithMethodAndArg,\n // Avoid propagating failures to Promises returned by later\n // invocations of the iterator.\n callInvokeWithMethodAndArg\n ) : callInvokeWithMethodAndArg();\n }\n\n // Define the unified helper method that is used to implement .next,\n // .throw, and .return (see defineIteratorMethods).\n this._invoke = enqueue;\n }\n\n defineIteratorMethods(AsyncIterator.prototype);\n define(AsyncIterator.prototype, asyncIteratorSymbol, function () {\n return this;\n });\n exports.AsyncIterator = AsyncIterator;\n\n // Note that simple async functions are implemented on top of\n // AsyncIterator objects; they just return a Promise for the value of\n // the final result produced by the iterator.\n exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {\n if (PromiseImpl === void 0) PromiseImpl = Promise;\n\n var iter = new AsyncIterator(\n wrap(innerFn, outerFn, self, tryLocsList),\n PromiseImpl\n );\n\n return exports.isGeneratorFunction(outerFn)\n ? iter // If outerFn is a generator, return the full iterator.\n : iter.next().then(function(result) {\n return result.done ? result.value : iter.next();\n });\n };\n\n function makeInvokeMethod(innerFn, self, context) {\n var state = GenStateSuspendedStart;\n\n return function invoke(method, arg) {\n if (state === GenStateExecuting) {\n throw new Error(\"Generator is already running\");\n }\n\n if (state === GenStateCompleted) {\n if (method === \"throw\") {\n throw arg;\n }\n\n // Be forgiving, per 25.3.3.3.3 of the spec:\n // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume\n return doneResult();\n }\n\n context.method = method;\n context.arg = arg;\n\n while (true) {\n var delegate = context.delegate;\n if (delegate) {\n var delegateResult = maybeInvokeDelegate(delegate, context);\n if (delegateResult) {\n if (delegateResult === ContinueSentinel) continue;\n return delegateResult;\n }\n }\n\n if (context.method === \"next\") {\n // Setting context._sent for legacy support of Babel's\n // function.sent implementation.\n context.sent = context._sent = context.arg;\n\n } else if (context.method === \"throw\") {\n if (state === GenStateSuspendedStart) {\n state = GenStateCompleted;\n throw context.arg;\n }\n\n context.dispatchException(context.arg);\n\n } else if (context.method === \"return\") {\n context.abrupt(\"return\", context.arg);\n }\n\n state = GenStateExecuting;\n\n var record = tryCatch(innerFn, self, context);\n if (record.type === \"normal\") {\n // If an exception is thrown from innerFn, we leave state ===\n // GenStateExecuting and loop back for another invocation.\n state = context.done\n ? GenStateCompleted\n : GenStateSuspendedYield;\n\n if (record.arg === ContinueSentinel) {\n continue;\n }\n\n return {\n value: record.arg,\n done: context.done\n };\n\n } else if (record.type === \"throw\") {\n state = GenStateCompleted;\n // Dispatch the exception by looping back around to the\n // context.dispatchException(context.arg) call above.\n context.method = \"throw\";\n context.arg = record.arg;\n }\n }\n };\n }\n\n // Call delegate.iterator[context.method](context.arg) and handle the\n // result, either by returning a { value, done } result from the\n // delegate iterator, or by modifying context.method and context.arg,\n // setting context.delegate to null, and returning the ContinueSentinel.\n function maybeInvokeDelegate(delegate, context) {\n var method = delegate.iterator[context.method];\n if (method === undefined) {\n // A .throw or .return when the delegate iterator has no .throw\n // method always terminates the yield* loop.\n context.delegate = null;\n\n if (context.method === \"throw\") {\n // Note: [\"return\"] must be used for ES3 parsing compatibility.\n if (delegate.iterator[\"return\"]) {\n // If the delegate iterator has a return method, give it a\n // chance to clean up.\n context.method = \"return\";\n context.arg = undefined;\n maybeInvokeDelegate(delegate, context);\n\n if (context.method === \"throw\") {\n // If maybeInvokeDelegate(context) changed context.method from\n // \"return\" to \"throw\", let that override the TypeError below.\n return ContinueSentinel;\n }\n }\n\n context.method = \"throw\";\n context.arg = new TypeError(\n \"The iterator does not provide a 'throw' method\");\n }\n\n return ContinueSentinel;\n }\n\n var record = tryCatch(method, delegate.iterator, context.arg);\n\n if (record.type === \"throw\") {\n context.method = \"throw\";\n context.arg = record.arg;\n context.delegate = null;\n return ContinueSentinel;\n }\n\n var info = record.arg;\n\n if (! info) {\n context.method = \"throw\";\n context.arg = new TypeError(\"iterator result is not an object\");\n context.delegate = null;\n return ContinueSentinel;\n }\n\n if (info.done) {\n // Assign the result of the finished delegate to the temporary\n // variable specified by delegate.resultName (see delegateYield).\n context[delegate.resultName] = info.value;\n\n // Resume execution at the desired location (see delegateYield).\n context.next = delegate.nextLoc;\n\n // If context.method was \"throw\" but the delegate handled the\n // exception, let the outer generator proceed normally. If\n // context.method was \"next\", forget context.arg since it has been\n // \"consumed\" by the delegate iterator. If context.method was\n // \"return\", allow the original .return call to continue in the\n // outer generator.\n if (context.method !== \"return\") {\n context.method = \"next\";\n context.arg = undefined;\n }\n\n } else {\n // Re-yield the result returned by the delegate method.\n return info;\n }\n\n // The delegate iterator is finished, so forget it and continue with\n // the outer generator.\n context.delegate = null;\n return ContinueSentinel;\n }\n\n // Define Generator.prototype.{next,throw,return} in terms of the\n // unified ._invoke helper method.\n defineIteratorMethods(Gp);\n\n define(Gp, toStringTagSymbol, \"Generator\");\n\n // A Generator should always return itself as the iterator object when the\n // @@iterator function is called on it. Some browsers' implementations of the\n // iterator prototype chain incorrectly implement this, causing the Generator\n // object to not be returned from this call. This ensures that doesn't happen.\n // See https://github.com/facebook/regenerator/issues/274 for more details.\n define(Gp, iteratorSymbol, function() {\n return this;\n });\n\n define(Gp, \"toString\", function() {\n return \"[object Generator]\";\n });\n\n function pushTryEntry(locs) {\n var entry = { tryLoc: locs[0] };\n\n if (1 in locs) {\n entry.catchLoc = locs[1];\n }\n\n if (2 in locs) {\n entry.finallyLoc = locs[2];\n entry.afterLoc = locs[3];\n }\n\n this.tryEntries.push(entry);\n }\n\n function resetTryEntry(entry) {\n var record = entry.completion || {};\n record.type = \"normal\";\n delete record.arg;\n entry.completion = record;\n }\n\n function Context(tryLocsList) {\n // The root entry object (effectively a try statement without a catch\n // or a finally block) gives us a place to store values thrown from\n // locations where there is no enclosing try statement.\n this.tryEntries = [{ tryLoc: \"root\" }];\n tryLocsList.forEach(pushTryEntry, this);\n this.reset(true);\n }\n\n exports.keys = function(object) {\n var keys = [];\n for (var key in object) {\n keys.push(key);\n }\n keys.reverse();\n\n // Rather than returning an object with a next method, we keep\n // things simple and return the next function itself.\n return function next() {\n while (keys.length) {\n var key = keys.pop();\n if (key in object) {\n next.value = key;\n next.done = false;\n return next;\n }\n }\n\n // To avoid creating an additional object, we just hang the .value\n // and .done properties off the next function object itself. This\n // also ensures that the minifier will not anonymize the function.\n next.done = true;\n return next;\n };\n };\n\n function values(iterable) {\n if (iterable) {\n var iteratorMethod = iterable[iteratorSymbol];\n if (iteratorMethod) {\n return iteratorMethod.call(iterable);\n }\n\n if (typeof iterable.next === \"function\") {\n return iterable;\n }\n\n if (!isNaN(iterable.length)) {\n var i = -1, next = function next() {\n while (++i < iterable.length) {\n if (hasOwn.call(iterable, i)) {\n next.value = iterable[i];\n next.done = false;\n return next;\n }\n }\n\n next.value = undefined;\n next.done = true;\n\n return next;\n };\n\n return next.next = next;\n }\n }\n\n // Return an iterator with no values.\n return { next: doneResult };\n }\n exports.values = values;\n\n function doneResult() {\n return { value: undefined, done: true };\n }\n\n Context.prototype = {\n constructor: Context,\n\n reset: function(skipTempReset) {\n this.prev = 0;\n this.next = 0;\n // Resetting context._sent for legacy support of Babel's\n // function.sent implementation.\n this.sent = this._sent = undefined;\n this.done = false;\n this.delegate = null;\n\n this.method = \"next\";\n this.arg = undefined;\n\n this.tryEntries.forEach(resetTryEntry);\n\n if (!skipTempReset) {\n for (var name in this) {\n // Not sure about the optimal order of these conditions:\n if (name.charAt(0) === \"t\" &&\n hasOwn.call(this, name) &&\n !isNaN(+name.slice(1))) {\n this[name] = undefined;\n }\n }\n }\n },\n\n stop: function() {\n this.done = true;\n\n var rootEntry = this.tryEntries[0];\n var rootRecord = rootEntry.completion;\n if (rootRecord.type === \"throw\") {\n throw rootRecord.arg;\n }\n\n return this.rval;\n },\n\n dispatchException: function(exception) {\n if (this.done) {\n throw exception;\n }\n\n var context = this;\n function handle(loc, caught) {\n record.type = \"throw\";\n record.arg = exception;\n context.next = loc;\n\n if (caught) {\n // If the dispatched exception was caught by a catch block,\n // then let that catch block handle the exception normally.\n context.method = \"next\";\n context.arg = undefined;\n }\n\n return !! caught;\n }\n\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n var record = entry.completion;\n\n if (entry.tryLoc === \"root\") {\n // Exception thrown outside of any try block that could handle\n // it, so set the completion value of the entire function to\n // throw the exception.\n return handle(\"end\");\n }\n\n if (entry.tryLoc <= this.prev) {\n var hasCatch = hasOwn.call(entry, \"catchLoc\");\n var hasFinally = hasOwn.call(entry, \"finallyLoc\");\n\n if (hasCatch && hasFinally) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n } else if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else if (hasCatch) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n }\n\n } else if (hasFinally) {\n if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else {\n throw new Error(\"try statement without catch or finally\");\n }\n }\n }\n },\n\n abrupt: function(type, arg) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc <= this.prev &&\n hasOwn.call(entry, \"finallyLoc\") &&\n this.prev < entry.finallyLoc) {\n var finallyEntry = entry;\n break;\n }\n }\n\n if (finallyEntry &&\n (type === \"break\" ||\n type === \"continue\") &&\n finallyEntry.tryLoc <= arg &&\n arg <= finallyEntry.finallyLoc) {\n // Ignore the finally entry if control is not jumping to a\n // location outside the try/catch block.\n finallyEntry = null;\n }\n\n var record = finallyEntry ? finallyEntry.completion : {};\n record.type = type;\n record.arg = arg;\n\n if (finallyEntry) {\n this.method = \"next\";\n this.next = finallyEntry.finallyLoc;\n return ContinueSentinel;\n }\n\n return this.complete(record);\n },\n\n complete: function(record, afterLoc) {\n if (record.type === \"throw\") {\n throw record.arg;\n }\n\n if (record.type === \"break\" ||\n record.type === \"continue\") {\n this.next = record.arg;\n } else if (record.type === \"return\") {\n this.rval = this.arg = record.arg;\n this.method = \"return\";\n this.next = \"end\";\n } else if (record.type === \"normal\" && afterLoc) {\n this.next = afterLoc;\n }\n\n return ContinueSentinel;\n },\n\n finish: function(finallyLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.finallyLoc === finallyLoc) {\n this.complete(entry.completion, entry.afterLoc);\n resetTryEntry(entry);\n return ContinueSentinel;\n }\n }\n },\n\n \"catch\": function(tryLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc === tryLoc) {\n var record = entry.completion;\n if (record.type === \"throw\") {\n var thrown = record.arg;\n resetTryEntry(entry);\n }\n return thrown;\n }\n }\n\n // The context.catch method must only be called with a location\n // argument that corresponds to a known catch block.\n throw new Error(\"illegal catch attempt\");\n },\n\n delegateYield: function(iterable, resultName, nextLoc) {\n this.delegate = {\n iterator: values(iterable),\n resultName: resultName,\n nextLoc: nextLoc\n };\n\n if (this.method === \"next\") {\n // Deliberately forget the last sent value so that we don't\n // accidentally pass it on to the delegate.\n this.arg = undefined;\n }\n\n return ContinueSentinel;\n }\n };\n\n // Regardless of whether this script is executing as a CommonJS module\n // or not, return the runtime object so that we can declare the variable\n // regeneratorRuntime in the outer scope, which allows this module to be\n // injected easily by `bin/regenerator --include-runtime script.js`.\n return exports;\n\n}(\n // If this script is executing as a CommonJS module, use module.exports\n // as the regeneratorRuntime namespace. Otherwise create a new empty\n // object. Either way, the resulting object will be used to initialize\n // the regeneratorRuntime variable at the top of this file.\n typeof module === \"object\" ? module.exports : {}\n));\n\ntry {\n regeneratorRuntime = runtime;\n} catch (accidentalStrictMode) {\n // This module should not be running in strict mode, so the above\n // assignment should always work unless something is misconfigured. Just\n // in case runtime.js accidentally runs in strict mode, in modern engines\n // we can explicitly access globalThis. In older engines we can escape\n // strict mode using a global Function call. This could conceivably fail\n // if a Content Security Policy forbids using Function, but in that case\n // the proper solution is to fix the accidental strict mode problem. If\n // you've misconfigured your bundler to force strict mode and applied a\n // CSP to forbid Function, and you're not willing to fix either of those\n // problems, please detail your unique predicament in a GitHub issue.\n if (typeof globalThis === \"object\") {\n globalThis.regeneratorRuntime = runtime;\n } else {\n Function(\"r\", \"regeneratorRuntime = r\")(runtime);\n }\n}\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src\n Changes: None \n*/\n\nexport const getSortVariables = (sort?: string, isCategory: boolean = false) => {\n let output = {}\n switch (sort) {\n case 'price-asc':\n output = {\n field: 'PRICE',\n direction: 'ASC',\n }\n break\n case 'price-desc':\n output = {\n field: 'PRICE',\n direction: 'DESC',\n }\n break\n case 'trending-desc': //default\n output = {} \n break\n case 'latest-desc':\n output = {\n field: 'DATE',\n direction: 'DESC',\n }\n break\n }\n return output\n}\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src\n Changes: None \n*/\n\nimport { FetcherError } from '@plasmicpkgs/commerce';\n\nexport function getError(errors: any[], status: number) {\n errors = errors ?? [{ message: 'Failed to fetch Saleor API' }]\n return new FetcherError({ errors, status })\n}\n\nexport async function getAsyncError(res: Response) {\n const data = await res.json()\n return getError(data.errors, res.status)\n}\n\nconst handleFetchResponse = async (res: Response) => {\n if (res.ok) {\n const { data, errors } = await res.json()\n\n if (errors && errors.length) {\n throw getError(errors, res.status)\n }\n\n return data\n }\n\n throw await getAsyncError(res)\n}\n\nexport default handleFetchResponse\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src\n Changes: None \n*/\n\nimport { getSortVariables } from './get-sort-variables'\nimport type { SearchProductsInput } from '../product/use-search'\n\nexport const getSearchVariables = ({ brandId, search, categoryId, sort, count }: SearchProductsInput) => {\n const sortBy = {\n field: 'NAME',\n direction: 'ASC',\n ...getSortVariables(sort, !!categoryId),\n channel: 'default-channel',\n }\n return {\n categoryId,\n filter: { search },\n sortBy,\n first: count\n }\n}\n\nexport default getSearchVariables\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src\n Changes: None \n*/\n\nimport Cookies from 'js-cookie'\nimport { CHECKOUT_ID_COOKIE } from '../const'\n\nconst getCheckoutId = (id?: string) => {\n const r = Cookies.get(CHECKOUT_ID_COOKIE)?.split(':') || []\n return { checkoutId: r[0], checkoutToken: r[1] }\n}\n\nexport default getCheckoutId\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src\n Changes: None \n*/\n\nexport const ProductConnection = /* GraphQL */ `\n fragment ProductConnection on ProductCountableConnection {\n pageInfo {\n hasNextPage\n hasPreviousPage\n }\n edges {\n node {\n id\n name\n description\n slug\n pricing {\n priceRange {\n start {\n net {\n amount\n }\n }\n }\n }\n media {\n url\n alt\n }\n variants {\n id\n name\n attributes {\n attribute {\n name\n }\n values {\n name\n }\n }\n pricing {\n price {\n net {\n amount\n currency\n }\n }\n }\n }\n }\n }\n }\n`\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src\n Changes: None \n*/\n\nexport const CheckoutDetails = /* GraphQL */ `\n fragment CheckoutDetails on Checkout {\n id\n token\n created\n totalPrice {\n currency\n gross {\n amount\n }\n }\n subtotalPrice {\n currency\n gross {\n amount\n }\n }\n\n lines {\n id\n variant {\n id\n name\n sku\n product {\n name\n slug\n }\n media {\n url\n }\n pricing {\n price {\n gross {\n amount\n }\n }\n }\n }\n quantity\n totalPrice {\n currency\n gross {\n amount\n }\n }\n }\n }\n`\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src\n Changes: None \n*/\n\nimport * as fragment from '../fragments'\n\nexport const CheckoutCreate = /* GraphQL */ `\n mutation CheckoutCreate {\n checkoutCreate(input: { email: \"customer@example.com\", lines: [], channel: \"default-channel\" }) {\n errors {\n code\n field\n message\n }\n checkout {\n ...CheckoutDetails\n }\n }\n }\n ${fragment.CheckoutDetails}\n`\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src\n Changes: None \n*/\n\nimport * as fragment from '../fragments'\n\nexport const CheckoutLineAdd = /* GraphQL */ `\n mutation CheckoutLineAdd($checkoutId: ID!, $lineItems: [CheckoutLineInput!]!) {\n checkoutLinesAdd(checkoutId: $checkoutId, lines: $lineItems) {\n errors {\n code\n field\n message\n }\n checkout {\n ...CheckoutDetails\n }\n }\n }\n ${fragment.CheckoutDetails}\n`\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src\n Changes: None \n*/\n\nimport * as fragment from '../fragments'\n\nexport const CheckoutLineUpdate = /* GraphQL */ `\n mutation CheckoutLineUpdate($checkoutId: ID!, $lineItems: [CheckoutLineInput!]!) {\n checkoutLinesUpdate(checkoutId: $checkoutId, lines: $lineItems) {\n errors {\n code\n field\n message\n }\n checkout {\n ...CheckoutDetails\n }\n }\n }\n ${fragment.CheckoutDetails}\n`\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src\n Changes: None \n*/\n\nimport * as fragment from '../fragments'\n\nexport const CheckoutLineDelete = /* GraphQL */ `\n mutation CheckoutLineDelete($checkoutId: ID!, $lineId: ID!) {\n checkoutLineDelete(checkoutId: $checkoutId, lineId: $lineId) {\n errors {\n code\n field\n message\n }\n checkout {\n ...CheckoutDetails\n }\n }\n }\n ${fragment.CheckoutDetails}\n`\n","import Cookies from 'js-cookie'\n\nimport * as mutation from './mutations'\nimport { CheckoutCreate } from '../schema'\nimport { CHECKOUT_ID_COOKIE } from '../const'\n\nexport const checkoutCreate = async (fetch: any): Promise<CheckoutCreate> => {\n const data = await fetch({ query: mutation.CheckoutCreate })\n const checkout = data.checkoutCreate?.checkout\n const checkoutId = checkout?.id\n const checkoutToken = checkout?.token\n\n const value = `${checkoutId}:${checkoutToken}`\n\n if (checkoutId) {\n const options: Cookies.CookieAttributes = {\n expires: 60 * 60 * 24 * 30,\n sameSite: \"none\",\n secure: true,\n }\n Cookies.set(CHECKOUT_ID_COOKIE, value, options)\n }\n\n return checkout\n}\n\nexport default checkoutCreate","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src\n Changes: None \n*/\n\nimport { Product } from '@plasmicpkgs/commerce'\n\nimport { Product as SaleorProduct, Checkout, CheckoutLine, Money, ProductVariant, Collection } from '../schema'\nimport { Category } from '../types/site';\nimport type { Cart, LineItem } from '../types'\n\n// TODO: Check nextjs-commerce bug if no images are added for a product\nconst placeholderImg = '/product-img-placeholder.svg'\n\nconst money = ({ amount, currency }: Money) => {\n return {\n value: +amount,\n currencyCode: currency || 'USD',\n }\n}\n\nconst normalizeProductOptions = (options: ProductVariant[]) => {\n return options\n ?.map((option) => option?.attributes)\n .flat(1)\n .reduce<any>((acc, x) => {\n if (acc.find(({ displayName }: any) => displayName === x.attribute.name)) {\n return acc.map((opt: any) => {\n return opt.displayName === x.attribute.name\n ? {\n ...opt,\n values: [\n ...opt.values,\n ...x.values.map((value: any) => ({\n label: value?.name,\n })),\n ],\n }\n : opt\n })\n }\n\n return acc.concat({\n __typename: 'MultipleChoiceOption',\n displayName: x.attribute.name,\n variant: 'size',\n values: x.values.map((value: any) => ({\n label: value?.name,\n })),\n })\n }, [])\n}\n\nconst normalizeProductVariants = (variants: ProductVariant[]) => {\n return variants?.map((variant) => {\n const { id, sku, name, pricing } = variant\n const price = pricing?.price?.net && money(pricing.price.net)?.value\n\n return {\n id,\n name,\n sku: sku ?? id,\n price,\n listPrice: price,\n requiresShipping: true,\n options: normalizeProductOptions([variant]),\n }\n })\n}\n\nexport function normalizeProduct(productNode: SaleorProduct): Product {\n const { id, name, media = [], variants, description, slug, pricing, ...rest } = productNode\n\n const product = {\n id,\n name,\n vendor: '',\n description: description ? JSON.parse(description)?.blocks[0]?.data.text : '',\n path: `/${slug}`,\n slug: slug?.replace(/^\\/+|\\/+$/g, ''),\n price: (pricing?.priceRange?.start?.net && money(pricing.priceRange.start.net)) || {\n value: 0,\n currencyCode: 'USD',\n },\n // TODO: Check nextjs-commerce bug if no images are added for a product\n images: media?.length ? media : [{ url: placeholderImg }],\n variants: variants && variants.length > 0 ? normalizeProductVariants(variants as ProductVariant[]) : [],\n options: variants && variants.length > 0 ? normalizeProductOptions(variants as ProductVariant[]) : [],\n ...rest,\n }\n\n return product as Product\n}\n\nexport function normalizeCart(checkout: Checkout): Cart {\n const lines = checkout.lines as CheckoutLine[]\n const lineItems: LineItem[] = lines.length > 0 ? lines?.map<LineItem>(normalizeLineItem) : []\n\n return {\n id: checkout.id,\n customerId: '',\n email: '',\n createdAt: checkout.created,\n currency: {\n code: checkout.totalPrice?.currency!,\n },\n taxesIncluded: false,\n lineItems,\n lineItemsSubtotalPrice: checkout.subtotalPrice?.gross?.amount!,\n subtotalPrice: checkout.subtotalPrice?.gross?.amount!,\n totalPrice: checkout.totalPrice?.gross.amount!,\n discounts: [],\n }\n}\n\nfunction normalizeLineItem({ id, variant, quantity }: CheckoutLine): LineItem {\n return {\n id,\n variantId: String(variant?.id),\n productId: String(variant?.id),\n name: `${variant.product.name}`,\n quantity,\n variant: {\n id: String(variant?.id),\n sku: variant?.sku ?? '',\n name: variant?.name!,\n image: {\n url: variant?.media![0] ? variant?.media![0].url : placeholderImg,\n },\n requiresShipping: false,\n price: variant?.pricing?.price?.gross.amount!,\n listPrice: 0,\n },\n path: String(variant?.product?.slug),\n discounts: [],\n options: [],\n }\n}\nexport const normalizeCategory = ({\n name,\n slug,\n id,\n}: Collection): Category => ({\n id,\n name,\n slug,\n path: `/${slug}`,\n})","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src\n Changes: None \n*/\n\nimport { ValidationError } from '@plasmicpkgs/commerce';\nimport { CheckoutError, CheckoutErrorCode, AppError, AccountError, AccountErrorCode } from '../schema'\n\nexport type UserErrors = Array<CheckoutError | AccountError | AppError>\n\nexport type UserErrorCode = CheckoutErrorCode | AccountErrorCode | null | undefined\n\nexport const throwUserErrors = (errors?: UserErrors) => {\n if (errors && errors.length) {\n throw new ValidationError({\n errors: errors.map(({ code, message }) => ({\n code: code ?? 'validation_error',\n message: message || '',\n })),\n })\n }\n}\n\nexport default throwUserErrors\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src\n Changes: None \n*/\n\nimport { Cart } from '../types'\nimport { CommerceError } from '@plasmicpkgs/commerce'\n\nimport {\n CheckoutLinesAdd,\n CheckoutLinesUpdate,\n CheckoutCreate,\n CheckoutError,\n Checkout,\n Maybe,\n CheckoutLineDelete,\n} from '../schema'\n\nimport { normalizeCart } from './normalize'\nimport throwUserErrors from './throw-user-errors'\n\nexport type CheckoutQuery = {\n checkout: Checkout\n errors?: Array<CheckoutError>\n}\n\nexport type CheckoutPayload =\n | CheckoutLinesAdd\n | CheckoutLinesUpdate\n | CheckoutCreate\n | CheckoutQuery\n | CheckoutLineDelete\n\nconst checkoutToCart = (checkoutPayload?: Maybe<CheckoutPayload>): Cart | undefined => {\n if (!checkoutPayload) {\n throw new CommerceError({\n message: 'Missing checkout payload from response',\n })\n }\n\n const checkout = checkoutPayload?.checkout\n if (checkoutPayload?.errors?.length === 1 && checkoutPayload.errors[0].code === \"PRODUCT_UNAVAILABLE_FOR_PURCHASE\") {\n console.error(checkoutPayload.errors[0]);\n return undefined;\n }\n\n if (checkoutPayload?.errors) {\n throwUserErrors(checkoutPayload?.errors)\n }\n\n if (!checkout) {\n throw new CommerceError({\n message: 'Missing checkout object from response',\n })\n }\n\n return normalizeCart(checkout)\n}\n\nexport default checkoutToCart\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src\n Changes: None \n*/\n\nimport Cookies, { CookieAttributes } from 'js-cookie'\nimport * as Const from '../const'\n\nexport const getToken = () => Cookies.get(Const.SALEOR_TOKEN)\nexport const setToken = (token?: string, options?: CookieAttributes) => {\n setCookie(Const.SALEOR_TOKEN, token, options)\n}\n\nexport const getCSRFToken = () => Cookies.get(Const.SALEOR_CRSF_TOKEN)\nexport const setCSRFToken = (token?: string, options?: CookieAttributes) => {\n setCookie(Const.SALEOR_CRSF_TOKEN, token, options)\n}\n\nexport const getCheckoutToken = () => Cookies.get(Const.CHECKOUT_ID_COOKIE)\nexport const setCheckoutToken = (token?: string, options?: CookieAttributes) => {\n setCookie(Const.CHECKOUT_ID_COOKIE, token, options)\n}\n\nconst setCookie = (name: string, token?: string, options?: CookieAttributes) => {\n if (!token) {\n Cookies.remove(name)\n } else {\n Cookies.set(name, token, options ?? { expires: 60 * 60 * 24 * 30 })\n }\n}\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src\n Changes: None \n*/\n\nexport const CollectionMany = /* GraphQL */ `\n query CollectionMany( $channel: String = \"default-channel\") {\n collections(first:100, channel: $channel) {\n edges {\n node {\n id\n name\n slug\n }\n }\n }\n }\n`\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src\n Changes: None \n*/\n\nexport const ProductOneBySlug = /* GraphQL */ `\n query ProductOneBySlug($slug: String!, $channel: String = \"default-channel\") {\n product(slug: $slug, channel: $channel) {\n id\n slug\n name\n description\n pricing {\n priceRange {\n start {\n net {\n amount\n }\n }\n }\n }\n variants {\n id\n name\n attributes {\n attribute {\n name\n }\n values {\n name\n }\n }\n pricing {\n price {\n net {\n amount\n currency\n }\n }\n }\n }\n media {\n url\n alt\n }\n }\n }\n`\n\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src\n Changes: None \n*/\n\nimport * as fragment from '../fragments'\n\nexport const ProductMany = /* GraphQL */ `\n query ProductMany(\n $first: Int = 100\n $filter: ProductFilterInput\n $sortBy: ProductOrder\n $channel: String = \"default-channel\"\n ) {\n products(first: $first, channel: $channel, filter: $filter, sortBy: $sortBy) {\n ...ProductConnection\n }\n }\n ${fragment.ProductConnection}\n`\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src\n Changes: None \n*/\n\nimport * as fragment from '../fragments'\n\nexport const CollectionOne = /* GraphQL */ `\n query getProductsFromCollection($categoryId: ID!, $first: Int = 100, $channel: String = \"default-channel\") {\n collection(id: $categoryId, channel: $channel) {\n id\n name\n slug\n products(first: $first) {\n ...ProductConnection\n }\n }\n }\n ${fragment.ProductConnection}\n`\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src\n Changes: None \n*/\n\n\n\nimport * as fragment from '../fragments'\n\nexport const CheckoutOne = /* GraphQL */ `\n query CheckoutOne($checkoutId: UUID!) {\n checkout(token: $checkoutId) {\n ... on Checkout {\n ...CheckoutDetails\n }\n }\n }\n ${fragment.CheckoutDetails}\n`\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src\n Changes: None \n*/\n\nexport const getAllProductVendors = /* GraphQL */ `\n query getAllProductVendors($cursor: String, $channel: String = \"default-channel\") {\n products(first:100,channel: $channel, after: $cursor) {\n pageInfo {\n hasNextPage\n hasPreviousPage\n }\n edges {\n node {\n slug\n }\n cursor\n }\n }\n }\n`\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src\n Changes:None\n*/\n\nimport { useMemo } from \"react\";\nimport { useCart as useCommerceCart, UseCart } from \"@plasmicpkgs/commerce\";\n\nimport { SWRHook } from \"@plasmicpkgs/commerce\";\nimport { checkoutCreate, checkoutToCart, getCheckoutId } from \"../utils\";\nimport * as query from \"../utils/queries\";\nimport { GetCartHook } from \"../types/cart\";\n\nexport default useCommerceCart as UseCart<typeof handler>;\n\nexport const handler: SWRHook<GetCartHook> = {\n fetchOptions: {\n query: query.CheckoutOne,\n },\n async fetcher({ input: { cartId: checkoutId }, options, fetch }) {\n let checkout;\n\n if (checkoutId) {\n const checkoutId = getCheckoutId().checkoutToken;\n const data = await fetch({\n ...options,\n variables: { checkoutId },\n });\n\n checkout = data;\n }\n\n if (checkout?.completedAt || !checkoutId) {\n checkout = await checkoutCreate(fetch);\n }\n\n return checkoutToCart(checkout);\n },\n useHook:\n ({ useData }) =>\n (input) => {\n const response = useData({\n swrOptions: { revalidateOnFocus: false, ...input?.swrOptions },\n });\n return useMemo(\n () =>\n Object.create(response, {\n isEmpty: {\n get() {\n return (response.data?.lineItems.length ?? 0) <= 0;\n },\n enumerable: true,\n },\n }),\n [response]\n );\n },\n};\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src\n Changes:None\n*/\nimport { useCallback } from \"react\";\nimport type { MutationHook } from \"@plasmicpkgs/commerce\";\nimport { CommerceError } from \"@plasmicpkgs/commerce\";\nimport { useAddItem, UseAddItem } from \"@plasmicpkgs/commerce\";\nimport useCart from \"./use-cart\";\n\nimport * as mutation from \"../utils/mutations\";\n\nimport { getCheckoutId, checkoutToCart } from \"../utils\";\n\nimport { Mutation, MutationCheckoutLinesAddArgs } from \"../schema\";\nimport { AddItemHook } from \"../types/cart\";\n\nexport default useAddItem as UseAddItem<typeof handler>;\n\nexport const handler: MutationHook<AddItemHook> = {\n fetchOptions: { query: mutation.CheckoutLineAdd },\n async fetcher({ input: item, options, fetch }) {\n if (\n item.quantity &&\n (!Number.isInteger(item.quantity) || item.quantity! < 1)\n ) {\n throw new CommerceError({\n message: \"The item quantity has to be a valid integer greater than 0\",\n });\n }\n\n const { checkoutLinesAdd } = await fetch<\n Mutation,\n MutationCheckoutLinesAddArgs\n >({\n ...options,\n variables: {\n checkoutId: getCheckoutId().checkoutId,\n lineItems: [\n {\n variantId: item.variantId,\n quantity: item.quantity ?? 1,\n },\n ],\n },\n });\n\n return checkoutToCart(checkoutLinesAdd);\n },\n useHook:\n ({ fetch }) =>\n () => {\n const { mutate } = useCart();\n\n return useCallback(\n async function addItem(input) {\n const data = await fetch({ input });\n if (data) {\n await mutate(data, false);\n } else {\n await mutate();\n }\n return data;\n },\n [fetch, mutate]\n );\n },\n};\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src\n Changes: None\n*/\n\nimport type {\n HookFetcherContext,\n MutationHookContext,\n} from \"@plasmicpkgs/commerce\";\nimport { useRemoveItem, UseRemoveItem } from \"@plasmicpkgs/commerce\";\nimport { useCallback } from \"react\";\nimport { Mutation, MutationCheckoutLineDeleteArgs } from \"../schema\";\nimport { LineItem, RemoveItemHook } from \"../types/cart\";\nimport { checkoutToCart, getCheckoutId } from \"../utils\";\nimport * as mutation from \"../utils/mutations\";\nimport useCart from \"./use-cart\";\n\nexport default useRemoveItem as UseRemoveItem<typeof handler>;\n\nexport const handler = {\n fetchOptions: { query: mutation.CheckoutLineDelete },\n async fetcher({\n input: { itemId },\n options,\n fetch,\n }: HookFetcherContext<RemoveItemHook>) {\n const data = await fetch<Mutation, MutationCheckoutLineDeleteArgs>({\n ...options,\n variables: {\n checkoutId: getCheckoutId().checkoutId,\n lineId: itemId,\n },\n });\n return checkoutToCart(data.checkoutLineDelete);\n },\n useHook: ({ fetch }: MutationHookContext<RemoveItemHook>) => <\n T extends LineItem | undefined = undefined\n >() => {\n const { mutate } = useCart();\n\n return useCallback(\n async function removeItem(input: { id: string }) {\n const data = await fetch({ input: { itemId: input.id } });\n await mutate(data, false);\n\n return data;\n },\n [fetch, mutate]\n );\n },\n};\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src\n Changes: None\n*/\n\nimport type {\n HookFetcherContext,\n MutationHookContext,\n} from \"@plasmicpkgs/commerce\";\nimport {\n useUpdateItem,\n UseUpdateItem,\n ValidationError,\n} from \"@plasmicpkgs/commerce\";\nimport debounce from \"debounce\";\nimport { useCallback } from \"react\";\n\nimport { Mutation, MutationCheckoutLinesUpdateArgs } from \"../schema\";\nimport type { LineItem } from \"../types/cart\";\nimport { checkoutToCart, getCheckoutId } from \"../utils\";\nimport useCart from \"./use-cart\";\nimport { handler as removeItemHandler } from \"./use-remove-item\";\n\nimport * as mutation from \"../utils/mutations\";\n\nimport type { UpdateItemHook } from \"../types/cart\";\n\nexport type UpdateItemActionInput<T = any> = T extends LineItem\n ? Partial<UpdateItemHook[\"actionInput\"]>\n : UpdateItemHook[\"actionInput\"];\n\nexport default useUpdateItem as UseUpdateItem<typeof handler>;\n\nexport const handler = {\n fetchOptions: { query: mutation.CheckoutLineUpdate },\n async fetcher({\n input: { itemId, item },\n options,\n fetch,\n }: HookFetcherContext<UpdateItemHook>) {\n if (Number.isInteger(item.quantity)) {\n // Also allow the update hook to remove an item if the quantity is lower than 1\n if (item.quantity! < 1) {\n return removeItemHandler.fetcher({\n options: removeItemHandler.fetchOptions,\n input: { itemId },\n fetch,\n });\n }\n } else if (item.quantity) {\n throw new ValidationError({\n message: \"The item quantity has to be a valid integer\",\n });\n }\n\n const checkoutId = getCheckoutId().checkoutId;\n const { checkoutLinesUpdate } = await fetch<\n Mutation,\n MutationCheckoutLinesUpdateArgs\n >({\n ...options,\n variables: {\n checkoutId,\n lineItems: [\n {\n variantId: item.variantId,\n quantity: item.quantity,\n },\n ],\n },\n });\n\n return checkoutToCart(checkoutLinesUpdate);\n },\n useHook: ({ fetch }: MutationHookContext<UpdateItemHook>) => <\n T extends LineItem | undefined = undefined\n >(\n ctx: {\n item?: T;\n wait?: number;\n } = {}\n ) => {\n const { item } = ctx;\n const { mutate } = useCart() as any;\n\n return useCallback(\n debounce(async (input: UpdateItemActionInput<T>) => {\n const itemId = input.id ?? item?.id;\n const productId = input.productId ?? item?.productId;\n const variantId = input.productId ?? item?.variantId;\n if (!itemId || !productId || !variantId) {\n throw new ValidationError({\n message: \"Invalid input used for this operation\",\n });\n }\n\n const data = await fetch({\n input: {\n item: {\n productId,\n variantId,\n quantity: input.quantity,\n },\n itemId,\n },\n });\n await mutate(data, false);\n return data;\n }, ctx.wait ?? 500),\n [fetch, mutate]\n );\n },\n};\n","import { SWRHook } from \"@plasmicpkgs/commerce\";\nimport { UseCategories, useCategories } from \"@plasmicpkgs/commerce\";\nimport { useMemo } from \"react\";\nimport { CollectionCountableEdge } from \"../schema\";\nimport { GetCategoriesHook } from \"../types/site\";\nimport { CollectionMany, CollectionOne, normalizeCategory } from \"../utils\";\n\nexport default useCategories as UseCategories<typeof handler>;\n\nexport const handler: SWRHook<GetCategoriesHook> = {\n fetchOptions: {\n query: CollectionMany,\n },\n async fetcher({ input, options, fetch }) {\n const { categoryId } = input;\n if (!categoryId) {\n const data = await fetch({\n query: CollectionMany,\n variables: {\n first: 250,\n },\n })\n\n return (\n data.collections?.edges?.map(({ node }: CollectionCountableEdge) =>\n normalizeCategory(node)\n ) ?? []\n );\n } else {\n const data = await fetch({\n query: CollectionOne,\n variables: { categoryId },\n });\n return !!data?.collection ? [normalizeCategory(data?.collection)] : [];\n }\n },\n useHook:\n ({ useData }) =>\n (input) => {\n const response = useData({\n input: [[\"categoryId\", input?.categoryId]],\n swrOptions: { revalidateOnFocus: false, ...input?.swrOptions },\n });\n return useMemo(\n () =>\n Object.create(response, {\n isEmpty: {\n get() {\n return (response.data?.length ?? 0) <= 0;\n },\n enumerable: true,\n },\n }),\n [response]\n );\n },\n};","import { SWRHook } from \"@plasmicpkgs/commerce\";\nimport { UseBrands, useBrands } from \"@plasmicpkgs/commerce\";\nimport { useMemo } from \"react\";\nimport {\n GetAllProductPathsQuery,\n GetAllProductPathsQueryVariables,\n} from \"../schema\";\nimport { GetBrandsHook } from \"../types/site\";\nimport { getAllProductVendors } from \"../utils\";\n\nexport default useBrands as UseBrands<typeof handler>;\n\nexport const handler: SWRHook<GetBrandsHook> = {\n fetchOptions: {\n query: getAllProductVendors,\n },\n async fetcher({ input, options, fetch }) {\n return []; // brands it's not available on saleor\n },\n useHook:\n ({ useData }) =>\n (input) => {\n const response = useData({\n swrOptions: { revalidateOnFocus: false, ...input?.swrOptions },\n });\n return useMemo(\n () =>\n Object.create(response, {\n isEmpty: {\n get() {\n return (response.data?.length ?? 0) <= 0;\n },\n enumerable: true,\n },\n }),\n [response]\n );\n },\n};\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src\n Changes:None\n*/\n\nimport { Product, SWRHook, useSearch, UseSearch } from \"@plasmicpkgs/commerce\";\n\nimport { ProductCountableEdge } from \"../schema\";\nimport { getSearchVariables, normalizeProduct } from \"../utils\";\n\nimport { SearchProductsHook } from \"@plasmicpkgs/commerce\";\nimport * as query from \"../utils/queries\";\n\nconst useSearchTyped: UseSearch<typeof handler> = useSearch;\nexport default useSearchTyped;\n\nexport type SearchProductsInput = {\n search?: string;\n categoryId?: string | number;\n brandId?: string | number;\n sort?: string;\n count?: number;\n};\n\nexport type SearchProductsData = {\n products: Product[];\n found: boolean;\n};\n\nexport const handler: SWRHook<SearchProductsHook> = {\n fetchOptions: {\n query: query.ProductMany,\n },\n async fetcher({ input, options, fetch }) {\n const { categoryId, brandId } = input;\n\n const data = await fetch({\n query: categoryId ? query.CollectionOne : options.query,\n method: options?.method,\n variables: getSearchVariables(input),\n });\n\n let edges;\n\n if (categoryId) {\n edges = data.collection?.products?.edges ?? [];\n // FIXME @zaiste, no `vendor` in Saleor\n // if (brandId) {\n // edges = edges.filter(\n // ({ node: { vendor } }: ProductCountableEdge) =>\n // vendor.replace(/\\s+/g, '-').toLowerCase() === brandId\n // )\n // }\n } else {\n edges = data.products?.edges ?? [];\n }\n\n return {\n products: edges.map(({ node }: ProductCountableEdge) =>\n normalizeProduct(node)\n ),\n found: !!edges.length,\n };\n },\n useHook:\n ({ useData }) =>\n (input = {}) => {\n return useData({\n input: [\n [\"search\", input.search],\n [\"categoryId\", input.categoryId],\n [\"brandId\", input.brandId],\n [\"sort\", input.sort],\n [\"count\", input.count],\n ],\n swrOptions: {\n revalidateOnFocus: false,\n ...input.swrOptions,\n },\n });\n },\n};\n","export const ProductOneById = /* GraphQL */ `\n query ProductOneById($id: ID!, $channel: String = \"default-channel\") {\n product(id: $id, channel: $channel) {\n\n slug\n name\n description\n pricing {\n priceRange {\n start {\n net {\n amount\n }\n }\n }\n }\n variants {\n id\n name\n attributes {\n attribute {\n name\n }\n values {\n name\n }\n }\n pricing {\n price {\n net {\n amount\n currency\n }\n }\n }\n }\n media {\n url\n alt\n }\n }\n }`","import { SWRHook } from \"@plasmicpkgs/commerce\";\nimport { useProduct, UseProduct } from \"@plasmicpkgs/commerce\";\n\nimport { normalizeProduct } from \"../utils\";\nimport type { GetProductHook } from \"@plasmicpkgs/commerce\";\n\nimport { ProductOneById } from \"../utils/queries/product-one-by-id\";\nimport { ProductOneBySlug } from '../utils/queries/product-one-by-slug';\n\nexport type GetProductInput = {\n id?: string;\n slug?: string\n};\n\nexport default useProduct as UseProduct<typeof handler>;\n\nexport const handler: SWRHook<GetProductHook> = {\n fetchOptions: {\n query: ProductOneById,\n },\n async fetcher({ input, options, fetch }) {\n const { id } = input;\n if (!id) {\n return null;\n }\n const data = await fetch({\n query: ProductOneById,\n variables: { id },\n });\n if (!data.product) {\n const response = await fetch({\n query: ProductOneBySlug,\n variables: { slug: id }\n })\n return response.product ? normalizeProduct(response.product) : null;\n }\n return data.product ? normalizeProduct(data.product) : null;\n },\n useHook:\n ({ useData }) =>\n (input = {}) => {\n return useData({\n input: [[\"id\", input.id]],\n swrOptions: {\n revalidateOnFocus: false,\n ...input.swrOptions,\n },\n });\n },\n};\n","\n/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src\n Changes: \n - Before: The saleor_api_url was defined at build time. \n So this file just implemented a fetcher with these parameters defined.\n - Now: The saleor_api_url is defined at runtime. \n So we have to get the fetcher using these parameters.\n*/\n\n\nimport { Fetcher } from '@plasmicpkgs/commerce'\nimport { getToken, handleFetchResponse } from './utils'\n\nexport const getFetcher:\n (saleorApiUrl: string) => Fetcher =\n (saleorApiUrl) => {\n return async ({\n url = saleorApiUrl,\n method = 'POST',\n query,\n variables,\n }) => {\n const { locale, ...vars } = variables ?? {}\n const token = getToken()\n return handleFetchResponse(\n await fetch(url, {\n method,\n body: JSON.stringify({ query, variables: vars }),\n headers: {\n Authorization: `JWT ${token}`,\n 'Content-Type': 'application/json',\n },\n })\n )\n }\n }\n\n\n\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src\n Changes:\n - Removed customer and auth hooks.\n - Added saleor_api_url parameters.\n*/\n\nimport { CHECKOUT_ID_COOKIE } from './const'\nimport { handler as useCart } from './cart/use-cart'\nimport { handler as useAddItem } from './cart/use-add-item'\nimport { handler as useUpdateItem } from './cart/use-update-item'\nimport { handler as useRemoveItem } from './cart/use-remove-item'\nimport { handler as useCategories } from './site/use-categories'\nimport { handler as useBrands } from './site/use-brands'\nimport { handler as useSearch } from './product/use-search'\nimport { handler as useProduct } from './product/use-product'\nimport { Fetcher } from '@plasmicpkgs/commerce'\nimport { getFetcher } from './fetcher'\n\nexport const getSaleorProvider = (saleorApiUrl: string,) => ({\n locale: 'en-us',\n cartCookie: CHECKOUT_ID_COOKIE,\n fetcher: getFetcher(saleorApiUrl),\n cart: { useCart, useAddItem, useUpdateItem, useRemoveItem },\n products: { useSearch, useProduct },\n site: { useCategories, useBrands }\n})\n\n\n\n\n\nexport type SaleorProvider = {\n locale: string;\n cartCookie: string;\n fetcher: Fetcher;\n cart: {\n useCart: typeof useCart;\n useAddItem: typeof useAddItem;\n useUpdateItem: typeof useUpdateItem;\n useRemoveItem: typeof useRemoveItem\n };\n products: {\n useSearch: typeof useSearch\n useProduct: typeof useProduct\n };\n site: {\n useCategories: typeof useCategories\n useBrands: typeof useBrands\n }\n}","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src\n Changes: \n - Added saleor_api_url parameter.\n*/\nimport {\n getCommerceProvider as getCoreCommerceProvider,\n useCommerce as useCoreCommerce,\n} from \"@plasmicpkgs/commerce\";\nimport { getSaleorProvider, SaleorProvider } from \"./provider\";\n\nexport type { SaleorProvider };\n\nexport const useCommerce = () => useCoreCommerce<SaleorProvider>();\nexport const getCommerceProvider = (saleorApiUrl: string) =>\n getCoreCommerceProvider(getSaleorProvider(saleorApiUrl));\n","import { GlobalContextMeta } from \"@plasmicapp/host\";\nimport registerGlobalContext from \"@plasmicapp/host/registerGlobalContext\";\nimport React from \"react\";\nimport { Registerable } from \"./registerable\";\nimport { getCommerceProvider } from \"./saleor\";\n\ninterface CommerceProviderProps {\n children?: React.ReactNode;\n saleorApiUrl: string;\n}\nexport const commerceProviderMeta: GlobalContextMeta<CommerceProviderProps> = {\n name: \"plasmic-commerce-saleor-provider\",\n displayName: \"Saleor Provider\",\n props: {\n saleorApiUrl: {\n type: \"string\",\n defaultValue: \"https://vercel.saleor.cloud/graphql/\",\n },\n },\n importPath: \"@plasmicpkgs/commerce-saleor\",\n importName: \"CommerceProviderComponent\",\n};\n\nexport function CommerceProviderComponent(props: CommerceProviderProps) {\n const { saleorApiUrl, children } = props;\n\n const CommerceProvider = React.useMemo(\n () => getCommerceProvider(saleorApiUrl),\n [saleorApiUrl]\n );\n\n return <CommerceProvider>{children}</CommerceProvider>;\n}\n\nexport function registerCommerceProvider(\n loader?: Registerable,\n customCommerceProviderMeta?: GlobalContextMeta<CommerceProviderProps>\n) {\n const doRegisterComponent: typeof registerGlobalContext = (...args) =>\n loader\n ? loader.registerGlobalContext(...args)\n : registerGlobalContext(...args);\n doRegisterComponent(\n CommerceProviderComponent,\n customCommerceProviderMeta ?? commerceProviderMeta\n );\n}\n","import { Registerable } from \"./registerable\";\nimport {\n registerCommerceProvider,\n CommerceProviderComponent,\n} from \"./registerCommerceProvider\";\nexport * from \"./registerable\";\n\nexport * from \"./saleor\";\n\nexport function registerAll(loader?: Registerable) {\n registerCommerceProvider(loader);\n}\n\nexport { registerCommerceProvider, CommerceProviderComponent };\n"],"names":["CHECKOUT_ID_COOKIE","SALEOR_TOKEN","runtime","exports","Op","Object","prototype","hasOwn","hasOwnProperty","undefined","$Symbol","Symbol","iteratorSymbol","iterator","asyncIteratorSymbol","asyncIterator","toStringTagSymbol","toStringTag","define","obj","key","value","defineProperty","enumerable","configurable","writable","err","wrap","innerFn","outerFn","self","tryLocsList","protoGenerator","Generator","generator","create","context","Context","_invoke","makeInvokeMethod","tryCatch","fn","arg","type","call","GenStateSuspendedStart","GenStateSuspendedYield","GenStateExecuting","GenStateCompleted","ContinueSentinel","GeneratorFunction","GeneratorFunctionPrototype","IteratorPrototype","getProto","getPrototypeOf","NativeIteratorPrototype","values","Gp","displayName","defineIteratorMethods","forEach","method","isGeneratorFunction","genFun","ctor","constructor","name","mark","setPrototypeOf","__proto__","awrap","__await","AsyncIterator","PromiseImpl","invoke","resolve","reject","record","result","then","unwrapped","error","previousPromise","enqueue","callInvokeWithMethodAndArg","async","Promise","iter","next","done","state","Error","doneResult","delegate","delegateResult","maybeInvokeDelegate","sent","_sent","dispatchException","abrupt","TypeError","info","resultName","nextLoc","pushTryEntry","locs","entry","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","push","resetTryEntry","completion","reset","keys","object","reverse","length","pop","iterable","iteratorMethod","isNaN","i","skipTempReset","prev","charAt","slice","stop","rootEntry","rootRecord","rval","exception","handle","loc","caught","hasCatch","hasFinally","finallyEntry","complete","finish","thrown","delegateYield","module","regeneratorRuntime","accidentalStrictMode","globalThis","Function","getSortVariables","sort","isCategory","output","field","direction","getError","errors","status","message","FetcherError","getAsyncError","res","json","data","handleFetchResponse","ok","getSearchVariables","search","categoryId","count","sortBy","channel","filter","first","getCheckoutId","id","r","Cookies","get","split","checkoutId","checkoutToken","ProductConnection","CheckoutDetails","CheckoutCreate","fragment","CheckoutLineAdd","CheckoutLineUpdate","CheckoutLineDelete","checkoutCreate","fetch","query","mutation","checkout","token","options","expires","sameSite","secure","set","placeholderImg","money","amount","currency","currencyCode","normalizeProductOptions","map","option","attributes","flat","reduce","acc","x","find","attribute","opt","label","concat","__typename","variant","normalizeProductVariants","variants","sku","pricing","price","net","listPrice","requiresShipping","normalizeProduct","productNode","media","description","slug","rest","product","vendor","JSON","parse","blocks","text","path","replace","priceRange","start","images","url","normalizeCart","lines","lineItems","normalizeLineItem","customerId","email","createdAt","created","code","totalPrice","taxesIncluded","lineItemsSubtotalPrice","subtotalPrice","gross","discounts","quantity","variantId","String","productId","image","normalizeCategory","throwUserErrors","ValidationError","checkoutToCart","checkoutPayload","CommerceError","console","getToken","Const","CollectionMany","ProductOneBySlug","ProductMany","CollectionOne","CheckoutOne","getAllProductVendors","handler","fetchOptions","fetcher","input","cartId","variables","completedAt","useHook","useData","response","swrOptions","revalidateOnFocus","useMemo","isEmpty","item","Number","isInteger","checkoutLinesAdd","useCart","mutate","useCallback","addItem","itemId","lineId","checkoutLineDelete","removeItem","removeItemHandler","checkoutLinesUpdate","ctx","debounce","wait","collections","edges","node","collection","brandId","products","found","ProductOneById","getFetcher","saleorApiUrl","locale","vars","body","stringify","headers","Authorization","getSaleorProvider","cartCookie","cart","useAddItem","useUpdateItem","useRemoveItem","useSearch","useProduct","site","useCategories","useBrands","useCommerce","useCoreCommerce","getCommerceProvider","getCoreCommerceProvider","commerceProviderMeta","props","defaultValue","importPath","importName","CommerceProviderComponent","children","CommerceProvider","React","registerCommerceProvider","loader","customCommerceProviderMeta","doRegisterComponent","registerGlobalContext","registerAll"],"mappings":";;;;;;AAAA;;;;AAMO,IAAMA,kBAAkB,GAAG,mBAAmB;AAC9C,IAAMC,YAAY,GAAG,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACN1C;AACA;AACA;AACA;AACA;;EAEA,IAAIC,OAAO,GAAI,UAAUC,OAAO,EAAE;;IAGhC,IAAIC,EAAE,GAAGC,MAAM,CAACC,SAAS;IACzB,IAAIC,MAAM,GAAGH,EAAE,CAACI,cAAc;IAC9B,IAAIC,WAAS,CAAC;IACd,IAAIC,OAAO,GAAG,OAAOC,MAAM,KAAK,UAAU,GAAGA,MAAM,GAAG,EAAE;IACxD,IAAIC,cAAc,GAAGF,OAAO,CAACG,QAAQ,IAAI,YAAY;IACrD,IAAIC,mBAAmB,GAAGJ,OAAO,CAACK,aAAa,IAAI,iBAAiB;IACpE,IAAIC,iBAAiB,GAAGN,OAAO,CAACO,WAAW,IAAI,eAAe;IAE9D,SAASC,MAAM,CAACC,GAAG,EAAEC,GAAG,EAAEC,KAAK,EAAE;MAC/BhB,MAAM,CAACiB,cAAc,CAACH,GAAG,EAAEC,GAAG,EAAE;QAC9BC,KAAK,EAAEA,KAAK;QACZE,UAAU,EAAE,IAAI;QAChBC,YAAY,EAAE,IAAI;QAClBC,QAAQ,EAAE;OACX,CAAC;MACF,OAAON,GAAG,CAACC,GAAG,CAAC;;IAEjB,IAAI;;MAEFF,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC;KACf,CAAC,OAAOQ,GAAG,EAAE;MACZR,MAAM,GAAG,gBAASC,GAAG,EAAEC,GAAG,EAAEC,KAAK,EAAE;QACjC,OAAOF,GAAG,CAACC,GAAG,CAAC,GAAGC,KAAK;OACxB;;IAGH,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AO8B,oBAACD,gBAAgB,QAAED,QAAQ,CAAoB;AACxD;AAEA,SAAgBG,wBAAwB,CACtCC,MAAqB,EACrBC,0BAAqE;EAErE,IAAMC,mBAAmB,GAAiC,SAApDA,mBAAmB;IAAA,OACvBF,MAAM,GACFA,MAAM,CAACG,qBAAqB,OAA5BH,MAAM,YAA+B,GACrCG,qBAAqB,yBAAS;;EACpCD,mBAAmB,CACjBP,yBAAyB,EACzBM,0BAA0B,WAA1BA,0BAA0B,GAAIX,oBAAoB,CACnD;AACH;;SCrCgBc,WAAW,CAACJ,MAAqB;EAC/CD,wBAAwB,CAACC,MAAM,CAAC;AAClC;;;;"}
1
+ {"version":3,"file":"commerce-saleor.esm.js","sources":["../src/const.ts","../../../../node_modules/regenerator-runtime/runtime.js","../src/utils/get-sort-variables.ts","../src/utils/handle-fetch-response.ts","../src/utils/get-search-variables.ts","../src/utils/get-checkout-id.ts","../src/utils/fragments/product.ts","../src/utils/fragments/checkout-details.ts","../src/utils/mutations/checkout-create.ts","../src/utils/mutations/checkout-line-add.ts","../src/utils/mutations/checkout-line-update.ts","../src/utils/mutations/checkout-line-remove.ts","../src/utils/checkout-create.ts","../src/utils/normalize.ts","../src/utils/throw-user-errors.ts","../src/utils/checkout-to-cart.ts","../src/utils/customer-token.ts","../src/utils/queries/collection-many.ts","../src/utils/queries/product-one-by-slug.ts","../src/utils/queries/product-many.ts","../src/utils/queries/collection-one.ts","../src/utils/queries/checkout-one.ts","../src/utils/queries/get-all-product-vendors-query.ts","../src/cart/use-cart.tsx","../src/cart/use-add-item.tsx","../src/cart/use-remove-item.tsx","../src/cart/use-update-item.tsx","../src/site/use-categories.tsx","../src/site/use-brands.tsx","../src/product/use-search.tsx","../src/utils/queries/product-one-by-id.ts","../src/product/use-product.tsx","../src/fetcher.ts","../src/provider.ts","../src/saleor.tsx","../src/registerCommerceProvider.tsx","../src/index.tsx"],"sourcesContent":["/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src\n Changes: Removed api_url \n*/\n\nexport const API_CHANNEL = 'default-channel'\nexport const CHECKOUT_ID_COOKIE = 'saleor.CheckoutID'\nexport const SALEOR_TOKEN = 'saleor.Token'\nexport const SALEOR_CRSF_TOKEN = 'saleor.CSRFToken'\n","/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nvar runtime = (function (exports) {\n \"use strict\";\n\n var Op = Object.prototype;\n var hasOwn = Op.hasOwnProperty;\n var undefined; // More compressible than void 0.\n var $Symbol = typeof Symbol === \"function\" ? Symbol : {};\n var iteratorSymbol = $Symbol.iterator || \"@@iterator\";\n var asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\";\n var toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\";\n\n function define(obj, key, value) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n return obj[key];\n }\n try {\n // IE 8 has a broken Object.defineProperty that only works on DOM objects.\n define({}, \"\");\n } catch (err) {\n define = function(obj, key, value) {\n return obj[key] = value;\n };\n }\n\n function wrap(innerFn, outerFn, self, tryLocsList) {\n // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.\n var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;\n var generator = Object.create(protoGenerator.prototype);\n var context = new Context(tryLocsList || []);\n\n // The ._invoke method unifies the implementations of the .next,\n // .throw, and .return methods.\n generator._invoke = makeInvokeMethod(innerFn, self, context);\n\n return generator;\n }\n exports.wrap = wrap;\n\n // Try/catch helper to minimize deoptimizations. Returns a completion\n // record like context.tryEntries[i].completion. This interface could\n // have been (and was previously) designed to take a closure to be\n // invoked without arguments, but in all the cases we care about we\n // already have an existing method we want to call, so there's no need\n // to create a new function object. We can even get away with assuming\n // the method takes exactly one argument, since that happens to be true\n // in every case, so we don't have to touch the arguments object. The\n // only additional allocation required is the completion record, which\n // has a stable shape and so hopefully should be cheap to allocate.\n function tryCatch(fn, obj, arg) {\n try {\n return { type: \"normal\", arg: fn.call(obj, arg) };\n } catch (err) {\n return { type: \"throw\", arg: err };\n }\n }\n\n var GenStateSuspendedStart = \"suspendedStart\";\n var GenStateSuspendedYield = \"suspendedYield\";\n var GenStateExecuting = \"executing\";\n var GenStateCompleted = \"completed\";\n\n // Returning this object from the innerFn has the same effect as\n // breaking out of the dispatch switch statement.\n var ContinueSentinel = {};\n\n // Dummy constructor functions that we use as the .constructor and\n // .constructor.prototype properties for functions that return Generator\n // objects. For full spec compliance, you may wish to configure your\n // minifier not to mangle the names of these two functions.\n function Generator() {}\n function GeneratorFunction() {}\n function GeneratorFunctionPrototype() {}\n\n // This is a polyfill for %IteratorPrototype% for environments that\n // don't natively support it.\n var IteratorPrototype = {};\n define(IteratorPrototype, iteratorSymbol, function () {\n return this;\n });\n\n var getProto = Object.getPrototypeOf;\n var NativeIteratorPrototype = getProto && getProto(getProto(values([])));\n if (NativeIteratorPrototype &&\n NativeIteratorPrototype !== Op &&\n hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {\n // This environment has a native %IteratorPrototype%; use it instead\n // of the polyfill.\n IteratorPrototype = NativeIteratorPrototype;\n }\n\n var Gp = GeneratorFunctionPrototype.prototype =\n Generator.prototype = Object.create(IteratorPrototype);\n GeneratorFunction.prototype = GeneratorFunctionPrototype;\n define(Gp, \"constructor\", GeneratorFunctionPrototype);\n define(GeneratorFunctionPrototype, \"constructor\", GeneratorFunction);\n GeneratorFunction.displayName = define(\n GeneratorFunctionPrototype,\n toStringTagSymbol,\n \"GeneratorFunction\"\n );\n\n // Helper for defining the .next, .throw, and .return methods of the\n // Iterator interface in terms of a single ._invoke method.\n function defineIteratorMethods(prototype) {\n [\"next\", \"throw\", \"return\"].forEach(function(method) {\n define(prototype, method, function(arg) {\n return this._invoke(method, arg);\n });\n });\n }\n\n exports.isGeneratorFunction = function(genFun) {\n var ctor = typeof genFun === \"function\" && genFun.constructor;\n return ctor\n ? ctor === GeneratorFunction ||\n // For the native GeneratorFunction constructor, the best we can\n // do is to check its .name property.\n (ctor.displayName || ctor.name) === \"GeneratorFunction\"\n : false;\n };\n\n exports.mark = function(genFun) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);\n } else {\n genFun.__proto__ = GeneratorFunctionPrototype;\n define(genFun, toStringTagSymbol, \"GeneratorFunction\");\n }\n genFun.prototype = Object.create(Gp);\n return genFun;\n };\n\n // Within the body of any async function, `await x` is transformed to\n // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test\n // `hasOwn.call(value, \"__await\")` to determine if the yielded value is\n // meant to be awaited.\n exports.awrap = function(arg) {\n return { __await: arg };\n };\n\n function AsyncIterator(generator, PromiseImpl) {\n function invoke(method, arg, resolve, reject) {\n var record = tryCatch(generator[method], generator, arg);\n if (record.type === \"throw\") {\n reject(record.arg);\n } else {\n var result = record.arg;\n var value = result.value;\n if (value &&\n typeof value === \"object\" &&\n hasOwn.call(value, \"__await\")) {\n return PromiseImpl.resolve(value.__await).then(function(value) {\n invoke(\"next\", value, resolve, reject);\n }, function(err) {\n invoke(\"throw\", err, resolve, reject);\n });\n }\n\n return PromiseImpl.resolve(value).then(function(unwrapped) {\n // When a yielded Promise is resolved, its final value becomes\n // the .value of the Promise<{value,done}> result for the\n // current iteration.\n result.value = unwrapped;\n resolve(result);\n }, function(error) {\n // If a rejected Promise was yielded, throw the rejection back\n // into the async generator function so it can be handled there.\n return invoke(\"throw\", error, resolve, reject);\n });\n }\n }\n\n var previousPromise;\n\n function enqueue(method, arg) {\n function callInvokeWithMethodAndArg() {\n return new PromiseImpl(function(resolve, reject) {\n invoke(method, arg, resolve, reject);\n });\n }\n\n return previousPromise =\n // If enqueue has been called before, then we want to wait until\n // all previous Promises have been resolved before calling invoke,\n // so that results are always delivered in the correct order. If\n // enqueue has not been called before, then it is important to\n // call invoke immediately, without waiting on a callback to fire,\n // so that the async generator function has the opportunity to do\n // any necessary setup in a predictable way. This predictability\n // is why the Promise constructor synchronously invokes its\n // executor callback, and why async functions synchronously\n // execute code before the first await. Since we implement simple\n // async functions in terms of async generators, it is especially\n // important to get this right, even though it requires care.\n previousPromise ? previousPromise.then(\n callInvokeWithMethodAndArg,\n // Avoid propagating failures to Promises returned by later\n // invocations of the iterator.\n callInvokeWithMethodAndArg\n ) : callInvokeWithMethodAndArg();\n }\n\n // Define the unified helper method that is used to implement .next,\n // .throw, and .return (see defineIteratorMethods).\n this._invoke = enqueue;\n }\n\n defineIteratorMethods(AsyncIterator.prototype);\n define(AsyncIterator.prototype, asyncIteratorSymbol, function () {\n return this;\n });\n exports.AsyncIterator = AsyncIterator;\n\n // Note that simple async functions are implemented on top of\n // AsyncIterator objects; they just return a Promise for the value of\n // the final result produced by the iterator.\n exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {\n if (PromiseImpl === void 0) PromiseImpl = Promise;\n\n var iter = new AsyncIterator(\n wrap(innerFn, outerFn, self, tryLocsList),\n PromiseImpl\n );\n\n return exports.isGeneratorFunction(outerFn)\n ? iter // If outerFn is a generator, return the full iterator.\n : iter.next().then(function(result) {\n return result.done ? result.value : iter.next();\n });\n };\n\n function makeInvokeMethod(innerFn, self, context) {\n var state = GenStateSuspendedStart;\n\n return function invoke(method, arg) {\n if (state === GenStateExecuting) {\n throw new Error(\"Generator is already running\");\n }\n\n if (state === GenStateCompleted) {\n if (method === \"throw\") {\n throw arg;\n }\n\n // Be forgiving, per 25.3.3.3.3 of the spec:\n // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume\n return doneResult();\n }\n\n context.method = method;\n context.arg = arg;\n\n while (true) {\n var delegate = context.delegate;\n if (delegate) {\n var delegateResult = maybeInvokeDelegate(delegate, context);\n if (delegateResult) {\n if (delegateResult === ContinueSentinel) continue;\n return delegateResult;\n }\n }\n\n if (context.method === \"next\") {\n // Setting context._sent for legacy support of Babel's\n // function.sent implementation.\n context.sent = context._sent = context.arg;\n\n } else if (context.method === \"throw\") {\n if (state === GenStateSuspendedStart) {\n state = GenStateCompleted;\n throw context.arg;\n }\n\n context.dispatchException(context.arg);\n\n } else if (context.method === \"return\") {\n context.abrupt(\"return\", context.arg);\n }\n\n state = GenStateExecuting;\n\n var record = tryCatch(innerFn, self, context);\n if (record.type === \"normal\") {\n // If an exception is thrown from innerFn, we leave state ===\n // GenStateExecuting and loop back for another invocation.\n state = context.done\n ? GenStateCompleted\n : GenStateSuspendedYield;\n\n if (record.arg === ContinueSentinel) {\n continue;\n }\n\n return {\n value: record.arg,\n done: context.done\n };\n\n } else if (record.type === \"throw\") {\n state = GenStateCompleted;\n // Dispatch the exception by looping back around to the\n // context.dispatchException(context.arg) call above.\n context.method = \"throw\";\n context.arg = record.arg;\n }\n }\n };\n }\n\n // Call delegate.iterator[context.method](context.arg) and handle the\n // result, either by returning a { value, done } result from the\n // delegate iterator, or by modifying context.method and context.arg,\n // setting context.delegate to null, and returning the ContinueSentinel.\n function maybeInvokeDelegate(delegate, context) {\n var method = delegate.iterator[context.method];\n if (method === undefined) {\n // A .throw or .return when the delegate iterator has no .throw\n // method always terminates the yield* loop.\n context.delegate = null;\n\n if (context.method === \"throw\") {\n // Note: [\"return\"] must be used for ES3 parsing compatibility.\n if (delegate.iterator[\"return\"]) {\n // If the delegate iterator has a return method, give it a\n // chance to clean up.\n context.method = \"return\";\n context.arg = undefined;\n maybeInvokeDelegate(delegate, context);\n\n if (context.method === \"throw\") {\n // If maybeInvokeDelegate(context) changed context.method from\n // \"return\" to \"throw\", let that override the TypeError below.\n return ContinueSentinel;\n }\n }\n\n context.method = \"throw\";\n context.arg = new TypeError(\n \"The iterator does not provide a 'throw' method\");\n }\n\n return ContinueSentinel;\n }\n\n var record = tryCatch(method, delegate.iterator, context.arg);\n\n if (record.type === \"throw\") {\n context.method = \"throw\";\n context.arg = record.arg;\n context.delegate = null;\n return ContinueSentinel;\n }\n\n var info = record.arg;\n\n if (! info) {\n context.method = \"throw\";\n context.arg = new TypeError(\"iterator result is not an object\");\n context.delegate = null;\n return ContinueSentinel;\n }\n\n if (info.done) {\n // Assign the result of the finished delegate to the temporary\n // variable specified by delegate.resultName (see delegateYield).\n context[delegate.resultName] = info.value;\n\n // Resume execution at the desired location (see delegateYield).\n context.next = delegate.nextLoc;\n\n // If context.method was \"throw\" but the delegate handled the\n // exception, let the outer generator proceed normally. If\n // context.method was \"next\", forget context.arg since it has been\n // \"consumed\" by the delegate iterator. If context.method was\n // \"return\", allow the original .return call to continue in the\n // outer generator.\n if (context.method !== \"return\") {\n context.method = \"next\";\n context.arg = undefined;\n }\n\n } else {\n // Re-yield the result returned by the delegate method.\n return info;\n }\n\n // The delegate iterator is finished, so forget it and continue with\n // the outer generator.\n context.delegate = null;\n return ContinueSentinel;\n }\n\n // Define Generator.prototype.{next,throw,return} in terms of the\n // unified ._invoke helper method.\n defineIteratorMethods(Gp);\n\n define(Gp, toStringTagSymbol, \"Generator\");\n\n // A Generator should always return itself as the iterator object when the\n // @@iterator function is called on it. Some browsers' implementations of the\n // iterator prototype chain incorrectly implement this, causing the Generator\n // object to not be returned from this call. This ensures that doesn't happen.\n // See https://github.com/facebook/regenerator/issues/274 for more details.\n define(Gp, iteratorSymbol, function() {\n return this;\n });\n\n define(Gp, \"toString\", function() {\n return \"[object Generator]\";\n });\n\n function pushTryEntry(locs) {\n var entry = { tryLoc: locs[0] };\n\n if (1 in locs) {\n entry.catchLoc = locs[1];\n }\n\n if (2 in locs) {\n entry.finallyLoc = locs[2];\n entry.afterLoc = locs[3];\n }\n\n this.tryEntries.push(entry);\n }\n\n function resetTryEntry(entry) {\n var record = entry.completion || {};\n record.type = \"normal\";\n delete record.arg;\n entry.completion = record;\n }\n\n function Context(tryLocsList) {\n // The root entry object (effectively a try statement without a catch\n // or a finally block) gives us a place to store values thrown from\n // locations where there is no enclosing try statement.\n this.tryEntries = [{ tryLoc: \"root\" }];\n tryLocsList.forEach(pushTryEntry, this);\n this.reset(true);\n }\n\n exports.keys = function(object) {\n var keys = [];\n for (var key in object) {\n keys.push(key);\n }\n keys.reverse();\n\n // Rather than returning an object with a next method, we keep\n // things simple and return the next function itself.\n return function next() {\n while (keys.length) {\n var key = keys.pop();\n if (key in object) {\n next.value = key;\n next.done = false;\n return next;\n }\n }\n\n // To avoid creating an additional object, we just hang the .value\n // and .done properties off the next function object itself. This\n // also ensures that the minifier will not anonymize the function.\n next.done = true;\n return next;\n };\n };\n\n function values(iterable) {\n if (iterable) {\n var iteratorMethod = iterable[iteratorSymbol];\n if (iteratorMethod) {\n return iteratorMethod.call(iterable);\n }\n\n if (typeof iterable.next === \"function\") {\n return iterable;\n }\n\n if (!isNaN(iterable.length)) {\n var i = -1, next = function next() {\n while (++i < iterable.length) {\n if (hasOwn.call(iterable, i)) {\n next.value = iterable[i];\n next.done = false;\n return next;\n }\n }\n\n next.value = undefined;\n next.done = true;\n\n return next;\n };\n\n return next.next = next;\n }\n }\n\n // Return an iterator with no values.\n return { next: doneResult };\n }\n exports.values = values;\n\n function doneResult() {\n return { value: undefined, done: true };\n }\n\n Context.prototype = {\n constructor: Context,\n\n reset: function(skipTempReset) {\n this.prev = 0;\n this.next = 0;\n // Resetting context._sent for legacy support of Babel's\n // function.sent implementation.\n this.sent = this._sent = undefined;\n this.done = false;\n this.delegate = null;\n\n this.method = \"next\";\n this.arg = undefined;\n\n this.tryEntries.forEach(resetTryEntry);\n\n if (!skipTempReset) {\n for (var name in this) {\n // Not sure about the optimal order of these conditions:\n if (name.charAt(0) === \"t\" &&\n hasOwn.call(this, name) &&\n !isNaN(+name.slice(1))) {\n this[name] = undefined;\n }\n }\n }\n },\n\n stop: function() {\n this.done = true;\n\n var rootEntry = this.tryEntries[0];\n var rootRecord = rootEntry.completion;\n if (rootRecord.type === \"throw\") {\n throw rootRecord.arg;\n }\n\n return this.rval;\n },\n\n dispatchException: function(exception) {\n if (this.done) {\n throw exception;\n }\n\n var context = this;\n function handle(loc, caught) {\n record.type = \"throw\";\n record.arg = exception;\n context.next = loc;\n\n if (caught) {\n // If the dispatched exception was caught by a catch block,\n // then let that catch block handle the exception normally.\n context.method = \"next\";\n context.arg = undefined;\n }\n\n return !! caught;\n }\n\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n var record = entry.completion;\n\n if (entry.tryLoc === \"root\") {\n // Exception thrown outside of any try block that could handle\n // it, so set the completion value of the entire function to\n // throw the exception.\n return handle(\"end\");\n }\n\n if (entry.tryLoc <= this.prev) {\n var hasCatch = hasOwn.call(entry, \"catchLoc\");\n var hasFinally = hasOwn.call(entry, \"finallyLoc\");\n\n if (hasCatch && hasFinally) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n } else if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else if (hasCatch) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n }\n\n } else if (hasFinally) {\n if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else {\n throw new Error(\"try statement without catch or finally\");\n }\n }\n }\n },\n\n abrupt: function(type, arg) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc <= this.prev &&\n hasOwn.call(entry, \"finallyLoc\") &&\n this.prev < entry.finallyLoc) {\n var finallyEntry = entry;\n break;\n }\n }\n\n if (finallyEntry &&\n (type === \"break\" ||\n type === \"continue\") &&\n finallyEntry.tryLoc <= arg &&\n arg <= finallyEntry.finallyLoc) {\n // Ignore the finally entry if control is not jumping to a\n // location outside the try/catch block.\n finallyEntry = null;\n }\n\n var record = finallyEntry ? finallyEntry.completion : {};\n record.type = type;\n record.arg = arg;\n\n if (finallyEntry) {\n this.method = \"next\";\n this.next = finallyEntry.finallyLoc;\n return ContinueSentinel;\n }\n\n return this.complete(record);\n },\n\n complete: function(record, afterLoc) {\n if (record.type === \"throw\") {\n throw record.arg;\n }\n\n if (record.type === \"break\" ||\n record.type === \"continue\") {\n this.next = record.arg;\n } else if (record.type === \"return\") {\n this.rval = this.arg = record.arg;\n this.method = \"return\";\n this.next = \"end\";\n } else if (record.type === \"normal\" && afterLoc) {\n this.next = afterLoc;\n }\n\n return ContinueSentinel;\n },\n\n finish: function(finallyLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.finallyLoc === finallyLoc) {\n this.complete(entry.completion, entry.afterLoc);\n resetTryEntry(entry);\n return ContinueSentinel;\n }\n }\n },\n\n \"catch\": function(tryLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc === tryLoc) {\n var record = entry.completion;\n if (record.type === \"throw\") {\n var thrown = record.arg;\n resetTryEntry(entry);\n }\n return thrown;\n }\n }\n\n // The context.catch method must only be called with a location\n // argument that corresponds to a known catch block.\n throw new Error(\"illegal catch attempt\");\n },\n\n delegateYield: function(iterable, resultName, nextLoc) {\n this.delegate = {\n iterator: values(iterable),\n resultName: resultName,\n nextLoc: nextLoc\n };\n\n if (this.method === \"next\") {\n // Deliberately forget the last sent value so that we don't\n // accidentally pass it on to the delegate.\n this.arg = undefined;\n }\n\n return ContinueSentinel;\n }\n };\n\n // Regardless of whether this script is executing as a CommonJS module\n // or not, return the runtime object so that we can declare the variable\n // regeneratorRuntime in the outer scope, which allows this module to be\n // injected easily by `bin/regenerator --include-runtime script.js`.\n return exports;\n\n}(\n // If this script is executing as a CommonJS module, use module.exports\n // as the regeneratorRuntime namespace. Otherwise create a new empty\n // object. Either way, the resulting object will be used to initialize\n // the regeneratorRuntime variable at the top of this file.\n typeof module === \"object\" ? module.exports : {}\n));\n\ntry {\n regeneratorRuntime = runtime;\n} catch (accidentalStrictMode) {\n // This module should not be running in strict mode, so the above\n // assignment should always work unless something is misconfigured. Just\n // in case runtime.js accidentally runs in strict mode, in modern engines\n // we can explicitly access globalThis. In older engines we can escape\n // strict mode using a global Function call. This could conceivably fail\n // if a Content Security Policy forbids using Function, but in that case\n // the proper solution is to fix the accidental strict mode problem. If\n // you've misconfigured your bundler to force strict mode and applied a\n // CSP to forbid Function, and you're not willing to fix either of those\n // problems, please detail your unique predicament in a GitHub issue.\n if (typeof globalThis === \"object\") {\n globalThis.regeneratorRuntime = runtime;\n } else {\n Function(\"r\", \"regeneratorRuntime = r\")(runtime);\n }\n}\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src\n Changes: None \n*/\n\nexport const getSortVariables = (sort?: string, isCategory: boolean = false) => {\n let output = {}\n switch (sort) {\n case 'price-asc':\n output = {\n field: 'PRICE',\n direction: 'ASC',\n }\n break\n case 'price-desc':\n output = {\n field: 'PRICE',\n direction: 'DESC',\n }\n break\n case 'trending-desc': //default\n output = {} \n break\n case 'latest-desc':\n output = {\n field: 'DATE',\n direction: 'DESC',\n }\n break\n }\n return output\n}\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src\n Changes: None \n*/\n\nimport { FetcherError } from '@plasmicpkgs/commerce';\n\nexport function getError(errors: any[], status: number) {\n errors = errors ?? [{ message: 'Failed to fetch Saleor API' }]\n return new FetcherError({ errors, status })\n}\n\nexport async function getAsyncError(res: Response) {\n const data = await res.json()\n return getError(data.errors, res.status)\n}\n\nconst handleFetchResponse = async (res: Response) => {\n if (res.ok) {\n const { data, errors } = await res.json()\n\n if (errors && errors.length) {\n throw getError(errors, res.status)\n }\n\n return data\n }\n\n throw await getAsyncError(res)\n}\n\nexport default handleFetchResponse\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src\n Changes: None \n*/\n\nimport { getSortVariables } from './get-sort-variables'\nimport type { SearchProductsInput } from '../product/use-search'\n\nexport const getSearchVariables = ({ brandId, search, categoryId, sort, count }: SearchProductsInput) => {\n const sortBy = {\n field: 'NAME',\n direction: 'ASC',\n ...getSortVariables(sort, !!categoryId),\n channel: 'default-channel',\n }\n return {\n categoryId,\n filter: { search },\n sortBy,\n first: count\n }\n}\n\nexport default getSearchVariables\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src\n Changes: None \n*/\n\nimport Cookies from 'js-cookie'\nimport { CHECKOUT_ID_COOKIE } from '../const'\n\nconst getCheckoutId = (id?: string) => {\n const r = Cookies.get(CHECKOUT_ID_COOKIE)?.split(':') || []\n return { checkoutId: r[0], checkoutToken: r[1] }\n}\n\nexport default getCheckoutId\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src\n Changes: None \n*/\n\nexport const ProductConnection = /* GraphQL */ `\n fragment ProductConnection on ProductCountableConnection {\n pageInfo {\n hasNextPage\n hasPreviousPage\n }\n edges {\n node {\n id\n name\n description\n slug\n pricing {\n priceRange {\n start {\n net {\n amount\n }\n }\n }\n }\n media {\n url\n alt\n }\n variants {\n id\n name\n attributes {\n attribute {\n name\n }\n values {\n name\n }\n }\n pricing {\n price {\n net {\n amount\n currency\n }\n }\n }\n }\n }\n }\n }\n`\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src\n Changes: None\n*/\n\nexport const CheckoutDetails = /* GraphQL */ `\n fragment CheckoutDetails on Checkout {\n id\n token\n created\n totalPrice {\n currency\n gross {\n amount\n }\n }\n subtotalPrice {\n currency\n gross {\n amount\n }\n }\n\n lines {\n id\n variant {\n id\n name\n sku\n product {\n name\n slug\n id\n }\n media {\n url\n }\n pricing {\n price {\n gross {\n amount\n }\n }\n }\n }\n quantity\n totalPrice {\n currency\n gross {\n amount\n }\n }\n }\n }\n`;\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src\n Changes: None \n*/\n\nimport * as fragment from '../fragments'\n\nexport const CheckoutCreate = /* GraphQL */ `\n mutation CheckoutCreate {\n checkoutCreate(input: { email: \"customer@example.com\", lines: [], channel: \"default-channel\" }) {\n errors {\n code\n field\n message\n }\n checkout {\n ...CheckoutDetails\n }\n }\n }\n ${fragment.CheckoutDetails}\n`\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src\n Changes: None \n*/\n\nimport * as fragment from '../fragments'\n\nexport const CheckoutLineAdd = /* GraphQL */ `\n mutation CheckoutLineAdd($checkoutId: ID!, $lineItems: [CheckoutLineInput!]!) {\n checkoutLinesAdd(checkoutId: $checkoutId, lines: $lineItems) {\n errors {\n code\n field\n message\n }\n checkout {\n ...CheckoutDetails\n }\n }\n }\n ${fragment.CheckoutDetails}\n`\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src\n Changes: None \n*/\n\nimport * as fragment from '../fragments'\n\nexport const CheckoutLineUpdate = /* GraphQL */ `\n mutation CheckoutLineUpdate($checkoutId: ID!, $lineItems: [CheckoutLineInput!]!) {\n checkoutLinesUpdate(checkoutId: $checkoutId, lines: $lineItems) {\n errors {\n code\n field\n message\n }\n checkout {\n ...CheckoutDetails\n }\n }\n }\n ${fragment.CheckoutDetails}\n`\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src\n Changes: None \n*/\n\nimport * as fragment from '../fragments'\n\nexport const CheckoutLineDelete = /* GraphQL */ `\n mutation CheckoutLineDelete($checkoutId: ID!, $lineId: ID!) {\n checkoutLineDelete(checkoutId: $checkoutId, lineId: $lineId) {\n errors {\n code\n field\n message\n }\n checkout {\n ...CheckoutDetails\n }\n }\n }\n ${fragment.CheckoutDetails}\n`\n","import Cookies from 'js-cookie'\n\nimport * as mutation from './mutations'\nimport { CheckoutCreate } from '../schema'\nimport { CHECKOUT_ID_COOKIE } from '../const'\n\nexport const checkoutCreate = async (fetch: any): Promise<CheckoutCreate> => {\n const data = await fetch({ query: mutation.CheckoutCreate })\n const checkout = data.checkoutCreate?.checkout\n const checkoutId = checkout?.id\n const checkoutToken = checkout?.token\n\n const value = `${checkoutId}:${checkoutToken}`\n\n if (checkoutId) {\n const options: Cookies.CookieAttributes = {\n expires: 60 * 60 * 24 * 30,\n sameSite: \"none\",\n secure: true,\n }\n Cookies.set(CHECKOUT_ID_COOKIE, value, options)\n }\n\n return checkout\n}\n\nexport default checkoutCreate","/* eslint-disable */\n/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src\n Changes: None\n*/\n\nimport { Product } from \"@plasmicpkgs/commerce\";\n\nimport {\n Product as SaleorProduct,\n Checkout,\n CheckoutLine,\n Money,\n ProductVariant,\n Collection,\n} from \"../schema\";\nimport { Category } from \"../types/site\";\nimport type { Cart, LineItem } from \"../types\";\n\n// TODO: Check nextjs-commerce bug if no images are added for a product\nconst placeholderImg = \"/product-img-placeholder.svg\";\n\nconst money = ({ amount, currency }: Money) => {\n return {\n value: +amount,\n currencyCode: currency || \"USD\",\n };\n};\n\nconst normalizeProductOptions = (options: ProductVariant[]) => {\n return options\n ?.map((option) => option?.attributes)\n .flat(1)\n .reduce<any>((acc, x) => {\n if (\n acc.find(({ displayName }: any) => displayName === x.attribute.name)\n ) {\n return acc.map((opt: any) => {\n return opt.displayName === x.attribute.name\n ? {\n ...opt,\n values: [\n ...opt.values,\n ...x.values.map((value: any) => ({\n label: value?.name,\n })),\n ],\n }\n : opt;\n });\n }\n\n return acc.concat({\n __typename: \"MultipleChoiceOption\",\n displayName: x.attribute.name,\n variant: \"size\",\n values: x.values.map((value: any) => ({\n label: value?.name,\n })),\n });\n }, []);\n};\n\nconst normalizeProductVariants = (variants: ProductVariant[]) => {\n return variants?.map((variant) => {\n const { id, sku, name, pricing } = variant;\n const price = pricing?.price?.net && money(pricing.price.net)?.value;\n\n return {\n id,\n name,\n sku: sku ?? id,\n price,\n listPrice: price,\n requiresShipping: true,\n options: normalizeProductOptions([variant]),\n };\n });\n};\n\nexport function normalizeProduct(productNode: SaleorProduct): Product {\n const {\n id,\n name,\n media = [],\n variants,\n description,\n slug,\n pricing,\n ...rest\n } = productNode;\n\n const product = {\n id,\n name,\n vendor: \"\",\n description: description\n ? JSON.parse(description)?.blocks[0]?.data.text\n : \"\",\n path: `/${slug}`,\n slug: slug?.replace(/^\\/+|\\/+$/g, \"\"),\n price: (pricing?.priceRange?.start?.net &&\n money(pricing.priceRange.start.net)) || {\n value: 0,\n currencyCode: \"USD\",\n },\n // TODO: Check nextjs-commerce bug if no images are added for a product\n images: media?.length ? media : [{ url: placeholderImg }],\n variants:\n variants && variants.length > 0\n ? normalizeProductVariants(variants as ProductVariant[])\n : [],\n options:\n variants && variants.length > 0\n ? normalizeProductOptions(variants as ProductVariant[])\n : [],\n ...rest,\n };\n\n return product as Product;\n}\n\nexport function normalizeCart(checkout: Checkout): Cart {\n const lines = checkout.lines as CheckoutLine[];\n const lineItems: LineItem[] =\n lines.length > 0 ? lines?.map<LineItem>(normalizeLineItem) : [];\n\n return {\n id: checkout.id,\n customerId: \"\",\n email: \"\",\n createdAt: checkout.created,\n currency: {\n code: checkout.totalPrice?.currency!,\n },\n taxesIncluded: false,\n lineItems,\n lineItemsSubtotalPrice: checkout.subtotalPrice?.gross?.amount!,\n subtotalPrice: checkout.subtotalPrice?.gross?.amount!,\n totalPrice: checkout.totalPrice?.gross.amount!,\n discounts: [],\n };\n}\n\nfunction normalizeLineItem({ id, variant, quantity }: CheckoutLine): LineItem {\n return {\n id,\n variantId: String(variant?.id),\n productId: String(variant?.product?.id),\n name: `${variant.product.name}`,\n quantity,\n variant: {\n id: String(variant?.id),\n sku: variant?.sku ?? \"\",\n name: variant?.name!,\n image: {\n url: variant?.media![0] ? variant?.media![0].url : placeholderImg,\n },\n requiresShipping: false,\n price: variant?.pricing?.price?.gross.amount!,\n listPrice: 0,\n },\n path: String(variant?.product?.slug),\n discounts: [],\n options: [],\n };\n}\nexport const normalizeCategory = ({\n name,\n slug,\n id,\n}: Collection): Category => ({\n id,\n name,\n slug,\n path: `/${slug}`,\n});\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src\n Changes: None \n*/\n\nimport { ValidationError } from '@plasmicpkgs/commerce';\nimport { CheckoutError, CheckoutErrorCode, AppError, AccountError, AccountErrorCode } from '../schema'\n\nexport type UserErrors = Array<CheckoutError | AccountError | AppError>\n\nexport type UserErrorCode = CheckoutErrorCode | AccountErrorCode | null | undefined\n\nexport const throwUserErrors = (errors?: UserErrors) => {\n if (errors && errors.length) {\n throw new ValidationError({\n errors: errors.map(({ code, message }) => ({\n code: code ?? 'validation_error',\n message: message || '',\n })),\n })\n }\n}\n\nexport default throwUserErrors\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src\n Changes: None \n*/\n\nimport { Cart } from '../types'\nimport { CommerceError } from '@plasmicpkgs/commerce'\n\nimport {\n CheckoutLinesAdd,\n CheckoutLinesUpdate,\n CheckoutCreate,\n CheckoutError,\n Checkout,\n Maybe,\n CheckoutLineDelete,\n} from '../schema'\n\nimport { normalizeCart } from './normalize'\nimport throwUserErrors from './throw-user-errors'\n\nexport type CheckoutQuery = {\n checkout: Checkout\n errors?: Array<CheckoutError>\n}\n\nexport type CheckoutPayload =\n | CheckoutLinesAdd\n | CheckoutLinesUpdate\n | CheckoutCreate\n | CheckoutQuery\n | CheckoutLineDelete\n\nconst checkoutToCart = (checkoutPayload?: Maybe<CheckoutPayload>): Cart | undefined => {\n if (!checkoutPayload) {\n throw new CommerceError({\n message: 'Missing checkout payload from response',\n })\n }\n\n const checkout = checkoutPayload?.checkout\n if (checkoutPayload?.errors?.length === 1 && checkoutPayload.errors[0].code === \"PRODUCT_UNAVAILABLE_FOR_PURCHASE\") {\n console.error(checkoutPayload.errors[0]);\n return undefined;\n }\n\n if (checkoutPayload?.errors) {\n throwUserErrors(checkoutPayload?.errors)\n }\n\n if (!checkout) {\n throw new CommerceError({\n message: 'Missing checkout object from response',\n })\n }\n\n return normalizeCart(checkout)\n}\n\nexport default checkoutToCart\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src\n Changes: None \n*/\n\nimport Cookies, { CookieAttributes } from 'js-cookie'\nimport * as Const from '../const'\n\nexport const getToken = () => Cookies.get(Const.SALEOR_TOKEN)\nexport const setToken = (token?: string, options?: CookieAttributes) => {\n setCookie(Const.SALEOR_TOKEN, token, options)\n}\n\nexport const getCSRFToken = () => Cookies.get(Const.SALEOR_CRSF_TOKEN)\nexport const setCSRFToken = (token?: string, options?: CookieAttributes) => {\n setCookie(Const.SALEOR_CRSF_TOKEN, token, options)\n}\n\nexport const getCheckoutToken = () => Cookies.get(Const.CHECKOUT_ID_COOKIE)\nexport const setCheckoutToken = (token?: string, options?: CookieAttributes) => {\n setCookie(Const.CHECKOUT_ID_COOKIE, token, options)\n}\n\nconst setCookie = (name: string, token?: string, options?: CookieAttributes) => {\n if (!token) {\n Cookies.remove(name)\n } else {\n Cookies.set(name, token, options ?? { expires: 60 * 60 * 24 * 30 })\n }\n}\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src\n Changes: None \n*/\n\nexport const CollectionMany = /* GraphQL */ `\n query CollectionMany( $channel: String = \"default-channel\") {\n collections(first:100, channel: $channel) {\n edges {\n node {\n id\n name\n slug\n }\n }\n }\n }\n`\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src\n Changes: None \n*/\n\nexport const ProductOneBySlug = /* GraphQL */ `\n query ProductOneBySlug($slug: String!, $channel: String = \"default-channel\") {\n product(slug: $slug, channel: $channel) {\n id\n slug\n name\n description\n pricing {\n priceRange {\n start {\n net {\n amount\n }\n }\n }\n }\n variants {\n id\n name\n attributes {\n attribute {\n name\n }\n values {\n name\n }\n }\n pricing {\n price {\n net {\n amount\n currency\n }\n }\n }\n }\n media {\n url\n alt\n }\n }\n }\n`\n\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src\n Changes: None \n*/\n\nimport * as fragment from '../fragments'\n\nexport const ProductMany = /* GraphQL */ `\n query ProductMany(\n $first: Int = 100\n $filter: ProductFilterInput\n $sortBy: ProductOrder\n $channel: String = \"default-channel\"\n ) {\n products(first: $first, channel: $channel, filter: $filter, sortBy: $sortBy) {\n ...ProductConnection\n }\n }\n ${fragment.ProductConnection}\n`\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src\n Changes: None \n*/\n\nimport * as fragment from '../fragments'\n\nexport const CollectionOne = /* GraphQL */ `\n query getProductsFromCollection($categoryId: ID!, $first: Int = 100, $channel: String = \"default-channel\") {\n collection(id: $categoryId, channel: $channel) {\n id\n name\n slug\n products(first: $first) {\n ...ProductConnection\n }\n }\n }\n ${fragment.ProductConnection}\n`\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src\n Changes: None \n*/\n\n\n\nimport * as fragment from '../fragments'\n\nexport const CheckoutOne = /* GraphQL */ `\n query CheckoutOne($checkoutId: UUID!) {\n checkout(token: $checkoutId) {\n ... on Checkout {\n ...CheckoutDetails\n }\n }\n }\n ${fragment.CheckoutDetails}\n`\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src\n Changes: None \n*/\n\nexport const getAllProductVendors = /* GraphQL */ `\n query getAllProductVendors($cursor: String, $channel: String = \"default-channel\") {\n products(first:100,channel: $channel, after: $cursor) {\n pageInfo {\n hasNextPage\n hasPreviousPage\n }\n edges {\n node {\n slug\n }\n cursor\n }\n }\n }\n`\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src\n Changes:None\n*/\n\nimport { useMemo } from \"react\";\nimport { useCart as useCommerceCart, UseCart } from \"@plasmicpkgs/commerce\";\n\nimport { SWRHook } from \"@plasmicpkgs/commerce\";\nimport { checkoutCreate, checkoutToCart, getCheckoutId } from \"../utils\";\nimport * as query from \"../utils/queries\";\nimport { GetCartHook } from \"../types/cart\";\n\nexport default useCommerceCart as UseCart<typeof handler>;\n\nexport const handler: SWRHook<GetCartHook> = {\n fetchOptions: {\n query: query.CheckoutOne,\n },\n async fetcher({ input: { cartId: checkoutId }, options, fetch }) {\n let checkout;\n\n if (checkoutId) {\n const checkoutId = getCheckoutId().checkoutToken;\n const data = await fetch({\n ...options,\n variables: { checkoutId },\n });\n\n checkout = data;\n }\n\n if (checkout?.completedAt || !checkoutId) {\n checkout = await checkoutCreate(fetch);\n }\n\n return checkoutToCart(checkout);\n },\n useHook:\n ({ useData }) =>\n (input) => {\n const response = useData({\n swrOptions: { revalidateOnFocus: false, ...input?.swrOptions },\n });\n return useMemo(\n () =>\n Object.create(response, {\n isEmpty: {\n get() {\n return (response.data?.lineItems.length ?? 0) <= 0;\n },\n enumerable: true,\n },\n }),\n [response]\n );\n },\n};\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src\n Changes:None\n*/\nimport { useCallback } from \"react\";\nimport type { MutationHook } from \"@plasmicpkgs/commerce\";\nimport { CommerceError } from \"@plasmicpkgs/commerce\";\nimport { useAddItem, UseAddItem } from \"@plasmicpkgs/commerce\";\nimport useCart from \"./use-cart\";\n\nimport * as mutation from \"../utils/mutations\";\n\nimport { getCheckoutId, checkoutToCart } from \"../utils\";\n\nimport { Mutation, MutationCheckoutLinesAddArgs } from \"../schema\";\nimport { AddItemHook } from \"../types/cart\";\n\nexport default useAddItem as UseAddItem<typeof handler>;\n\nexport const handler: MutationHook<AddItemHook> = {\n fetchOptions: { query: mutation.CheckoutLineAdd },\n async fetcher({ input: item, options, fetch }) {\n if (\n item.quantity &&\n (!Number.isInteger(item.quantity) || item.quantity! < 1)\n ) {\n throw new CommerceError({\n message: \"The item quantity has to be a valid integer greater than 0\",\n });\n }\n\n const { checkoutLinesAdd } = await fetch<\n Mutation,\n MutationCheckoutLinesAddArgs\n >({\n ...options,\n variables: {\n checkoutId: getCheckoutId().checkoutId,\n lineItems: [\n {\n variantId: item.variantId,\n quantity: item.quantity ?? 1,\n },\n ],\n },\n });\n\n return checkoutToCart(checkoutLinesAdd);\n },\n useHook:\n ({ fetch }) =>\n () => {\n const { mutate } = useCart();\n\n return useCallback(\n async function addItem(input) {\n const data = await fetch({ input });\n if (data) {\n await mutate(data, false);\n } else {\n await mutate();\n }\n return data;\n },\n [fetch, mutate]\n );\n },\n};\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src\n Changes: None\n*/\n\nimport type {\n HookFetcherContext,\n MutationHookContext,\n} from \"@plasmicpkgs/commerce\";\nimport { useRemoveItem, UseRemoveItem } from \"@plasmicpkgs/commerce\";\nimport { useCallback } from \"react\";\nimport { Mutation, MutationCheckoutLineDeleteArgs } from \"../schema\";\nimport { LineItem, RemoveItemHook } from \"../types/cart\";\nimport { checkoutToCart, getCheckoutId } from \"../utils\";\nimport * as mutation from \"../utils/mutations\";\nimport useCart from \"./use-cart\";\n\nexport default useRemoveItem as UseRemoveItem<typeof handler>;\n\nexport const handler = {\n fetchOptions: { query: mutation.CheckoutLineDelete },\n async fetcher({\n input: { itemId },\n options,\n fetch,\n }: HookFetcherContext<RemoveItemHook>) {\n const data = await fetch<Mutation, MutationCheckoutLineDeleteArgs>({\n ...options,\n variables: {\n checkoutId: getCheckoutId().checkoutId,\n lineId: itemId,\n },\n });\n return checkoutToCart(data.checkoutLineDelete);\n },\n useHook: ({ fetch }: MutationHookContext<RemoveItemHook>) => <\n T extends LineItem | undefined = undefined\n >() => {\n const { mutate } = useCart();\n\n return useCallback(\n async function removeItem(input: { id: string }) {\n const data = await fetch({ input: { itemId: input.id } });\n await mutate(data, false);\n\n return data;\n },\n [fetch, mutate]\n );\n },\n};\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src\n Changes: None\n*/\n\nimport type {\n HookFetcherContext,\n MutationHookContext,\n} from \"@plasmicpkgs/commerce\";\nimport {\n useUpdateItem,\n UseUpdateItem,\n ValidationError,\n} from \"@plasmicpkgs/commerce\";\nimport debounce from \"debounce\";\nimport { useCallback } from \"react\";\n\nimport { Mutation, MutationCheckoutLinesUpdateArgs } from \"../schema\";\nimport type { LineItem } from \"../types/cart\";\nimport { checkoutToCart, getCheckoutId } from \"../utils\";\nimport useCart from \"./use-cart\";\nimport { handler as removeItemHandler } from \"./use-remove-item\";\n\nimport * as mutation from \"../utils/mutations\";\n\nimport type { UpdateItemHook } from \"../types/cart\";\n\nexport type UpdateItemActionInput<T = any> = T extends LineItem\n ? Partial<UpdateItemHook[\"actionInput\"]>\n : UpdateItemHook[\"actionInput\"];\n\nexport default useUpdateItem as UseUpdateItem<typeof handler>;\n\nexport const handler = {\n fetchOptions: { query: mutation.CheckoutLineUpdate },\n async fetcher({\n input: { itemId, item },\n options,\n fetch,\n }: HookFetcherContext<UpdateItemHook>) {\n if (Number.isInteger(item.quantity)) {\n // Also allow the update hook to remove an item if the quantity is lower than 1\n if (item.quantity! < 1) {\n return removeItemHandler.fetcher({\n options: removeItemHandler.fetchOptions,\n input: { itemId },\n fetch,\n });\n }\n } else if (item.quantity) {\n throw new ValidationError({\n message: \"The item quantity has to be a valid integer\",\n });\n }\n\n const checkoutId = getCheckoutId().checkoutId;\n const { checkoutLinesUpdate } = await fetch<\n Mutation,\n MutationCheckoutLinesUpdateArgs\n >({\n ...options,\n variables: {\n checkoutId,\n lineItems: [\n {\n itemId,\n quantity: item.quantity,\n },\n ],\n },\n });\n\n return checkoutToCart(checkoutLinesUpdate);\n },\n useHook:\n ({ fetch }: MutationHookContext<UpdateItemHook>) =>\n <T extends LineItem | undefined = undefined>(\n ctx: {\n item?: T;\n wait?: number;\n } = {}\n ) => {\n const { item } = ctx;\n const { mutate } = useCart() as any;\n\n return useCallback(\n debounce(async (input: UpdateItemActionInput<T>) => {\n const itemId = input.id ?? item?.id;\n if (!itemId) {\n throw new ValidationError({\n message: \"Invalid input used for this operation\",\n });\n }\n\n const data = await fetch({\n input: {\n item: {\n quantity: input.quantity,\n },\n itemId,\n },\n });\n await mutate(data, false);\n return data;\n }, ctx.wait ?? 500),\n [fetch, mutate]\n );\n },\n};\n","import { SWRHook } from \"@plasmicpkgs/commerce\";\nimport { UseCategories, useCategories } from \"@plasmicpkgs/commerce\";\nimport { useMemo } from \"react\";\nimport { CollectionCountableEdge } from \"../schema\";\nimport { GetCategoriesHook } from \"../types/site\";\nimport { CollectionMany, CollectionOne, normalizeCategory } from \"../utils\";\n\nexport default useCategories as UseCategories<typeof handler>;\n\nexport const handler: SWRHook<GetCategoriesHook> = {\n fetchOptions: {\n query: CollectionMany,\n },\n async fetcher({ input, options, fetch }) {\n const { categoryId } = input;\n if (!categoryId) {\n const data = await fetch({\n query: CollectionMany,\n variables: {\n first: 250,\n },\n })\n\n return (\n data.collections?.edges?.map(({ node }: CollectionCountableEdge) =>\n normalizeCategory(node)\n ) ?? []\n );\n } else {\n const data = await fetch({\n query: CollectionOne,\n variables: { categoryId },\n });\n return !!data?.collection ? [normalizeCategory(data?.collection)] : [];\n }\n },\n useHook:\n ({ useData }) =>\n (input) => {\n const response = useData({\n input: [[\"categoryId\", input?.categoryId]],\n swrOptions: { revalidateOnFocus: false, ...input?.swrOptions },\n });\n return useMemo(\n () =>\n Object.create(response, {\n isEmpty: {\n get() {\n return (response.data?.length ?? 0) <= 0;\n },\n enumerable: true,\n },\n }),\n [response]\n );\n },\n};","import { SWRHook } from \"@plasmicpkgs/commerce\";\nimport { UseBrands, useBrands } from \"@plasmicpkgs/commerce\";\nimport { useMemo } from \"react\";\nimport {\n GetAllProductPathsQuery,\n GetAllProductPathsQueryVariables,\n} from \"../schema\";\nimport { GetBrandsHook } from \"../types/site\";\nimport { getAllProductVendors } from \"../utils\";\n\nexport default useBrands as UseBrands<typeof handler>;\n\nexport const handler: SWRHook<GetBrandsHook> = {\n fetchOptions: {\n query: getAllProductVendors,\n },\n async fetcher({ input, options, fetch }) {\n return []; // brands it's not available on saleor\n },\n useHook:\n ({ useData }) =>\n (input) => {\n const response = useData({\n swrOptions: { revalidateOnFocus: false, ...input?.swrOptions },\n });\n return useMemo(\n () =>\n Object.create(response, {\n isEmpty: {\n get() {\n return (response.data?.length ?? 0) <= 0;\n },\n enumerable: true,\n },\n }),\n [response]\n );\n },\n};\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src\n Changes:None\n*/\n\nimport { Product, SWRHook, useSearch, UseSearch } from \"@plasmicpkgs/commerce\";\n\nimport { ProductCountableEdge } from \"../schema\";\nimport { getSearchVariables, normalizeProduct } from \"../utils\";\n\nimport { SearchProductsHook } from \"@plasmicpkgs/commerce\";\nimport * as query from \"../utils/queries\";\n\nconst useSearchTyped: UseSearch<typeof handler> = useSearch;\nexport default useSearchTyped;\n\nexport type SearchProductsInput = {\n search?: string;\n categoryId?: string | number;\n brandId?: string | number;\n sort?: string;\n count?: number;\n};\n\nexport type SearchProductsData = {\n products: Product[];\n found: boolean;\n};\n\nexport const handler: SWRHook<SearchProductsHook> = {\n fetchOptions: {\n query: query.ProductMany,\n },\n async fetcher({ input, options, fetch }) {\n const { categoryId, brandId } = input;\n\n const data = await fetch({\n query: categoryId ? query.CollectionOne : options.query,\n method: options?.method,\n variables: getSearchVariables(input),\n });\n\n let edges;\n\n if (categoryId) {\n edges = data.collection?.products?.edges ?? [];\n // FIXME @zaiste, no `vendor` in Saleor\n // if (brandId) {\n // edges = edges.filter(\n // ({ node: { vendor } }: ProductCountableEdge) =>\n // vendor.replace(/\\s+/g, '-').toLowerCase() === brandId\n // )\n // }\n } else {\n edges = data.products?.edges ?? [];\n }\n\n return {\n products: edges.map(({ node }: ProductCountableEdge) =>\n normalizeProduct(node)\n ),\n found: !!edges.length,\n };\n },\n useHook:\n ({ useData }) =>\n (input = {}) => {\n return useData({\n input: [\n [\"search\", input.search],\n [\"categoryId\", input.categoryId],\n [\"brandId\", input.brandId],\n [\"sort\", input.sort],\n [\"count\", input.count],\n ],\n swrOptions: {\n revalidateOnFocus: false,\n ...input.swrOptions,\n },\n });\n },\n};\n","export const ProductOneById = /* GraphQL */ `\n query ProductOneById($id: ID!, $channel: String = \"default-channel\") {\n product(id: $id, channel: $channel) {\n\n slug\n name\n description\n pricing {\n priceRange {\n start {\n net {\n amount\n }\n }\n }\n }\n variants {\n id\n name\n attributes {\n attribute {\n name\n }\n values {\n name\n }\n }\n pricing {\n price {\n net {\n amount\n currency\n }\n }\n }\n }\n media {\n url\n alt\n }\n }\n }`","import { SWRHook } from \"@plasmicpkgs/commerce\";\nimport { useProduct, UseProduct } from \"@plasmicpkgs/commerce\";\n\nimport { normalizeProduct } from \"../utils\";\nimport type { GetProductHook } from \"@plasmicpkgs/commerce\";\n\nimport { ProductOneById } from \"../utils/queries/product-one-by-id\";\nimport { ProductOneBySlug } from '../utils/queries/product-one-by-slug';\n\nexport type GetProductInput = {\n id?: string;\n slug?: string\n};\n\nexport default useProduct as UseProduct<typeof handler>;\n\nexport const handler: SWRHook<GetProductHook> = {\n fetchOptions: {\n query: ProductOneById,\n },\n async fetcher({ input, options, fetch }) {\n const { id } = input;\n if (!id) {\n return null;\n }\n const data = await fetch({\n query: ProductOneById,\n variables: { id },\n });\n if (!data.product) {\n const response = await fetch({\n query: ProductOneBySlug,\n variables: { slug: id }\n })\n return response.product ? normalizeProduct(response.product) : null;\n }\n return data.product ? normalizeProduct(data.product) : null;\n },\n useHook:\n ({ useData }) =>\n (input = {}) => {\n return useData({\n input: [[\"id\", input.id]],\n swrOptions: {\n revalidateOnFocus: false,\n ...input.swrOptions,\n },\n });\n },\n};\n","\n/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src\n Changes: \n - Before: The saleor_api_url was defined at build time. \n So this file just implemented a fetcher with these parameters defined.\n - Now: The saleor_api_url is defined at runtime. \n So we have to get the fetcher using these parameters.\n*/\n\n\nimport { Fetcher } from '@plasmicpkgs/commerce'\nimport { getToken, handleFetchResponse } from './utils'\n\nexport const getFetcher:\n (saleorApiUrl: string) => Fetcher =\n (saleorApiUrl) => {\n return async ({\n url = saleorApiUrl,\n method = 'POST',\n query,\n variables,\n }) => {\n const { locale, ...vars } = variables ?? {}\n const token = getToken()\n return handleFetchResponse(\n await fetch(url, {\n method,\n body: JSON.stringify({ query, variables: vars }),\n headers: {\n Authorization: `JWT ${token}`,\n 'Content-Type': 'application/json',\n },\n })\n )\n }\n }\n\n\n\n","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src\n Changes:\n - Removed customer and auth hooks.\n - Added saleor_api_url parameters.\n*/\n\nimport { CHECKOUT_ID_COOKIE } from './const'\nimport { handler as useCart } from './cart/use-cart'\nimport { handler as useAddItem } from './cart/use-add-item'\nimport { handler as useUpdateItem } from './cart/use-update-item'\nimport { handler as useRemoveItem } from './cart/use-remove-item'\nimport { handler as useCategories } from './site/use-categories'\nimport { handler as useBrands } from './site/use-brands'\nimport { handler as useSearch } from './product/use-search'\nimport { handler as useProduct } from './product/use-product'\nimport { Fetcher } from '@plasmicpkgs/commerce'\nimport { getFetcher } from './fetcher'\n\nexport const getSaleorProvider = (saleorApiUrl: string,) => ({\n locale: 'en-us',\n cartCookie: CHECKOUT_ID_COOKIE,\n fetcher: getFetcher(saleorApiUrl),\n cart: { useCart, useAddItem, useUpdateItem, useRemoveItem },\n products: { useSearch, useProduct },\n site: { useCategories, useBrands }\n})\n\n\n\n\n\nexport type SaleorProvider = {\n locale: string;\n cartCookie: string;\n fetcher: Fetcher;\n cart: {\n useCart: typeof useCart;\n useAddItem: typeof useAddItem;\n useUpdateItem: typeof useUpdateItem;\n useRemoveItem: typeof useRemoveItem\n };\n products: {\n useSearch: typeof useSearch\n useProduct: typeof useProduct\n };\n site: {\n useCategories: typeof useCategories\n useBrands: typeof useBrands\n }\n}","/*\n Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src\n Changes: \n - Added saleor_api_url parameter.\n*/\nimport {\n getCommerceProvider as getCoreCommerceProvider,\n useCommerce as useCoreCommerce,\n} from \"@plasmicpkgs/commerce\";\nimport { getSaleorProvider, SaleorProvider } from \"./provider\";\n\nexport type { SaleorProvider };\n\nexport const useCommerce = () => useCoreCommerce<SaleorProvider>();\nexport const getCommerceProvider = (saleorApiUrl: string) =>\n getCoreCommerceProvider(getSaleorProvider(saleorApiUrl));\n","import { GlobalContextMeta } from \"@plasmicapp/host\";\nimport registerGlobalContext from \"@plasmicapp/host/registerGlobalContext\";\nimport React from \"react\";\nimport { Registerable } from \"./registerable\";\nimport { getCommerceProvider } from \"./saleor\";\nimport {\n CartActionsProvider,\n globalActionsRegistrations,\n} from \"@plasmicpkgs/commerce\";\n\ninterface CommerceProviderProps {\n children?: React.ReactNode;\n saleorApiUrl: string;\n}\n\nconst globalContextName = \"plasmic-commerce-saleor-provider\";\n\nexport const commerceProviderMeta: GlobalContextMeta<CommerceProviderProps> = {\n name: globalContextName,\n displayName: \"Saleor Provider\",\n props: {\n saleorApiUrl: {\n type: \"string\",\n defaultValue: \"https://vercel.saleor.cloud/graphql/\",\n },\n },\n unstable__globalActions: globalActionsRegistrations as any,\n importPath: \"@plasmicpkgs/commerce-saleor\",\n importName: \"CommerceProviderComponent\",\n};\n\nexport function CommerceProviderComponent(props: CommerceProviderProps) {\n const { saleorApiUrl, children } = props;\n\n const CommerceProvider = React.useMemo(\n () => getCommerceProvider(saleorApiUrl),\n [saleorApiUrl]\n );\n\n return (\n <CommerceProvider>\n <CartActionsProvider globalContextName={globalContextName}>\n {children}\n </CartActionsProvider>\n </CommerceProvider>\n );\n}\n\nexport function registerCommerceProvider(\n loader?: Registerable,\n customCommerceProviderMeta?: GlobalContextMeta<CommerceProviderProps>\n) {\n const doRegisterComponent: typeof registerGlobalContext = (...args) =>\n loader\n ? loader.registerGlobalContext(...args)\n : registerGlobalContext(...args);\n doRegisterComponent(\n CommerceProviderComponent,\n customCommerceProviderMeta ?? commerceProviderMeta\n );\n}\n","import { Registerable } from \"./registerable\";\nimport {\n registerCommerceProvider,\n CommerceProviderComponent,\n} from \"./registerCommerceProvider\";\nexport * from \"./registerable\";\n\nexport * from \"./saleor\";\n\nexport function registerAll(loader?: Registerable) {\n registerCommerceProvider(loader);\n}\n\nexport { registerCommerceProvider, CommerceProviderComponent };\n"],"names":["CHECKOUT_ID_COOKIE","SALEOR_TOKEN","runtime","exports","Op","Object","prototype","hasOwn","hasOwnProperty","undefined","$Symbol","Symbol","iteratorSymbol","iterator","asyncIteratorSymbol","asyncIterator","toStringTagSymbol","toStringTag","define","obj","key","value","defineProperty","enumerable","configurable","writable","err","wrap","innerFn","outerFn","self","tryLocsList","protoGenerator","Generator","generator","create","context","Context","_invoke","makeInvokeMethod","tryCatch","fn","arg","type","call","GenStateSuspendedStart","GenStateSuspendedYield","GenStateExecuting","GenStateCompleted","ContinueSentinel","GeneratorFunction","GeneratorFunctionPrototype","IteratorPrototype","getProto","getPrototypeOf","NativeIteratorPrototype","values","Gp","displayName","defineIteratorMethods","forEach","method","isGeneratorFunction","genFun","ctor","constructor","name","mark","setPrototypeOf","__proto__","awrap","__await","AsyncIterator","PromiseImpl","invoke","resolve","reject","record","result","then","unwrapped","error","previousPromise","enqueue","callInvokeWithMethodAndArg","async","Promise","iter","next","done","state","Error","doneResult","delegate","delegateResult","maybeInvokeDelegate","sent","_sent","dispatchException","abrupt","TypeError","info","resultName","nextLoc","pushTryEntry","locs","entry","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","push","resetTryEntry","completion","reset","keys","object","reverse","length","pop","iterable","iteratorMethod","isNaN","i","skipTempReset","prev","charAt","slice","stop","rootEntry","rootRecord","rval","exception","handle","loc","caught","hasCatch","hasFinally","finallyEntry","complete","finish","thrown","delegateYield","module","regeneratorRuntime","accidentalStrictMode","globalThis","Function","getSortVariables","sort","isCategory","output","field","direction","getError","errors","status","message","FetcherError","getAsyncError","res","json","data","handleFetchResponse","ok","getSearchVariables","search","categoryId","count","sortBy","channel","filter","first","getCheckoutId","id","r","Cookies","get","split","checkoutId","checkoutToken","ProductConnection","CheckoutDetails","CheckoutCreate","fragment","CheckoutLineAdd","CheckoutLineUpdate","CheckoutLineDelete","checkoutCreate","fetch","query","mutation","checkout","token","options","expires","sameSite","secure","set","placeholderImg","money","amount","currency","currencyCode","normalizeProductOptions","map","option","attributes","flat","reduce","acc","x","find","attribute","opt","label","concat","__typename","variant","normalizeProductVariants","variants","sku","pricing","price","net","listPrice","requiresShipping","normalizeProduct","productNode","media","description","slug","rest","product","vendor","JSON","parse","blocks","text","path","replace","priceRange","start","images","url","normalizeCart","lines","lineItems","normalizeLineItem","customerId","email","createdAt","created","code","totalPrice","taxesIncluded","lineItemsSubtotalPrice","subtotalPrice","gross","discounts","quantity","variantId","String","productId","image","normalizeCategory","throwUserErrors","ValidationError","checkoutToCart","checkoutPayload","CommerceError","console","getToken","Const","CollectionMany","ProductOneBySlug","ProductMany","CollectionOne","CheckoutOne","getAllProductVendors","handler","fetchOptions","fetcher","input","cartId","variables","completedAt","useHook","useData","response","swrOptions","revalidateOnFocus","useMemo","isEmpty","item","Number","isInteger","checkoutLinesAdd","useCart","mutate","useCallback","addItem","itemId","lineId","checkoutLineDelete","removeItem","removeItemHandler","checkoutLinesUpdate","ctx","debounce","wait","collections","edges","node","collection","brandId","products","found","ProductOneById","getFetcher","saleorApiUrl","locale","vars","body","stringify","headers","Authorization","getSaleorProvider","cartCookie","cart","useAddItem","useUpdateItem","useRemoveItem","useSearch","useProduct","site","useCategories","useBrands","useCommerce","useCoreCommerce","getCommerceProvider","getCoreCommerceProvider","globalContextName","commerceProviderMeta","props","defaultValue","unstable__globalActions","globalActionsRegistrations","importPath","importName","CommerceProviderComponent","children","CommerceProvider","React","CartActionsProvider","registerCommerceProvider","loader","customCommerceProviderMeta","doRegisterComponent","registerGlobalContext","registerAll"],"mappings":";;;;;;AAAA;;;;AAMO,IAAMA,kBAAkB,GAAG,mBAAmB;AAC9C,IAAMC,YAAY,GAAG,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACN1C;AACA;AACA;AACA;AACA;;EAEA,IAAIC,OAAO,GAAI,UAAUC,OAAO,EAAE;;IAGhC,IAAIC,EAAE,GAAGC,MAAM,CAACC,SAAS;IACzB,IAAIC,MAAM,GAAGH,EAAE,CAACI,cAAc;IAC9B,IAAIC,WAAS,CAAC;IACd,IAAIC,OAAO,GAAG,OAAOC,MAAM,KAAK,UAAU,GAAGA,MAAM,GAAG,EAAE;IACxD,IAAIC,cAAc,GAAGF,OAAO,CAACG,QAAQ,IAAI,YAAY;IACrD,IAAIC,mBAAmB,GAAGJ,OAAO,CAACK,aAAa,IAAI,iBAAiB;IACpE,IAAIC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AU,EAAE,8BAA8B;EAC1CC,UAAU,EAAE;CACb;AAED,SAAgBC,yBAAyB,CAACN,KAA4B;EACpE,IAAQxB,YAAY,GAAewB,KAAK,CAAhCxB,YAAY;IAAE+B,QAAQ,GAAKP,KAAK,CAAlBO,QAAQ;EAE9B,IAAMC,gBAAgB,GAAGC,KAAK,CAAC7D,OAAO,CACpC;IAAA,OAAMgD,mBAAmB,CAACpB,YAAY,CAAC;KACvC,CAACA,YAAY,CAAC,CACf;EAED,OACEiC,oBAACD,gBAAgB,QACfC,oBAACC,mBAAmB;IAACZ,iBAAiB,EAAEA;KACrCS,QAAQ,CACW,CACL;AAEvB;AAEA,SAAgBI,wBAAwB,CACtCC,MAAqB,EACrBC,0BAAqE;EAErE,IAAMC,mBAAmB,GAAiC,SAApDA,mBAAmB;IAAA,OACvBF,MAAM,GACFA,MAAM,CAACG,qBAAqB,OAA5BH,MAAM,YAA+B,GACrCG,qBAAqB,yBAAS;;EACpCD,mBAAmB,CACjBR,yBAAyB,EACzBO,0BAA0B,WAA1BA,0BAA0B,GAAId,oBAAoB,CACnD;AACH;;SCnDgBiB,WAAW,CAACJ,MAAqB;EAC/CD,wBAAwB,CAACC,MAAM,CAAC;AAClC;;;;"}
@@ -1 +1 @@
1
- export declare const CheckoutDetails = "\n fragment CheckoutDetails on Checkout {\n id\n token\n created\n totalPrice {\n currency\n gross {\n amount\n }\n }\n subtotalPrice {\n currency\n gross {\n amount\n }\n }\n\n lines {\n id\n variant {\n id\n name\n sku\n product {\n name\n slug\n }\n media {\n url\n }\n pricing {\n price {\n gross {\n amount\n }\n }\n }\n }\n quantity\n totalPrice {\n currency\n gross {\n amount\n }\n }\n }\n }\n";
1
+ export declare const CheckoutDetails = "\n fragment CheckoutDetails on Checkout {\n id\n token\n created\n totalPrice {\n currency\n gross {\n amount\n }\n }\n subtotalPrice {\n currency\n gross {\n amount\n }\n }\n\n lines {\n id\n variant {\n id\n name\n sku\n product {\n name\n slug\n id\n }\n media {\n url\n }\n pricing {\n price {\n gross {\n amount\n }\n }\n }\n }\n quantity\n totalPrice {\n currency\n gross {\n amount\n }\n }\n }\n }\n";
@@ -1,7 +1,7 @@
1
- import { Product } from '@plasmicpkgs/commerce';
2
- import { Product as SaleorProduct, Checkout, Collection } from '../schema';
3
- import { Category } from '../types/site';
4
- import type { Cart } from '../types';
1
+ import { Product } from "@plasmicpkgs/commerce";
2
+ import { Product as SaleorProduct, Checkout, Collection } from "../schema";
3
+ import { Category } from "../types/site";
4
+ import type { Cart } from "../types";
5
5
  export declare function normalizeProduct(productNode: SaleorProduct): Product;
6
6
  export declare function normalizeCart(checkout: Checkout): Cart;
7
7
  export declare const normalizeCategory: ({ name, slug, id, }: Collection) => Category;