@plasmicpkgs/commerce-saleor 0.0.48 → 0.0.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commerce-saleor.cjs.development.js +123 -372
- package/dist/commerce-saleor.cjs.development.js.map +1 -1
- package/dist/commerce-saleor.cjs.production.min.js +1 -1
- package/dist/commerce-saleor.cjs.production.min.js.map +1 -1
- package/dist/commerce-saleor.esm.js +123 -372
- package/dist/commerce-saleor.esm.js.map +1 -1
- package/package.json +4 -4
|
@@ -26,64 +26,52 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
|
26
26
|
reject(error);
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
|
-
|
|
30
29
|
if (info.done) {
|
|
31
30
|
resolve(value);
|
|
32
31
|
} else {
|
|
33
32
|
Promise.resolve(value).then(_next, _throw);
|
|
34
33
|
}
|
|
35
34
|
}
|
|
36
|
-
|
|
37
35
|
function _asyncToGenerator(fn) {
|
|
38
36
|
return function () {
|
|
39
37
|
var self = this,
|
|
40
|
-
|
|
38
|
+
args = arguments;
|
|
41
39
|
return new Promise(function (resolve, reject) {
|
|
42
40
|
var gen = fn.apply(self, args);
|
|
43
|
-
|
|
44
41
|
function _next(value) {
|
|
45
42
|
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
46
43
|
}
|
|
47
|
-
|
|
48
44
|
function _throw(err) {
|
|
49
45
|
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
50
46
|
}
|
|
51
|
-
|
|
52
47
|
_next(undefined);
|
|
53
48
|
});
|
|
54
49
|
};
|
|
55
50
|
}
|
|
56
|
-
|
|
57
51
|
function _extends() {
|
|
58
|
-
_extends = Object.assign
|
|
52
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
59
53
|
for (var i = 1; i < arguments.length; i++) {
|
|
60
54
|
var source = arguments[i];
|
|
61
|
-
|
|
62
55
|
for (var key in source) {
|
|
63
56
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
64
57
|
target[key] = source[key];
|
|
65
58
|
}
|
|
66
59
|
}
|
|
67
60
|
}
|
|
68
|
-
|
|
69
61
|
return target;
|
|
70
62
|
};
|
|
71
|
-
|
|
72
63
|
return _extends.apply(this, arguments);
|
|
73
64
|
}
|
|
74
|
-
|
|
75
65
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
76
66
|
if (source == null) return {};
|
|
77
67
|
var target = {};
|
|
78
68
|
var sourceKeys = Object.keys(source);
|
|
79
69
|
var key, i;
|
|
80
|
-
|
|
81
70
|
for (i = 0; i < sourceKeys.length; i++) {
|
|
82
71
|
key = sourceKeys[i];
|
|
83
72
|
if (excluded.indexOf(key) >= 0) continue;
|
|
84
73
|
target[key] = source[key];
|
|
85
74
|
}
|
|
86
|
-
|
|
87
75
|
return target;
|
|
88
76
|
}
|
|
89
77
|
|
|
@@ -98,17 +86,16 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
98
86
|
* This source code is licensed under the MIT license found in the
|
|
99
87
|
* LICENSE file in the root directory of this source tree.
|
|
100
88
|
*/
|
|
89
|
+
|
|
101
90
|
var runtime = function (exports) {
|
|
102
91
|
|
|
103
92
|
var Op = Object.prototype;
|
|
104
93
|
var hasOwn = Op.hasOwnProperty;
|
|
105
94
|
var undefined$1; // More compressible than void 0.
|
|
106
|
-
|
|
107
95
|
var $Symbol = typeof Symbol === "function" ? Symbol : {};
|
|
108
96
|
var iteratorSymbol = $Symbol.iterator || "@@iterator";
|
|
109
97
|
var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
|
|
110
98
|
var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
111
|
-
|
|
112
99
|
function define(obj, key, value) {
|
|
113
100
|
Object.defineProperty(obj, key, {
|
|
114
101
|
value: value,
|
|
@@ -118,7 +105,6 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
118
105
|
});
|
|
119
106
|
return obj[key];
|
|
120
107
|
}
|
|
121
|
-
|
|
122
108
|
try {
|
|
123
109
|
// IE 8 has a broken Object.defineProperty that only works on DOM objects.
|
|
124
110
|
define({}, "");
|
|
@@ -127,19 +113,20 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
127
113
|
return obj[key] = value;
|
|
128
114
|
};
|
|
129
115
|
}
|
|
130
|
-
|
|
131
116
|
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
132
117
|
// If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
|
|
133
118
|
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
|
|
134
119
|
var generator = Object.create(protoGenerator.prototype);
|
|
135
|
-
var context = new Context(tryLocsList || []);
|
|
136
|
-
// .throw, and .return methods.
|
|
120
|
+
var context = new Context(tryLocsList || []);
|
|
137
121
|
|
|
122
|
+
// The ._invoke method unifies the implementations of the .next,
|
|
123
|
+
// .throw, and .return methods.
|
|
138
124
|
generator._invoke = makeInvokeMethod(innerFn, self, context);
|
|
139
125
|
return generator;
|
|
140
126
|
}
|
|
127
|
+
exports.wrap = wrap;
|
|
141
128
|
|
|
142
|
-
|
|
129
|
+
// Try/catch helper to minimize deoptimizations. Returns a completion
|
|
143
130
|
// record like context.tryEntries[i].completion. This interface could
|
|
144
131
|
// have been (and was previously) designed to take a closure to be
|
|
145
132
|
// invoked without arguments, but in all the cases we care about we
|
|
@@ -149,7 +136,6 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
149
136
|
// in every case, so we don't have to touch the arguments object. The
|
|
150
137
|
// only additional allocation required is the completion record, which
|
|
151
138
|
// has a stable shape and so hopefully should be cheap to allocate.
|
|
152
|
-
|
|
153
139
|
function tryCatch(fn, obj, arg) {
|
|
154
140
|
try {
|
|
155
141
|
return {
|
|
@@ -163,46 +149,44 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
163
149
|
};
|
|
164
150
|
}
|
|
165
151
|
}
|
|
166
|
-
|
|
167
152
|
var GenStateSuspendedStart = "suspendedStart";
|
|
168
153
|
var GenStateSuspendedYield = "suspendedYield";
|
|
169
154
|
var GenStateExecuting = "executing";
|
|
170
|
-
var GenStateCompleted = "completed";
|
|
155
|
+
var GenStateCompleted = "completed";
|
|
156
|
+
|
|
157
|
+
// Returning this object from the innerFn has the same effect as
|
|
171
158
|
// breaking out of the dispatch switch statement.
|
|
159
|
+
var ContinueSentinel = {};
|
|
172
160
|
|
|
173
|
-
|
|
161
|
+
// Dummy constructor functions that we use as the .constructor and
|
|
174
162
|
// .constructor.prototype properties for functions that return Generator
|
|
175
163
|
// objects. For full spec compliance, you may wish to configure your
|
|
176
164
|
// minifier not to mangle the names of these two functions.
|
|
177
|
-
|
|
178
165
|
function Generator() {}
|
|
179
|
-
|
|
180
166
|
function GeneratorFunction() {}
|
|
167
|
+
function GeneratorFunctionPrototype() {}
|
|
181
168
|
|
|
182
|
-
|
|
169
|
+
// This is a polyfill for %IteratorPrototype% for environments that
|
|
183
170
|
// don't natively support it.
|
|
184
|
-
|
|
185
|
-
|
|
186
171
|
var IteratorPrototype = {};
|
|
187
172
|
define(IteratorPrototype, iteratorSymbol, function () {
|
|
188
173
|
return this;
|
|
189
174
|
});
|
|
190
175
|
var getProto = Object.getPrototypeOf;
|
|
191
176
|
var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
192
|
-
|
|
193
177
|
if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
|
|
194
178
|
// This environment has a native %IteratorPrototype%; use it instead
|
|
195
179
|
// of the polyfill.
|
|
196
180
|
IteratorPrototype = NativeIteratorPrototype;
|
|
197
181
|
}
|
|
198
|
-
|
|
199
182
|
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
200
183
|
GeneratorFunction.prototype = GeneratorFunctionPrototype;
|
|
201
184
|
define(Gp, "constructor", GeneratorFunctionPrototype);
|
|
202
185
|
define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
|
|
203
|
-
GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction");
|
|
204
|
-
// Iterator interface in terms of a single ._invoke method.
|
|
186
|
+
GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction");
|
|
205
187
|
|
|
188
|
+
// Helper for defining the .next, .throw, and .return methods of the
|
|
189
|
+
// Iterator interface in terms of a single ._invoke method.
|
|
206
190
|
function defineIteratorMethods(prototype) {
|
|
207
191
|
["next", "throw", "return"].forEach(function (method) {
|
|
208
192
|
define(prototype, method, function (arg) {
|
|
@@ -210,14 +194,13 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
210
194
|
});
|
|
211
195
|
});
|
|
212
196
|
}
|
|
213
|
-
|
|
214
197
|
exports.isGeneratorFunction = function (genFun) {
|
|
215
198
|
var ctor = typeof genFun === "function" && genFun.constructor;
|
|
216
|
-
return ctor ? ctor === GeneratorFunction ||
|
|
199
|
+
return ctor ? ctor === GeneratorFunction ||
|
|
200
|
+
// For the native GeneratorFunction constructor, the best we can
|
|
217
201
|
// do is to check its .name property.
|
|
218
202
|
(ctor.displayName || ctor.name) === "GeneratorFunction" : false;
|
|
219
203
|
};
|
|
220
|
-
|
|
221
204
|
exports.mark = function (genFun) {
|
|
222
205
|
if (Object.setPrototypeOf) {
|
|
223
206
|
Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
|
|
@@ -225,31 +208,27 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
225
208
|
genFun.__proto__ = GeneratorFunctionPrototype;
|
|
226
209
|
define(genFun, toStringTagSymbol, "GeneratorFunction");
|
|
227
210
|
}
|
|
228
|
-
|
|
229
211
|
genFun.prototype = Object.create(Gp);
|
|
230
212
|
return genFun;
|
|
231
|
-
};
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
// Within the body of any async function, `await x` is transformed to
|
|
232
216
|
// `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
|
|
233
217
|
// `hasOwn.call(value, "__await")` to determine if the yielded value is
|
|
234
218
|
// meant to be awaited.
|
|
235
|
-
|
|
236
|
-
|
|
237
219
|
exports.awrap = function (arg) {
|
|
238
220
|
return {
|
|
239
221
|
__await: arg
|
|
240
222
|
};
|
|
241
223
|
};
|
|
242
|
-
|
|
243
224
|
function AsyncIterator(generator, PromiseImpl) {
|
|
244
225
|
function invoke(method, arg, resolve, reject) {
|
|
245
226
|
var record = tryCatch(generator[method], generator, arg);
|
|
246
|
-
|
|
247
227
|
if (record.type === "throw") {
|
|
248
228
|
reject(record.arg);
|
|
249
229
|
} else {
|
|
250
230
|
var result = record.arg;
|
|
251
231
|
var value = result.value;
|
|
252
|
-
|
|
253
232
|
if (value && typeof value === "object" && hasOwn.call(value, "__await")) {
|
|
254
233
|
return PromiseImpl.resolve(value.__await).then(function (value) {
|
|
255
234
|
invoke("next", value, resolve, reject);
|
|
@@ -257,7 +236,6 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
257
236
|
invoke("throw", err, resolve, reject);
|
|
258
237
|
});
|
|
259
238
|
}
|
|
260
|
-
|
|
261
239
|
return PromiseImpl.resolve(value).then(function (unwrapped) {
|
|
262
240
|
// When a yielded Promise is resolved, its final value becomes
|
|
263
241
|
// the .value of the Promise<{value,done}> result for the
|
|
@@ -271,17 +249,15 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
271
249
|
});
|
|
272
250
|
}
|
|
273
251
|
}
|
|
274
|
-
|
|
275
252
|
var previousPromise;
|
|
276
|
-
|
|
277
253
|
function enqueue(method, arg) {
|
|
278
254
|
function callInvokeWithMethodAndArg() {
|
|
279
255
|
return new PromiseImpl(function (resolve, reject) {
|
|
280
256
|
invoke(method, arg, resolve, reject);
|
|
281
257
|
});
|
|
282
258
|
}
|
|
283
|
-
|
|
284
|
-
|
|
259
|
+
return previousPromise =
|
|
260
|
+
// If enqueue has been called before, then we want to wait until
|
|
285
261
|
// all previous Promises have been resolved before calling invoke,
|
|
286
262
|
// so that results are always delivered in the correct order. If
|
|
287
263
|
// enqueue has not been called before, then it is important to
|
|
@@ -293,24 +269,25 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
293
269
|
// execute code before the first await. Since we implement simple
|
|
294
270
|
// async functions in terms of async generators, it is especially
|
|
295
271
|
// important to get this right, even though it requires care.
|
|
296
|
-
previousPromise ? previousPromise.then(callInvokeWithMethodAndArg,
|
|
272
|
+
previousPromise ? previousPromise.then(callInvokeWithMethodAndArg,
|
|
273
|
+
// Avoid propagating failures to Promises returned by later
|
|
297
274
|
// invocations of the iterator.
|
|
298
275
|
callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
299
|
-
}
|
|
300
|
-
// .throw, and .return (see defineIteratorMethods).
|
|
301
|
-
|
|
276
|
+
}
|
|
302
277
|
|
|
278
|
+
// Define the unified helper method that is used to implement .next,
|
|
279
|
+
// .throw, and .return (see defineIteratorMethods).
|
|
303
280
|
this._invoke = enqueue;
|
|
304
281
|
}
|
|
305
|
-
|
|
306
282
|
defineIteratorMethods(AsyncIterator.prototype);
|
|
307
283
|
define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
308
284
|
return this;
|
|
309
285
|
});
|
|
310
|
-
exports.AsyncIterator = AsyncIterator;
|
|
286
|
+
exports.AsyncIterator = AsyncIterator;
|
|
287
|
+
|
|
288
|
+
// Note that simple async functions are implemented on top of
|
|
311
289
|
// AsyncIterator objects; they just return a Promise for the value of
|
|
312
290
|
// the final result produced by the iterator.
|
|
313
|
-
|
|
314
291
|
exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
315
292
|
if (PromiseImpl === void 0) PromiseImpl = Promise;
|
|
316
293
|
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
|
@@ -319,39 +296,32 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
319
296
|
return result.done ? result.value : iter.next();
|
|
320
297
|
});
|
|
321
298
|
};
|
|
322
|
-
|
|
323
299
|
function makeInvokeMethod(innerFn, self, context) {
|
|
324
300
|
var state = GenStateSuspendedStart;
|
|
325
301
|
return function invoke(method, arg) {
|
|
326
302
|
if (state === GenStateExecuting) {
|
|
327
303
|
throw new Error("Generator is already running");
|
|
328
304
|
}
|
|
329
|
-
|
|
330
305
|
if (state === GenStateCompleted) {
|
|
331
306
|
if (method === "throw") {
|
|
332
307
|
throw arg;
|
|
333
|
-
}
|
|
334
|
-
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
|
|
335
|
-
|
|
308
|
+
}
|
|
336
309
|
|
|
310
|
+
// Be forgiving, per 25.3.3.3.3 of the spec:
|
|
311
|
+
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
|
|
337
312
|
return doneResult();
|
|
338
313
|
}
|
|
339
|
-
|
|
340
314
|
context.method = method;
|
|
341
315
|
context.arg = arg;
|
|
342
|
-
|
|
343
316
|
while (true) {
|
|
344
317
|
var delegate = context.delegate;
|
|
345
|
-
|
|
346
318
|
if (delegate) {
|
|
347
319
|
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
348
|
-
|
|
349
320
|
if (delegateResult) {
|
|
350
321
|
if (delegateResult === ContinueSentinel) continue;
|
|
351
322
|
return delegateResult;
|
|
352
323
|
}
|
|
353
324
|
}
|
|
354
|
-
|
|
355
325
|
if (context.method === "next") {
|
|
356
326
|
// Setting context._sent for legacy support of Babel's
|
|
357
327
|
// function.sent implementation.
|
|
@@ -361,51 +331,44 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
361
331
|
state = GenStateCompleted;
|
|
362
332
|
throw context.arg;
|
|
363
333
|
}
|
|
364
|
-
|
|
365
334
|
context.dispatchException(context.arg);
|
|
366
335
|
} else if (context.method === "return") {
|
|
367
336
|
context.abrupt("return", context.arg);
|
|
368
337
|
}
|
|
369
|
-
|
|
370
338
|
state = GenStateExecuting;
|
|
371
339
|
var record = tryCatch(innerFn, self, context);
|
|
372
|
-
|
|
373
340
|
if (record.type === "normal") {
|
|
374
341
|
// If an exception is thrown from innerFn, we leave state ===
|
|
375
342
|
// GenStateExecuting and loop back for another invocation.
|
|
376
343
|
state = context.done ? GenStateCompleted : GenStateSuspendedYield;
|
|
377
|
-
|
|
378
344
|
if (record.arg === ContinueSentinel) {
|
|
379
345
|
continue;
|
|
380
346
|
}
|
|
381
|
-
|
|
382
347
|
return {
|
|
383
348
|
value: record.arg,
|
|
384
349
|
done: context.done
|
|
385
350
|
};
|
|
386
351
|
} else if (record.type === "throw") {
|
|
387
|
-
state = GenStateCompleted;
|
|
352
|
+
state = GenStateCompleted;
|
|
353
|
+
// Dispatch the exception by looping back around to the
|
|
388
354
|
// context.dispatchException(context.arg) call above.
|
|
389
|
-
|
|
390
355
|
context.method = "throw";
|
|
391
356
|
context.arg = record.arg;
|
|
392
357
|
}
|
|
393
358
|
}
|
|
394
359
|
};
|
|
395
|
-
}
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
// Call delegate.iterator[context.method](context.arg) and handle the
|
|
396
363
|
// result, either by returning a { value, done } result from the
|
|
397
364
|
// delegate iterator, or by modifying context.method and context.arg,
|
|
398
365
|
// setting context.delegate to null, and returning the ContinueSentinel.
|
|
399
|
-
|
|
400
|
-
|
|
401
366
|
function maybeInvokeDelegate(delegate, context) {
|
|
402
367
|
var method = delegate.iterator[context.method];
|
|
403
|
-
|
|
404
368
|
if (method === undefined$1) {
|
|
405
369
|
// A .throw or .return when the delegate iterator has no .throw
|
|
406
370
|
// method always terminates the yield* loop.
|
|
407
371
|
context.delegate = null;
|
|
408
|
-
|
|
409
372
|
if (context.method === "throw") {
|
|
410
373
|
// Note: ["return"] must be used for ES3 parsing compatibility.
|
|
411
374
|
if (delegate.iterator["return"]) {
|
|
@@ -414,51 +377,45 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
414
377
|
context.method = "return";
|
|
415
378
|
context.arg = undefined$1;
|
|
416
379
|
maybeInvokeDelegate(delegate, context);
|
|
417
|
-
|
|
418
380
|
if (context.method === "throw") {
|
|
419
381
|
// If maybeInvokeDelegate(context) changed context.method from
|
|
420
382
|
// "return" to "throw", let that override the TypeError below.
|
|
421
383
|
return ContinueSentinel;
|
|
422
384
|
}
|
|
423
385
|
}
|
|
424
|
-
|
|
425
386
|
context.method = "throw";
|
|
426
387
|
context.arg = new TypeError("The iterator does not provide a 'throw' method");
|
|
427
388
|
}
|
|
428
|
-
|
|
429
389
|
return ContinueSentinel;
|
|
430
390
|
}
|
|
431
|
-
|
|
432
391
|
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
433
|
-
|
|
434
392
|
if (record.type === "throw") {
|
|
435
393
|
context.method = "throw";
|
|
436
394
|
context.arg = record.arg;
|
|
437
395
|
context.delegate = null;
|
|
438
396
|
return ContinueSentinel;
|
|
439
397
|
}
|
|
440
|
-
|
|
441
398
|
var info = record.arg;
|
|
442
|
-
|
|
443
399
|
if (!info) {
|
|
444
400
|
context.method = "throw";
|
|
445
401
|
context.arg = new TypeError("iterator result is not an object");
|
|
446
402
|
context.delegate = null;
|
|
447
403
|
return ContinueSentinel;
|
|
448
404
|
}
|
|
449
|
-
|
|
450
405
|
if (info.done) {
|
|
451
406
|
// Assign the result of the finished delegate to the temporary
|
|
452
407
|
// variable specified by delegate.resultName (see delegateYield).
|
|
453
|
-
context[delegate.resultName] = info.value;
|
|
408
|
+
context[delegate.resultName] = info.value;
|
|
409
|
+
|
|
410
|
+
// Resume execution at the desired location (see delegateYield).
|
|
411
|
+
context.next = delegate.nextLoc;
|
|
454
412
|
|
|
455
|
-
|
|
413
|
+
// If context.method was "throw" but the delegate handled the
|
|
456
414
|
// exception, let the outer generator proceed normally. If
|
|
457
415
|
// context.method was "next", forget context.arg since it has been
|
|
458
416
|
// "consumed" by the delegate iterator. If context.method was
|
|
459
417
|
// "return", allow the original .return call to continue in the
|
|
460
418
|
// outer generator.
|
|
461
|
-
|
|
462
419
|
if (context.method !== "return") {
|
|
463
420
|
context.method = "next";
|
|
464
421
|
context.arg = undefined$1;
|
|
@@ -466,54 +423,49 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
466
423
|
} else {
|
|
467
424
|
// Re-yield the result returned by the delegate method.
|
|
468
425
|
return info;
|
|
469
|
-
}
|
|
470
|
-
// the outer generator.
|
|
471
|
-
|
|
426
|
+
}
|
|
472
427
|
|
|
428
|
+
// The delegate iterator is finished, so forget it and continue with
|
|
429
|
+
// the outer generator.
|
|
473
430
|
context.delegate = null;
|
|
474
431
|
return ContinueSentinel;
|
|
475
|
-
}
|
|
476
|
-
// unified ._invoke helper method.
|
|
477
|
-
|
|
432
|
+
}
|
|
478
433
|
|
|
434
|
+
// Define Generator.prototype.{next,throw,return} in terms of the
|
|
435
|
+
// unified ._invoke helper method.
|
|
479
436
|
defineIteratorMethods(Gp);
|
|
480
|
-
define(Gp, toStringTagSymbol, "Generator");
|
|
437
|
+
define(Gp, toStringTagSymbol, "Generator");
|
|
438
|
+
|
|
439
|
+
// A Generator should always return itself as the iterator object when the
|
|
481
440
|
// @@iterator function is called on it. Some browsers' implementations of the
|
|
482
441
|
// iterator prototype chain incorrectly implement this, causing the Generator
|
|
483
442
|
// object to not be returned from this call. This ensures that doesn't happen.
|
|
484
443
|
// See https://github.com/facebook/regenerator/issues/274 for more details.
|
|
485
|
-
|
|
486
444
|
define(Gp, iteratorSymbol, function () {
|
|
487
445
|
return this;
|
|
488
446
|
});
|
|
489
447
|
define(Gp, "toString", function () {
|
|
490
448
|
return "[object Generator]";
|
|
491
449
|
});
|
|
492
|
-
|
|
493
450
|
function pushTryEntry(locs) {
|
|
494
451
|
var entry = {
|
|
495
452
|
tryLoc: locs[0]
|
|
496
453
|
};
|
|
497
|
-
|
|
498
454
|
if (1 in locs) {
|
|
499
455
|
entry.catchLoc = locs[1];
|
|
500
456
|
}
|
|
501
|
-
|
|
502
457
|
if (2 in locs) {
|
|
503
458
|
entry.finallyLoc = locs[2];
|
|
504
459
|
entry.afterLoc = locs[3];
|
|
505
460
|
}
|
|
506
|
-
|
|
507
461
|
this.tryEntries.push(entry);
|
|
508
462
|
}
|
|
509
|
-
|
|
510
463
|
function resetTryEntry(entry) {
|
|
511
464
|
var record = entry.completion || {};
|
|
512
465
|
record.type = "normal";
|
|
513
466
|
delete record.arg;
|
|
514
467
|
entry.completion = record;
|
|
515
468
|
}
|
|
516
|
-
|
|
517
469
|
function Context(tryLocsList) {
|
|
518
470
|
// The root entry object (effectively a try statement without a catch
|
|
519
471
|
// or a finally block) gives us a place to store values thrown from
|
|
@@ -524,97 +476,84 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
524
476
|
tryLocsList.forEach(pushTryEntry, this);
|
|
525
477
|
this.reset(true);
|
|
526
478
|
}
|
|
527
|
-
|
|
528
479
|
exports.keys = function (object) {
|
|
529
480
|
var keys = [];
|
|
530
|
-
|
|
531
481
|
for (var key in object) {
|
|
532
482
|
keys.push(key);
|
|
533
483
|
}
|
|
484
|
+
keys.reverse();
|
|
534
485
|
|
|
535
|
-
|
|
486
|
+
// Rather than returning an object with a next method, we keep
|
|
536
487
|
// things simple and return the next function itself.
|
|
537
|
-
|
|
538
488
|
return function next() {
|
|
539
489
|
while (keys.length) {
|
|
540
490
|
var key = keys.pop();
|
|
541
|
-
|
|
542
491
|
if (key in object) {
|
|
543
492
|
next.value = key;
|
|
544
493
|
next.done = false;
|
|
545
494
|
return next;
|
|
546
495
|
}
|
|
547
|
-
}
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
// To avoid creating an additional object, we just hang the .value
|
|
548
499
|
// and .done properties off the next function object itself. This
|
|
549
500
|
// also ensures that the minifier will not anonymize the function.
|
|
550
|
-
|
|
551
|
-
|
|
552
501
|
next.done = true;
|
|
553
502
|
return next;
|
|
554
503
|
};
|
|
555
504
|
};
|
|
556
|
-
|
|
557
505
|
function values(iterable) {
|
|
558
506
|
if (iterable) {
|
|
559
507
|
var iteratorMethod = iterable[iteratorSymbol];
|
|
560
|
-
|
|
561
508
|
if (iteratorMethod) {
|
|
562
509
|
return iteratorMethod.call(iterable);
|
|
563
510
|
}
|
|
564
|
-
|
|
565
511
|
if (typeof iterable.next === "function") {
|
|
566
512
|
return iterable;
|
|
567
513
|
}
|
|
568
|
-
|
|
569
514
|
if (!isNaN(iterable.length)) {
|
|
570
515
|
var i = -1,
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
516
|
+
next = function next() {
|
|
517
|
+
while (++i < iterable.length) {
|
|
518
|
+
if (hasOwn.call(iterable, i)) {
|
|
519
|
+
next.value = iterable[i];
|
|
520
|
+
next.done = false;
|
|
521
|
+
return next;
|
|
522
|
+
}
|
|
577
523
|
}
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
return next;
|
|
583
|
-
};
|
|
584
|
-
|
|
524
|
+
next.value = undefined$1;
|
|
525
|
+
next.done = true;
|
|
526
|
+
return next;
|
|
527
|
+
};
|
|
585
528
|
return next.next = next;
|
|
586
529
|
}
|
|
587
|
-
}
|
|
588
|
-
|
|
530
|
+
}
|
|
589
531
|
|
|
532
|
+
// Return an iterator with no values.
|
|
590
533
|
return {
|
|
591
534
|
next: doneResult
|
|
592
535
|
};
|
|
593
536
|
}
|
|
594
|
-
|
|
595
537
|
exports.values = values;
|
|
596
|
-
|
|
597
538
|
function doneResult() {
|
|
598
539
|
return {
|
|
599
540
|
value: undefined$1,
|
|
600
541
|
done: true
|
|
601
542
|
};
|
|
602
543
|
}
|
|
603
|
-
|
|
604
544
|
Context.prototype = {
|
|
605
545
|
constructor: Context,
|
|
606
546
|
reset: function reset(skipTempReset) {
|
|
607
547
|
this.prev = 0;
|
|
608
|
-
this.next = 0;
|
|
548
|
+
this.next = 0;
|
|
549
|
+
// Resetting context._sent for legacy support of Babel's
|
|
609
550
|
// function.sent implementation.
|
|
610
|
-
|
|
611
551
|
this.sent = this._sent = undefined$1;
|
|
612
552
|
this.done = false;
|
|
613
553
|
this.delegate = null;
|
|
614
554
|
this.method = "next";
|
|
615
555
|
this.arg = undefined$1;
|
|
616
556
|
this.tryEntries.forEach(resetTryEntry);
|
|
617
|
-
|
|
618
557
|
if (!skipTempReset) {
|
|
619
558
|
for (var name in this) {
|
|
620
559
|
// Not sure about the optimal order of these conditions:
|
|
@@ -628,50 +567,40 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
628
567
|
this.done = true;
|
|
629
568
|
var rootEntry = this.tryEntries[0];
|
|
630
569
|
var rootRecord = rootEntry.completion;
|
|
631
|
-
|
|
632
570
|
if (rootRecord.type === "throw") {
|
|
633
571
|
throw rootRecord.arg;
|
|
634
572
|
}
|
|
635
|
-
|
|
636
573
|
return this.rval;
|
|
637
574
|
},
|
|
638
575
|
dispatchException: function dispatchException(exception) {
|
|
639
576
|
if (this.done) {
|
|
640
577
|
throw exception;
|
|
641
578
|
}
|
|
642
|
-
|
|
643
579
|
var context = this;
|
|
644
|
-
|
|
645
580
|
function handle(loc, caught) {
|
|
646
581
|
record.type = "throw";
|
|
647
582
|
record.arg = exception;
|
|
648
583
|
context.next = loc;
|
|
649
|
-
|
|
650
584
|
if (caught) {
|
|
651
585
|
// If the dispatched exception was caught by a catch block,
|
|
652
586
|
// then let that catch block handle the exception normally.
|
|
653
587
|
context.method = "next";
|
|
654
588
|
context.arg = undefined$1;
|
|
655
589
|
}
|
|
656
|
-
|
|
657
590
|
return !!caught;
|
|
658
591
|
}
|
|
659
|
-
|
|
660
592
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
661
593
|
var entry = this.tryEntries[i];
|
|
662
594
|
var record = entry.completion;
|
|
663
|
-
|
|
664
595
|
if (entry.tryLoc === "root") {
|
|
665
596
|
// Exception thrown outside of any try block that could handle
|
|
666
597
|
// it, so set the completion value of the entire function to
|
|
667
598
|
// throw the exception.
|
|
668
599
|
return handle("end");
|
|
669
600
|
}
|
|
670
|
-
|
|
671
601
|
if (entry.tryLoc <= this.prev) {
|
|
672
602
|
var hasCatch = hasOwn.call(entry, "catchLoc");
|
|
673
603
|
var hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
674
|
-
|
|
675
604
|
if (hasCatch && hasFinally) {
|
|
676
605
|
if (this.prev < entry.catchLoc) {
|
|
677
606
|
return handle(entry.catchLoc, true);
|
|
@@ -695,36 +624,30 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
695
624
|
abrupt: function abrupt(type, arg) {
|
|
696
625
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
697
626
|
var entry = this.tryEntries[i];
|
|
698
|
-
|
|
699
627
|
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
700
628
|
var finallyEntry = entry;
|
|
701
629
|
break;
|
|
702
630
|
}
|
|
703
631
|
}
|
|
704
|
-
|
|
705
632
|
if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
|
|
706
633
|
// Ignore the finally entry if control is not jumping to a
|
|
707
634
|
// location outside the try/catch block.
|
|
708
635
|
finallyEntry = null;
|
|
709
636
|
}
|
|
710
|
-
|
|
711
637
|
var record = finallyEntry ? finallyEntry.completion : {};
|
|
712
638
|
record.type = type;
|
|
713
639
|
record.arg = arg;
|
|
714
|
-
|
|
715
640
|
if (finallyEntry) {
|
|
716
641
|
this.method = "next";
|
|
717
642
|
this.next = finallyEntry.finallyLoc;
|
|
718
643
|
return ContinueSentinel;
|
|
719
644
|
}
|
|
720
|
-
|
|
721
645
|
return this.complete(record);
|
|
722
646
|
},
|
|
723
647
|
complete: function complete(record, afterLoc) {
|
|
724
648
|
if (record.type === "throw") {
|
|
725
649
|
throw record.arg;
|
|
726
650
|
}
|
|
727
|
-
|
|
728
651
|
if (record.type === "break" || record.type === "continue") {
|
|
729
652
|
this.next = record.arg;
|
|
730
653
|
} else if (record.type === "return") {
|
|
@@ -734,13 +657,11 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
734
657
|
} else if (record.type === "normal" && afterLoc) {
|
|
735
658
|
this.next = afterLoc;
|
|
736
659
|
}
|
|
737
|
-
|
|
738
660
|
return ContinueSentinel;
|
|
739
661
|
},
|
|
740
662
|
finish: function finish(finallyLoc) {
|
|
741
663
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
742
664
|
var entry = this.tryEntries[i];
|
|
743
|
-
|
|
744
665
|
if (entry.finallyLoc === finallyLoc) {
|
|
745
666
|
this.complete(entry.completion, entry.afterLoc);
|
|
746
667
|
resetTryEntry(entry);
|
|
@@ -751,21 +672,18 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
751
672
|
"catch": function _catch(tryLoc) {
|
|
752
673
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
753
674
|
var entry = this.tryEntries[i];
|
|
754
|
-
|
|
755
675
|
if (entry.tryLoc === tryLoc) {
|
|
756
676
|
var record = entry.completion;
|
|
757
|
-
|
|
758
677
|
if (record.type === "throw") {
|
|
759
678
|
var thrown = record.arg;
|
|
760
679
|
resetTryEntry(entry);
|
|
761
680
|
}
|
|
762
|
-
|
|
763
681
|
return thrown;
|
|
764
682
|
}
|
|
765
|
-
}
|
|
766
|
-
// argument that corresponds to a known catch block.
|
|
767
|
-
|
|
683
|
+
}
|
|
768
684
|
|
|
685
|
+
// The context.catch method must only be called with a location
|
|
686
|
+
// argument that corresponds to a known catch block.
|
|
769
687
|
throw new Error("illegal catch attempt");
|
|
770
688
|
},
|
|
771
689
|
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
|
|
@@ -774,27 +692,26 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
774
692
|
resultName: resultName,
|
|
775
693
|
nextLoc: nextLoc
|
|
776
694
|
};
|
|
777
|
-
|
|
778
695
|
if (this.method === "next") {
|
|
779
696
|
// Deliberately forget the last sent value so that we don't
|
|
780
697
|
// accidentally pass it on to the delegate.
|
|
781
698
|
this.arg = undefined$1;
|
|
782
699
|
}
|
|
783
|
-
|
|
784
700
|
return ContinueSentinel;
|
|
785
701
|
}
|
|
786
|
-
};
|
|
702
|
+
};
|
|
703
|
+
|
|
704
|
+
// Regardless of whether this script is executing as a CommonJS module
|
|
787
705
|
// or not, return the runtime object so that we can declare the variable
|
|
788
706
|
// regeneratorRuntime in the outer scope, which allows this module to be
|
|
789
707
|
// injected easily by `bin/regenerator --include-runtime script.js`.
|
|
790
|
-
|
|
791
708
|
return exports;
|
|
792
|
-
}(
|
|
709
|
+
}(
|
|
710
|
+
// If this script is executing as a CommonJS module, use module.exports
|
|
793
711
|
// as the regeneratorRuntime namespace. Otherwise create a new empty
|
|
794
712
|
// object. Either way, the resulting object will be used to initialize
|
|
795
713
|
// the regeneratorRuntime variable at the top of this file.
|
|
796
714
|
module.exports );
|
|
797
|
-
|
|
798
715
|
try {
|
|
799
716
|
regeneratorRuntime = runtime;
|
|
800
717
|
} catch (accidentalStrictMode) {
|
|
@@ -821,9 +738,7 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
821
738
|
Changes: None
|
|
822
739
|
*/
|
|
823
740
|
var getSortVariables = function getSortVariables(sort, isCategory) {
|
|
824
|
-
|
|
825
741
|
var output = {};
|
|
826
|
-
|
|
827
742
|
switch (sort) {
|
|
828
743
|
case 'price-asc':
|
|
829
744
|
output = {
|
|
@@ -831,19 +746,16 @@ var getSortVariables = function getSortVariables(sort, isCategory) {
|
|
|
831
746
|
direction: 'ASC'
|
|
832
747
|
};
|
|
833
748
|
break;
|
|
834
|
-
|
|
835
749
|
case 'price-desc':
|
|
836
750
|
output = {
|
|
837
751
|
field: 'PRICE',
|
|
838
752
|
direction: 'DESC'
|
|
839
753
|
};
|
|
840
754
|
break;
|
|
841
|
-
|
|
842
755
|
case 'trending-desc':
|
|
843
756
|
//default
|
|
844
757
|
output = {};
|
|
845
758
|
break;
|
|
846
|
-
|
|
847
759
|
case 'latest-desc':
|
|
848
760
|
output = {
|
|
849
761
|
field: 'DATE',
|
|
@@ -851,13 +763,11 @@ var getSortVariables = function getSortVariables(sort, isCategory) {
|
|
|
851
763
|
};
|
|
852
764
|
break;
|
|
853
765
|
}
|
|
854
|
-
|
|
855
766
|
return output;
|
|
856
767
|
};
|
|
857
768
|
|
|
858
769
|
function getError(errors, status) {
|
|
859
770
|
var _errors;
|
|
860
|
-
|
|
861
771
|
errors = (_errors = errors) != null ? _errors : [{
|
|
862
772
|
message: 'Failed to fetch Saleor API'
|
|
863
773
|
}];
|
|
@@ -869,7 +779,6 @@ function getError(errors, status) {
|
|
|
869
779
|
function getAsyncError(_x) {
|
|
870
780
|
return _getAsyncError.apply(this, arguments);
|
|
871
781
|
}
|
|
872
|
-
|
|
873
782
|
function _getAsyncError() {
|
|
874
783
|
_getAsyncError = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(res) {
|
|
875
784
|
var data;
|
|
@@ -879,11 +788,9 @@ function _getAsyncError() {
|
|
|
879
788
|
case 0:
|
|
880
789
|
_context2.next = 2;
|
|
881
790
|
return res.json();
|
|
882
|
-
|
|
883
791
|
case 2:
|
|
884
792
|
data = _context2.sent;
|
|
885
793
|
return _context2.abrupt("return", getError(data.errors, res.status));
|
|
886
|
-
|
|
887
794
|
case 4:
|
|
888
795
|
case "end":
|
|
889
796
|
return _context2.stop();
|
|
@@ -893,11 +800,9 @@ function _getAsyncError() {
|
|
|
893
800
|
}));
|
|
894
801
|
return _getAsyncError.apply(this, arguments);
|
|
895
802
|
}
|
|
896
|
-
|
|
897
803
|
var handleFetchResponse = /*#__PURE__*/function () {
|
|
898
804
|
var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(res) {
|
|
899
805
|
var _yield$res$json, data, errors;
|
|
900
|
-
|
|
901
806
|
return runtime_1.wrap(function _callee$(_context) {
|
|
902
807
|
while (1) {
|
|
903
808
|
switch (_context.prev = _context.next) {
|
|
@@ -906,32 +811,24 @@ var handleFetchResponse = /*#__PURE__*/function () {
|
|
|
906
811
|
_context.next = 9;
|
|
907
812
|
break;
|
|
908
813
|
}
|
|
909
|
-
|
|
910
814
|
_context.next = 3;
|
|
911
815
|
return res.json();
|
|
912
|
-
|
|
913
816
|
case 3:
|
|
914
817
|
_yield$res$json = _context.sent;
|
|
915
818
|
data = _yield$res$json.data;
|
|
916
819
|
errors = _yield$res$json.errors;
|
|
917
|
-
|
|
918
820
|
if (!(errors && errors.length)) {
|
|
919
821
|
_context.next = 8;
|
|
920
822
|
break;
|
|
921
823
|
}
|
|
922
|
-
|
|
923
824
|
throw getError(errors, res.status);
|
|
924
|
-
|
|
925
825
|
case 8:
|
|
926
826
|
return _context.abrupt("return", data);
|
|
927
|
-
|
|
928
827
|
case 9:
|
|
929
828
|
_context.next = 11;
|
|
930
829
|
return getAsyncError(res);
|
|
931
|
-
|
|
932
830
|
case 11:
|
|
933
831
|
throw _context.sent;
|
|
934
|
-
|
|
935
832
|
case 12:
|
|
936
833
|
case "end":
|
|
937
834
|
return _context.stop();
|
|
@@ -939,7 +836,6 @@ var handleFetchResponse = /*#__PURE__*/function () {
|
|
|
939
836
|
}
|
|
940
837
|
}, _callee);
|
|
941
838
|
}));
|
|
942
|
-
|
|
943
839
|
return function handleFetchResponse(_x2) {
|
|
944
840
|
return _ref.apply(this, arguments);
|
|
945
841
|
};
|
|
@@ -947,17 +843,15 @@ var handleFetchResponse = /*#__PURE__*/function () {
|
|
|
947
843
|
|
|
948
844
|
var getSearchVariables = function getSearchVariables(_ref) {
|
|
949
845
|
var search = _ref.search,
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
846
|
+
categoryId = _ref.categoryId,
|
|
847
|
+
sort = _ref.sort,
|
|
848
|
+
count = _ref.count;
|
|
954
849
|
var sortBy = _extends({
|
|
955
850
|
field: 'NAME',
|
|
956
851
|
direction: 'ASC'
|
|
957
852
|
}, getSortVariables(sort), {
|
|
958
853
|
channel: 'default-channel'
|
|
959
854
|
});
|
|
960
|
-
|
|
961
855
|
return {
|
|
962
856
|
categoryId: categoryId,
|
|
963
857
|
filter: {
|
|
@@ -972,10 +866,8 @@ var getSearchVariables = function getSearchVariables(_ref) {
|
|
|
972
866
|
Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
|
|
973
867
|
Changes: None
|
|
974
868
|
*/
|
|
975
|
-
|
|
976
869
|
var getCheckoutId = function getCheckoutId(id) {
|
|
977
870
|
var _Cookies$get;
|
|
978
|
-
|
|
979
871
|
var r = ((_Cookies$get = Cookies.get(CHECKOUT_ID_COOKIE)) == null ? void 0 : _Cookies$get.split(':')) || [];
|
|
980
872
|
return {
|
|
981
873
|
checkoutId: r[0],
|
|
@@ -987,54 +879,41 @@ var getCheckoutId = function getCheckoutId(id) {
|
|
|
987
879
|
Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
|
|
988
880
|
Changes: None
|
|
989
881
|
*/
|
|
990
|
-
var ProductConnection =
|
|
991
|
-
/* GraphQL */
|
|
992
|
-
"\n fragment ProductConnection on ProductCountableConnection {\n pageInfo {\n hasNextPage\n hasPreviousPage\n }\n edges {\n node {\n id\n name\n description\n slug\n pricing {\n priceRange {\n start {\n net {\n amount\n }\n }\n }\n }\n media {\n url\n alt\n }\n variants {\n id\n name\n attributes {\n attribute {\n name\n }\n values {\n name\n }\n }\n pricing {\n price {\n net {\n amount\n currency\n }\n }\n }\n }\n }\n }\n }\n";
|
|
882
|
+
var ProductConnection = /* GraphQL */"\n fragment ProductConnection on ProductCountableConnection {\n pageInfo {\n hasNextPage\n hasPreviousPage\n }\n edges {\n node {\n id\n name\n description\n slug\n pricing {\n priceRange {\n start {\n net {\n amount\n }\n }\n }\n }\n media {\n url\n alt\n }\n variants {\n id\n name\n attributes {\n attribute {\n name\n }\n values {\n name\n }\n }\n pricing {\n price {\n net {\n amount\n currency\n }\n }\n }\n }\n }\n }\n }\n";
|
|
993
883
|
|
|
994
884
|
/*
|
|
995
885
|
Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
|
|
996
886
|
Changes: None
|
|
997
887
|
*/
|
|
998
|
-
var CheckoutDetails =
|
|
999
|
-
/* GraphQL */
|
|
1000
|
-
"\n fragment CheckoutDetails on Checkout {\n id\n token\n created\n totalPrice {\n currency\n gross {\n amount\n }\n }\n subtotalPrice {\n currency\n gross {\n amount\n }\n }\n\n lines {\n id\n variant {\n id\n name\n sku\n product {\n name\n slug\n }\n media {\n url\n }\n pricing {\n price {\n gross {\n amount\n }\n }\n }\n }\n quantity\n totalPrice {\n currency\n gross {\n amount\n }\n }\n }\n }\n";
|
|
888
|
+
var CheckoutDetails = /* GraphQL */"\n fragment CheckoutDetails on Checkout {\n id\n token\n created\n totalPrice {\n currency\n gross {\n amount\n }\n }\n subtotalPrice {\n currency\n gross {\n amount\n }\n }\n\n lines {\n id\n variant {\n id\n name\n sku\n product {\n name\n slug\n }\n media {\n url\n }\n pricing {\n price {\n gross {\n amount\n }\n }\n }\n }\n quantity\n totalPrice {\n currency\n gross {\n amount\n }\n }\n }\n }\n";
|
|
1001
889
|
|
|
1002
890
|
/*
|
|
1003
891
|
Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
|
|
1004
892
|
Changes: None
|
|
1005
893
|
*/
|
|
1006
|
-
var CheckoutCreate =
|
|
1007
|
-
/* GraphQL */
|
|
1008
|
-
"\n mutation CheckoutCreate {\n checkoutCreate(input: { email: \"customer@example.com\", lines: [], channel: \"default-channel\" }) {\n errors {\n code\n field\n message\n }\n checkout {\n ...CheckoutDetails\n }\n }\n }\n " + CheckoutDetails + "\n";
|
|
894
|
+
var CheckoutCreate = /* GraphQL */"\n mutation CheckoutCreate {\n checkoutCreate(input: { email: \"customer@example.com\", lines: [], channel: \"default-channel\" }) {\n errors {\n code\n field\n message\n }\n checkout {\n ...CheckoutDetails\n }\n }\n }\n " + CheckoutDetails + "\n";
|
|
1009
895
|
|
|
1010
896
|
/*
|
|
1011
897
|
Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
|
|
1012
898
|
Changes: None
|
|
1013
899
|
*/
|
|
1014
|
-
var CheckoutLineAdd =
|
|
1015
|
-
/* GraphQL */
|
|
1016
|
-
"\n mutation CheckoutLineAdd($checkoutId: ID!, $lineItems: [CheckoutLineInput!]!) {\n checkoutLinesAdd(checkoutId: $checkoutId, lines: $lineItems) {\n errors {\n code\n field\n message\n }\n checkout {\n ...CheckoutDetails\n }\n }\n }\n " + CheckoutDetails + "\n";
|
|
900
|
+
var CheckoutLineAdd = /* GraphQL */"\n mutation CheckoutLineAdd($checkoutId: ID!, $lineItems: [CheckoutLineInput!]!) {\n checkoutLinesAdd(checkoutId: $checkoutId, lines: $lineItems) {\n errors {\n code\n field\n message\n }\n checkout {\n ...CheckoutDetails\n }\n }\n }\n " + CheckoutDetails + "\n";
|
|
1017
901
|
|
|
1018
902
|
/*
|
|
1019
903
|
Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
|
|
1020
904
|
Changes: None
|
|
1021
905
|
*/
|
|
1022
|
-
var CheckoutLineUpdate =
|
|
1023
|
-
/* GraphQL */
|
|
1024
|
-
"\n mutation CheckoutLineUpdate($checkoutId: ID!, $lineItems: [CheckoutLineInput!]!) {\n checkoutLinesUpdate(checkoutId: $checkoutId, lines: $lineItems) {\n errors {\n code\n field\n message\n }\n checkout {\n ...CheckoutDetails\n }\n }\n }\n " + CheckoutDetails + "\n";
|
|
906
|
+
var CheckoutLineUpdate = /* GraphQL */"\n mutation CheckoutLineUpdate($checkoutId: ID!, $lineItems: [CheckoutLineInput!]!) {\n checkoutLinesUpdate(checkoutId: $checkoutId, lines: $lineItems) {\n errors {\n code\n field\n message\n }\n checkout {\n ...CheckoutDetails\n }\n }\n }\n " + CheckoutDetails + "\n";
|
|
1025
907
|
|
|
1026
908
|
/*
|
|
1027
909
|
Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
|
|
1028
910
|
Changes: None
|
|
1029
911
|
*/
|
|
1030
|
-
var CheckoutLineDelete =
|
|
1031
|
-
/* GraphQL */
|
|
1032
|
-
"\n mutation CheckoutLineDelete($checkoutId: ID!, $lineId: ID!) {\n checkoutLineDelete(checkoutId: $checkoutId, lineId: $lineId) {\n errors {\n code\n field\n message\n }\n checkout {\n ...CheckoutDetails\n }\n }\n }\n " + CheckoutDetails + "\n";
|
|
912
|
+
var CheckoutLineDelete = /* GraphQL */"\n mutation CheckoutLineDelete($checkoutId: ID!, $lineId: ID!) {\n checkoutLineDelete(checkoutId: $checkoutId, lineId: $lineId) {\n errors {\n code\n field\n message\n }\n checkout {\n ...CheckoutDetails\n }\n }\n }\n " + CheckoutDetails + "\n";
|
|
1033
913
|
|
|
1034
914
|
var checkoutCreate = /*#__PURE__*/function () {
|
|
1035
915
|
var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(fetch) {
|
|
1036
916
|
var _data$checkoutCreate;
|
|
1037
|
-
|
|
1038
917
|
var data, checkout, checkoutId, checkoutToken, value, options;
|
|
1039
918
|
return runtime_1.wrap(function _callee$(_context) {
|
|
1040
919
|
while (1) {
|
|
@@ -1044,14 +923,12 @@ var checkoutCreate = /*#__PURE__*/function () {
|
|
|
1044
923
|
return fetch({
|
|
1045
924
|
query: CheckoutCreate
|
|
1046
925
|
});
|
|
1047
|
-
|
|
1048
926
|
case 2:
|
|
1049
927
|
data = _context.sent;
|
|
1050
928
|
checkout = (_data$checkoutCreate = data.checkoutCreate) == null ? void 0 : _data$checkoutCreate.checkout;
|
|
1051
929
|
checkoutId = checkout == null ? void 0 : checkout.id;
|
|
1052
930
|
checkoutToken = checkout == null ? void 0 : checkout.token;
|
|
1053
931
|
value = checkoutId + ":" + checkoutToken;
|
|
1054
|
-
|
|
1055
932
|
if (checkoutId) {
|
|
1056
933
|
options = {
|
|
1057
934
|
expires: 60 * 60 * 24 * 30,
|
|
@@ -1060,9 +937,7 @@ var checkoutCreate = /*#__PURE__*/function () {
|
|
|
1060
937
|
};
|
|
1061
938
|
Cookies.set(CHECKOUT_ID_COOKIE, value, options);
|
|
1062
939
|
}
|
|
1063
|
-
|
|
1064
940
|
return _context.abrupt("return", checkout);
|
|
1065
|
-
|
|
1066
941
|
case 9:
|
|
1067
942
|
case "end":
|
|
1068
943
|
return _context.stop();
|
|
@@ -1070,30 +945,26 @@ var checkoutCreate = /*#__PURE__*/function () {
|
|
|
1070
945
|
}
|
|
1071
946
|
}, _callee);
|
|
1072
947
|
}));
|
|
1073
|
-
|
|
1074
948
|
return function checkoutCreate(_x) {
|
|
1075
949
|
return _ref.apply(this, arguments);
|
|
1076
950
|
};
|
|
1077
951
|
}();
|
|
1078
952
|
|
|
1079
953
|
var _excluded = ["id", "name", "media", "variants", "description", "slug", "pricing"];
|
|
1080
|
-
|
|
1081
954
|
/*
|
|
1082
955
|
Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
|
|
1083
956
|
Changes: None
|
|
1084
957
|
*/
|
|
1085
958
|
// TODO: Check nextjs-commerce bug if no images are added for a product
|
|
1086
959
|
var placeholderImg = '/product-img-placeholder.svg';
|
|
1087
|
-
|
|
1088
960
|
var money = function money(_ref) {
|
|
1089
961
|
var amount = _ref.amount,
|
|
1090
|
-
|
|
962
|
+
currency = _ref.currency;
|
|
1091
963
|
return {
|
|
1092
964
|
value: +amount,
|
|
1093
965
|
currencyCode: currency || 'USD'
|
|
1094
966
|
};
|
|
1095
967
|
};
|
|
1096
|
-
|
|
1097
968
|
var normalizeProductOptions = function normalizeProductOptions(options) {
|
|
1098
969
|
return options == null ? void 0 : options.map(function (option) {
|
|
1099
970
|
return option == null ? void 0 : option.attributes;
|
|
@@ -1112,7 +983,6 @@ var normalizeProductOptions = function normalizeProductOptions(options) {
|
|
|
1112
983
|
}) : opt;
|
|
1113
984
|
});
|
|
1114
985
|
}
|
|
1115
|
-
|
|
1116
986
|
return acc.concat({
|
|
1117
987
|
__typename: 'MultipleChoiceOption',
|
|
1118
988
|
displayName: x.attribute.name,
|
|
@@ -1125,15 +995,13 @@ var normalizeProductOptions = function normalizeProductOptions(options) {
|
|
|
1125
995
|
});
|
|
1126
996
|
}, []);
|
|
1127
997
|
};
|
|
1128
|
-
|
|
1129
998
|
var normalizeProductVariants = function normalizeProductVariants(variants) {
|
|
1130
999
|
return variants == null ? void 0 : variants.map(function (variant) {
|
|
1131
1000
|
var _pricing$price, _money;
|
|
1132
|
-
|
|
1133
1001
|
var id = variant.id,
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1002
|
+
sku = variant.sku,
|
|
1003
|
+
name = variant.name,
|
|
1004
|
+
pricing = variant.pricing;
|
|
1137
1005
|
var price = (pricing == null ? void 0 : (_pricing$price = pricing.price) == null ? void 0 : _pricing$price.net) && ((_money = money(pricing.price.net)) == null ? void 0 : _money.value);
|
|
1138
1006
|
return {
|
|
1139
1007
|
id: id,
|
|
@@ -1146,20 +1014,17 @@ var normalizeProductVariants = function normalizeProductVariants(variants) {
|
|
|
1146
1014
|
};
|
|
1147
1015
|
});
|
|
1148
1016
|
};
|
|
1149
|
-
|
|
1150
1017
|
function normalizeProduct(productNode) {
|
|
1151
1018
|
var _JSON$parse, _JSON$parse$blocks$, _pricing$priceRange, _pricing$priceRange$s;
|
|
1152
|
-
|
|
1153
1019
|
var id = productNode.id,
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1020
|
+
name = productNode.name,
|
|
1021
|
+
_productNode$media = productNode.media,
|
|
1022
|
+
media = _productNode$media === void 0 ? [] : _productNode$media,
|
|
1023
|
+
variants = productNode.variants,
|
|
1024
|
+
description = productNode.description,
|
|
1025
|
+
slug = productNode.slug,
|
|
1026
|
+
pricing = productNode.pricing,
|
|
1027
|
+
rest = _objectWithoutPropertiesLoose(productNode, _excluded);
|
|
1163
1028
|
var product = _extends({
|
|
1164
1029
|
id: id,
|
|
1165
1030
|
name: name,
|
|
@@ -1178,12 +1043,10 @@ function normalizeProduct(productNode) {
|
|
|
1178
1043
|
variants: variants && variants.length > 0 ? normalizeProductVariants(variants) : [],
|
|
1179
1044
|
options: variants && variants.length > 0 ? normalizeProductOptions(variants) : []
|
|
1180
1045
|
}, rest);
|
|
1181
|
-
|
|
1182
1046
|
return product;
|
|
1183
1047
|
}
|
|
1184
1048
|
function normalizeCart(checkout) {
|
|
1185
1049
|
var _checkout$totalPrice, _checkout$subtotalPri, _checkout$subtotalPri2, _checkout$subtotalPri3, _checkout$subtotalPri4, _checkout$totalPrice2;
|
|
1186
|
-
|
|
1187
1050
|
var lines = checkout.lines;
|
|
1188
1051
|
var lineItems = lines.length > 0 ? lines == null ? void 0 : lines.map(normalizeLineItem) : [];
|
|
1189
1052
|
return {
|
|
@@ -1202,13 +1065,11 @@ function normalizeCart(checkout) {
|
|
|
1202
1065
|
discounts: []
|
|
1203
1066
|
};
|
|
1204
1067
|
}
|
|
1205
|
-
|
|
1206
1068
|
function normalizeLineItem(_ref3) {
|
|
1207
1069
|
var _variant$sku, _variant$pricing, _variant$pricing$pric, _variant$product;
|
|
1208
|
-
|
|
1209
1070
|
var id = _ref3.id,
|
|
1210
|
-
|
|
1211
|
-
|
|
1071
|
+
variant = _ref3.variant,
|
|
1072
|
+
quantity = _ref3.quantity;
|
|
1212
1073
|
return {
|
|
1213
1074
|
id: id,
|
|
1214
1075
|
variantId: String(variant == null ? void 0 : variant.id),
|
|
@@ -1231,11 +1092,10 @@ function normalizeLineItem(_ref3) {
|
|
|
1231
1092
|
options: []
|
|
1232
1093
|
};
|
|
1233
1094
|
}
|
|
1234
|
-
|
|
1235
1095
|
var normalizeCategory = function normalizeCategory(_ref4) {
|
|
1236
1096
|
var name = _ref4.name,
|
|
1237
|
-
|
|
1238
|
-
|
|
1097
|
+
slug = _ref4.slug,
|
|
1098
|
+
id = _ref4.id;
|
|
1239
1099
|
return {
|
|
1240
1100
|
id: id,
|
|
1241
1101
|
name: name,
|
|
@@ -1253,7 +1113,7 @@ var throwUserErrors = function throwUserErrors(errors) {
|
|
|
1253
1113
|
throw new commerce.ValidationError({
|
|
1254
1114
|
errors: errors.map(function (_ref) {
|
|
1255
1115
|
var code = _ref.code,
|
|
1256
|
-
|
|
1116
|
+
message = _ref.message;
|
|
1257
1117
|
return {
|
|
1258
1118
|
code: code != null ? code : 'validation_error',
|
|
1259
1119
|
message: message || ''
|
|
@@ -1267,33 +1127,26 @@ var throwUserErrors = function throwUserErrors(errors) {
|
|
|
1267
1127
|
Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
|
|
1268
1128
|
Changes: None
|
|
1269
1129
|
*/
|
|
1270
|
-
|
|
1271
1130
|
var checkoutToCart = function checkoutToCart(checkoutPayload) {
|
|
1272
1131
|
var _checkoutPayload$erro;
|
|
1273
|
-
|
|
1274
1132
|
if (!checkoutPayload) {
|
|
1275
1133
|
throw new commerce.CommerceError({
|
|
1276
1134
|
message: 'Missing checkout payload from response'
|
|
1277
1135
|
});
|
|
1278
1136
|
}
|
|
1279
|
-
|
|
1280
1137
|
var checkout = checkoutPayload == null ? void 0 : checkoutPayload.checkout;
|
|
1281
|
-
|
|
1282
1138
|
if ((checkoutPayload == null ? void 0 : (_checkoutPayload$erro = checkoutPayload.errors) == null ? void 0 : _checkoutPayload$erro.length) === 1 && checkoutPayload.errors[0].code === "PRODUCT_UNAVAILABLE_FOR_PURCHASE") {
|
|
1283
1139
|
console.error(checkoutPayload.errors[0]);
|
|
1284
1140
|
return undefined;
|
|
1285
1141
|
}
|
|
1286
|
-
|
|
1287
1142
|
if (checkoutPayload != null && checkoutPayload.errors) {
|
|
1288
1143
|
throwUserErrors(checkoutPayload == null ? void 0 : checkoutPayload.errors);
|
|
1289
1144
|
}
|
|
1290
|
-
|
|
1291
1145
|
if (!checkout) {
|
|
1292
1146
|
throw new commerce.CommerceError({
|
|
1293
1147
|
message: 'Missing checkout object from response'
|
|
1294
1148
|
});
|
|
1295
1149
|
}
|
|
1296
|
-
|
|
1297
1150
|
return normalizeCart(checkout);
|
|
1298
1151
|
};
|
|
1299
1152
|
|
|
@@ -1309,49 +1162,37 @@ var getToken = function getToken() {
|
|
|
1309
1162
|
Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
|
|
1310
1163
|
Changes: None
|
|
1311
1164
|
*/
|
|
1312
|
-
var CollectionMany =
|
|
1313
|
-
/* GraphQL */
|
|
1314
|
-
"\n query CollectionMany( $channel: String = \"default-channel\") {\n collections(first:100, channel: $channel) {\n edges {\n node {\n id\n name\n slug\n }\n }\n }\n }\n";
|
|
1165
|
+
var CollectionMany = /* GraphQL */"\n query CollectionMany( $channel: String = \"default-channel\") {\n collections(first:100, channel: $channel) {\n edges {\n node {\n id\n name\n slug\n }\n }\n }\n }\n";
|
|
1315
1166
|
|
|
1316
1167
|
/*
|
|
1317
1168
|
Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
|
|
1318
1169
|
Changes: None
|
|
1319
1170
|
*/
|
|
1320
|
-
var ProductOneBySlug =
|
|
1321
|
-
/* GraphQL */
|
|
1322
|
-
"\n query ProductOneBySlug($slug: String!, $channel: String = \"default-channel\") {\n product(slug: $slug, channel: $channel) {\n id\n slug\n name\n description\n pricing {\n priceRange {\n start {\n net {\n amount\n }\n }\n }\n }\n variants {\n id\n name\n attributes {\n attribute {\n name\n }\n values {\n name\n }\n }\n pricing {\n price {\n net {\n amount\n currency\n }\n }\n }\n }\n media {\n url\n alt\n }\n }\n }\n";
|
|
1171
|
+
var ProductOneBySlug = /* GraphQL */"\n query ProductOneBySlug($slug: String!, $channel: String = \"default-channel\") {\n product(slug: $slug, channel: $channel) {\n id\n slug\n name\n description\n pricing {\n priceRange {\n start {\n net {\n amount\n }\n }\n }\n }\n variants {\n id\n name\n attributes {\n attribute {\n name\n }\n values {\n name\n }\n }\n pricing {\n price {\n net {\n amount\n currency\n }\n }\n }\n }\n media {\n url\n alt\n }\n }\n }\n";
|
|
1323
1172
|
|
|
1324
1173
|
/*
|
|
1325
1174
|
Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
|
|
1326
1175
|
Changes: None
|
|
1327
1176
|
*/
|
|
1328
|
-
var ProductMany =
|
|
1329
|
-
/* GraphQL */
|
|
1330
|
-
"\n query ProductMany(\n $first: Int = 100\n $filter: ProductFilterInput\n $sortBy: ProductOrder\n $channel: String = \"default-channel\"\n ) {\n products(first: $first, channel: $channel, filter: $filter, sortBy: $sortBy) {\n ...ProductConnection\n }\n }\n " + ProductConnection + "\n";
|
|
1177
|
+
var ProductMany = /* GraphQL */"\n query ProductMany(\n $first: Int = 100\n $filter: ProductFilterInput\n $sortBy: ProductOrder\n $channel: String = \"default-channel\"\n ) {\n products(first: $first, channel: $channel, filter: $filter, sortBy: $sortBy) {\n ...ProductConnection\n }\n }\n " + ProductConnection + "\n";
|
|
1331
1178
|
|
|
1332
1179
|
/*
|
|
1333
1180
|
Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
|
|
1334
1181
|
Changes: None
|
|
1335
1182
|
*/
|
|
1336
|
-
var CollectionOne =
|
|
1337
|
-
/* GraphQL */
|
|
1338
|
-
"\n query getProductsFromCollection($categoryId: ID!, $first: Int = 100, $channel: String = \"default-channel\") {\n collection(id: $categoryId, channel: $channel) {\n id\n name\n slug\n products(first: $first) {\n ...ProductConnection\n }\n }\n }\n " + ProductConnection + "\n";
|
|
1183
|
+
var CollectionOne = /* GraphQL */"\n query getProductsFromCollection($categoryId: ID!, $first: Int = 100, $channel: String = \"default-channel\") {\n collection(id: $categoryId, channel: $channel) {\n id\n name\n slug\n products(first: $first) {\n ...ProductConnection\n }\n }\n }\n " + ProductConnection + "\n";
|
|
1339
1184
|
|
|
1340
1185
|
/*
|
|
1341
1186
|
Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
|
|
1342
1187
|
Changes: None
|
|
1343
1188
|
*/
|
|
1344
|
-
var CheckoutOne =
|
|
1345
|
-
/* GraphQL */
|
|
1346
|
-
"\n query CheckoutOne($checkoutId: UUID!) {\n checkout(token: $checkoutId) {\n ... on Checkout {\n ...CheckoutDetails\n }\n }\n }\n " + CheckoutDetails + "\n";
|
|
1189
|
+
var CheckoutOne = /* GraphQL */"\n query CheckoutOne($checkoutId: UUID!) {\n checkout(token: $checkoutId) {\n ... on Checkout {\n ...CheckoutDetails\n }\n }\n }\n " + CheckoutDetails + "\n";
|
|
1347
1190
|
|
|
1348
1191
|
/*
|
|
1349
1192
|
Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
|
|
1350
1193
|
Changes: None
|
|
1351
1194
|
*/
|
|
1352
|
-
var getAllProductVendors =
|
|
1353
|
-
/* GraphQL */
|
|
1354
|
-
"\n query getAllProductVendors($cursor: String, $channel: String = \"default-channel\") {\n products(first:100,channel: $channel, after: $cursor) {\n pageInfo {\n hasNextPage\n hasPreviousPage\n }\n edges {\n node {\n slug\n }\n cursor\n }\n }\n }\n";
|
|
1195
|
+
var getAllProductVendors = /* GraphQL */"\n query getAllProductVendors($cursor: String, $channel: String = \"default-channel\") {\n products(first:100,channel: $channel, after: $cursor) {\n pageInfo {\n hasNextPage\n hasPreviousPage\n }\n edges {\n node {\n slug\n }\n cursor\n }\n }\n }\n";
|
|
1355
1196
|
|
|
1356
1197
|
var handler = {
|
|
1357
1198
|
fetchOptions: {
|
|
@@ -1360,20 +1201,16 @@ var handler = {
|
|
|
1360
1201
|
fetcher: function fetcher(_ref) {
|
|
1361
1202
|
return _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
|
|
1362
1203
|
var _checkout;
|
|
1363
|
-
|
|
1364
1204
|
var checkoutId, options, fetch, checkout, _checkoutId, data;
|
|
1365
|
-
|
|
1366
1205
|
return runtime_1.wrap(function _callee$(_context) {
|
|
1367
1206
|
while (1) {
|
|
1368
1207
|
switch (_context.prev = _context.next) {
|
|
1369
1208
|
case 0:
|
|
1370
1209
|
checkoutId = _ref.input.cartId, options = _ref.options, fetch = _ref.fetch;
|
|
1371
|
-
|
|
1372
1210
|
if (!checkoutId) {
|
|
1373
1211
|
_context.next = 7;
|
|
1374
1212
|
break;
|
|
1375
1213
|
}
|
|
1376
|
-
|
|
1377
1214
|
_checkoutId = getCheckoutId().checkoutToken;
|
|
1378
1215
|
_context.next = 5;
|
|
1379
1216
|
return fetch(_extends({}, options, {
|
|
@@ -1381,26 +1218,20 @@ var handler = {
|
|
|
1381
1218
|
checkoutId: _checkoutId
|
|
1382
1219
|
}
|
|
1383
1220
|
}));
|
|
1384
|
-
|
|
1385
1221
|
case 5:
|
|
1386
1222
|
data = _context.sent;
|
|
1387
1223
|
checkout = data;
|
|
1388
|
-
|
|
1389
1224
|
case 7:
|
|
1390
1225
|
if (!((_checkout = checkout) != null && _checkout.completedAt || !checkoutId)) {
|
|
1391
1226
|
_context.next = 11;
|
|
1392
1227
|
break;
|
|
1393
1228
|
}
|
|
1394
|
-
|
|
1395
1229
|
_context.next = 10;
|
|
1396
1230
|
return checkoutCreate(fetch);
|
|
1397
|
-
|
|
1398
1231
|
case 10:
|
|
1399
1232
|
checkout = _context.sent;
|
|
1400
|
-
|
|
1401
1233
|
case 11:
|
|
1402
1234
|
return _context.abrupt("return", checkoutToCart(checkout));
|
|
1403
|
-
|
|
1404
1235
|
case 12:
|
|
1405
1236
|
case "end":
|
|
1406
1237
|
return _context.stop();
|
|
@@ -1422,7 +1253,6 @@ var handler = {
|
|
|
1422
1253
|
isEmpty: {
|
|
1423
1254
|
get: function get() {
|
|
1424
1255
|
var _response$data$lineIt, _response$data;
|
|
1425
|
-
|
|
1426
1256
|
return ((_response$data$lineIt = (_response$data = response.data) == null ? void 0 : _response$data.lineItems.length) != null ? _response$data$lineIt : 0) <= 0;
|
|
1427
1257
|
},
|
|
1428
1258
|
enumerable: true
|
|
@@ -1440,24 +1270,19 @@ var handler$1 = {
|
|
|
1440
1270
|
fetcher: function fetcher(_ref) {
|
|
1441
1271
|
return _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
|
|
1442
1272
|
var _item$quantity;
|
|
1443
|
-
|
|
1444
1273
|
var item, options, fetch, _yield$fetch, checkoutLinesAdd;
|
|
1445
|
-
|
|
1446
1274
|
return runtime_1.wrap(function _callee$(_context) {
|
|
1447
1275
|
while (1) {
|
|
1448
1276
|
switch (_context.prev = _context.next) {
|
|
1449
1277
|
case 0:
|
|
1450
1278
|
item = _ref.input, options = _ref.options, fetch = _ref.fetch;
|
|
1451
|
-
|
|
1452
1279
|
if (!(item.quantity && (!Number.isInteger(item.quantity) || item.quantity < 1))) {
|
|
1453
1280
|
_context.next = 3;
|
|
1454
1281
|
break;
|
|
1455
1282
|
}
|
|
1456
|
-
|
|
1457
1283
|
throw new commerce.CommerceError({
|
|
1458
1284
|
message: "The item quantity has to be a valid integer greater than 0"
|
|
1459
1285
|
});
|
|
1460
|
-
|
|
1461
1286
|
case 3:
|
|
1462
1287
|
_context.next = 5;
|
|
1463
1288
|
return fetch(_extends({}, options, {
|
|
@@ -1469,12 +1294,10 @@ var handler$1 = {
|
|
|
1469
1294
|
}]
|
|
1470
1295
|
}
|
|
1471
1296
|
}));
|
|
1472
|
-
|
|
1473
1297
|
case 5:
|
|
1474
1298
|
_yield$fetch = _context.sent;
|
|
1475
1299
|
checkoutLinesAdd = _yield$fetch.checkoutLinesAdd;
|
|
1476
1300
|
return _context.abrupt("return", checkoutToCart(checkoutLinesAdd));
|
|
1477
|
-
|
|
1478
1301
|
case 8:
|
|
1479
1302
|
case "end":
|
|
1480
1303
|
return _context.stop();
|
|
@@ -1487,8 +1310,7 @@ var handler$1 = {
|
|
|
1487
1310
|
var fetch = _ref2.fetch;
|
|
1488
1311
|
return function () {
|
|
1489
1312
|
var _useCart = commerce.useCart(),
|
|
1490
|
-
|
|
1491
|
-
|
|
1313
|
+
mutate = _useCart.mutate;
|
|
1492
1314
|
return React.useCallback( /*#__PURE__*/function () {
|
|
1493
1315
|
var _addItem = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(input) {
|
|
1494
1316
|
var data;
|
|
@@ -1500,29 +1322,22 @@ var handler$1 = {
|
|
|
1500
1322
|
return fetch({
|
|
1501
1323
|
input: input
|
|
1502
1324
|
});
|
|
1503
|
-
|
|
1504
1325
|
case 2:
|
|
1505
1326
|
data = _context2.sent;
|
|
1506
|
-
|
|
1507
1327
|
if (!data) {
|
|
1508
1328
|
_context2.next = 8;
|
|
1509
1329
|
break;
|
|
1510
1330
|
}
|
|
1511
|
-
|
|
1512
1331
|
_context2.next = 6;
|
|
1513
1332
|
return mutate(data, false);
|
|
1514
|
-
|
|
1515
1333
|
case 6:
|
|
1516
1334
|
_context2.next = 10;
|
|
1517
1335
|
break;
|
|
1518
|
-
|
|
1519
1336
|
case 8:
|
|
1520
1337
|
_context2.next = 10;
|
|
1521
1338
|
return mutate();
|
|
1522
|
-
|
|
1523
1339
|
case 10:
|
|
1524
1340
|
return _context2.abrupt("return", data);
|
|
1525
|
-
|
|
1526
1341
|
case 11:
|
|
1527
1342
|
case "end":
|
|
1528
1343
|
return _context2.stop();
|
|
@@ -1530,11 +1345,9 @@ var handler$1 = {
|
|
|
1530
1345
|
}
|
|
1531
1346
|
}, _callee2);
|
|
1532
1347
|
}));
|
|
1533
|
-
|
|
1534
1348
|
function addItem(_x) {
|
|
1535
1349
|
return _addItem.apply(this, arguments);
|
|
1536
1350
|
}
|
|
1537
|
-
|
|
1538
1351
|
return addItem;
|
|
1539
1352
|
}(), [fetch, mutate]);
|
|
1540
1353
|
};
|
|
@@ -1560,11 +1373,9 @@ var handler$2 = {
|
|
|
1560
1373
|
lineId: itemId
|
|
1561
1374
|
}
|
|
1562
1375
|
}));
|
|
1563
|
-
|
|
1564
1376
|
case 3:
|
|
1565
1377
|
data = _context.sent;
|
|
1566
1378
|
return _context.abrupt("return", checkoutToCart(data.checkoutLineDelete));
|
|
1567
|
-
|
|
1568
1379
|
case 5:
|
|
1569
1380
|
case "end":
|
|
1570
1381
|
return _context.stop();
|
|
@@ -1577,8 +1388,7 @@ var handler$2 = {
|
|
|
1577
1388
|
var fetch = _ref2.fetch;
|
|
1578
1389
|
return function () {
|
|
1579
1390
|
var _useCart = commerce.useCart(),
|
|
1580
|
-
|
|
1581
|
-
|
|
1391
|
+
mutate = _useCart.mutate;
|
|
1582
1392
|
return React.useCallback( /*#__PURE__*/function () {
|
|
1583
1393
|
var _removeItem = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(input) {
|
|
1584
1394
|
var data;
|
|
@@ -1592,15 +1402,12 @@ var handler$2 = {
|
|
|
1592
1402
|
itemId: input.id
|
|
1593
1403
|
}
|
|
1594
1404
|
});
|
|
1595
|
-
|
|
1596
1405
|
case 2:
|
|
1597
1406
|
data = _context2.sent;
|
|
1598
1407
|
_context2.next = 5;
|
|
1599
1408
|
return mutate(data, false);
|
|
1600
|
-
|
|
1601
1409
|
case 5:
|
|
1602
1410
|
return _context2.abrupt("return", data);
|
|
1603
|
-
|
|
1604
1411
|
case 6:
|
|
1605
1412
|
case "end":
|
|
1606
1413
|
return _context2.stop();
|
|
@@ -1608,11 +1415,9 @@ var handler$2 = {
|
|
|
1608
1415
|
}
|
|
1609
1416
|
}, _callee2);
|
|
1610
1417
|
}));
|
|
1611
|
-
|
|
1612
1418
|
function removeItem(_x) {
|
|
1613
1419
|
return _removeItem.apply(this, arguments);
|
|
1614
1420
|
}
|
|
1615
|
-
|
|
1616
1421
|
return removeItem;
|
|
1617
1422
|
}(), [fetch, mutate]);
|
|
1618
1423
|
};
|
|
@@ -1626,23 +1431,19 @@ var handler$3 = {
|
|
|
1626
1431
|
fetcher: function fetcher(_ref) {
|
|
1627
1432
|
return _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
|
|
1628
1433
|
var _ref$input, itemId, item, options, fetch, checkoutId, _yield$fetch, checkoutLinesUpdate;
|
|
1629
|
-
|
|
1630
1434
|
return runtime_1.wrap(function _callee$(_context) {
|
|
1631
1435
|
while (1) {
|
|
1632
1436
|
switch (_context.prev = _context.next) {
|
|
1633
1437
|
case 0:
|
|
1634
1438
|
_ref$input = _ref.input, itemId = _ref$input.itemId, item = _ref$input.item, options = _ref.options, fetch = _ref.fetch;
|
|
1635
|
-
|
|
1636
1439
|
if (!Number.isInteger(item.quantity)) {
|
|
1637
1440
|
_context.next = 6;
|
|
1638
1441
|
break;
|
|
1639
1442
|
}
|
|
1640
|
-
|
|
1641
1443
|
if (!(item.quantity < 1)) {
|
|
1642
1444
|
_context.next = 4;
|
|
1643
1445
|
break;
|
|
1644
1446
|
}
|
|
1645
|
-
|
|
1646
1447
|
return _context.abrupt("return", handler$2.fetcher({
|
|
1647
1448
|
options: handler$2.fetchOptions,
|
|
1648
1449
|
input: {
|
|
@@ -1650,21 +1451,17 @@ var handler$3 = {
|
|
|
1650
1451
|
},
|
|
1651
1452
|
fetch: fetch
|
|
1652
1453
|
}));
|
|
1653
|
-
|
|
1654
1454
|
case 4:
|
|
1655
1455
|
_context.next = 8;
|
|
1656
1456
|
break;
|
|
1657
|
-
|
|
1658
1457
|
case 6:
|
|
1659
1458
|
if (!item.quantity) {
|
|
1660
1459
|
_context.next = 8;
|
|
1661
1460
|
break;
|
|
1662
1461
|
}
|
|
1663
|
-
|
|
1664
1462
|
throw new commerce.ValidationError({
|
|
1665
1463
|
message: "The item quantity has to be a valid integer"
|
|
1666
1464
|
});
|
|
1667
|
-
|
|
1668
1465
|
case 8:
|
|
1669
1466
|
checkoutId = getCheckoutId().checkoutId;
|
|
1670
1467
|
_context.next = 11;
|
|
@@ -1677,12 +1474,10 @@ var handler$3 = {
|
|
|
1677
1474
|
}]
|
|
1678
1475
|
}
|
|
1679
1476
|
}));
|
|
1680
|
-
|
|
1681
1477
|
case 11:
|
|
1682
1478
|
_yield$fetch = _context.sent;
|
|
1683
1479
|
checkoutLinesUpdate = _yield$fetch.checkoutLinesUpdate;
|
|
1684
1480
|
return _context.abrupt("return", checkoutToCart(checkoutLinesUpdate));
|
|
1685
|
-
|
|
1686
1481
|
case 14:
|
|
1687
1482
|
case "end":
|
|
1688
1483
|
return _context.stop();
|
|
@@ -1695,21 +1490,16 @@ var handler$3 = {
|
|
|
1695
1490
|
var fetch = _ref2.fetch;
|
|
1696
1491
|
return function (ctx) {
|
|
1697
1492
|
var _ctx$wait;
|
|
1698
|
-
|
|
1699
1493
|
if (ctx === void 0) {
|
|
1700
1494
|
ctx = {};
|
|
1701
1495
|
}
|
|
1702
|
-
|
|
1703
1496
|
var _ctx = ctx,
|
|
1704
|
-
|
|
1705
|
-
|
|
1497
|
+
item = _ctx.item;
|
|
1706
1498
|
var _useCart = commerce.useCart(),
|
|
1707
|
-
|
|
1708
|
-
|
|
1499
|
+
mutate = _useCart.mutate;
|
|
1709
1500
|
return React.useCallback(debounce( /*#__PURE__*/function () {
|
|
1710
1501
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(input) {
|
|
1711
1502
|
var _input$id, _input$productId, _input$productId2;
|
|
1712
|
-
|
|
1713
1503
|
var itemId, productId, variantId, data;
|
|
1714
1504
|
return runtime_1.wrap(function _callee2$(_context2) {
|
|
1715
1505
|
while (1) {
|
|
@@ -1718,16 +1508,13 @@ var handler$3 = {
|
|
|
1718
1508
|
itemId = (_input$id = input.id) != null ? _input$id : item == null ? void 0 : item.id;
|
|
1719
1509
|
productId = (_input$productId = input.productId) != null ? _input$productId : item == null ? void 0 : item.productId;
|
|
1720
1510
|
variantId = (_input$productId2 = input.productId) != null ? _input$productId2 : item == null ? void 0 : item.variantId;
|
|
1721
|
-
|
|
1722
1511
|
if (!(!itemId || !productId || !variantId)) {
|
|
1723
1512
|
_context2.next = 5;
|
|
1724
1513
|
break;
|
|
1725
1514
|
}
|
|
1726
|
-
|
|
1727
1515
|
throw new commerce.ValidationError({
|
|
1728
1516
|
message: "Invalid input used for this operation"
|
|
1729
1517
|
});
|
|
1730
|
-
|
|
1731
1518
|
case 5:
|
|
1732
1519
|
_context2.next = 7;
|
|
1733
1520
|
return fetch({
|
|
@@ -1740,15 +1527,12 @@ var handler$3 = {
|
|
|
1740
1527
|
itemId: itemId
|
|
1741
1528
|
}
|
|
1742
1529
|
});
|
|
1743
|
-
|
|
1744
1530
|
case 7:
|
|
1745
1531
|
data = _context2.sent;
|
|
1746
1532
|
_context2.next = 10;
|
|
1747
1533
|
return mutate(data, false);
|
|
1748
|
-
|
|
1749
1534
|
case 10:
|
|
1750
1535
|
return _context2.abrupt("return", data);
|
|
1751
|
-
|
|
1752
1536
|
case 11:
|
|
1753
1537
|
case "end":
|
|
1754
1538
|
return _context2.stop();
|
|
@@ -1756,7 +1540,6 @@ var handler$3 = {
|
|
|
1756
1540
|
}
|
|
1757
1541
|
}, _callee2);
|
|
1758
1542
|
}));
|
|
1759
|
-
|
|
1760
1543
|
return function (_x) {
|
|
1761
1544
|
return _ref3.apply(this, arguments);
|
|
1762
1545
|
};
|
|
@@ -1772,19 +1555,16 @@ var handler$4 = {
|
|
|
1772
1555
|
fetcher: function fetcher(_ref) {
|
|
1773
1556
|
return _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
|
|
1774
1557
|
var input, fetch, categoryId, _data$collections$edg, _data$collections, _data$collections$edg2, data, _data;
|
|
1775
|
-
|
|
1776
1558
|
return runtime_1.wrap(function _callee$(_context) {
|
|
1777
1559
|
while (1) {
|
|
1778
1560
|
switch (_context.prev = _context.next) {
|
|
1779
1561
|
case 0:
|
|
1780
1562
|
input = _ref.input, fetch = _ref.fetch;
|
|
1781
1563
|
categoryId = input.categoryId;
|
|
1782
|
-
|
|
1783
1564
|
if (categoryId) {
|
|
1784
1565
|
_context.next = 9;
|
|
1785
1566
|
break;
|
|
1786
1567
|
}
|
|
1787
|
-
|
|
1788
1568
|
_context.next = 5;
|
|
1789
1569
|
return fetch({
|
|
1790
1570
|
query: CollectionMany,
|
|
@@ -1792,14 +1572,12 @@ var handler$4 = {
|
|
|
1792
1572
|
first: 250
|
|
1793
1573
|
}
|
|
1794
1574
|
});
|
|
1795
|
-
|
|
1796
1575
|
case 5:
|
|
1797
1576
|
data = _context.sent;
|
|
1798
1577
|
return _context.abrupt("return", (_data$collections$edg = (_data$collections = data.collections) == null ? void 0 : (_data$collections$edg2 = _data$collections.edges) == null ? void 0 : _data$collections$edg2.map(function (_ref2) {
|
|
1799
1578
|
var node = _ref2.node;
|
|
1800
1579
|
return normalizeCategory(node);
|
|
1801
1580
|
})) != null ? _data$collections$edg : []);
|
|
1802
|
-
|
|
1803
1581
|
case 9:
|
|
1804
1582
|
_context.next = 11;
|
|
1805
1583
|
return fetch({
|
|
@@ -1808,11 +1586,9 @@ var handler$4 = {
|
|
|
1808
1586
|
categoryId: categoryId
|
|
1809
1587
|
}
|
|
1810
1588
|
});
|
|
1811
|
-
|
|
1812
1589
|
case 11:
|
|
1813
1590
|
_data = _context.sent;
|
|
1814
1591
|
return _context.abrupt("return", !!(_data != null && _data.collection) ? [normalizeCategory(_data == null ? void 0 : _data.collection)] : []);
|
|
1815
|
-
|
|
1816
1592
|
case 13:
|
|
1817
1593
|
case "end":
|
|
1818
1594
|
return _context.stop();
|
|
@@ -1835,7 +1611,6 @@ var handler$4 = {
|
|
|
1835
1611
|
isEmpty: {
|
|
1836
1612
|
get: function get() {
|
|
1837
1613
|
var _response$data$length, _response$data;
|
|
1838
|
-
|
|
1839
1614
|
return ((_response$data$length = (_response$data = response.data) == null ? void 0 : _response$data.length) != null ? _response$data$length : 0) <= 0;
|
|
1840
1615
|
},
|
|
1841
1616
|
enumerable: true
|
|
@@ -1857,7 +1632,6 @@ var handler$5 = {
|
|
|
1857
1632
|
switch (_context.prev = _context.next) {
|
|
1858
1633
|
case 0:
|
|
1859
1634
|
return _context.abrupt("return", []);
|
|
1860
|
-
|
|
1861
1635
|
case 2:
|
|
1862
1636
|
case "end":
|
|
1863
1637
|
return _context.stop();
|
|
@@ -1879,7 +1653,6 @@ var handler$5 = {
|
|
|
1879
1653
|
isEmpty: {
|
|
1880
1654
|
get: function get() {
|
|
1881
1655
|
var _response$data$length, _response$data;
|
|
1882
|
-
|
|
1883
1656
|
return ((_response$data$length = (_response$data = response.data) == null ? void 0 : _response$data.length) != null ? _response$data$length : 0) <= 0;
|
|
1884
1657
|
},
|
|
1885
1658
|
enumerable: true
|
|
@@ -1897,7 +1670,6 @@ var handler$6 = {
|
|
|
1897
1670
|
fetcher: function fetcher(_ref) {
|
|
1898
1671
|
return _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
|
|
1899
1672
|
var input, options, fetch, categoryId, brandId, data, edges, _data$collection$prod, _data$collection, _data$collection$prod2, _data$products$edges, _data$products;
|
|
1900
|
-
|
|
1901
1673
|
return runtime_1.wrap(function _callee$(_context) {
|
|
1902
1674
|
while (1) {
|
|
1903
1675
|
switch (_context.prev = _context.next) {
|
|
@@ -1910,12 +1682,11 @@ var handler$6 = {
|
|
|
1910
1682
|
method: options == null ? void 0 : options.method,
|
|
1911
1683
|
variables: getSearchVariables(input)
|
|
1912
1684
|
});
|
|
1913
|
-
|
|
1914
1685
|
case 4:
|
|
1915
1686
|
data = _context.sent;
|
|
1916
|
-
|
|
1917
1687
|
if (categoryId) {
|
|
1918
|
-
edges = (_data$collection$prod = (_data$collection = data.collection) == null ? void 0 : (_data$collection$prod2 = _data$collection.products) == null ? void 0 : _data$collection$prod2.edges) != null ? _data$collection$prod : [];
|
|
1688
|
+
edges = (_data$collection$prod = (_data$collection = data.collection) == null ? void 0 : (_data$collection$prod2 = _data$collection.products) == null ? void 0 : _data$collection$prod2.edges) != null ? _data$collection$prod : [];
|
|
1689
|
+
// FIXME @zaiste, no `vendor` in Saleor
|
|
1919
1690
|
// if (brandId) {
|
|
1920
1691
|
// edges = edges.filter(
|
|
1921
1692
|
// ({ node: { vendor } }: ProductCountableEdge) =>
|
|
@@ -1925,7 +1696,6 @@ var handler$6 = {
|
|
|
1925
1696
|
} else {
|
|
1926
1697
|
edges = (_data$products$edges = (_data$products = data.products) == null ? void 0 : _data$products.edges) != null ? _data$products$edges : [];
|
|
1927
1698
|
}
|
|
1928
|
-
|
|
1929
1699
|
return _context.abrupt("return", {
|
|
1930
1700
|
products: edges.map(function (_ref2) {
|
|
1931
1701
|
var node = _ref2.node;
|
|
@@ -1933,7 +1703,6 @@ var handler$6 = {
|
|
|
1933
1703
|
}),
|
|
1934
1704
|
found: !!edges.length
|
|
1935
1705
|
});
|
|
1936
|
-
|
|
1937
1706
|
case 7:
|
|
1938
1707
|
case "end":
|
|
1939
1708
|
return _context.stop();
|
|
@@ -1948,7 +1717,6 @@ var handler$6 = {
|
|
|
1948
1717
|
if (input === void 0) {
|
|
1949
1718
|
input = {};
|
|
1950
1719
|
}
|
|
1951
|
-
|
|
1952
1720
|
return useData({
|
|
1953
1721
|
input: [["search", input.search], ["categoryId", input.categoryId], ["brandId", input.brandId], ["sort", input.sort], ["count", input.count]],
|
|
1954
1722
|
swrOptions: _extends({
|
|
@@ -1959,9 +1727,7 @@ var handler$6 = {
|
|
|
1959
1727
|
}
|
|
1960
1728
|
};
|
|
1961
1729
|
|
|
1962
|
-
var ProductOneById =
|
|
1963
|
-
/* GraphQL */
|
|
1964
|
-
"\n query ProductOneById($id: ID!, $channel: String = \"default-channel\") {\n product(id: $id, channel: $channel) {\n\n slug\n name\n description\n pricing {\n priceRange {\n start {\n net {\n amount\n }\n }\n }\n }\n variants {\n id\n name\n attributes {\n attribute {\n name\n }\n values {\n name\n }\n }\n pricing {\n price {\n net {\n amount\n currency\n }\n }\n }\n }\n media {\n url\n alt\n }\n }\n }";
|
|
1730
|
+
var ProductOneById = /* GraphQL */"\n query ProductOneById($id: ID!, $channel: String = \"default-channel\") {\n product(id: $id, channel: $channel) {\n\n slug\n name\n description\n pricing {\n priceRange {\n start {\n net {\n amount\n }\n }\n }\n }\n variants {\n id\n name\n attributes {\n attribute {\n name\n }\n values {\n name\n }\n }\n pricing {\n price {\n net {\n amount\n currency\n }\n }\n }\n }\n media {\n url\n alt\n }\n }\n }";
|
|
1965
1731
|
|
|
1966
1732
|
var handler$7 = {
|
|
1967
1733
|
fetchOptions: {
|
|
@@ -1976,14 +1742,11 @@ var handler$7 = {
|
|
|
1976
1742
|
case 0:
|
|
1977
1743
|
input = _ref.input, fetch = _ref.fetch;
|
|
1978
1744
|
id = input.id;
|
|
1979
|
-
|
|
1980
1745
|
if (id) {
|
|
1981
1746
|
_context.next = 4;
|
|
1982
1747
|
break;
|
|
1983
1748
|
}
|
|
1984
|
-
|
|
1985
1749
|
return _context.abrupt("return", null);
|
|
1986
|
-
|
|
1987
1750
|
case 4:
|
|
1988
1751
|
_context.next = 6;
|
|
1989
1752
|
return fetch({
|
|
@@ -1992,15 +1755,12 @@ var handler$7 = {
|
|
|
1992
1755
|
id: id
|
|
1993
1756
|
}
|
|
1994
1757
|
});
|
|
1995
|
-
|
|
1996
1758
|
case 6:
|
|
1997
1759
|
data = _context.sent;
|
|
1998
|
-
|
|
1999
1760
|
if (data.product) {
|
|
2000
1761
|
_context.next = 12;
|
|
2001
1762
|
break;
|
|
2002
1763
|
}
|
|
2003
|
-
|
|
2004
1764
|
_context.next = 10;
|
|
2005
1765
|
return fetch({
|
|
2006
1766
|
query: ProductOneBySlug,
|
|
@@ -2008,14 +1768,11 @@ var handler$7 = {
|
|
|
2008
1768
|
slug: id
|
|
2009
1769
|
}
|
|
2010
1770
|
});
|
|
2011
|
-
|
|
2012
1771
|
case 10:
|
|
2013
1772
|
response = _context.sent;
|
|
2014
1773
|
return _context.abrupt("return", response.product ? normalizeProduct(response.product) : null);
|
|
2015
|
-
|
|
2016
1774
|
case 12:
|
|
2017
1775
|
return _context.abrupt("return", data.product ? normalizeProduct(data.product) : null);
|
|
2018
|
-
|
|
2019
1776
|
case 13:
|
|
2020
1777
|
case "end":
|
|
2021
1778
|
return _context.stop();
|
|
@@ -2030,7 +1787,6 @@ var handler$7 = {
|
|
|
2030
1787
|
if (input === void 0) {
|
|
2031
1788
|
input = {};
|
|
2032
1789
|
}
|
|
2033
|
-
|
|
2034
1790
|
return useData({
|
|
2035
1791
|
input: [["id", input.id]],
|
|
2036
1792
|
swrOptions: _extends({
|
|
@@ -2046,7 +1802,6 @@ var getFetcher = function getFetcher(saleorApiUrl) {
|
|
|
2046
1802
|
return /*#__PURE__*/function () {
|
|
2047
1803
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(_ref) {
|
|
2048
1804
|
var _ref$url, url, _ref$method, method, query, variables, _ref3, vars, token;
|
|
2049
|
-
|
|
2050
1805
|
return runtime_1.wrap(function _callee$(_context) {
|
|
2051
1806
|
while (1) {
|
|
2052
1807
|
switch (_context.prev = _context.next) {
|
|
@@ -2067,11 +1822,9 @@ var getFetcher = function getFetcher(saleorApiUrl) {
|
|
|
2067
1822
|
'Content-Type': 'application/json'
|
|
2068
1823
|
}
|
|
2069
1824
|
});
|
|
2070
|
-
|
|
2071
1825
|
case 6:
|
|
2072
1826
|
_context.t1 = _context.sent;
|
|
2073
1827
|
return _context.abrupt("return", (0, _context.t0)(_context.t1));
|
|
2074
|
-
|
|
2075
1828
|
case 8:
|
|
2076
1829
|
case "end":
|
|
2077
1830
|
return _context.stop();
|
|
@@ -2079,7 +1832,6 @@ var getFetcher = function getFetcher(saleorApiUrl) {
|
|
|
2079
1832
|
}
|
|
2080
1833
|
}, _callee);
|
|
2081
1834
|
}));
|
|
2082
|
-
|
|
2083
1835
|
return function (_x) {
|
|
2084
1836
|
return _ref2.apply(this, arguments);
|
|
2085
1837
|
};
|
|
@@ -2140,7 +1892,7 @@ var commerceProviderMeta = {
|
|
|
2140
1892
|
};
|
|
2141
1893
|
function CommerceProviderComponent(props) {
|
|
2142
1894
|
var saleorApiUrl = props.saleorApiUrl,
|
|
2143
|
-
|
|
1895
|
+
children = props.children;
|
|
2144
1896
|
var CommerceProvider = React__default.useMemo(function () {
|
|
2145
1897
|
return getCommerceProvider(saleorApiUrl);
|
|
2146
1898
|
}, [saleorApiUrl]);
|
|
@@ -2150,7 +1902,6 @@ function registerCommerceProvider(loader, customCommerceProviderMeta) {
|
|
|
2150
1902
|
var doRegisterComponent = function doRegisterComponent() {
|
|
2151
1903
|
return loader ? loader.registerGlobalContext.apply(loader, arguments) : registerGlobalContext.apply(void 0, arguments);
|
|
2152
1904
|
};
|
|
2153
|
-
|
|
2154
1905
|
doRegisterComponent(CommerceProviderComponent, customCommerceProviderMeta != null ? customCommerceProviderMeta : commerceProviderMeta);
|
|
2155
1906
|
}
|
|
2156
1907
|
|