@faststore/api
Advanced tools
Comparing version 1.2.29 to 1.2.30
@@ -6,2 +6,13 @@ # Change Log | ||
## 1.2.30 (2021-11-03) | ||
### Bug Fixes | ||
* Channel simulation ([#1014](https://github.com/vtex/faststore/issues/1014)) ([b45406b](https://github.com/vtex/faststore/commit/b45406b2b7ee8deb2b6e256629ba6df89d1b5940)) | ||
## 1.2.29 (2021-11-03) | ||
@@ -8,0 +19,0 @@ |
@@ -1,2 +0,2 @@ | ||
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var n=require("@graphql-tools/schema"),t=e(require("isomorphic-unfetch")),i=e(require("dataloader")),a=e(require("slugify")),r=e(require("fast-deep-equal")),o=require("graphql");function d(e,n,t,i,a,r,o){try{var d=e[r](o),u=d.value}catch(e){return void t(e)}d.done?n(u):Promise.resolve(u).then(i,a)}function u(e){return function(){var n=this,t=arguments;return new Promise((function(i,a){var r=e.apply(n,t);function o(e){d(r,i,a,o,u,"next",e)}function u(e){d(r,i,a,o,u,"throw",e)}o(void 0)}))}}function l(){return(l=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e}).apply(this,arguments)}function c(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,i=new Array(n);t<n;t++)i[t]=e[t];return i}function s(e,n){var t;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(t=function(e,n){if(e){if("string"==typeof e)return c(e,void 0);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?c(e,void 0):void 0}}(e))||n&&e&&"number"==typeof e.length){t&&(e=t);var i=0;return function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(t=e[Symbol.iterator]()).next.bind(t)}function m(e,n){return e(n={exports:{}},n.exports),n.exports}var p=m((function(e){var n=function(e){var n=Object.prototype,t=n.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",r=i.asyncIterator||"@@asyncIterator",o=i.toStringTag||"@@toStringTag";function d(e,n,t){return Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}),e[n]}try{d({},"")}catch(e){d=function(e,n,t){return e[n]=t}}function u(e,n,t,i){var a=Object.create((n&&n.prototype instanceof s?n:s).prototype),r=new D(i||[]);return a._invoke=function(e,n,t){var i="suspendedStart";return function(a,r){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===a)throw r;return{value:void 0,done:!0}}for(t.method=a,t.arg=r;;){var o=t.delegate;if(o){var d=S(o,t);if(d){if(d===c)continue;return d}}if("next"===t.method)t.sent=t._sent=t.arg;else if("throw"===t.method){if("suspendedStart"===i)throw i="completed",t.arg;t.dispatchException(t.arg)}else"return"===t.method&&t.abrupt("return",t.arg);i="executing";var u=l(e,n,t);if("normal"===u.type){if(i=t.done?"completed":"suspendedYield",u.arg===c)continue;return{value:u.arg,done:t.done}}"throw"===u.type&&(i="completed",t.method="throw",t.arg=u.arg)}}}(e,t,r),a}function l(e,n,t){try{return{type:"normal",arg:e.call(n,t)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var c={};function s(){}function m(){}function p(){}var k={};k[a]=function(){return this};var y=Object.getPrototypeOf,f=y&&y(y(b([])));f&&f!==n&&t.call(f,a)&&(k=f);var v=p.prototype=s.prototype=Object.create(k);function N(e){["next","throw","return"].forEach((function(n){d(e,n,(function(e){return this._invoke(n,e)}))}))}function g(e,n){var i;this._invoke=function(a,r){function o(){return new n((function(i,o){!function i(a,r,o,d){var u=l(e[a],e,r);if("throw"!==u.type){var c=u.arg,s=c.value;return s&&"object"==typeof s&&t.call(s,"__await")?n.resolve(s.__await).then((function(e){i("next",e,o,d)}),(function(e){i("throw",e,o,d)})):n.resolve(s).then((function(e){c.value=e,o(c)}),(function(e){return i("throw",e,o,d)}))}d(u.arg)}(a,r,i,o)}))}return i=i?i.then(o,o):o()}}function S(e,n){var t=e.iterator[n.method];if(void 0===t){if(n.delegate=null,"throw"===n.method){if(e.iterator.return&&(n.method="return",n.arg=void 0,S(e,n),"throw"===n.method))return c;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return c}var i=l(t,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,c;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=void 0),n.delegate=null,c):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,c)}function T(e){var n={tryLoc:e[0]};1 in e&&(n.catchLoc=e[1]),2 in e&&(n.finallyLoc=e[2],n.afterLoc=e[3]),this.tryEntries.push(n)}function h(e){var n=e.completion||{};n.type="normal",delete n.arg,e.completion=n}function D(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(T,this),this.reset(!0)}function b(e){if(e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,r=function n(){for(;++i<e.length;)if(t.call(e,i))return n.value=e[i],n.done=!1,n;return n.value=void 0,n.done=!0,n};return r.next=r}}return{next:F}}function F(){return{value:void 0,done:!0}}return m.prototype=v.constructor=p,p.constructor=m,m.displayName=d(p,o,"GeneratorFunction"),e.isGeneratorFunction=function(e){var n="function"==typeof e&&e.constructor;return!!n&&(n===m||"GeneratorFunction"===(n.displayName||n.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,d(e,o,"GeneratorFunction")),e.prototype=Object.create(v),e},e.awrap=function(e){return{__await:e}},N(g.prototype),g.prototype[r]=function(){return this},e.AsyncIterator=g,e.async=function(n,t,i,a,r){void 0===r&&(r=Promise);var o=new g(u(n,t,i,a),r);return e.isGeneratorFunction(t)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},N(v),d(v,o,"Generator"),v[a]=function(){return this},v.toString=function(){return"[object Generator]"},e.keys=function(e){var n=[];for(var t in e)n.push(t);return n.reverse(),function t(){for(;n.length;){var i=n.pop();if(i in e)return t.value=i,t.done=!1,t}return t.done=!0,t}},e.values=b,D.prototype={constructor:D,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(h),!e)for(var n in this)"t"===n.charAt(0)&&t.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function i(t,i){return o.type="throw",o.arg=e,n.next=t,i&&(n.method="next",n.arg=void 0),!!i}for(var a=this.tryEntries.length-1;a>=0;--a){var r=this.tryEntries[a],o=r.completion;if("root"===r.tryLoc)return i("end");if(r.tryLoc<=this.prev){var d=t.call(r,"catchLoc"),u=t.call(r,"finallyLoc");if(d&&u){if(this.prev<r.catchLoc)return i(r.catchLoc,!0);if(this.prev<r.finallyLoc)return i(r.finallyLoc)}else if(d){if(this.prev<r.catchLoc)return i(r.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<r.finallyLoc)return i(r.finallyLoc)}}}},abrupt:function(e,n){for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i];if(a.tryLoc<=this.prev&&t.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var r=a;break}}r&&("break"===e||"continue"===e)&&r.tryLoc<=n&&n<=r.finallyLoc&&(r=null);var o=r?r.completion:{};return o.type=e,o.arg=n,r?(this.method="next",this.next=r.finallyLoc,c):this.complete(o)},complete:function(e,n){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&n&&(this.next=n),c},finish:function(e){for(var n=this.tryEntries.length-1;n>=0;--n){var t=this.tryEntries[n];if(t.finallyLoc===e)return this.complete(t.completion,t.afterLoc),h(t),c}},catch:function(e){for(var n=this.tryEntries.length-1;n>=0;--n){var t=this.tryEntries[n];if(t.tryLoc===e){var i=t.completion;if("throw"===i.type){var a=i.arg;h(t)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,t){return this.delegate={iterator:b(e),resultName:n,nextLoc:t},"next"===this.method&&(this.arg=void 0),c}},e}(e.exports);try{regeneratorRuntime=n}catch(e){Function("r","regeneratorRuntime = r")(n)}})),k=function(){var e=u(p.mark((function e(n,i){var a;return p.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t(n,i);case 2:if(!(a=e.sent).ok){e.next=5;break}return e.abrupt("return",a.json());case 5:return e.next=7,a.text();case 7:throw new Error(e.sent);case 9:case"end":return e.stop()}}),e)})));return function(n,t){return e.apply(this,arguments)}}(),y={method:"POST",headers:{"content-type":"application/json"}},f=function(e,n){return l({},e,{isVariantOf:n})},v={highPrice:function(e){var n,t,i=e.items;return i.reduce((function(e,n){return e>n.sellingPrice?e:n.sellingPrice}),null!=(n=null==(t=i[0])?void 0:t.sellingPrice)?n:0)/100},lowPrice:function(e){var n,t,i=e.items;return i.reduce((function(e,n){return e<n.sellingPrice?e:n.sellingPrice}),null!=(n=null==(t=i[0])?void 0:t.sellingPrice)?n:0)/100},offerCount:function(e){return e.items.length},priceCurrency:function(){return""},offers:function(e){var n=e.product;return e.items.map((function(e){return l({},e,{product:n})}))}},N=function(e){return a(e,{replacement:"-",lower:!0})},g=function(e){return"brand"===e.type},S={id:function(e){return e.id.toString()},slug:function(e){return N(e.name)},seo:function(e){return g(e)?{title:e.title,description:e.metaTagDescription}:{title:e.Title,description:e.MetaTagDescription}},type:function(e){return g(e)?"Brand":0===e.level?"Department":"Category"},meta:function(e){return g(e)?{selectedFacets:[{key:"brand",value:N(e.name)}]}:{selectedFacets:new URL(e.url).pathname.slice(1).split("/").map((function(e,n){return{key:"category-"+(n+1),value:N(e)}}))}},breadcrumbList:function(){return{itemListElement:[],numberOfItems:0}}},T=function(e){return[e.itemOffered.sku,e.seller.identifier,e.price].join("::")},h=function(e,n){return{listPrice:e.listPrice/100,price:e.sellingPrice/100,quantity:e.quantity,seller:{identifier:e.seller},itemOffered:{sku:e.id,image:[],name:e.name},index:n}},D=function(e){return{quantity:e.quantity,seller:e.seller.identifier,id:e.itemOffered.sku,index:e.index}},b=function(e){return e.reduce((function(e,n){var t,i=T(n);return e.set(i,null!=(t=e.get(i))?t:n),e}),new Map)},F={validateCart:function(){var e=u(p.mark((function e(n,t,i){var a,o,d,u,c,s,m,k,y,f,v,N,g,S,F,O;return p.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=(a=t.cart.order).orderNumber,d=a.acceptedOffer,u=i.clients.commerce,c=i.loaders.skuLoader,e.next=4,u.checkout.orderForm({id:o});case 4:if(s=e.sent,m=b(d),k=b(s.items.map(h)),y=Array.from(m.values()),f=Array.from(k.values()),v=y.reduce((function(e,n){var t=k.get(T(n));return t?e.itemsToUpdate.push(l({},t,{quantity:n.quantity})):e.itemsToAdd.push(n),e}),{itemsToAdd:[],itemsToUpdate:[]}),N=v.itemsToAdd,g=v.itemsToUpdate,S=f.filter((function(e){return!m.has(T(e))})).map((function(e){return l({},e,{quantity:0})})),0!==(F=[].concat(N,g,S).map(D)).length){e.next=14;break}return e.abrupt("return",null);case 14:return e.next=16,u.checkout.updateOrderFormItems({id:s.orderFormId,orderItems:F});case 16:if(n=O=e.sent,!r((p=function(e){return{orderFormId:e.orderFormId,messages:e.messages,salesChannel:e.salesChannel,items:e.items.map((function(e){return{uniqueId:e.uniqueId,quantity:e.quantity,seller:e.seller,sellingPrice:e.sellingPrice,availability:e.availability}}))}})(s),p(n))){e.next=19;break}return e.abrupt("return",null);case 19:return e.abrupt("return",{order:{orderNumber:O.orderFormId,acceptedOffer:O.items.map((function(e){return l({},e,{product:c.load([{key:"id",value:e.id}])})}))},messages:O.messages.map((function(e){return{text:e.text,status:e.status.toUpperCase()}}))});case 20:case"end":return e.stop()}var n,p}),e)})));return function(n,t,i){return e.apply(this,arguments)}}()},O={name:"image",value:"https://storecomponents.vtexassets.com/assets/faststore/images/image___117a6d3e229a96ad0e0d0876352566e2.svg"},I=function(e,n){return e+"-"+n},w=function(e,n){return"/"+I(e,n)+"/p"},C={productID:function(e){return e.id},name:function(e){var n=e.name;return null!=n?n:e.isVariantOf.name},slug:function(e){return I(e.isVariantOf.link,e.id)},description:function(e){return e.isVariantOf.description},seo:function(e){var n=e.isVariantOf;return{title:n.name,description:n.description}},brand:function(e){return{name:e.isVariantOf.brand}},breadcrumbList:function(e){var n=e.isVariantOf,t=n.categoryTrees,i=n.name,a=n.link,r=e.id;return{itemListElement:[].concat(t.map((function(e,n){var t=e.categoryNames;return{name:t[t.length-1],item:"/"+t.join("/").toLowerCase(),position:n+1}})),[{name:i,item:w(a,r),position:t.length+1}]),numberOfItems:t.length}},image:function(e){var n,t=e.images;return(null!=(n=null!=t?t:e.isVariantOf.images)?n:[O]).map((function(e){var n=e.name;return{alternateName:null!=n?n:"",url:e.value.replace("vteximg.com.br","vtexassets.com")}}))},sku:function(e){return e.isVariantOf.skus[0].id},gtin:function(e){var n=e.reference;return null!=n?n:""},review:function(){return[]},aggregateRating:function(){return{}},offers:function(){var e=u(p.mark((function e(n,t,i){var a,r,o,d;return p.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=i.loaders.simulationLoader,r=n.id,o=n.sellers.map((function(e){return e.id})),d=Array.from(new Set(o)).map((function(e){return{quantity:1,seller:e,id:r}})),e.next=6,a.load(d);case 6:return e.abrupt("return",l({},e.sent,{product:n}));case 8:case"end":return e.stop()}}),e)})));return function(n,t,i){return e.apply(this,arguments)}}(),isVariantOf:function(e){return e.isVariantOf}},L={hasVariant:function(e){return e.skus.map((function(n){return f(n,e)}))},productGroupID:function(e){return e.product},name:function(e){return e.name}},P=function(e){var n=e.split("-").pop();if(null==n)throw new Error("Error while extracting sku id from product slug");return n},x=function(e){var n=e.key,t=e.value;switch(n){case"channel":return{key:"trade-policy",value:t};case"slug":return{key:"id",value:P(t)};default:return{key:n,value:t}}},V={price_desc:"price:desc",price_asc:"price:asc",orders_desc:"orders:desc",name_desc:"name:desc",name_asc:"name:asc",release_desc:"release:desc",discount_desc:"discount:desc",score_desc:""},E={product:function(){var e=u(p.mark((function e(n,t,i){return p.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",i.loaders.skuLoader.load(t.locator.map(x)));case 3:case"end":return e.stop()}}),e)})));return function(n,t,i){return e.apply(this,arguments)}}(),search:function(){var e=u(p.mark((function e(n,t){var i,a,r,o,d,u,l,c;return p.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=t.first,o=t.sort,d=t.term,u=t.selectedFacets,l=(r=t.after)?Number(r):0,c={page:Math.ceil(l/a),count:a,query:d,sort:V[null!=o?o:"score_desc"],selectedFacets:null!=(i=null==u?void 0:u.map(x))?i:[]},e.abrupt("return",c);case 4:case"end":return e.stop()}}),e)})));return function(n,t){return e.apply(this,arguments)}}(),allProducts:function(){var e=u(p.mark((function e(n,t,i){var a,r,o,d,u,l;return p.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=t.first,o=i.clients.search,d=(r=t.after)?Number(r):0,e.next=5,o.products({page:Math.ceil(d/a),count:a});case 5:return l=(u=e.sent).products.map((function(e){return e.skus.map((function(n){return f(n,e)}))})).flat().filter((function(e){return e.sellers.length>0})),e.abrupt("return",{pageInfo:{hasNextPage:u.pagination.after.length>0,hasPreviousPage:u.pagination.before.length>0,startCursor:"0",endCursor:u.total.toString(),totalCount:u.total},edges:l.map((function(e,n){return{node:e,cursor:(d+n).toString()}}))});case 8:case"end":return e.stop()}}),e)})));return function(n,t,i){return e.apply(this,arguments)}}(),allCollections:function(){var e=u(p.mark((function e(n,t,i){var a,r,o,d,u,c,m,k;return p.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=i.clients.commerce,e.next=3,Promise.all([a.catalog.brand.list(),a.catalog.category.tree()]);case 3:for(o=(r=e.sent)[0],d=[],u=function e(n,t){d.push(l({},n,{level:t}));for(var i,a=s(n.children);!(i=a()).done;)e(i.value,t+1)},c=s(r[1]);!(m=c()).done;)u(m.value,0);return k=[].concat(o.map((function(e){return l({},e,{type:"brand"})})),d),e.abrupt("return",{pageInfo:{hasNextPage:!1,hasPreviousPage:!1,startCursor:"0",endCursor:"0"},edges:k.map((function(e,n){return{node:e,cursor:n.toString()}}))});case 11:case"end":return e.stop()}}),e)})));return function(n,t,i){return e.apply(this,arguments)}}()},j={StoreCollection:S,StoreAggregateOffer:v,StoreProduct:C,StoreSeo:{title:function(e){var n=e.title;return null!=n?n:""},description:function(e){var n=e.description;return null!=n?n:""},titleTemplate:function(){return""},canonical:function(){return""}},StoreFacet:{key:function(e){return e.key},label:function(e){return e.label},values:function(e){return e.values},type:function(e){return"text"===e.type?"BOOLEAN":"RANGE"}},StoreFacetValue:{value:function(e){var n=e.key;return null!=n?n:e.from+"-to-"+e.to},label:function(e){var n=e.label;return null!=n?n:"unknown"},selected:function(e){return e.active},quantity:function(e){return e.count}},StoreOffer:{priceCurrency:function(){return""},priceValidUntil:function(e){var n=e.priceValidUntil;return null!=n?n:""},itemCondition:function(){return"https://schema.org/NewCondition"},availability:function(e){return"available"===e.availability?"https://schema.org/InStock":"https://schema.org/OutOfStock"},seller:function(e){return{identifier:e.seller}},price:function(e){return e.sellingPrice/100},sellingPrice:function(e){return e.sellingPrice/100},listPrice:function(e){return e.listPrice/100},itemOffered:function(e){return e.product},quantity:function(e){return e.quantity}},StoreAggregateRating:{ratingValue:function(){return 5},reviewCount:function(){return 0}},StoreReview:{reviewRating:function(){return{ratingValue:5,bestRating:5}},author:function(){return{name:""}}},StoreProductGroup:L,StoreSearchResult:{products:function(){var e=u(p.mark((function e(n,t,i){var a,r,o;return p.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=i.clients.search,e.next=3,a.products(n);case 3:return o=(r=e.sent).products.map((function(e){var n=e.skus.find((function(e){return e.sellers.length>0}));return n&&f(n,e)})).filter((function(e){return!!e})),e.abrupt("return",{pageInfo:{hasNextPage:r.pagination.after.length>0,hasPreviousPage:r.pagination.before.length>0,startCursor:"0",endCursor:r.total.toString(),totalCount:r.total},edges:o.map((function(e,n){return{node:e,cursor:n.toString()}}))});case 6:case"end":return e.stop()}}),e)})));return function(n,t,i){return e.apply(this,arguments)}}(),facets:function(){var e=u(p.mark((function e(n,t,i){var a;return p.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=i.clients.search,e.next=3,a.facets(n);case 3:return e.abrupt("return",e.sent.attributes);case 5:case"end":return e.stop()}}),e)})));return function(n,t,i){return e.apply(this,arguments)}}()},Query:E,Mutation:F},q={kind:"Document",definitions:[{kind:"ObjectTypeDefinition",name:{kind:"Name",value:"StoreAggregateOffer"},interfaces:[],directives:[],fields:[{kind:"FieldDefinition",name:{kind:"Name",value:"highPrice"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Float"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"lowPrice"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Float"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"offerCount"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"priceCurrency"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"offers"},arguments:[],type:{kind:"NonNullType",type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreOffer"}}}}},directives:[]}]}],loc:{start:0,end:261}};q.loc.source={body:"type StoreAggregateOffer {\n # Highest spot price amongst all sellers\n highPrice: Float!\n # Lowest spot price amongst all sellers\n lowPrice: Float!\n # Number of sellers selling this sku\n offerCount: Int!\n priceCurrency: String!\n offers: [StoreOffer!]!\n}\n",name:"GraphQL request",locationOffset:{line:1,column:1}};var R={kind:"Document",definitions:[{kind:"ObjectTypeDefinition",name:{kind:"Name",value:"StoreAggregateRating"},interfaces:[],directives:[],fields:[{kind:"FieldDefinition",name:{kind:"Name",value:"ratingValue"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Float"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"reviewCount"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},directives:[]}]}],loc:{start:0,end:72}};R.loc.source={body:"type StoreAggregateRating {\n ratingValue: Float!\n reviewCount: Int!\n}\n",name:"GraphQL request",locationOffset:{line:1,column:1}};var _={kind:"Document",definitions:[{kind:"ObjectTypeDefinition",name:{kind:"Name",value:"StoreAuthor"},interfaces:[],directives:[],fields:[{kind:"FieldDefinition",name:{kind:"Name",value:"name"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]}]}],loc:{start:0,end:37}};_.loc.source={body:"type StoreAuthor {\n name: String!\n}\n",name:"GraphQL request",locationOffset:{line:1,column:1}};var G={kind:"Document",definitions:[{kind:"ObjectTypeDefinition",name:{kind:"Name",value:"StoreBrand"},interfaces:[],directives:[],fields:[{kind:"FieldDefinition",name:{kind:"Name",value:"name"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]}]}],loc:{start:0,end:36}};G.loc.source={body:"type StoreBrand {\n name: String!\n}\n",name:"GraphQL request",locationOffset:{line:1,column:1}};var A={kind:"Document",definitions:[{kind:"ObjectTypeDefinition",name:{kind:"Name",value:"StoreListItem"},interfaces:[],directives:[],fields:[{kind:"FieldDefinition",name:{kind:"Name",value:"item"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"name"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"position"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},directives:[]}]},{kind:"ObjectTypeDefinition",name:{kind:"Name",value:"StoreBreadcrumbList"},interfaces:[],directives:[],fields:[{kind:"FieldDefinition",name:{kind:"Name",value:"itemListElement"},arguments:[],type:{kind:"NonNullType",type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreListItem"}}}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"numberOfItems"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},directives:[]}]}],loc:{start:0,end:161}};A.loc.source={body:"type StoreListItem {\n item: String!\n name: String!\n position: Int!\n}\n\ntype StoreBreadcrumbList {\n itemListElement: [StoreListItem!]!\n numberOfItems: Int!\n}\n",name:"GraphQL request",locationOffset:{line:1,column:1}};var B={kind:"Document",definitions:[{kind:"EnumTypeDefinition",name:{kind:"Name",value:"StoreCollectionType"},directives:[],values:[{kind:"EnumValueDefinition",name:{kind:"Name",value:"Department"},directives:[]},{kind:"EnumValueDefinition",name:{kind:"Name",value:"Category"},directives:[]},{kind:"EnumValueDefinition",name:{kind:"Name",value:"Brand"},directives:[]},{kind:"EnumValueDefinition",name:{kind:"Name",value:"Cluster"},directives:[]}]},{kind:"ObjectTypeDefinition",name:{kind:"Name",value:"StoreCollectionFacet"},interfaces:[],directives:[],fields:[{kind:"FieldDefinition",name:{kind:"Name",value:"key"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"value"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]}]},{kind:"ObjectTypeDefinition",name:{kind:"Name",value:"StoreCollectionMeta"},interfaces:[],directives:[],fields:[{kind:"FieldDefinition",name:{kind:"Name",value:"selectedFacets"},arguments:[],type:{kind:"NonNullType",type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreCollectionFacet"}}}}},directives:[]}]},{kind:"ObjectTypeDefinition",name:{kind:"Name",value:"StoreCollection"},interfaces:[],directives:[],fields:[{kind:"FieldDefinition",name:{kind:"Name",value:"seo"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreSeo"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"breadcrumbList"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreBreadcrumbList"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"meta"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreCollectionMeta"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"id"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"ID"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"slug"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"type"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreCollectionType"}}},directives:[]}]}],loc:{start:0,end:424}};B.loc.source={body:"enum StoreCollectionType {\n Department\n Category\n Brand\n Cluster\n}\n\ntype StoreCollectionFacet {\n key: String!\n value: String!\n}\n\ntype StoreCollectionMeta {\n selectedFacets: [StoreCollectionFacet!]!\n}\n\ntype StoreCollection {\n # Meta tag data\n seo: StoreSeo!\n # location for structured data\n breadcrumbList: StoreBreadcrumbList!\n meta: StoreCollectionMeta!\n id: ID!\n slug: String!\n type: StoreCollectionType!\n}\n",name:"GraphQL request",locationOffset:{line:1,column:1}};var Q={kind:"Document",definitions:[{kind:"ObjectTypeDefinition",name:{kind:"Name",value:"StoreFacet"},interfaces:[],directives:[],fields:[{kind:"FieldDefinition",name:{kind:"Name",value:"key"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"label"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"values"},arguments:[],type:{kind:"NonNullType",type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreFacetValue"}}}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"type"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreFacetType"}}},directives:[]}]},{kind:"ObjectTypeDefinition",name:{kind:"Name",value:"StoreFacetValue"},interfaces:[],directives:[],fields:[{kind:"FieldDefinition",name:{kind:"Name",value:"value"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"label"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"selected"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Boolean"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"quantity"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},directives:[]}]}],loc:{start:0,end:240}};Q.loc.source={body:"type StoreFacet {\n key: String!\n label: String!\n values: [StoreFacetValue!]!\n type: StoreFacetType!\n}\n\ntype StoreFacetValue {\n value: String!\n label: String!\n selected: Boolean!\n # Number of items with this facet\n quantity: Int!\n}\n",name:"GraphQL request",locationOffset:{line:1,column:1}};var M={kind:"Document",definitions:[{kind:"ObjectTypeDefinition",name:{kind:"Name",value:"StoreImage"},interfaces:[],directives:[],fields:[{kind:"FieldDefinition",name:{kind:"Name",value:"url"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"alternateName"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]}]},{kind:"InputObjectTypeDefinition",name:{kind:"Name",value:"IStoreImage"},directives:[],fields:[{kind:"InputValueDefinition",name:{kind:"Name",value:"url"},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"InputValueDefinition",name:{kind:"Name",value:"alternateName"},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]}]}],loc:{start:0,end:123}};M.loc.source={body:"type StoreImage {\n url: String!\n alternateName: String!\n}\n\ninput IStoreImage {\n url: String!\n alternateName: String!\n}\n",name:"GraphQL request",locationOffset:{line:1,column:1}};var U={kind:"Document",definitions:[{kind:"ObjectTypeDefinition",name:{kind:"Name",value:"Mutation"},interfaces:[],directives:[],fields:[{kind:"FieldDefinition",name:{kind:"Name",value:"validateCart"},arguments:[{kind:"InputValueDefinition",name:{kind:"Name",value:"cart"},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"IStoreCart"}}},directives:[]}],type:{kind:"NamedType",name:{kind:"Name",value:"StoreCart"}},directives:[]}]}],loc:{start:0,end:148}};U.loc.source={body:"type Mutation {\n # Returns the order if anything changed with the order. Null if the order is valid\n validateCart(cart: IStoreCart!): StoreCart\n}\n",name:"GraphQL request",locationOffset:{line:1,column:1}};var z={kind:"Document",definitions:[{kind:"ObjectTypeDefinition",name:{kind:"Name",value:"StoreOffer"},interfaces:[],directives:[],fields:[{kind:"FieldDefinition",name:{kind:"Name",value:"listPrice"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Float"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"sellingPrice"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Float"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"priceCurrency"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"price"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Float"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"priceValidUntil"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"itemCondition"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"availability"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"seller"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreOrganization"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"itemOffered"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreProduct"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"quantity"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},directives:[]}]},{kind:"InputObjectTypeDefinition",name:{kind:"Name",value:"IStoreOffer"},directives:[],fields:[{kind:"InputValueDefinition",name:{kind:"Name",value:"price"},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Float"}}},directives:[]},{kind:"InputValueDefinition",name:{kind:"Name",value:"listPrice"},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Float"}}},directives:[]},{kind:"InputValueDefinition",name:{kind:"Name",value:"seller"},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"IStoreOrganization"}}},directives:[]},{kind:"InputValueDefinition",name:{kind:"Name",value:"itemOffered"},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"IStoreProduct"}}},directives:[]},{kind:"InputValueDefinition",name:{kind:"Name",value:"quantity"},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},directives:[]}]}],loc:{start:0,end:419}};z.loc.source={body:"type StoreOffer {\n listPrice: Float!\n sellingPrice: Float!\n priceCurrency: String!\n # Also known as spotPrice\n price: Float!\n priceValidUntil: String!\n itemCondition: String!\n availability: String!\n seller: StoreOrganization!\n itemOffered: StoreProduct!\n quantity: Int!\n}\n\ninput IStoreOffer {\n price: Float!\n listPrice: Float!\n seller: IStoreOrganization!\n itemOffered: IStoreProduct!\n quantity: Int!\n}\n",name:"GraphQL request",locationOffset:{line:1,column:1}};var W={kind:"Document",definitions:[{kind:"ObjectTypeDefinition",name:{kind:"Name",value:"StoreOrder"},interfaces:[],directives:[],fields:[{kind:"FieldDefinition",name:{kind:"Name",value:"orderNumber"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"acceptedOffer"},arguments:[],type:{kind:"NonNullType",type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreOffer"}}}}},directives:[]}]},{kind:"InputObjectTypeDefinition",name:{kind:"Name",value:"IStoreOrder"},directives:[],fields:[{kind:"InputValueDefinition",name:{kind:"Name",value:"orderNumber"},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"InputValueDefinition",name:{kind:"Name",value:"acceptedOffer"},type:{kind:"NonNullType",type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"IStoreOffer"}}}}},directives:[]}]}],loc:{start:0,end:154}};W.loc.source={body:"type StoreOrder {\n orderNumber: String!\n acceptedOffer: [StoreOffer!]!\n}\n\ninput IStoreOrder {\n orderNumber: String!\n acceptedOffer: [IStoreOffer!]!\n}\n",name:"GraphQL request",locationOffset:{line:1,column:1}};var H={kind:"Document",definitions:[{kind:"ObjectTypeDefinition",name:{kind:"Name",value:"StoreOrganization"},interfaces:[],directives:[],fields:[{kind:"FieldDefinition",name:{kind:"Name",value:"identifier"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]}]},{kind:"InputObjectTypeDefinition",name:{kind:"Name",value:"IStoreOrganization"},directives:[],fields:[{kind:"InputValueDefinition",name:{kind:"Name",value:"identifier"},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]}]}],loc:{start:0,end:101}};H.loc.source={body:"type StoreOrganization {\n identifier: String!\n}\n\ninput IStoreOrganization {\n identifier: String!\n}\n",name:"GraphQL request",locationOffset:{line:1,column:1}};var J={kind:"Document",definitions:[{kind:"ObjectTypeDefinition",name:{kind:"Name",value:"StorePageInfo"},interfaces:[],directives:[],fields:[{kind:"FieldDefinition",name:{kind:"Name",value:"hasNextPage"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Boolean"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"hasPreviousPage"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Boolean"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"startCursor"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"endCursor"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"totalCount"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},directives:[]}]}],loc:{start:0,end:197}};J.loc.source={body:"type StorePageInfo {\n hasNextPage: Boolean!\n hasPreviousPage: Boolean!\n startCursor: String!\n endCursor: String!\n # Total number of items(products/collections), not pages\n totalCount: Int!\n}\n",name:"GraphQL request",locationOffset:{line:1,column:1}};var Y={kind:"Document",definitions:[{kind:"ObjectTypeDefinition",name:{kind:"Name",value:"StoreProduct"},interfaces:[],directives:[],fields:[{kind:"FieldDefinition",name:{kind:"Name",value:"seo"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreSeo"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"breadcrumbList"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreBreadcrumbList"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"slug"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"name"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"productID"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"brand"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreBrand"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"description"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"image"},arguments:[],type:{kind:"NonNullType",type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreImage"}}}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"offers"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreAggregateOffer"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"sku"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"gtin"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"review"},arguments:[],type:{kind:"NonNullType",type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreReview"}}}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"aggregateRating"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreAggregateRating"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"isVariantOf"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreProductGroup"}}},directives:[]}]},{kind:"InputObjectTypeDefinition",name:{kind:"Name",value:"IStoreProduct"},directives:[],fields:[{kind:"InputValueDefinition",name:{kind:"Name",value:"sku"},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"InputValueDefinition",name:{kind:"Name",value:"name"},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"InputValueDefinition",name:{kind:"Name",value:"image"},type:{kind:"NonNullType",type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"IStoreImage"}}}}},directives:[]}]}],loc:{start:0,end:528}};Y.loc.source={body:"type StoreProduct {\n # Meta tag data\n seo: StoreSeo!\n # Location for structured data\n breadcrumbList: StoreBreadcrumbList!\n # Where to retrieve this entity\n slug: String!\n name: String!\n productID: String!\n brand: StoreBrand!\n description: String!\n image: [StoreImage!]!\n offers: StoreAggregateOffer!\n sku: String!\n gtin: String!\n review: [StoreReview!]!\n aggregateRating: StoreAggregateRating!\n isVariantOf: StoreProductGroup!\n}\n\ninput IStoreProduct {\n sku: String!\n name: String!\n image: [IStoreImage!]!\n}\n",name:"GraphQL request",locationOffset:{line:1,column:1}};var K={kind:"Document",definitions:[{kind:"ObjectTypeDefinition",name:{kind:"Name",value:"StoreProductGroup"},interfaces:[],directives:[],fields:[{kind:"FieldDefinition",name:{kind:"Name",value:"hasVariant"},arguments:[],type:{kind:"NonNullType",type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreProduct"}}}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"productGroupID"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"name"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]}]}],loc:{start:0,end:100}};K.loc.source={body:"type StoreProductGroup {\n hasVariant: [StoreProduct!]!\n productGroupID: String!\n name: String!\n}\n",name:"GraphQL request",locationOffset:{line:1,column:1}};var $={kind:"Document",definitions:[{kind:"ObjectTypeDefinition",name:{kind:"Name",value:"StoreProductEdge"},interfaces:[],directives:[],fields:[{kind:"FieldDefinition",name:{kind:"Name",value:"node"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreProduct"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"cursor"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]}]},{kind:"ObjectTypeDefinition",name:{kind:"Name",value:"StoreProductConnection"},interfaces:[],directives:[],fields:[{kind:"FieldDefinition",name:{kind:"Name",value:"pageInfo"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StorePageInfo"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"edges"},arguments:[],type:{kind:"NonNullType",type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreProductEdge"}}}}},directives:[]}]},{kind:"ObjectTypeDefinition",name:{kind:"Name",value:"StoreCollectionEdge"},interfaces:[],directives:[],fields:[{kind:"FieldDefinition",name:{kind:"Name",value:"node"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreCollection"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"cursor"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]}]},{kind:"ObjectTypeDefinition",name:{kind:"Name",value:"StoreCollectionConnection"},interfaces:[],directives:[],fields:[{kind:"FieldDefinition",name:{kind:"Name",value:"pageInfo"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StorePageInfo"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"edges"},arguments:[],type:{kind:"NonNullType",type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreCollectionEdge"}}}}},directives:[]}]},{kind:"EnumTypeDefinition",name:{kind:"Name",value:"StoreSort"},directives:[],values:[{kind:"EnumValueDefinition",name:{kind:"Name",value:"price_desc"},directives:[]},{kind:"EnumValueDefinition",name:{kind:"Name",value:"price_asc"},directives:[]},{kind:"EnumValueDefinition",name:{kind:"Name",value:"orders_desc"},directives:[]},{kind:"EnumValueDefinition",name:{kind:"Name",value:"name_desc"},directives:[]},{kind:"EnumValueDefinition",name:{kind:"Name",value:"name_asc"},directives:[]},{kind:"EnumValueDefinition",name:{kind:"Name",value:"release_desc"},directives:[]},{kind:"EnumValueDefinition",name:{kind:"Name",value:"discount_desc"},directives:[]},{kind:"EnumValueDefinition",name:{kind:"Name",value:"score_desc"},directives:[]}]},{kind:"InputObjectTypeDefinition",name:{kind:"Name",value:"IStoreSelectedFacet"},directives:[],fields:[{kind:"InputValueDefinition",name:{kind:"Name",value:"key"},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"InputValueDefinition",name:{kind:"Name",value:"value"},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]}]},{kind:"EnumTypeDefinition",name:{kind:"Name",value:"StoreFacetType"},directives:[],values:[{kind:"EnumValueDefinition",name:{kind:"Name",value:"BOOLEAN"},directives:[]},{kind:"EnumValueDefinition",name:{kind:"Name",value:"RANGE"},directives:[]}]},{kind:"ObjectTypeDefinition",name:{kind:"Name",value:"StoreSearchResult"},interfaces:[],directives:[],fields:[{kind:"FieldDefinition",name:{kind:"Name",value:"products"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreProductConnection"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"facets"},arguments:[],type:{kind:"NonNullType",type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreFacet"}}}}},directives:[]}]},{kind:"ObjectTypeDefinition",name:{kind:"Name",value:"Query"},interfaces:[],directives:[],fields:[{kind:"FieldDefinition",name:{kind:"Name",value:"product"},arguments:[{kind:"InputValueDefinition",name:{kind:"Name",value:"locator"},type:{kind:"NonNullType",type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"IStoreSelectedFacet"}}}}},directives:[]}],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreProduct"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"search"},arguments:[{kind:"InputValueDefinition",name:{kind:"Name",value:"first"},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},directives:[]},{kind:"InputValueDefinition",name:{kind:"Name",value:"after"},type:{kind:"NamedType",name:{kind:"Name",value:"String"}},directives:[]},{kind:"InputValueDefinition",name:{kind:"Name",value:"sort"},type:{kind:"NamedType",name:{kind:"Name",value:"StoreSort"}},defaultValue:{kind:"EnumValue",value:"score_desc"},directives:[]},{kind:"InputValueDefinition",name:{kind:"Name",value:"term"},type:{kind:"NamedType",name:{kind:"Name",value:"String"}},defaultValue:{kind:"StringValue",value:"",block:!1},directives:[]},{kind:"InputValueDefinition",name:{kind:"Name",value:"selectedFacets"},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"IStoreSelectedFacet"}}}},directives:[]}],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreSearchResult"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"allProducts"},arguments:[{kind:"InputValueDefinition",name:{kind:"Name",value:"first"},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},directives:[]},{kind:"InputValueDefinition",name:{kind:"Name",value:"after"},type:{kind:"NamedType",name:{kind:"Name",value:"String"}},directives:[]}],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreProductConnection"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"allCollections"},arguments:[{kind:"InputValueDefinition",name:{kind:"Name",value:"first"},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},directives:[]},{kind:"InputValueDefinition",name:{kind:"Name",value:"after"},type:{kind:"NamedType",name:{kind:"Name",value:"String"}},directives:[]}],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreCollectionConnection"}}},directives:[]}]}],loc:{start:0,end:1214}};$.loc.source={body:'type StoreProductEdge {\n node: StoreProduct!\n cursor: String!\n}\n\ntype StoreProductConnection {\n pageInfo: StorePageInfo!\n edges: [StoreProductEdge!]!\n}\n\n\ntype StoreCollectionEdge {\n node: StoreCollection!\n cursor: String!\n}\n\ntype StoreCollectionConnection {\n pageInfo: StorePageInfo!\n edges: [StoreCollectionEdge!]!\n}\n\nenum StoreSort {\n price_desc\n price_asc\n orders_desc\n name_desc\n name_asc\n release_desc\n discount_desc\n score_desc\n}\n\ninput IStoreSelectedFacet {\n key: String!\n value: String!\n}\n\nenum StoreFacetType {\n BOOLEAN\n RANGE\n}\n\ntype StoreSearchResult {\n products: StoreProductConnection!\n facets: [StoreFacet!]!\n}\n\ntype Query {\n product(locator: [IStoreSelectedFacet!]!): StoreProduct!\n\n search(\n # Relay style pagination args. To know more: https://relay.dev/graphql/connections.htm\n first: Int!\n # Relay style pagination args. To know more: https://relay.dev/graphql/connections.htm\n after: String\n sort: StoreSort = score_desc\n term: String = ""\n selectedFacets: [IStoreSelectedFacet!]\n ): StoreSearchResult!\n\n allProducts(first: Int!, after: String): StoreProductConnection!\n\n allCollections(first: Int!, after: String): StoreCollectionConnection!\n}\n',name:"GraphQL request",locationOffset:{line:1,column:1}};var X={kind:"Document",definitions:[{kind:"ObjectTypeDefinition",name:{kind:"Name",value:"StoreReviewRating"},interfaces:[],directives:[],fields:[{kind:"FieldDefinition",name:{kind:"Name",value:"ratingValue"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Float"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"bestRating"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Float"}}},directives:[]}]},{kind:"ObjectTypeDefinition",name:{kind:"Name",value:"StoreReview"},interfaces:[],directives:[],fields:[{kind:"FieldDefinition",name:{kind:"Name",value:"reviewRating"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreReviewRating"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"author"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreAuthor"}}},directives:[]}]}],loc:{start:0,end:150}};X.loc.source={body:"type StoreReviewRating {\n ratingValue: Float!\n bestRating: Float!\n}\n\ntype StoreReview {\n reviewRating: StoreReviewRating!\n author: StoreAuthor!\n}\n",name:"GraphQL request",locationOffset:{line:1,column:1}};var Z={kind:"Document",definitions:[{kind:"ObjectTypeDefinition",name:{kind:"Name",value:"StoreSeo"},interfaces:[],directives:[],fields:[{kind:"FieldDefinition",name:{kind:"Name",value:"title"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"titleTemplate"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"description"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"canonical"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]}]}],loc:{start:0,end:104}};Z.loc.source={body:"type StoreSeo {\n title: String!\n titleTemplate: String!\n description: String!\n canonical: String!\n}\n",name:"GraphQL request",locationOffset:{line:1,column:1}};var ee={kind:"Document",definitions:[{kind:"ObjectTypeDefinition",name:{kind:"Name",value:"StoreCartMessage"},interfaces:[],directives:[],fields:[{kind:"FieldDefinition",name:{kind:"Name",value:"text"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"status"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreStatus"}}},directives:[]}]},{kind:"ObjectTypeDefinition",name:{kind:"Name",value:"StoreCart"},interfaces:[],directives:[],fields:[{kind:"FieldDefinition",name:{kind:"Name",value:"order"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreOrder"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"messages"},arguments:[],type:{kind:"NonNullType",type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreCartMessage"}}}}},directives:[]}]},{kind:"InputObjectTypeDefinition",name:{kind:"Name",value:"IStoreCart"},directives:[],fields:[{kind:"InputValueDefinition",name:{kind:"Name",value:"order"},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"IStoreOrder"}}},directives:[]}]}],loc:{start:0,end:183}};ee.loc.source={body:"type StoreCartMessage {\n text: String!\n status: StoreStatus!\n}\n\ntype StoreCart {\n order: StoreOrder!\n messages: [StoreCartMessage!]!\n}\n\ninput IStoreCart {\n order: IStoreOrder!\n}\n",name:"GraphQL request",locationOffset:{line:1,column:1}};var ne={kind:"Document",definitions:[{kind:"EnumTypeDefinition",name:{kind:"Name",value:"StoreStatus"},directives:[],values:[{kind:"EnumValueDefinition",name:{kind:"Name",value:"INFO"},directives:[]},{kind:"EnumValueDefinition",name:{kind:"Name",value:"WARNING"},directives:[]},{kind:"EnumValueDefinition",name:{kind:"Name",value:"ERROR"},directives:[]}]}],loc:{start:0,end:46}};ne.loc.source={body:"enum StoreStatus {\n INFO\n WARNING\n ERROR\n}\n",name:"GraphQL request",locationOffset:{line:1,column:1}};var te=[$,U,G,A,B,Q,M,J,Y,Z,z,R,X,_,K,H,q,W,ee,ne].map(o.print).join("\n"),ie={vtex:{getResolvers:function(e){return j},getContextFactory:function(e){return function(n){return n.clients=function(e){return{search:(n=e,t=n.channel,i="http://search.biggylabs.com.br/search-api/v1/"+n.account,a=function(e){var n,a,r=e.query,o=void 0===r?"":r,d=e.count,u=e.sort,c=void 0===u?"":u,s=e.selectedFacets,m=void 0===s?[]:s,p=e.type,y=e.fuzzy,f=void 0===y?"0":y,v=new URLSearchParams({page:(e.page+1).toString(),count:d.toString(),query:o,sort:c,fuzzy:f}),N=(n=m,a=Object.fromEntries(n.map((function(e){return[e.key,e.value]}))),Object.entries(l({"trade-policy":t},a)).map((function(e){return{key:e[0],value:e[1]}}))).map((function(e){return e.key+"/"+e.value})).join("/");return k(i+"/api/split/"+p+"/"+N+"?"+v.toString())},{facets:function(e){return a(l({},e,{type:"attribute_search"}))},products:function(e){return a(l({},e,{type:"product_search"}))}}),commerce:function(e){var n,t=e.channel,i="http://"+(n=e).account+"."+n.environment+".com.br";return{catalog:{brand:{list:function(){return k(i+"/api/catalog_system/pub/brand/list")}},category:{tree:function(e){return void 0===e&&(e=3),k(i+"/api/catalog_system/pub/category/tree/"+e)}}},checkout:{simulation:function(e,n){var a=new URLSearchParams({sc:(void 0===n?{salesChannel:t}:n).salesChannel});return k(i+"/api/checkout/pub/orderForms/simulation?"+a.toString(),l({},y,{body:JSON.stringify(e)}))},orderForm:function(e){var n=e.id,a=e.refreshOutdatedData,r=e.salesChannel,o=void 0===r?t:r,d=new URLSearchParams({refreshOutdatedData:(void 0===a||a).toString(),sc:o});return k(i+"/api/checkout/pub/orderForm/"+n+"?"+d.toString(),y)},updateOrderFormItems:function(e){var n=e.id,a=e.orderItems,r=e.allowOutdatedData,o=e.salesChannel,d=new URLSearchParams({allowOutdatedData:void 0===r?"paymentData":r,sc:void 0===o?t:o});return k(i+"/api/checkout/pub/orderForm/"+n+"/items?"+d,l({},y,{body:JSON.stringify({orderItems:a}),method:"PATCH"}))}}}}(e)};var n,t,i,a}(e),n.loaders={skuLoader:function(e,n){return new i(function(){var e=u(p.mark((function e(t){var i,a,r,o,d,u,c,m;return p.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=t.map((function(e){var n=e.find((function(e){return"id"===e.key}));if(!n)throw new Error("Error while loading SKU. Needs to pass an id to selected facets");return n.value})),a=i.reduce((function(e,n,t){var i;return l({},e,((i={})[n]=t,i))}),{}),e.next=4,n.search.products({query:"sku:"+i.join(";"),page:0,count:i.length});case 4:if((r=e.sent.products).length===i.length){e.next=8;break}throw new Error("Sku batching went wrong. Asked for "+i.length+" sku(s) but search api returned "+r.length+" sku(s)");case 8:o=new Array(r.length),d=s(r);case 10:if((u=d()).done){e.next=19;break}if(null!=(m=(c=u.value).skus.find((function(e){return null!=a[e.id]})))){e.next=15;break}throw new Error("Could not find sku for product "+c.id);case 15:o[a[m.id]]=f(m,c);case 17:e.next=10;break;case 19:return e.abrupt("return",o);case 20:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),{maxBatchSize:99})}(0,t=n.clients),simulationLoader:function(e,n){return new i(function(){var e=u(p.mark((function e(t){var i,a;return p.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.commerce.checkout.simulation({items:[].concat(t.flat())});case 2:if(i=e.sent,a=t.reduce((function(e,n){return[].concat(e,[n.length+e[e.length-1]])}),[0]),i.items.length===a[a.length-1]){e.next=8;break}throw new Error("Simulation asked for "+a[a.length-1]+", but received "+i.items.length+" items");case 8:return e.abrupt("return",t.map((function(e,n){return l({},i,{items:i.items.slice(a[n],a[n+1])})})));case 9:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),{maxBatchSize:20})}(0,t)},n;var t}}}},ae=function(){return te},re=function(e){return ie[e.platform].getResolvers(e)},oe=function(){var e=u(p.mark((function e(t){return p.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",n.makeExecutableSchema({resolvers:re(t),typeDefs:ae()}));case 1:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}();exports.getContextFactory=function(e){return ie[e.platform].getContextFactory(e)},exports.getResolvers=re,exports.getSchema=oe,exports.getTypeDefs=ae; | ||
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var n=require("@graphql-tools/schema"),t=e(require("isomorphic-unfetch")),i=e(require("dataloader")),a=e(require("slugify")),r=e(require("fast-deep-equal")),o=require("graphql");function d(e,n,t,i,a,r,o){try{var d=e[r](o),u=d.value}catch(e){return void t(e)}d.done?n(u):Promise.resolve(u).then(i,a)}function u(e){return function(){var n=this,t=arguments;return new Promise((function(i,a){var r=e.apply(n,t);function o(e){d(r,i,a,o,u,"next",e)}function u(e){d(r,i,a,o,u,"throw",e)}o(void 0)}))}}function l(){return(l=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e}).apply(this,arguments)}function c(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,i=new Array(n);t<n;t++)i[t]=e[t];return i}function s(e,n){var t;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(t=function(e,n){if(e){if("string"==typeof e)return c(e,void 0);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?c(e,void 0):void 0}}(e))||n&&e&&"number"==typeof e.length){t&&(e=t);var i=0;return function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(t=e[Symbol.iterator]()).next.bind(t)}function m(e,n){return e(n={exports:{}},n.exports),n.exports}var p=m((function(e){var n=function(e){var n=Object.prototype,t=n.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",r=i.asyncIterator||"@@asyncIterator",o=i.toStringTag||"@@toStringTag";function d(e,n,t){return Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}),e[n]}try{d({},"")}catch(e){d=function(e,n,t){return e[n]=t}}function u(e,n,t,i){var a=Object.create((n&&n.prototype instanceof s?n:s).prototype),r=new D(i||[]);return a._invoke=function(e,n,t){var i="suspendedStart";return function(a,r){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===a)throw r;return{value:void 0,done:!0}}for(t.method=a,t.arg=r;;){var o=t.delegate;if(o){var d=h(o,t);if(d){if(d===c)continue;return d}}if("next"===t.method)t.sent=t._sent=t.arg;else if("throw"===t.method){if("suspendedStart"===i)throw i="completed",t.arg;t.dispatchException(t.arg)}else"return"===t.method&&t.abrupt("return",t.arg);i="executing";var u=l(e,n,t);if("normal"===u.type){if(i=t.done?"completed":"suspendedYield",u.arg===c)continue;return{value:u.arg,done:t.done}}"throw"===u.type&&(i="completed",t.method="throw",t.arg=u.arg)}}}(e,t,r),a}function l(e,n,t){try{return{type:"normal",arg:e.call(n,t)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var c={};function s(){}function m(){}function p(){}var k={};k[a]=function(){return this};var y=Object.getPrototypeOf,f=y&&y(y(b([])));f&&f!==n&&t.call(f,a)&&(k=f);var v=p.prototype=s.prototype=Object.create(k);function N(e){["next","throw","return"].forEach((function(n){d(e,n,(function(e){return this._invoke(n,e)}))}))}function g(e,n){var i;this._invoke=function(a,r){function o(){return new n((function(i,o){!function i(a,r,o,d){var u=l(e[a],e,r);if("throw"!==u.type){var c=u.arg,s=c.value;return s&&"object"==typeof s&&t.call(s,"__await")?n.resolve(s.__await).then((function(e){i("next",e,o,d)}),(function(e){i("throw",e,o,d)})):n.resolve(s).then((function(e){c.value=e,o(c)}),(function(e){return i("throw",e,o,d)}))}d(u.arg)}(a,r,i,o)}))}return i=i?i.then(o,o):o()}}function h(e,n){var t=e.iterator[n.method];if(void 0===t){if(n.delegate=null,"throw"===n.method){if(e.iterator.return&&(n.method="return",n.arg=void 0,h(e,n),"throw"===n.method))return c;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return c}var i=l(t,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,c;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=void 0),n.delegate=null,c):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,c)}function S(e){var n={tryLoc:e[0]};1 in e&&(n.catchLoc=e[1]),2 in e&&(n.finallyLoc=e[2],n.afterLoc=e[3]),this.tryEntries.push(n)}function T(e){var n=e.completion||{};n.type="normal",delete n.arg,e.completion=n}function D(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function b(e){if(e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,r=function n(){for(;++i<e.length;)if(t.call(e,i))return n.value=e[i],n.done=!1,n;return n.value=void 0,n.done=!0,n};return r.next=r}}return{next:F}}function F(){return{value:void 0,done:!0}}return m.prototype=v.constructor=p,p.constructor=m,m.displayName=d(p,o,"GeneratorFunction"),e.isGeneratorFunction=function(e){var n="function"==typeof e&&e.constructor;return!!n&&(n===m||"GeneratorFunction"===(n.displayName||n.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,d(e,o,"GeneratorFunction")),e.prototype=Object.create(v),e},e.awrap=function(e){return{__await:e}},N(g.prototype),g.prototype[r]=function(){return this},e.AsyncIterator=g,e.async=function(n,t,i,a,r){void 0===r&&(r=Promise);var o=new g(u(n,t,i,a),r);return e.isGeneratorFunction(t)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},N(v),d(v,o,"Generator"),v[a]=function(){return this},v.toString=function(){return"[object Generator]"},e.keys=function(e){var n=[];for(var t in e)n.push(t);return n.reverse(),function t(){for(;n.length;){var i=n.pop();if(i in e)return t.value=i,t.done=!1,t}return t.done=!0,t}},e.values=b,D.prototype={constructor:D,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(T),!e)for(var n in this)"t"===n.charAt(0)&&t.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function i(t,i){return o.type="throw",o.arg=e,n.next=t,i&&(n.method="next",n.arg=void 0),!!i}for(var a=this.tryEntries.length-1;a>=0;--a){var r=this.tryEntries[a],o=r.completion;if("root"===r.tryLoc)return i("end");if(r.tryLoc<=this.prev){var d=t.call(r,"catchLoc"),u=t.call(r,"finallyLoc");if(d&&u){if(this.prev<r.catchLoc)return i(r.catchLoc,!0);if(this.prev<r.finallyLoc)return i(r.finallyLoc)}else if(d){if(this.prev<r.catchLoc)return i(r.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<r.finallyLoc)return i(r.finallyLoc)}}}},abrupt:function(e,n){for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i];if(a.tryLoc<=this.prev&&t.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var r=a;break}}r&&("break"===e||"continue"===e)&&r.tryLoc<=n&&n<=r.finallyLoc&&(r=null);var o=r?r.completion:{};return o.type=e,o.arg=n,r?(this.method="next",this.next=r.finallyLoc,c):this.complete(o)},complete:function(e,n){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&n&&(this.next=n),c},finish:function(e){for(var n=this.tryEntries.length-1;n>=0;--n){var t=this.tryEntries[n];if(t.finallyLoc===e)return this.complete(t.completion,t.afterLoc),T(t),c}},catch:function(e){for(var n=this.tryEntries.length-1;n>=0;--n){var t=this.tryEntries[n];if(t.tryLoc===e){var i=t.completion;if("throw"===i.type){var a=i.arg;T(t)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,t){return this.delegate={iterator:b(e),resultName:n,nextLoc:t},"next"===this.method&&(this.arg=void 0),c}},e}(e.exports);try{regeneratorRuntime=n}catch(e){Function("r","regeneratorRuntime = r")(n)}})),k=function(){var e=u(p.mark((function e(n,i){var a;return p.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t(n,i);case 2:if(!(a=e.sent).ok){e.next=5;break}return e.abrupt("return",a.json());case 5:return e.next=7,a.text();case 7:throw new Error(e.sent);case 9:case"end":return e.stop()}}),e)})));return function(n,t){return e.apply(this,arguments)}}(),y={method:"POST",headers:{"content-type":"application/json"}},f=function(e,n){var t="http://search.biggylabs.com.br/search-api/v1/"+e.account,i=function(e){var i,a,r=e.query,o=void 0===r?"":r,d=e.count,u=e.sort,c=void 0===u?"":u,s=e.selectedFacets,m=void 0===s?[]:s,p=e.type,y=e.fuzzy,f=void 0===y?"0":y,v=new URLSearchParams({page:(e.page+1).toString(),count:d.toString(),query:o,sort:c,fuzzy:f}),N=(i=m,a=Object.fromEntries(i.map((function(e){return[e.key,e.value]}))),Object.entries(l({"trade-policy":n.storage.channel},a)).map((function(e){return{key:e[0],value:e[1]}}))).map((function(e){return e.key+"/"+e.value})).join("/");return k(t+"/api/split/"+p+"/"+N+"?"+v.toString())};return{facets:function(e){return i(l({},e,{type:"attribute_search"}))},products:function(e){return i(l({},e,{type:"product_search"}))}}},v=function(e,n){return l({},e,{isVariantOf:n})},N={highPrice:function(e){var n,t,i=e.items;return i.reduce((function(e,n){return e>n.sellingPrice?e:n.sellingPrice}),null!=(n=null==(t=i[0])?void 0:t.sellingPrice)?n:0)/100},lowPrice:function(e){var n,t,i=e.items;return i.reduce((function(e,n){return e<n.sellingPrice?e:n.sellingPrice}),null!=(n=null==(t=i[0])?void 0:t.sellingPrice)?n:0)/100},offerCount:function(e){return e.items.length},priceCurrency:function(){return""},offers:function(e){var n=e.product;return e.items.map((function(e){return l({},e,{product:n})}))}},g=function(e){return a(e,{replacement:"-",lower:!0})},h=function(e){return"brand"===e.type},S={id:function(e){return e.id.toString()},slug:function(e){return g(e.name)},seo:function(e){return h(e)?{title:e.title,description:e.metaTagDescription}:{title:e.Title,description:e.MetaTagDescription}},type:function(e){return h(e)?"Brand":0===e.level?"Department":"Category"},meta:function(e){return h(e)?{selectedFacets:[{key:"brand",value:g(e.name)}]}:{selectedFacets:new URL(e.url).pathname.slice(1).split("/").map((function(e,n){return{key:"category-"+(n+1),value:g(e)}}))}},breadcrumbList:function(){return{itemListElement:[],numberOfItems:0}}},T=function(e){return[e.itemOffered.sku,e.seller.identifier,e.price].join("::")},D=function(e,n){return{listPrice:e.listPrice/100,price:e.sellingPrice/100,quantity:e.quantity,seller:{identifier:e.seller},itemOffered:{sku:e.id,image:[],name:e.name},index:n}},b=function(e){return{quantity:e.quantity,seller:e.seller.identifier,id:e.itemOffered.sku,index:e.index}},F=function(e){return e.reduce((function(e,n){var t,i=T(n);return e.set(i,null!=(t=e.get(i))?t:n),e}),new Map)},O={validateCart:function(){var e=u(p.mark((function e(n,t,i){var a,o,d,u,c,s,m,k,y,f,v,N,g,h,S,O;return p.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=(a=t.cart.order).orderNumber,d=a.acceptedOffer,u=i.clients.commerce,c=i.loaders.skuLoader,e.next=4,u.checkout.orderForm({id:o});case 4:if(s=e.sent,m=F(d),k=F(s.items.map(D)),y=Array.from(m.values()),f=Array.from(k.values()),v=y.reduce((function(e,n){var t=k.get(T(n));return t?e.itemsToUpdate.push(l({},t,{quantity:n.quantity})):e.itemsToAdd.push(n),e}),{itemsToAdd:[],itemsToUpdate:[]}),N=v.itemsToAdd,g=v.itemsToUpdate,h=f.filter((function(e){return!m.has(T(e))})).map((function(e){return l({},e,{quantity:0})})),0!==(S=[].concat(N,g,h).map(b)).length){e.next=14;break}return e.abrupt("return",null);case 14:return e.next=16,u.checkout.updateOrderFormItems({id:s.orderFormId,orderItems:S});case 16:if(n=O=e.sent,!r((p=function(e){return{orderFormId:e.orderFormId,messages:e.messages,salesChannel:e.salesChannel,items:e.items.map((function(e){return{uniqueId:e.uniqueId,quantity:e.quantity,seller:e.seller,sellingPrice:e.sellingPrice,availability:e.availability}}))}})(s),p(n))){e.next=19;break}return e.abrupt("return",null);case 19:return e.abrupt("return",{order:{orderNumber:O.orderFormId,acceptedOffer:O.items.map((function(e){return l({},e,{product:c.load([{key:"id",value:e.id}])})}))},messages:O.messages.map((function(e){return{text:e.text,status:e.status.toUpperCase()}}))});case 20:case"end":return e.stop()}var n,p}),e)})));return function(n,t,i){return e.apply(this,arguments)}}()},I={name:"image",value:"https://storecomponents.vtexassets.com/assets/faststore/images/image___117a6d3e229a96ad0e0d0876352566e2.svg"},w=function(e,n){return e+"-"+n},C=function(e,n){return"/"+w(e,n)+"/p"},P=function(e){return Array.isArray(e)&&e.length>0?e:null},L={productID:function(e){return e.id},name:function(e){var n=e.name;return null!=n?n:e.isVariantOf.name},slug:function(e){return w(e.isVariantOf.link,e.id)},description:function(e){return e.isVariantOf.description},seo:function(e){var n=e.isVariantOf;return{title:n.name,description:n.description}},brand:function(e){return{name:e.isVariantOf.brand}},breadcrumbList:function(e){var n=e.isVariantOf,t=n.categoryTrees,i=n.name,a=n.link,r=e.id;return{itemListElement:[].concat(t.map((function(e,n){var t=e.categoryNames;return{name:t[t.length-1],item:"/"+t.join("/").toLowerCase(),position:n+1}})),[{name:i,item:C(a,r),position:t.length+1}]),numberOfItems:t.length}},image:function(e){var n,t,i=e.isVariantOf;return(null!=(n=null!=(t=P(e.images))?t:P(i.images))?n:[I]).map((function(e){var n=e.name;return{alternateName:null!=n?n:"",url:e.value.replace("vteximg.com.br","vtexassets.com")}}))},sku:function(e){return e.isVariantOf.skus[0].id},gtin:function(e){var n=e.reference;return null!=n?n:""},review:function(){return[]},aggregateRating:function(){return{}},offers:function(){var e=u(p.mark((function e(n,t,i){var a,r,o,d,u,c,s;return p.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=i.loaders.simulationLoader,o=i.storage.channel,d=n.id,null!=(u=null==(a=n.policies.find((function(e){return e.id===o})))?void 0:a.sellers)){e.next=5;break}throw new Error("Product with id "+d+" has no sellers for channel "+o+".");case 5:return c=u.map((function(e){return e.id})),s=Array.from(new Set(c)).map((function(e){return{quantity:1,seller:e,id:d}})),e.next=9,r.load(s);case 9:return e.abrupt("return",l({},e.sent,{product:n}));case 11:case"end":return e.stop()}}),e)})));return function(n,t,i){return e.apply(this,arguments)}}(),isVariantOf:function(e){return e.isVariantOf}},x={hasVariant:function(e){return e.skus.map((function(n){return v(n,e)}))},productGroupID:function(e){return e.product},name:function(e){return e.name}},V=function(e){var n=e.split("-").pop();if(null==n)throw new Error("Error while extracting sku id from product slug");return n},E=function(e){var n=e.key,t=e.value;switch(n){case"channel":return{key:"trade-policy",value:t};case"slug":return{key:"id",value:V(t)};default:return{key:n,value:t}}},j={price_desc:"price:desc",price_asc:"price:asc",orders_desc:"orders:desc",name_desc:"name:desc",name_asc:"name:asc",release_desc:"release:desc",discount_desc:"discount:desc",score_desc:""},q={product:function(){var e=u(p.mark((function e(n,t,i){var a,r,o;return p.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i.storage=l({},i.storage,{channel:null!=(a=null==(r=(o=t.locator).find((function(e){return"channel"===e.key})))?void 0:r.value)?a:i.storage.channel}),e.abrupt("return",i.loaders.skuLoader.load(o.map(E)));case 4:case"end":return e.stop()}}),e)})));return function(n,t,i){return e.apply(this,arguments)}}(),search:function(){var e=u(p.mark((function e(n,t,i){var a,r,o,d,u,c,s,m,k,y;return p.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return d=t.first,u=t.after,c=t.sort,s=t.term,i.storage=l({},i.storage,{channel:null!=(a=null==(m=t.selectedFacets)||null==(r=m.find((function(e){return"channel"===e.key})))?void 0:r.value)?a:i.storage.channel}),k=u?Number(u):0,y={page:Math.ceil(k/d),count:d,query:s,sort:j[null!=c?c:"score_desc"],selectedFacets:null!=(o=null==m?void 0:m.map(E))?o:[]},e.abrupt("return",y);case 5:case"end":return e.stop()}}),e)})));return function(n,t,i){return e.apply(this,arguments)}}(),allProducts:function(){var e=u(p.mark((function e(n,t,i){var a,r,o,d,u,l;return p.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=t.first,o=i.clients.search,d=(r=t.after)?Number(r):0,e.next=5,o.products({page:Math.ceil(d/a),count:a});case 5:return l=(u=e.sent).products.map((function(e){return e.skus.map((function(n){return v(n,e)}))})).flat().filter((function(e){return e.sellers.length>0})),e.abrupt("return",{pageInfo:{hasNextPage:u.pagination.after.length>0,hasPreviousPage:u.pagination.before.length>0,startCursor:"0",endCursor:u.total.toString(),totalCount:u.total},edges:l.map((function(e,n){return{node:e,cursor:(d+n).toString()}}))});case 8:case"end":return e.stop()}}),e)})));return function(n,t,i){return e.apply(this,arguments)}}(),allCollections:function(){var e=u(p.mark((function e(n,t,i){var a,r,o,d,u,c,m,k;return p.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=i.clients.commerce,e.next=3,Promise.all([a.catalog.brand.list(),a.catalog.category.tree()]);case 3:for(o=(r=e.sent)[0],d=[],u=function e(n,t){d.push(l({},n,{level:t}));for(var i,a=s(n.children);!(i=a()).done;)e(i.value,t+1)},c=s(r[1]);!(m=c()).done;)u(m.value,0);return k=[].concat(o.map((function(e){return l({},e,{type:"brand"})})),d),e.abrupt("return",{pageInfo:{hasNextPage:!1,hasPreviousPage:!1,startCursor:"0",endCursor:"0"},edges:k.map((function(e,n){return{node:e,cursor:n.toString()}}))});case 11:case"end":return e.stop()}}),e)})));return function(n,t,i){return e.apply(this,arguments)}}()},R={StoreCollection:S,StoreAggregateOffer:N,StoreProduct:L,StoreSeo:{title:function(e){var n=e.title;return null!=n?n:""},description:function(e){var n=e.description;return null!=n?n:""},titleTemplate:function(){return""},canonical:function(){return""}},StoreFacet:{key:function(e){return e.key},label:function(e){return e.label},values:function(e){return e.values},type:function(e){return"text"===e.type?"BOOLEAN":"RANGE"}},StoreFacetValue:{value:function(e){var n=e.key;return null!=n?n:e.from+"-to-"+e.to},label:function(e){var n=e.label;return null!=n?n:"unknown"},selected:function(e){return e.active},quantity:function(e){return e.count}},StoreOffer:{priceCurrency:function(){return""},priceValidUntil:function(e){var n=e.priceValidUntil;return null!=n?n:""},itemCondition:function(){return"https://schema.org/NewCondition"},availability:function(e){return"available"===e.availability?"https://schema.org/InStock":"https://schema.org/OutOfStock"},seller:function(e){return{identifier:e.seller}},price:function(e){return e.sellingPrice/100},sellingPrice:function(e){return e.sellingPrice/100},listPrice:function(e){return e.listPrice/100},itemOffered:function(e){return e.product},quantity:function(e){return e.quantity}},StoreAggregateRating:{ratingValue:function(){return 5},reviewCount:function(){return 0}},StoreReview:{reviewRating:function(){return{ratingValue:5,bestRating:5}},author:function(){return{name:""}}},StoreProductGroup:x,StoreSearchResult:{products:function(){var e=u(p.mark((function e(n,t,i){var a,r,o;return p.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=i.clients.search,e.next=3,a.products(n);case 3:return o=(r=e.sent).products.map((function(e){var n=e.skus.find((function(e){return e.sellers.length>0}));return n&&v(n,e)})).filter((function(e){return!!e})),e.abrupt("return",{pageInfo:{hasNextPage:r.pagination.after.length>0,hasPreviousPage:r.pagination.before.length>0,startCursor:"0",endCursor:r.total.toString(),totalCount:r.total},edges:o.map((function(e,n){return{node:e,cursor:n.toString()}}))});case 6:case"end":return e.stop()}}),e)})));return function(n,t,i){return e.apply(this,arguments)}}(),facets:function(){var e=u(p.mark((function e(n,t,i){var a;return p.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=i.clients.search,e.next=3,a.facets(n);case 3:return e.abrupt("return",e.sent.attributes);case 5:case"end":return e.stop()}}),e)})));return function(n,t,i){return e.apply(this,arguments)}}()},Query:q,Mutation:O},_={kind:"Document",definitions:[{kind:"ObjectTypeDefinition",name:{kind:"Name",value:"StoreAggregateOffer"},interfaces:[],directives:[],fields:[{kind:"FieldDefinition",name:{kind:"Name",value:"highPrice"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Float"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"lowPrice"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Float"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"offerCount"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"priceCurrency"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"offers"},arguments:[],type:{kind:"NonNullType",type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreOffer"}}}}},directives:[]}]}],loc:{start:0,end:261}};_.loc.source={body:"type StoreAggregateOffer {\n # Highest spot price amongst all sellers\n highPrice: Float!\n # Lowest spot price amongst all sellers\n lowPrice: Float!\n # Number of sellers selling this sku\n offerCount: Int!\n priceCurrency: String!\n offers: [StoreOffer!]!\n}\n",name:"GraphQL request",locationOffset:{line:1,column:1}};var A={kind:"Document",definitions:[{kind:"ObjectTypeDefinition",name:{kind:"Name",value:"StoreAggregateRating"},interfaces:[],directives:[],fields:[{kind:"FieldDefinition",name:{kind:"Name",value:"ratingValue"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Float"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"reviewCount"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},directives:[]}]}],loc:{start:0,end:72}};A.loc.source={body:"type StoreAggregateRating {\n ratingValue: Float!\n reviewCount: Int!\n}\n",name:"GraphQL request",locationOffset:{line:1,column:1}};var G={kind:"Document",definitions:[{kind:"ObjectTypeDefinition",name:{kind:"Name",value:"StoreAuthor"},interfaces:[],directives:[],fields:[{kind:"FieldDefinition",name:{kind:"Name",value:"name"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]}]}],loc:{start:0,end:37}};G.loc.source={body:"type StoreAuthor {\n name: String!\n}\n",name:"GraphQL request",locationOffset:{line:1,column:1}};var B={kind:"Document",definitions:[{kind:"ObjectTypeDefinition",name:{kind:"Name",value:"StoreBrand"},interfaces:[],directives:[],fields:[{kind:"FieldDefinition",name:{kind:"Name",value:"name"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]}]}],loc:{start:0,end:36}};B.loc.source={body:"type StoreBrand {\n name: String!\n}\n",name:"GraphQL request",locationOffset:{line:1,column:1}};var Q={kind:"Document",definitions:[{kind:"ObjectTypeDefinition",name:{kind:"Name",value:"StoreListItem"},interfaces:[],directives:[],fields:[{kind:"FieldDefinition",name:{kind:"Name",value:"item"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"name"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"position"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},directives:[]}]},{kind:"ObjectTypeDefinition",name:{kind:"Name",value:"StoreBreadcrumbList"},interfaces:[],directives:[],fields:[{kind:"FieldDefinition",name:{kind:"Name",value:"itemListElement"},arguments:[],type:{kind:"NonNullType",type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreListItem"}}}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"numberOfItems"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},directives:[]}]}],loc:{start:0,end:161}};Q.loc.source={body:"type StoreListItem {\n item: String!\n name: String!\n position: Int!\n}\n\ntype StoreBreadcrumbList {\n itemListElement: [StoreListItem!]!\n numberOfItems: Int!\n}\n",name:"GraphQL request",locationOffset:{line:1,column:1}};var M={kind:"Document",definitions:[{kind:"EnumTypeDefinition",name:{kind:"Name",value:"StoreCollectionType"},directives:[],values:[{kind:"EnumValueDefinition",name:{kind:"Name",value:"Department"},directives:[]},{kind:"EnumValueDefinition",name:{kind:"Name",value:"Category"},directives:[]},{kind:"EnumValueDefinition",name:{kind:"Name",value:"Brand"},directives:[]},{kind:"EnumValueDefinition",name:{kind:"Name",value:"Cluster"},directives:[]}]},{kind:"ObjectTypeDefinition",name:{kind:"Name",value:"StoreCollectionFacet"},interfaces:[],directives:[],fields:[{kind:"FieldDefinition",name:{kind:"Name",value:"key"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"value"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]}]},{kind:"ObjectTypeDefinition",name:{kind:"Name",value:"StoreCollectionMeta"},interfaces:[],directives:[],fields:[{kind:"FieldDefinition",name:{kind:"Name",value:"selectedFacets"},arguments:[],type:{kind:"NonNullType",type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreCollectionFacet"}}}}},directives:[]}]},{kind:"ObjectTypeDefinition",name:{kind:"Name",value:"StoreCollection"},interfaces:[],directives:[],fields:[{kind:"FieldDefinition",name:{kind:"Name",value:"seo"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreSeo"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"breadcrumbList"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreBreadcrumbList"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"meta"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreCollectionMeta"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"id"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"ID"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"slug"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"type"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreCollectionType"}}},directives:[]}]}],loc:{start:0,end:424}};M.loc.source={body:"enum StoreCollectionType {\n Department\n Category\n Brand\n Cluster\n}\n\ntype StoreCollectionFacet {\n key: String!\n value: String!\n}\n\ntype StoreCollectionMeta {\n selectedFacets: [StoreCollectionFacet!]!\n}\n\ntype StoreCollection {\n # Meta tag data\n seo: StoreSeo!\n # location for structured data\n breadcrumbList: StoreBreadcrumbList!\n meta: StoreCollectionMeta!\n id: ID!\n slug: String!\n type: StoreCollectionType!\n}\n",name:"GraphQL request",locationOffset:{line:1,column:1}};var U={kind:"Document",definitions:[{kind:"ObjectTypeDefinition",name:{kind:"Name",value:"StoreFacet"},interfaces:[],directives:[],fields:[{kind:"FieldDefinition",name:{kind:"Name",value:"key"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"label"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"values"},arguments:[],type:{kind:"NonNullType",type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreFacetValue"}}}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"type"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreFacetType"}}},directives:[]}]},{kind:"ObjectTypeDefinition",name:{kind:"Name",value:"StoreFacetValue"},interfaces:[],directives:[],fields:[{kind:"FieldDefinition",name:{kind:"Name",value:"value"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"label"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"selected"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Boolean"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"quantity"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},directives:[]}]}],loc:{start:0,end:240}};U.loc.source={body:"type StoreFacet {\n key: String!\n label: String!\n values: [StoreFacetValue!]!\n type: StoreFacetType!\n}\n\ntype StoreFacetValue {\n value: String!\n label: String!\n selected: Boolean!\n # Number of items with this facet\n quantity: Int!\n}\n",name:"GraphQL request",locationOffset:{line:1,column:1}};var z={kind:"Document",definitions:[{kind:"ObjectTypeDefinition",name:{kind:"Name",value:"StoreImage"},interfaces:[],directives:[],fields:[{kind:"FieldDefinition",name:{kind:"Name",value:"url"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"alternateName"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]}]},{kind:"InputObjectTypeDefinition",name:{kind:"Name",value:"IStoreImage"},directives:[],fields:[{kind:"InputValueDefinition",name:{kind:"Name",value:"url"},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"InputValueDefinition",name:{kind:"Name",value:"alternateName"},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]}]}],loc:{start:0,end:123}};z.loc.source={body:"type StoreImage {\n url: String!\n alternateName: String!\n}\n\ninput IStoreImage {\n url: String!\n alternateName: String!\n}\n",name:"GraphQL request",locationOffset:{line:1,column:1}};var W={kind:"Document",definitions:[{kind:"ObjectTypeDefinition",name:{kind:"Name",value:"Mutation"},interfaces:[],directives:[],fields:[{kind:"FieldDefinition",name:{kind:"Name",value:"validateCart"},arguments:[{kind:"InputValueDefinition",name:{kind:"Name",value:"cart"},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"IStoreCart"}}},directives:[]}],type:{kind:"NamedType",name:{kind:"Name",value:"StoreCart"}},directives:[]}]}],loc:{start:0,end:148}};W.loc.source={body:"type Mutation {\n # Returns the order if anything changed with the order. Null if the order is valid\n validateCart(cart: IStoreCart!): StoreCart\n}\n",name:"GraphQL request",locationOffset:{line:1,column:1}};var H={kind:"Document",definitions:[{kind:"ObjectTypeDefinition",name:{kind:"Name",value:"StoreOffer"},interfaces:[],directives:[],fields:[{kind:"FieldDefinition",name:{kind:"Name",value:"listPrice"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Float"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"sellingPrice"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Float"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"priceCurrency"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"price"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Float"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"priceValidUntil"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"itemCondition"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"availability"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"seller"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreOrganization"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"itemOffered"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreProduct"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"quantity"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},directives:[]}]},{kind:"InputObjectTypeDefinition",name:{kind:"Name",value:"IStoreOffer"},directives:[],fields:[{kind:"InputValueDefinition",name:{kind:"Name",value:"price"},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Float"}}},directives:[]},{kind:"InputValueDefinition",name:{kind:"Name",value:"listPrice"},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Float"}}},directives:[]},{kind:"InputValueDefinition",name:{kind:"Name",value:"seller"},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"IStoreOrganization"}}},directives:[]},{kind:"InputValueDefinition",name:{kind:"Name",value:"itemOffered"},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"IStoreProduct"}}},directives:[]},{kind:"InputValueDefinition",name:{kind:"Name",value:"quantity"},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},directives:[]}]}],loc:{start:0,end:419}};H.loc.source={body:"type StoreOffer {\n listPrice: Float!\n sellingPrice: Float!\n priceCurrency: String!\n # Also known as spotPrice\n price: Float!\n priceValidUntil: String!\n itemCondition: String!\n availability: String!\n seller: StoreOrganization!\n itemOffered: StoreProduct!\n quantity: Int!\n}\n\ninput IStoreOffer {\n price: Float!\n listPrice: Float!\n seller: IStoreOrganization!\n itemOffered: IStoreProduct!\n quantity: Int!\n}\n",name:"GraphQL request",locationOffset:{line:1,column:1}};var J={kind:"Document",definitions:[{kind:"ObjectTypeDefinition",name:{kind:"Name",value:"StoreOrder"},interfaces:[],directives:[],fields:[{kind:"FieldDefinition",name:{kind:"Name",value:"orderNumber"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"acceptedOffer"},arguments:[],type:{kind:"NonNullType",type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreOffer"}}}}},directives:[]}]},{kind:"InputObjectTypeDefinition",name:{kind:"Name",value:"IStoreOrder"},directives:[],fields:[{kind:"InputValueDefinition",name:{kind:"Name",value:"orderNumber"},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"InputValueDefinition",name:{kind:"Name",value:"acceptedOffer"},type:{kind:"NonNullType",type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"IStoreOffer"}}}}},directives:[]}]}],loc:{start:0,end:154}};J.loc.source={body:"type StoreOrder {\n orderNumber: String!\n acceptedOffer: [StoreOffer!]!\n}\n\ninput IStoreOrder {\n orderNumber: String!\n acceptedOffer: [IStoreOffer!]!\n}\n",name:"GraphQL request",locationOffset:{line:1,column:1}};var Y={kind:"Document",definitions:[{kind:"ObjectTypeDefinition",name:{kind:"Name",value:"StoreOrganization"},interfaces:[],directives:[],fields:[{kind:"FieldDefinition",name:{kind:"Name",value:"identifier"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]}]},{kind:"InputObjectTypeDefinition",name:{kind:"Name",value:"IStoreOrganization"},directives:[],fields:[{kind:"InputValueDefinition",name:{kind:"Name",value:"identifier"},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]}]}],loc:{start:0,end:101}};Y.loc.source={body:"type StoreOrganization {\n identifier: String!\n}\n\ninput IStoreOrganization {\n identifier: String!\n}\n",name:"GraphQL request",locationOffset:{line:1,column:1}};var K={kind:"Document",definitions:[{kind:"ObjectTypeDefinition",name:{kind:"Name",value:"StorePageInfo"},interfaces:[],directives:[],fields:[{kind:"FieldDefinition",name:{kind:"Name",value:"hasNextPage"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Boolean"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"hasPreviousPage"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Boolean"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"startCursor"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"endCursor"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"totalCount"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},directives:[]}]}],loc:{start:0,end:197}};K.loc.source={body:"type StorePageInfo {\n hasNextPage: Boolean!\n hasPreviousPage: Boolean!\n startCursor: String!\n endCursor: String!\n # Total number of items(products/collections), not pages\n totalCount: Int!\n}\n",name:"GraphQL request",locationOffset:{line:1,column:1}};var $={kind:"Document",definitions:[{kind:"ObjectTypeDefinition",name:{kind:"Name",value:"StoreProduct"},interfaces:[],directives:[],fields:[{kind:"FieldDefinition",name:{kind:"Name",value:"seo"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreSeo"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"breadcrumbList"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreBreadcrumbList"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"slug"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"name"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"productID"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"brand"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreBrand"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"description"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"image"},arguments:[],type:{kind:"NonNullType",type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreImage"}}}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"offers"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreAggregateOffer"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"sku"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"gtin"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"review"},arguments:[],type:{kind:"NonNullType",type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreReview"}}}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"aggregateRating"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreAggregateRating"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"isVariantOf"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreProductGroup"}}},directives:[]}]},{kind:"InputObjectTypeDefinition",name:{kind:"Name",value:"IStoreProduct"},directives:[],fields:[{kind:"InputValueDefinition",name:{kind:"Name",value:"sku"},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"InputValueDefinition",name:{kind:"Name",value:"name"},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"InputValueDefinition",name:{kind:"Name",value:"image"},type:{kind:"NonNullType",type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"IStoreImage"}}}}},directives:[]}]}],loc:{start:0,end:528}};$.loc.source={body:"type StoreProduct {\n # Meta tag data\n seo: StoreSeo!\n # Location for structured data\n breadcrumbList: StoreBreadcrumbList!\n # Where to retrieve this entity\n slug: String!\n name: String!\n productID: String!\n brand: StoreBrand!\n description: String!\n image: [StoreImage!]!\n offers: StoreAggregateOffer!\n sku: String!\n gtin: String!\n review: [StoreReview!]!\n aggregateRating: StoreAggregateRating!\n isVariantOf: StoreProductGroup!\n}\n\ninput IStoreProduct {\n sku: String!\n name: String!\n image: [IStoreImage!]!\n}\n",name:"GraphQL request",locationOffset:{line:1,column:1}};var X={kind:"Document",definitions:[{kind:"ObjectTypeDefinition",name:{kind:"Name",value:"StoreProductGroup"},interfaces:[],directives:[],fields:[{kind:"FieldDefinition",name:{kind:"Name",value:"hasVariant"},arguments:[],type:{kind:"NonNullType",type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreProduct"}}}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"productGroupID"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"name"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]}]}],loc:{start:0,end:100}};X.loc.source={body:"type StoreProductGroup {\n hasVariant: [StoreProduct!]!\n productGroupID: String!\n name: String!\n}\n",name:"GraphQL request",locationOffset:{line:1,column:1}};var Z={kind:"Document",definitions:[{kind:"ObjectTypeDefinition",name:{kind:"Name",value:"StoreProductEdge"},interfaces:[],directives:[],fields:[{kind:"FieldDefinition",name:{kind:"Name",value:"node"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreProduct"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"cursor"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]}]},{kind:"ObjectTypeDefinition",name:{kind:"Name",value:"StoreProductConnection"},interfaces:[],directives:[],fields:[{kind:"FieldDefinition",name:{kind:"Name",value:"pageInfo"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StorePageInfo"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"edges"},arguments:[],type:{kind:"NonNullType",type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreProductEdge"}}}}},directives:[]}]},{kind:"ObjectTypeDefinition",name:{kind:"Name",value:"StoreCollectionEdge"},interfaces:[],directives:[],fields:[{kind:"FieldDefinition",name:{kind:"Name",value:"node"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreCollection"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"cursor"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]}]},{kind:"ObjectTypeDefinition",name:{kind:"Name",value:"StoreCollectionConnection"},interfaces:[],directives:[],fields:[{kind:"FieldDefinition",name:{kind:"Name",value:"pageInfo"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StorePageInfo"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"edges"},arguments:[],type:{kind:"NonNullType",type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreCollectionEdge"}}}}},directives:[]}]},{kind:"EnumTypeDefinition",name:{kind:"Name",value:"StoreSort"},directives:[],values:[{kind:"EnumValueDefinition",name:{kind:"Name",value:"price_desc"},directives:[]},{kind:"EnumValueDefinition",name:{kind:"Name",value:"price_asc"},directives:[]},{kind:"EnumValueDefinition",name:{kind:"Name",value:"orders_desc"},directives:[]},{kind:"EnumValueDefinition",name:{kind:"Name",value:"name_desc"},directives:[]},{kind:"EnumValueDefinition",name:{kind:"Name",value:"name_asc"},directives:[]},{kind:"EnumValueDefinition",name:{kind:"Name",value:"release_desc"},directives:[]},{kind:"EnumValueDefinition",name:{kind:"Name",value:"discount_desc"},directives:[]},{kind:"EnumValueDefinition",name:{kind:"Name",value:"score_desc"},directives:[]}]},{kind:"InputObjectTypeDefinition",name:{kind:"Name",value:"IStoreSelectedFacet"},directives:[],fields:[{kind:"InputValueDefinition",name:{kind:"Name",value:"key"},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"InputValueDefinition",name:{kind:"Name",value:"value"},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]}]},{kind:"EnumTypeDefinition",name:{kind:"Name",value:"StoreFacetType"},directives:[],values:[{kind:"EnumValueDefinition",name:{kind:"Name",value:"BOOLEAN"},directives:[]},{kind:"EnumValueDefinition",name:{kind:"Name",value:"RANGE"},directives:[]}]},{kind:"ObjectTypeDefinition",name:{kind:"Name",value:"StoreSearchResult"},interfaces:[],directives:[],fields:[{kind:"FieldDefinition",name:{kind:"Name",value:"products"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreProductConnection"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"facets"},arguments:[],type:{kind:"NonNullType",type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreFacet"}}}}},directives:[]}]},{kind:"ObjectTypeDefinition",name:{kind:"Name",value:"Query"},interfaces:[],directives:[],fields:[{kind:"FieldDefinition",name:{kind:"Name",value:"product"},arguments:[{kind:"InputValueDefinition",name:{kind:"Name",value:"locator"},type:{kind:"NonNullType",type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"IStoreSelectedFacet"}}}}},directives:[]}],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreProduct"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"search"},arguments:[{kind:"InputValueDefinition",name:{kind:"Name",value:"first"},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},directives:[]},{kind:"InputValueDefinition",name:{kind:"Name",value:"after"},type:{kind:"NamedType",name:{kind:"Name",value:"String"}},directives:[]},{kind:"InputValueDefinition",name:{kind:"Name",value:"sort"},type:{kind:"NamedType",name:{kind:"Name",value:"StoreSort"}},defaultValue:{kind:"EnumValue",value:"score_desc"},directives:[]},{kind:"InputValueDefinition",name:{kind:"Name",value:"term"},type:{kind:"NamedType",name:{kind:"Name",value:"String"}},defaultValue:{kind:"StringValue",value:"",block:!1},directives:[]},{kind:"InputValueDefinition",name:{kind:"Name",value:"selectedFacets"},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"IStoreSelectedFacet"}}}},directives:[]}],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreSearchResult"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"allProducts"},arguments:[{kind:"InputValueDefinition",name:{kind:"Name",value:"first"},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},directives:[]},{kind:"InputValueDefinition",name:{kind:"Name",value:"after"},type:{kind:"NamedType",name:{kind:"Name",value:"String"}},directives:[]}],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreProductConnection"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"allCollections"},arguments:[{kind:"InputValueDefinition",name:{kind:"Name",value:"first"},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},directives:[]},{kind:"InputValueDefinition",name:{kind:"Name",value:"after"},type:{kind:"NamedType",name:{kind:"Name",value:"String"}},directives:[]}],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreCollectionConnection"}}},directives:[]}]}],loc:{start:0,end:1214}};Z.loc.source={body:'type StoreProductEdge {\n node: StoreProduct!\n cursor: String!\n}\n\ntype StoreProductConnection {\n pageInfo: StorePageInfo!\n edges: [StoreProductEdge!]!\n}\n\n\ntype StoreCollectionEdge {\n node: StoreCollection!\n cursor: String!\n}\n\ntype StoreCollectionConnection {\n pageInfo: StorePageInfo!\n edges: [StoreCollectionEdge!]!\n}\n\nenum StoreSort {\n price_desc\n price_asc\n orders_desc\n name_desc\n name_asc\n release_desc\n discount_desc\n score_desc\n}\n\ninput IStoreSelectedFacet {\n key: String!\n value: String!\n}\n\nenum StoreFacetType {\n BOOLEAN\n RANGE\n}\n\ntype StoreSearchResult {\n products: StoreProductConnection!\n facets: [StoreFacet!]!\n}\n\ntype Query {\n product(locator: [IStoreSelectedFacet!]!): StoreProduct!\n\n search(\n # Relay style pagination args. To know more: https://relay.dev/graphql/connections.htm\n first: Int!\n # Relay style pagination args. To know more: https://relay.dev/graphql/connections.htm\n after: String\n sort: StoreSort = score_desc\n term: String = ""\n selectedFacets: [IStoreSelectedFacet!]\n ): StoreSearchResult!\n\n allProducts(first: Int!, after: String): StoreProductConnection!\n\n allCollections(first: Int!, after: String): StoreCollectionConnection!\n}\n',name:"GraphQL request",locationOffset:{line:1,column:1}};var ee={kind:"Document",definitions:[{kind:"ObjectTypeDefinition",name:{kind:"Name",value:"StoreReviewRating"},interfaces:[],directives:[],fields:[{kind:"FieldDefinition",name:{kind:"Name",value:"ratingValue"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Float"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"bestRating"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Float"}}},directives:[]}]},{kind:"ObjectTypeDefinition",name:{kind:"Name",value:"StoreReview"},interfaces:[],directives:[],fields:[{kind:"FieldDefinition",name:{kind:"Name",value:"reviewRating"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreReviewRating"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"author"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreAuthor"}}},directives:[]}]}],loc:{start:0,end:150}};ee.loc.source={body:"type StoreReviewRating {\n ratingValue: Float!\n bestRating: Float!\n}\n\ntype StoreReview {\n reviewRating: StoreReviewRating!\n author: StoreAuthor!\n}\n",name:"GraphQL request",locationOffset:{line:1,column:1}};var ne={kind:"Document",definitions:[{kind:"ObjectTypeDefinition",name:{kind:"Name",value:"StoreSeo"},interfaces:[],directives:[],fields:[{kind:"FieldDefinition",name:{kind:"Name",value:"title"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"titleTemplate"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"description"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"canonical"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]}]}],loc:{start:0,end:104}};ne.loc.source={body:"type StoreSeo {\n title: String!\n titleTemplate: String!\n description: String!\n canonical: String!\n}\n",name:"GraphQL request",locationOffset:{line:1,column:1}};var te={kind:"Document",definitions:[{kind:"ObjectTypeDefinition",name:{kind:"Name",value:"StoreCartMessage"},interfaces:[],directives:[],fields:[{kind:"FieldDefinition",name:{kind:"Name",value:"text"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"status"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreStatus"}}},directives:[]}]},{kind:"ObjectTypeDefinition",name:{kind:"Name",value:"StoreCart"},interfaces:[],directives:[],fields:[{kind:"FieldDefinition",name:{kind:"Name",value:"order"},arguments:[],type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreOrder"}}},directives:[]},{kind:"FieldDefinition",name:{kind:"Name",value:"messages"},arguments:[],type:{kind:"NonNullType",type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StoreCartMessage"}}}}},directives:[]}]},{kind:"InputObjectTypeDefinition",name:{kind:"Name",value:"IStoreCart"},directives:[],fields:[{kind:"InputValueDefinition",name:{kind:"Name",value:"order"},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"IStoreOrder"}}},directives:[]}]}],loc:{start:0,end:183}};te.loc.source={body:"type StoreCartMessage {\n text: String!\n status: StoreStatus!\n}\n\ntype StoreCart {\n order: StoreOrder!\n messages: [StoreCartMessage!]!\n}\n\ninput IStoreCart {\n order: IStoreOrder!\n}\n",name:"GraphQL request",locationOffset:{line:1,column:1}};var ie={kind:"Document",definitions:[{kind:"EnumTypeDefinition",name:{kind:"Name",value:"StoreStatus"},directives:[],values:[{kind:"EnumValueDefinition",name:{kind:"Name",value:"INFO"},directives:[]},{kind:"EnumValueDefinition",name:{kind:"Name",value:"WARNING"},directives:[]},{kind:"EnumValueDefinition",name:{kind:"Name",value:"ERROR"},directives:[]}]}],loc:{start:0,end:46}};ie.loc.source={body:"enum StoreStatus {\n INFO\n WARNING\n ERROR\n}\n",name:"GraphQL request",locationOffset:{line:1,column:1}};var ae=[Z,W,B,Q,M,U,z,K,$,ne,H,A,ee,G,X,Y,_,J,te,ie].map(o.print).join("\n"),re={vtex:{getResolvers:function(e){return R},getContextFactory:function(e){return function(n){return n.storage={channel:e.channel},n.clients=function(e,n){return{search:f(e,n),commerce:function(e,n){var t="http://"+e.account+"."+e.environment+".com.br";return{catalog:{brand:{list:function(){return k(t+"/api/catalog_system/pub/brand/list")}},category:{tree:function(e){return void 0===e&&(e=3),k(t+"/api/catalog_system/pub/category/tree/"+e)}}},checkout:{simulation:function(e,i){var a=new URLSearchParams({sc:(void 0===i?{salesChannel:n.storage.channel}:i).salesChannel});return k(t+"/api/checkout/pub/orderForms/simulation?"+a.toString(),l({},y,{body:JSON.stringify(e)}))},orderForm:function(e){var i=e.id,a=e.refreshOutdatedData,r=e.salesChannel,o=void 0===r?n.storage.channel:r,d=new URLSearchParams({refreshOutdatedData:(void 0===a||a).toString(),sc:o});return k(t+"/api/checkout/pub/orderForm/"+i+"?"+d.toString(),y)},updateOrderFormItems:function(e){var i=e.id,a=e.orderItems,r=e.allowOutdatedData,o=e.salesChannel,d=new URLSearchParams({allowOutdatedData:void 0===r?"paymentData":r,sc:void 0===o?n.storage.channel:o});return k(t+"/api/checkout/pub/orderForm/"+i+"/items?"+d,l({},y,{body:JSON.stringify({orderItems:a}),method:"PATCH"}))}}}}(e,n)}}(e,n),n.loaders={skuLoader:function(e,n){return new i(function(){var e=u(p.mark((function e(t){var i,a,r,o,d,u,c,m;return p.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=t.map((function(e){var n=e.find((function(e){return"id"===e.key}));if(!n)throw new Error("Error while loading SKU. Needs to pass an id to selected facets");return n.value})),a=i.reduce((function(e,n,t){var i;return l({},e,((i={})[n]=t,i))}),{}),e.next=4,n.search.products({query:"sku:"+i.join(";"),page:0,count:i.length});case 4:if((r=e.sent.products).length===i.length){e.next=8;break}throw new Error("Sku batching went wrong. Asked for "+i.length+" sku(s) but search api returned "+r.length+" sku(s)");case 8:o=new Array(r.length),d=s(r);case 10:if((u=d()).done){e.next=19;break}if(null!=(m=(c=u.value).skus.find((function(e){return null!=a[e.id]})))){e.next=15;break}throw new Error("Could not find sku for product "+c.id);case 15:o[a[m.id]]=v(m,c);case 17:e.next=10;break;case 19:return e.abrupt("return",o);case 20:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),{maxBatchSize:99})}(0,t=n.clients),simulationLoader:function(e,n){return new i(function(){var e=u(p.mark((function e(t){var i,a;return p.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.commerce.checkout.simulation({items:[].concat(t.flat())});case 2:if(i=e.sent,a=t.reduce((function(e,n){return[].concat(e,[n.length+e[e.length-1]])}),[0]),i.items.length===a[a.length-1]){e.next=8;break}throw new Error("Simulation asked for "+a[a.length-1]+", but received "+i.items.length+" items");case 8:return e.abrupt("return",t.map((function(e,n){return l({},i,{items:i.items.slice(a[n],a[n+1])})})));case 9:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),{maxBatchSize:20})}(0,t)},n;var t}}}},oe=function(){return ae},de=function(e){return re[e.platform].getResolvers(e)},ue=function(){var e=u(p.mark((function e(t){return p.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",n.makeExecutableSchema({resolvers:de(t),typeDefs:oe()}));case 1:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}();exports.getContextFactory=function(e){return re[e.platform].getContextFactory(e)},exports.getResolvers=de,exports.getSchema=ue,exports.getTypeDefs=oe; | ||
//# sourceMappingURL=api.cjs.production.min.js.map |
@@ -30,3 +30,3 @@ import type { Options as OptionsVTEX } from './platforms/vtex'; | ||
product: (_: unknown, { locator }: import("./__generated__/schema").QueryProductArgs, ctx: import("./platforms/vtex").Context) => Promise<import("./platforms/vtex/utils/enhanceSku").EnhancedSku>; | ||
search: (_: unknown, { first, after: maybeAfter, sort, term, selectedFacets }: import("./__generated__/schema").QuerySearchArgs) => Promise<{ | ||
search: (_: unknown, { first, after: maybeAfter, sort, term, selectedFacets }: import("./__generated__/schema").QuerySearchArgs, ctx: import("./platforms/vtex").Context) => Promise<{ | ||
page: number; | ||
@@ -33,0 +33,0 @@ count: number; |
@@ -0,7 +1,7 @@ | ||
import type { Context, Options } from '../../index'; | ||
import type { Simulation, SimulationArgs, SimulationOptions } from './types/Simulation'; | ||
import type { CategoryTree } from './types/CategoryTree'; | ||
import type { Options } from '../..'; | ||
import type { Brand } from './types/Brand'; | ||
import type { OrderForm, OrderFormInputItem } from './types/OrderForm'; | ||
export declare const VtexCommerce: (options: Options) => { | ||
export declare const VtexCommerce: ({ account, environment }: Options, ctx: Context) => { | ||
catalog: { | ||
@@ -8,0 +8,0 @@ brand: { |
@@ -1,4 +0,4 @@ | ||
import type { Options } from '..'; | ||
import type { Context, Options } from '..'; | ||
export declare type Clients = ReturnType<typeof getClients>; | ||
export declare const getClients: (options: Options) => { | ||
export declare const getClients: (options: Options, ctx: Context) => { | ||
search: { | ||
@@ -5,0 +5,0 @@ facets: (args: Pick<import("./search").SearchArgs, "query" | "page" | "count" | "sort" | "selectedFacets" | "fuzzy">) => Promise<import("./search/types/AttributeSearchResult").AttributeSearchResult>; |
@@ -0,3 +1,3 @@ | ||
import type { Context, Options } from '../../index'; | ||
import type { SelectedFacet } from '../../utils/facets'; | ||
import type { Options } from '../..'; | ||
import type { ProductSearchResult } from './types/ProductSearchResult'; | ||
@@ -19,5 +19,5 @@ import type { AttributeSearchResult } from './types/AttributeSearchResult'; | ||
} | ||
export declare const IntelligentSearch: (opts: Options) => { | ||
export declare const IntelligentSearch: ({ account }: Options, ctx: Context) => { | ||
facets: (args: Omit<SearchArgs, 'type'>) => Promise<AttributeSearchResult>; | ||
products: (args: Omit<SearchArgs, 'type'>) => Promise<ProductSearchResult>; | ||
}; |
@@ -12,2 +12,11 @@ import type { Loaders } from './loaders'; | ||
loaders: Loaders; | ||
/** | ||
* @description Storage updated at each request. | ||
* | ||
* Use this datastructure to store and share small values in the context. | ||
* Use it with caution since dependecy injection leads to a more complex code | ||
* */ | ||
storage: { | ||
channel: string; | ||
}; | ||
} | ||
@@ -41,3 +50,3 @@ export declare type Resolver<R = unknown, A = unknown> = (root: R, args: A, ctx: Context, info: any) => any; | ||
product: (_: unknown, { locator }: import("../..").QueryProductArgs, ctx: Context) => Promise<import("./utils/enhanceSku").EnhancedSku>; | ||
search: (_: unknown, { first, after: maybeAfter, sort, term, selectedFacets }: import("../..").QuerySearchArgs) => Promise<{ | ||
search: (_: unknown, { first, after: maybeAfter, sort, term, selectedFacets }: import("../..").QuerySearchArgs, ctx: Context) => Promise<{ | ||
page: number; | ||
@@ -44,0 +53,0 @@ count: number; |
@@ -1,7 +0,6 @@ | ||
import type { Options } from '..'; | ||
import type { Clients } from '../clients'; | ||
import type { Context, Options } from '..'; | ||
export declare type Loaders = ReturnType<typeof getLoaders>; | ||
export declare const getLoaders: (options: Options, clients: Clients) => { | ||
export declare const getLoaders: (options: Options, { clients }: Context) => { | ||
skuLoader: import("dataloader")<import("../utils/facets").SelectedFacet[], import("../utils/enhanceSku").EnhancedSku, import("../utils/facets").SelectedFacet[]>; | ||
simulationLoader: import("dataloader")<import("../clients/commerce/types/Simulation").PayloadItem[], import("../clients/commerce/types/Simulation").Simulation, import("../clients/commerce/types/Simulation").PayloadItem[]>; | ||
}; |
@@ -6,3 +6,3 @@ import type { QueryProductArgs, QueryAllCollectionsArgs, QueryAllProductsArgs, QuerySearchArgs } from '../../../__generated__/schema'; | ||
product: (_: unknown, { locator }: QueryProductArgs, ctx: Context) => Promise<import("../utils/enhanceSku").EnhancedSku>; | ||
search: (_: unknown, { first, after: maybeAfter, sort, term, selectedFacets }: QuerySearchArgs) => Promise<{ | ||
search: (_: unknown, { first, after: maybeAfter, sort, term, selectedFacets }: QuerySearchArgs, ctx: Context) => Promise<{ | ||
page: number; | ||
@@ -9,0 +9,0 @@ count: number; |
{ | ||
"name": "@faststore/api", | ||
"version": "1.2.29", | ||
"version": "1.2.30", | ||
"license": "MIT", | ||
@@ -44,3 +44,3 @@ "main": "dist/index.js", | ||
}, | ||
"gitHead": "ffef11498b98f2795ba4de6c172d97aa0cd568f7" | ||
"gitHead": "be24853d5738ee7434da746adfcd9faf6ee41849" | ||
} |
@@ -0,1 +1,2 @@ | ||
import type { Context, Options } from '../../index' | ||
import { fetchAPI } from '../fetch' | ||
@@ -8,3 +9,2 @@ import type { | ||
import type { CategoryTree } from './types/CategoryTree' | ||
import type { Options } from '../..' | ||
import type { Brand } from './types/Brand' | ||
@@ -20,9 +20,8 @@ import type { OrderForm, OrderFormInputItem } from './types/OrderForm' | ||
const getBase = ({ account, environment }: Options) => | ||
`http://${account}.${environment}.com.br` | ||
export const VtexCommerce = ( | ||
{ account, environment }: Options, | ||
ctx: Context | ||
) => { | ||
const base = `http://${account}.${environment}.com.br` | ||
export const VtexCommerce = (options: Options) => { | ||
const { channel } = options | ||
const base = getBase(options) | ||
return { | ||
@@ -42,3 +41,5 @@ catalog: { | ||
args: SimulationArgs, | ||
{ salesChannel }: SimulationOptions = { salesChannel: channel } | ||
{ salesChannel }: SimulationOptions = { | ||
salesChannel: ctx.storage.channel, | ||
} | ||
): Promise<Simulation> => { | ||
@@ -60,3 +61,3 @@ const params = new URLSearchParams({ | ||
refreshOutdatedData = true, | ||
salesChannel = channel, | ||
salesChannel = ctx.storage.channel, | ||
}: { | ||
@@ -81,3 +82,3 @@ id: string | ||
allowOutdatedData = 'paymentData', | ||
salesChannel = channel, | ||
salesChannel = ctx.storage.channel, | ||
}: { | ||
@@ -84,0 +85,0 @@ id: string |
import { VtexCommerce } from './commerce' | ||
import { IntelligentSearch } from './search' | ||
import type { Options } from '..' | ||
import type { Context, Options } from '..' | ||
export type Clients = ReturnType<typeof getClients> | ||
export const getClients = (options: Options) => { | ||
const search = IntelligentSearch(options) | ||
const commerce = VtexCommerce(options) | ||
export const getClients = (options: Options, ctx: Context) => { | ||
const search = IntelligentSearch(options, ctx) | ||
const commerce = VtexCommerce(options, ctx) | ||
@@ -11,0 +11,0 @@ return { |
@@ -0,4 +1,4 @@ | ||
import type { Context, Options } from '../../index' | ||
import { fetchAPI } from '../fetch' | ||
import type { SelectedFacet } from '../../utils/facets' | ||
import type { Options } from '../..' | ||
import type { ProductSearchResult } from './types/ProductSearchResult' | ||
@@ -32,5 +32,4 @@ import type { AttributeSearchResult } from './types/AttributeSearchResult' | ||
export const IntelligentSearch = (opts: Options) => { | ||
const { channel } = opts | ||
const base = `http://search.biggylabs.com.br/search-api/v1/${opts.account}` | ||
export const IntelligentSearch = ({ account }: Options, ctx: Context) => { | ||
const base = `http://search.biggylabs.com.br/search-api/v1/${account}` | ||
@@ -43,3 +42,3 @@ const addDefaultFacets = (facets: SelectedFacet[]) => { | ||
return Object.entries({ | ||
'trade-policy': channel, | ||
'trade-policy': ctx.storage.channel, | ||
...facetsObj, | ||
@@ -46,0 +45,0 @@ }).map(([key, value]) => ({ key, value })) |
@@ -30,2 +30,11 @@ import { getClients } from './clients' | ||
loaders: Loaders | ||
/** | ||
* @description Storage updated at each request. | ||
* | ||
* Use this datastructure to store and share small values in the context. | ||
* Use it with caution since dependecy injection leads to a more complex code | ||
* */ | ||
storage: { | ||
channel: string | ||
} | ||
} | ||
@@ -57,4 +66,7 @@ | ||
export const getContextFactory = (options: Options) => (ctx: any) => { | ||
ctx.clients = getClients(options) | ||
ctx.loaders = getLoaders(options, ctx.clients) | ||
ctx.storage = { | ||
channel: options.channel, | ||
} | ||
ctx.clients = getClients(options, ctx) | ||
ctx.loaders = getLoaders(options, ctx) | ||
@@ -61,0 +73,0 @@ return ctx |
import { getSimulationLoader } from './simulation' | ||
import { getSkuLoader } from './sku' | ||
import type { Options } from '..' | ||
import type { Clients } from '../clients' | ||
import type { Context, Options } from '..' | ||
export type Loaders = ReturnType<typeof getLoaders> | ||
export const getLoaders = (options: Options, clients: Clients) => { | ||
export const getLoaders = (options: Options, { clients }: Context) => { | ||
const skuLoader = getSkuLoader(options, clients) | ||
@@ -10,0 +9,0 @@ const simulationLoader = getSimulationLoader(options, clients) |
@@ -14,2 +14,4 @@ import type { Resolver } from '..' | ||
const getPath = (link: string, id: string) => `/${getSlug(link, id)}/p` | ||
const nonEmptyArray = <T>(array: T[] | null | undefined) => | ||
Array.isArray(array) && array.length > 0 ? array : null | ||
@@ -42,8 +44,9 @@ export const StoreProduct: Record<string, Resolver<Root>> = { | ||
image: ({ isVariantOf, images }) => | ||
(images ?? isVariantOf.images ?? [DEFAULT_IMAGE]).map( | ||
({ name, value }) => ({ | ||
alternateName: name ?? '', | ||
url: value.replace('vteximg.com.br', 'vtexassets.com'), | ||
}) | ||
), | ||
( | ||
nonEmptyArray(images) ?? | ||
nonEmptyArray(isVariantOf.images) ?? [DEFAULT_IMAGE] | ||
).map(({ name, value }) => ({ | ||
alternateName: name ?? '', | ||
url: value.replace('vteximg.com.br', 'vtexassets.com'), | ||
})), | ||
sku: ({ | ||
@@ -60,6 +63,16 @@ isVariantOf: { | ||
loaders: { simulationLoader }, | ||
storage: { channel }, | ||
} = ctx | ||
const { sellers, id } = product | ||
const { id, policies } = product | ||
const sellers = policies.find((policy) => policy.id === channel)?.sellers | ||
if (sellers == null) { | ||
// This error will likely happen when you forget to forward the channel somewhere in your code. | ||
// Make sure all queries that lead to a product are forwarding the channel in context corectly | ||
throw new Error( | ||
`Product with id ${id} has no sellers for channel ${channel}.` | ||
) | ||
} | ||
// Unique seller ids | ||
@@ -66,0 +79,0 @@ const sellerIds = sellers.map((seller) => seller.id) |
@@ -15,2 +15,10 @@ import { enhanceSku } from '../utils/enhanceSku' | ||
product: async (_: unknown, { locator }: QueryProductArgs, ctx: Context) => { | ||
// Insert channel in context for later usage | ||
ctx.storage = { | ||
...ctx.storage, | ||
channel: | ||
locator.find((facet) => facet.key === 'channel')?.value ?? | ||
ctx.storage.channel, | ||
} | ||
const { | ||
@@ -24,4 +32,13 @@ loaders: { skuLoader }, | ||
_: unknown, | ||
{ first, after: maybeAfter, sort, term, selectedFacets }: QuerySearchArgs | ||
{ first, after: maybeAfter, sort, term, selectedFacets }: QuerySearchArgs, | ||
ctx: Context | ||
) => { | ||
// Insert channel in context for later usage | ||
ctx.storage = { | ||
...ctx.storage, | ||
channel: | ||
selectedFacets?.find((facet) => facet.key === 'channel')?.value ?? | ||
ctx.storage.channel, | ||
} | ||
const after = maybeAfter ? Number(maybeAfter) : 0 | ||
@@ -28,0 +45,0 @@ const searchArgs = { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
713898
8111