@plasmicpkgs/commerce-shopify 0.0.91 → 0.0.93
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-shopify.cjs.development.js +142 -409
- package/dist/commerce-shopify.cjs.development.js.map +1 -1
- package/dist/commerce-shopify.cjs.production.min.js +1 -1
- package/dist/commerce-shopify.cjs.production.min.js.map +1 -1
- package/dist/commerce-shopify.esm.js +142 -409
- package/dist/commerce-shopify.esm.js.map +1 -1
- package/package.json +4 -4
|
@@ -27,64 +27,52 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
|
27
27
|
reject(error);
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
|
-
|
|
31
30
|
if (info.done) {
|
|
32
31
|
resolve(value);
|
|
33
32
|
} else {
|
|
34
33
|
Promise.resolve(value).then(_next, _throw);
|
|
35
34
|
}
|
|
36
35
|
}
|
|
37
|
-
|
|
38
36
|
function _asyncToGenerator(fn) {
|
|
39
37
|
return function () {
|
|
40
38
|
var self = this,
|
|
41
|
-
|
|
39
|
+
args = arguments;
|
|
42
40
|
return new Promise(function (resolve, reject) {
|
|
43
41
|
var gen = fn.apply(self, args);
|
|
44
|
-
|
|
45
42
|
function _next(value) {
|
|
46
43
|
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
47
44
|
}
|
|
48
|
-
|
|
49
45
|
function _throw(err) {
|
|
50
46
|
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
51
47
|
}
|
|
52
|
-
|
|
53
48
|
_next(undefined);
|
|
54
49
|
});
|
|
55
50
|
};
|
|
56
51
|
}
|
|
57
|
-
|
|
58
52
|
function _extends() {
|
|
59
|
-
_extends = Object.assign
|
|
53
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
60
54
|
for (var i = 1; i < arguments.length; i++) {
|
|
61
55
|
var source = arguments[i];
|
|
62
|
-
|
|
63
56
|
for (var key in source) {
|
|
64
57
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
65
58
|
target[key] = source[key];
|
|
66
59
|
}
|
|
67
60
|
}
|
|
68
61
|
}
|
|
69
|
-
|
|
70
62
|
return target;
|
|
71
63
|
};
|
|
72
|
-
|
|
73
64
|
return _extends.apply(this, arguments);
|
|
74
65
|
}
|
|
75
|
-
|
|
76
66
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
77
67
|
if (source == null) return {};
|
|
78
68
|
var target = {};
|
|
79
69
|
var sourceKeys = Object.keys(source);
|
|
80
70
|
var key, i;
|
|
81
|
-
|
|
82
71
|
for (i = 0; i < sourceKeys.length; i++) {
|
|
83
72
|
key = sourceKeys[i];
|
|
84
73
|
if (excluded.indexOf(key) >= 0) continue;
|
|
85
74
|
target[key] = source[key];
|
|
86
75
|
}
|
|
87
|
-
|
|
88
76
|
return target;
|
|
89
77
|
}
|
|
90
78
|
|
|
@@ -99,17 +87,16 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
99
87
|
* This source code is licensed under the MIT license found in the
|
|
100
88
|
* LICENSE file in the root directory of this source tree.
|
|
101
89
|
*/
|
|
90
|
+
|
|
102
91
|
var runtime = function (exports) {
|
|
103
92
|
|
|
104
93
|
var Op = Object.prototype;
|
|
105
94
|
var hasOwn = Op.hasOwnProperty;
|
|
106
95
|
var undefined$1; // More compressible than void 0.
|
|
107
|
-
|
|
108
96
|
var $Symbol = typeof Symbol === "function" ? Symbol : {};
|
|
109
97
|
var iteratorSymbol = $Symbol.iterator || "@@iterator";
|
|
110
98
|
var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
|
|
111
99
|
var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
112
|
-
|
|
113
100
|
function define(obj, key, value) {
|
|
114
101
|
Object.defineProperty(obj, key, {
|
|
115
102
|
value: value,
|
|
@@ -119,7 +106,6 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
119
106
|
});
|
|
120
107
|
return obj[key];
|
|
121
108
|
}
|
|
122
|
-
|
|
123
109
|
try {
|
|
124
110
|
// IE 8 has a broken Object.defineProperty that only works on DOM objects.
|
|
125
111
|
define({}, "");
|
|
@@ -128,19 +114,20 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
128
114
|
return obj[key] = value;
|
|
129
115
|
};
|
|
130
116
|
}
|
|
131
|
-
|
|
132
117
|
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
133
118
|
// If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
|
|
134
119
|
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
|
|
135
120
|
var generator = Object.create(protoGenerator.prototype);
|
|
136
|
-
var context = new Context(tryLocsList || []);
|
|
137
|
-
// .throw, and .return methods.
|
|
121
|
+
var context = new Context(tryLocsList || []);
|
|
138
122
|
|
|
123
|
+
// The ._invoke method unifies the implementations of the .next,
|
|
124
|
+
// .throw, and .return methods.
|
|
139
125
|
generator._invoke = makeInvokeMethod(innerFn, self, context);
|
|
140
126
|
return generator;
|
|
141
127
|
}
|
|
128
|
+
exports.wrap = wrap;
|
|
142
129
|
|
|
143
|
-
|
|
130
|
+
// Try/catch helper to minimize deoptimizations. Returns a completion
|
|
144
131
|
// record like context.tryEntries[i].completion. This interface could
|
|
145
132
|
// have been (and was previously) designed to take a closure to be
|
|
146
133
|
// invoked without arguments, but in all the cases we care about we
|
|
@@ -150,7 +137,6 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
150
137
|
// in every case, so we don't have to touch the arguments object. The
|
|
151
138
|
// only additional allocation required is the completion record, which
|
|
152
139
|
// has a stable shape and so hopefully should be cheap to allocate.
|
|
153
|
-
|
|
154
140
|
function tryCatch(fn, obj, arg) {
|
|
155
141
|
try {
|
|
156
142
|
return {
|
|
@@ -164,46 +150,44 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
164
150
|
};
|
|
165
151
|
}
|
|
166
152
|
}
|
|
167
|
-
|
|
168
153
|
var GenStateSuspendedStart = "suspendedStart";
|
|
169
154
|
var GenStateSuspendedYield = "suspendedYield";
|
|
170
155
|
var GenStateExecuting = "executing";
|
|
171
|
-
var GenStateCompleted = "completed";
|
|
156
|
+
var GenStateCompleted = "completed";
|
|
157
|
+
|
|
158
|
+
// Returning this object from the innerFn has the same effect as
|
|
172
159
|
// breaking out of the dispatch switch statement.
|
|
160
|
+
var ContinueSentinel = {};
|
|
173
161
|
|
|
174
|
-
|
|
162
|
+
// Dummy constructor functions that we use as the .constructor and
|
|
175
163
|
// .constructor.prototype properties for functions that return Generator
|
|
176
164
|
// objects. For full spec compliance, you may wish to configure your
|
|
177
165
|
// minifier not to mangle the names of these two functions.
|
|
178
|
-
|
|
179
166
|
function Generator() {}
|
|
180
|
-
|
|
181
167
|
function GeneratorFunction() {}
|
|
168
|
+
function GeneratorFunctionPrototype() {}
|
|
182
169
|
|
|
183
|
-
|
|
170
|
+
// This is a polyfill for %IteratorPrototype% for environments that
|
|
184
171
|
// don't natively support it.
|
|
185
|
-
|
|
186
|
-
|
|
187
172
|
var IteratorPrototype = {};
|
|
188
173
|
define(IteratorPrototype, iteratorSymbol, function () {
|
|
189
174
|
return this;
|
|
190
175
|
});
|
|
191
176
|
var getProto = Object.getPrototypeOf;
|
|
192
177
|
var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
193
|
-
|
|
194
178
|
if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
|
|
195
179
|
// This environment has a native %IteratorPrototype%; use it instead
|
|
196
180
|
// of the polyfill.
|
|
197
181
|
IteratorPrototype = NativeIteratorPrototype;
|
|
198
182
|
}
|
|
199
|
-
|
|
200
183
|
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
201
184
|
GeneratorFunction.prototype = GeneratorFunctionPrototype;
|
|
202
185
|
define(Gp, "constructor", GeneratorFunctionPrototype);
|
|
203
186
|
define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
|
|
204
|
-
GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction");
|
|
205
|
-
// Iterator interface in terms of a single ._invoke method.
|
|
187
|
+
GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction");
|
|
206
188
|
|
|
189
|
+
// Helper for defining the .next, .throw, and .return methods of the
|
|
190
|
+
// Iterator interface in terms of a single ._invoke method.
|
|
207
191
|
function defineIteratorMethods(prototype) {
|
|
208
192
|
["next", "throw", "return"].forEach(function (method) {
|
|
209
193
|
define(prototype, method, function (arg) {
|
|
@@ -211,14 +195,13 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
211
195
|
});
|
|
212
196
|
});
|
|
213
197
|
}
|
|
214
|
-
|
|
215
198
|
exports.isGeneratorFunction = function (genFun) {
|
|
216
199
|
var ctor = typeof genFun === "function" && genFun.constructor;
|
|
217
|
-
return ctor ? ctor === GeneratorFunction ||
|
|
200
|
+
return ctor ? ctor === GeneratorFunction ||
|
|
201
|
+
// For the native GeneratorFunction constructor, the best we can
|
|
218
202
|
// do is to check its .name property.
|
|
219
203
|
(ctor.displayName || ctor.name) === "GeneratorFunction" : false;
|
|
220
204
|
};
|
|
221
|
-
|
|
222
205
|
exports.mark = function (genFun) {
|
|
223
206
|
if (Object.setPrototypeOf) {
|
|
224
207
|
Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
|
|
@@ -226,31 +209,27 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
226
209
|
genFun.__proto__ = GeneratorFunctionPrototype;
|
|
227
210
|
define(genFun, toStringTagSymbol, "GeneratorFunction");
|
|
228
211
|
}
|
|
229
|
-
|
|
230
212
|
genFun.prototype = Object.create(Gp);
|
|
231
213
|
return genFun;
|
|
232
|
-
};
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
// Within the body of any async function, `await x` is transformed to
|
|
233
217
|
// `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
|
|
234
218
|
// `hasOwn.call(value, "__await")` to determine if the yielded value is
|
|
235
219
|
// meant to be awaited.
|
|
236
|
-
|
|
237
|
-
|
|
238
220
|
exports.awrap = function (arg) {
|
|
239
221
|
return {
|
|
240
222
|
__await: arg
|
|
241
223
|
};
|
|
242
224
|
};
|
|
243
|
-
|
|
244
225
|
function AsyncIterator(generator, PromiseImpl) {
|
|
245
226
|
function invoke(method, arg, resolve, reject) {
|
|
246
227
|
var record = tryCatch(generator[method], generator, arg);
|
|
247
|
-
|
|
248
228
|
if (record.type === "throw") {
|
|
249
229
|
reject(record.arg);
|
|
250
230
|
} else {
|
|
251
231
|
var result = record.arg;
|
|
252
232
|
var value = result.value;
|
|
253
|
-
|
|
254
233
|
if (value && typeof value === "object" && hasOwn.call(value, "__await")) {
|
|
255
234
|
return PromiseImpl.resolve(value.__await).then(function (value) {
|
|
256
235
|
invoke("next", value, resolve, reject);
|
|
@@ -258,7 +237,6 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
258
237
|
invoke("throw", err, resolve, reject);
|
|
259
238
|
});
|
|
260
239
|
}
|
|
261
|
-
|
|
262
240
|
return PromiseImpl.resolve(value).then(function (unwrapped) {
|
|
263
241
|
// When a yielded Promise is resolved, its final value becomes
|
|
264
242
|
// the .value of the Promise<{value,done}> result for the
|
|
@@ -272,17 +250,15 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
272
250
|
});
|
|
273
251
|
}
|
|
274
252
|
}
|
|
275
|
-
|
|
276
253
|
var previousPromise;
|
|
277
|
-
|
|
278
254
|
function enqueue(method, arg) {
|
|
279
255
|
function callInvokeWithMethodAndArg() {
|
|
280
256
|
return new PromiseImpl(function (resolve, reject) {
|
|
281
257
|
invoke(method, arg, resolve, reject);
|
|
282
258
|
});
|
|
283
259
|
}
|
|
284
|
-
|
|
285
|
-
|
|
260
|
+
return previousPromise =
|
|
261
|
+
// If enqueue has been called before, then we want to wait until
|
|
286
262
|
// all previous Promises have been resolved before calling invoke,
|
|
287
263
|
// so that results are always delivered in the correct order. If
|
|
288
264
|
// enqueue has not been called before, then it is important to
|
|
@@ -294,24 +270,25 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
294
270
|
// execute code before the first await. Since we implement simple
|
|
295
271
|
// async functions in terms of async generators, it is especially
|
|
296
272
|
// important to get this right, even though it requires care.
|
|
297
|
-
previousPromise ? previousPromise.then(callInvokeWithMethodAndArg,
|
|
273
|
+
previousPromise ? previousPromise.then(callInvokeWithMethodAndArg,
|
|
274
|
+
// Avoid propagating failures to Promises returned by later
|
|
298
275
|
// invocations of the iterator.
|
|
299
276
|
callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
300
|
-
}
|
|
301
|
-
// .throw, and .return (see defineIteratorMethods).
|
|
302
|
-
|
|
277
|
+
}
|
|
303
278
|
|
|
279
|
+
// Define the unified helper method that is used to implement .next,
|
|
280
|
+
// .throw, and .return (see defineIteratorMethods).
|
|
304
281
|
this._invoke = enqueue;
|
|
305
282
|
}
|
|
306
|
-
|
|
307
283
|
defineIteratorMethods(AsyncIterator.prototype);
|
|
308
284
|
define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
309
285
|
return this;
|
|
310
286
|
});
|
|
311
|
-
exports.AsyncIterator = AsyncIterator;
|
|
287
|
+
exports.AsyncIterator = AsyncIterator;
|
|
288
|
+
|
|
289
|
+
// Note that simple async functions are implemented on top of
|
|
312
290
|
// AsyncIterator objects; they just return a Promise for the value of
|
|
313
291
|
// the final result produced by the iterator.
|
|
314
|
-
|
|
315
292
|
exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
316
293
|
if (PromiseImpl === void 0) PromiseImpl = Promise;
|
|
317
294
|
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
|
@@ -320,39 +297,32 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
320
297
|
return result.done ? result.value : iter.next();
|
|
321
298
|
});
|
|
322
299
|
};
|
|
323
|
-
|
|
324
300
|
function makeInvokeMethod(innerFn, self, context) {
|
|
325
301
|
var state = GenStateSuspendedStart;
|
|
326
302
|
return function invoke(method, arg) {
|
|
327
303
|
if (state === GenStateExecuting) {
|
|
328
304
|
throw new Error("Generator is already running");
|
|
329
305
|
}
|
|
330
|
-
|
|
331
306
|
if (state === GenStateCompleted) {
|
|
332
307
|
if (method === "throw") {
|
|
333
308
|
throw arg;
|
|
334
|
-
}
|
|
335
|
-
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
|
|
336
|
-
|
|
309
|
+
}
|
|
337
310
|
|
|
311
|
+
// Be forgiving, per 25.3.3.3.3 of the spec:
|
|
312
|
+
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
|
|
338
313
|
return doneResult();
|
|
339
314
|
}
|
|
340
|
-
|
|
341
315
|
context.method = method;
|
|
342
316
|
context.arg = arg;
|
|
343
|
-
|
|
344
317
|
while (true) {
|
|
345
318
|
var delegate = context.delegate;
|
|
346
|
-
|
|
347
319
|
if (delegate) {
|
|
348
320
|
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
349
|
-
|
|
350
321
|
if (delegateResult) {
|
|
351
322
|
if (delegateResult === ContinueSentinel) continue;
|
|
352
323
|
return delegateResult;
|
|
353
324
|
}
|
|
354
325
|
}
|
|
355
|
-
|
|
356
326
|
if (context.method === "next") {
|
|
357
327
|
// Setting context._sent for legacy support of Babel's
|
|
358
328
|
// function.sent implementation.
|
|
@@ -362,51 +332,44 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
362
332
|
state = GenStateCompleted;
|
|
363
333
|
throw context.arg;
|
|
364
334
|
}
|
|
365
|
-
|
|
366
335
|
context.dispatchException(context.arg);
|
|
367
336
|
} else if (context.method === "return") {
|
|
368
337
|
context.abrupt("return", context.arg);
|
|
369
338
|
}
|
|
370
|
-
|
|
371
339
|
state = GenStateExecuting;
|
|
372
340
|
var record = tryCatch(innerFn, self, context);
|
|
373
|
-
|
|
374
341
|
if (record.type === "normal") {
|
|
375
342
|
// If an exception is thrown from innerFn, we leave state ===
|
|
376
343
|
// GenStateExecuting and loop back for another invocation.
|
|
377
344
|
state = context.done ? GenStateCompleted : GenStateSuspendedYield;
|
|
378
|
-
|
|
379
345
|
if (record.arg === ContinueSentinel) {
|
|
380
346
|
continue;
|
|
381
347
|
}
|
|
382
|
-
|
|
383
348
|
return {
|
|
384
349
|
value: record.arg,
|
|
385
350
|
done: context.done
|
|
386
351
|
};
|
|
387
352
|
} else if (record.type === "throw") {
|
|
388
|
-
state = GenStateCompleted;
|
|
353
|
+
state = GenStateCompleted;
|
|
354
|
+
// Dispatch the exception by looping back around to the
|
|
389
355
|
// context.dispatchException(context.arg) call above.
|
|
390
|
-
|
|
391
356
|
context.method = "throw";
|
|
392
357
|
context.arg = record.arg;
|
|
393
358
|
}
|
|
394
359
|
}
|
|
395
360
|
};
|
|
396
|
-
}
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
// Call delegate.iterator[context.method](context.arg) and handle the
|
|
397
364
|
// result, either by returning a { value, done } result from the
|
|
398
365
|
// delegate iterator, or by modifying context.method and context.arg,
|
|
399
366
|
// setting context.delegate to null, and returning the ContinueSentinel.
|
|
400
|
-
|
|
401
|
-
|
|
402
367
|
function maybeInvokeDelegate(delegate, context) {
|
|
403
368
|
var method = delegate.iterator[context.method];
|
|
404
|
-
|
|
405
369
|
if (method === undefined$1) {
|
|
406
370
|
// A .throw or .return when the delegate iterator has no .throw
|
|
407
371
|
// method always terminates the yield* loop.
|
|
408
372
|
context.delegate = null;
|
|
409
|
-
|
|
410
373
|
if (context.method === "throw") {
|
|
411
374
|
// Note: ["return"] must be used for ES3 parsing compatibility.
|
|
412
375
|
if (delegate.iterator["return"]) {
|
|
@@ -415,51 +378,45 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
415
378
|
context.method = "return";
|
|
416
379
|
context.arg = undefined$1;
|
|
417
380
|
maybeInvokeDelegate(delegate, context);
|
|
418
|
-
|
|
419
381
|
if (context.method === "throw") {
|
|
420
382
|
// If maybeInvokeDelegate(context) changed context.method from
|
|
421
383
|
// "return" to "throw", let that override the TypeError below.
|
|
422
384
|
return ContinueSentinel;
|
|
423
385
|
}
|
|
424
386
|
}
|
|
425
|
-
|
|
426
387
|
context.method = "throw";
|
|
427
388
|
context.arg = new TypeError("The iterator does not provide a 'throw' method");
|
|
428
389
|
}
|
|
429
|
-
|
|
430
390
|
return ContinueSentinel;
|
|
431
391
|
}
|
|
432
|
-
|
|
433
392
|
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
434
|
-
|
|
435
393
|
if (record.type === "throw") {
|
|
436
394
|
context.method = "throw";
|
|
437
395
|
context.arg = record.arg;
|
|
438
396
|
context.delegate = null;
|
|
439
397
|
return ContinueSentinel;
|
|
440
398
|
}
|
|
441
|
-
|
|
442
399
|
var info = record.arg;
|
|
443
|
-
|
|
444
400
|
if (!info) {
|
|
445
401
|
context.method = "throw";
|
|
446
402
|
context.arg = new TypeError("iterator result is not an object");
|
|
447
403
|
context.delegate = null;
|
|
448
404
|
return ContinueSentinel;
|
|
449
405
|
}
|
|
450
|
-
|
|
451
406
|
if (info.done) {
|
|
452
407
|
// Assign the result of the finished delegate to the temporary
|
|
453
408
|
// variable specified by delegate.resultName (see delegateYield).
|
|
454
|
-
context[delegate.resultName] = info.value;
|
|
409
|
+
context[delegate.resultName] = info.value;
|
|
410
|
+
|
|
411
|
+
// Resume execution at the desired location (see delegateYield).
|
|
412
|
+
context.next = delegate.nextLoc;
|
|
455
413
|
|
|
456
|
-
|
|
414
|
+
// If context.method was "throw" but the delegate handled the
|
|
457
415
|
// exception, let the outer generator proceed normally. If
|
|
458
416
|
// context.method was "next", forget context.arg since it has been
|
|
459
417
|
// "consumed" by the delegate iterator. If context.method was
|
|
460
418
|
// "return", allow the original .return call to continue in the
|
|
461
419
|
// outer generator.
|
|
462
|
-
|
|
463
420
|
if (context.method !== "return") {
|
|
464
421
|
context.method = "next";
|
|
465
422
|
context.arg = undefined$1;
|
|
@@ -467,54 +424,49 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
467
424
|
} else {
|
|
468
425
|
// Re-yield the result returned by the delegate method.
|
|
469
426
|
return info;
|
|
470
|
-
}
|
|
471
|
-
// the outer generator.
|
|
472
|
-
|
|
427
|
+
}
|
|
473
428
|
|
|
429
|
+
// The delegate iterator is finished, so forget it and continue with
|
|
430
|
+
// the outer generator.
|
|
474
431
|
context.delegate = null;
|
|
475
432
|
return ContinueSentinel;
|
|
476
|
-
}
|
|
477
|
-
// unified ._invoke helper method.
|
|
478
|
-
|
|
433
|
+
}
|
|
479
434
|
|
|
435
|
+
// Define Generator.prototype.{next,throw,return} in terms of the
|
|
436
|
+
// unified ._invoke helper method.
|
|
480
437
|
defineIteratorMethods(Gp);
|
|
481
|
-
define(Gp, toStringTagSymbol, "Generator");
|
|
438
|
+
define(Gp, toStringTagSymbol, "Generator");
|
|
439
|
+
|
|
440
|
+
// A Generator should always return itself as the iterator object when the
|
|
482
441
|
// @@iterator function is called on it. Some browsers' implementations of the
|
|
483
442
|
// iterator prototype chain incorrectly implement this, causing the Generator
|
|
484
443
|
// object to not be returned from this call. This ensures that doesn't happen.
|
|
485
444
|
// See https://github.com/facebook/regenerator/issues/274 for more details.
|
|
486
|
-
|
|
487
445
|
define(Gp, iteratorSymbol, function () {
|
|
488
446
|
return this;
|
|
489
447
|
});
|
|
490
448
|
define(Gp, "toString", function () {
|
|
491
449
|
return "[object Generator]";
|
|
492
450
|
});
|
|
493
|
-
|
|
494
451
|
function pushTryEntry(locs) {
|
|
495
452
|
var entry = {
|
|
496
453
|
tryLoc: locs[0]
|
|
497
454
|
};
|
|
498
|
-
|
|
499
455
|
if (1 in locs) {
|
|
500
456
|
entry.catchLoc = locs[1];
|
|
501
457
|
}
|
|
502
|
-
|
|
503
458
|
if (2 in locs) {
|
|
504
459
|
entry.finallyLoc = locs[2];
|
|
505
460
|
entry.afterLoc = locs[3];
|
|
506
461
|
}
|
|
507
|
-
|
|
508
462
|
this.tryEntries.push(entry);
|
|
509
463
|
}
|
|
510
|
-
|
|
511
464
|
function resetTryEntry(entry) {
|
|
512
465
|
var record = entry.completion || {};
|
|
513
466
|
record.type = "normal";
|
|
514
467
|
delete record.arg;
|
|
515
468
|
entry.completion = record;
|
|
516
469
|
}
|
|
517
|
-
|
|
518
470
|
function Context(tryLocsList) {
|
|
519
471
|
// The root entry object (effectively a try statement without a catch
|
|
520
472
|
// or a finally block) gives us a place to store values thrown from
|
|
@@ -525,97 +477,84 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
525
477
|
tryLocsList.forEach(pushTryEntry, this);
|
|
526
478
|
this.reset(true);
|
|
527
479
|
}
|
|
528
|
-
|
|
529
480
|
exports.keys = function (object) {
|
|
530
481
|
var keys = [];
|
|
531
|
-
|
|
532
482
|
for (var key in object) {
|
|
533
483
|
keys.push(key);
|
|
534
484
|
}
|
|
485
|
+
keys.reverse();
|
|
535
486
|
|
|
536
|
-
|
|
487
|
+
// Rather than returning an object with a next method, we keep
|
|
537
488
|
// things simple and return the next function itself.
|
|
538
|
-
|
|
539
489
|
return function next() {
|
|
540
490
|
while (keys.length) {
|
|
541
491
|
var key = keys.pop();
|
|
542
|
-
|
|
543
492
|
if (key in object) {
|
|
544
493
|
next.value = key;
|
|
545
494
|
next.done = false;
|
|
546
495
|
return next;
|
|
547
496
|
}
|
|
548
|
-
}
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
// To avoid creating an additional object, we just hang the .value
|
|
549
500
|
// and .done properties off the next function object itself. This
|
|
550
501
|
// also ensures that the minifier will not anonymize the function.
|
|
551
|
-
|
|
552
|
-
|
|
553
502
|
next.done = true;
|
|
554
503
|
return next;
|
|
555
504
|
};
|
|
556
505
|
};
|
|
557
|
-
|
|
558
506
|
function values(iterable) {
|
|
559
507
|
if (iterable) {
|
|
560
508
|
var iteratorMethod = iterable[iteratorSymbol];
|
|
561
|
-
|
|
562
509
|
if (iteratorMethod) {
|
|
563
510
|
return iteratorMethod.call(iterable);
|
|
564
511
|
}
|
|
565
|
-
|
|
566
512
|
if (typeof iterable.next === "function") {
|
|
567
513
|
return iterable;
|
|
568
514
|
}
|
|
569
|
-
|
|
570
515
|
if (!isNaN(iterable.length)) {
|
|
571
516
|
var i = -1,
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
517
|
+
next = function next() {
|
|
518
|
+
while (++i < iterable.length) {
|
|
519
|
+
if (hasOwn.call(iterable, i)) {
|
|
520
|
+
next.value = iterable[i];
|
|
521
|
+
next.done = false;
|
|
522
|
+
return next;
|
|
523
|
+
}
|
|
578
524
|
}
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
return next;
|
|
584
|
-
};
|
|
585
|
-
|
|
525
|
+
next.value = undefined$1;
|
|
526
|
+
next.done = true;
|
|
527
|
+
return next;
|
|
528
|
+
};
|
|
586
529
|
return next.next = next;
|
|
587
530
|
}
|
|
588
|
-
}
|
|
589
|
-
|
|
531
|
+
}
|
|
590
532
|
|
|
533
|
+
// Return an iterator with no values.
|
|
591
534
|
return {
|
|
592
535
|
next: doneResult
|
|
593
536
|
};
|
|
594
537
|
}
|
|
595
|
-
|
|
596
538
|
exports.values = values;
|
|
597
|
-
|
|
598
539
|
function doneResult() {
|
|
599
540
|
return {
|
|
600
541
|
value: undefined$1,
|
|
601
542
|
done: true
|
|
602
543
|
};
|
|
603
544
|
}
|
|
604
|
-
|
|
605
545
|
Context.prototype = {
|
|
606
546
|
constructor: Context,
|
|
607
547
|
reset: function reset(skipTempReset) {
|
|
608
548
|
this.prev = 0;
|
|
609
|
-
this.next = 0;
|
|
549
|
+
this.next = 0;
|
|
550
|
+
// Resetting context._sent for legacy support of Babel's
|
|
610
551
|
// function.sent implementation.
|
|
611
|
-
|
|
612
552
|
this.sent = this._sent = undefined$1;
|
|
613
553
|
this.done = false;
|
|
614
554
|
this.delegate = null;
|
|
615
555
|
this.method = "next";
|
|
616
556
|
this.arg = undefined$1;
|
|
617
557
|
this.tryEntries.forEach(resetTryEntry);
|
|
618
|
-
|
|
619
558
|
if (!skipTempReset) {
|
|
620
559
|
for (var name in this) {
|
|
621
560
|
// Not sure about the optimal order of these conditions:
|
|
@@ -629,50 +568,40 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
629
568
|
this.done = true;
|
|
630
569
|
var rootEntry = this.tryEntries[0];
|
|
631
570
|
var rootRecord = rootEntry.completion;
|
|
632
|
-
|
|
633
571
|
if (rootRecord.type === "throw") {
|
|
634
572
|
throw rootRecord.arg;
|
|
635
573
|
}
|
|
636
|
-
|
|
637
574
|
return this.rval;
|
|
638
575
|
},
|
|
639
576
|
dispatchException: function dispatchException(exception) {
|
|
640
577
|
if (this.done) {
|
|
641
578
|
throw exception;
|
|
642
579
|
}
|
|
643
|
-
|
|
644
580
|
var context = this;
|
|
645
|
-
|
|
646
581
|
function handle(loc, caught) {
|
|
647
582
|
record.type = "throw";
|
|
648
583
|
record.arg = exception;
|
|
649
584
|
context.next = loc;
|
|
650
|
-
|
|
651
585
|
if (caught) {
|
|
652
586
|
// If the dispatched exception was caught by a catch block,
|
|
653
587
|
// then let that catch block handle the exception normally.
|
|
654
588
|
context.method = "next";
|
|
655
589
|
context.arg = undefined$1;
|
|
656
590
|
}
|
|
657
|
-
|
|
658
591
|
return !!caught;
|
|
659
592
|
}
|
|
660
|
-
|
|
661
593
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
662
594
|
var entry = this.tryEntries[i];
|
|
663
595
|
var record = entry.completion;
|
|
664
|
-
|
|
665
596
|
if (entry.tryLoc === "root") {
|
|
666
597
|
// Exception thrown outside of any try block that could handle
|
|
667
598
|
// it, so set the completion value of the entire function to
|
|
668
599
|
// throw the exception.
|
|
669
600
|
return handle("end");
|
|
670
601
|
}
|
|
671
|
-
|
|
672
602
|
if (entry.tryLoc <= this.prev) {
|
|
673
603
|
var hasCatch = hasOwn.call(entry, "catchLoc");
|
|
674
604
|
var hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
675
|
-
|
|
676
605
|
if (hasCatch && hasFinally) {
|
|
677
606
|
if (this.prev < entry.catchLoc) {
|
|
678
607
|
return handle(entry.catchLoc, true);
|
|
@@ -696,36 +625,30 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
696
625
|
abrupt: function abrupt(type, arg) {
|
|
697
626
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
698
627
|
var entry = this.tryEntries[i];
|
|
699
|
-
|
|
700
628
|
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
701
629
|
var finallyEntry = entry;
|
|
702
630
|
break;
|
|
703
631
|
}
|
|
704
632
|
}
|
|
705
|
-
|
|
706
633
|
if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
|
|
707
634
|
// Ignore the finally entry if control is not jumping to a
|
|
708
635
|
// location outside the try/catch block.
|
|
709
636
|
finallyEntry = null;
|
|
710
637
|
}
|
|
711
|
-
|
|
712
638
|
var record = finallyEntry ? finallyEntry.completion : {};
|
|
713
639
|
record.type = type;
|
|
714
640
|
record.arg = arg;
|
|
715
|
-
|
|
716
641
|
if (finallyEntry) {
|
|
717
642
|
this.method = "next";
|
|
718
643
|
this.next = finallyEntry.finallyLoc;
|
|
719
644
|
return ContinueSentinel;
|
|
720
645
|
}
|
|
721
|
-
|
|
722
646
|
return this.complete(record);
|
|
723
647
|
},
|
|
724
648
|
complete: function complete(record, afterLoc) {
|
|
725
649
|
if (record.type === "throw") {
|
|
726
650
|
throw record.arg;
|
|
727
651
|
}
|
|
728
|
-
|
|
729
652
|
if (record.type === "break" || record.type === "continue") {
|
|
730
653
|
this.next = record.arg;
|
|
731
654
|
} else if (record.type === "return") {
|
|
@@ -735,13 +658,11 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
735
658
|
} else if (record.type === "normal" && afterLoc) {
|
|
736
659
|
this.next = afterLoc;
|
|
737
660
|
}
|
|
738
|
-
|
|
739
661
|
return ContinueSentinel;
|
|
740
662
|
},
|
|
741
663
|
finish: function finish(finallyLoc) {
|
|
742
664
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
743
665
|
var entry = this.tryEntries[i];
|
|
744
|
-
|
|
745
666
|
if (entry.finallyLoc === finallyLoc) {
|
|
746
667
|
this.complete(entry.completion, entry.afterLoc);
|
|
747
668
|
resetTryEntry(entry);
|
|
@@ -752,21 +673,18 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
752
673
|
"catch": function _catch(tryLoc) {
|
|
753
674
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
754
675
|
var entry = this.tryEntries[i];
|
|
755
|
-
|
|
756
676
|
if (entry.tryLoc === tryLoc) {
|
|
757
677
|
var record = entry.completion;
|
|
758
|
-
|
|
759
678
|
if (record.type === "throw") {
|
|
760
679
|
var thrown = record.arg;
|
|
761
680
|
resetTryEntry(entry);
|
|
762
681
|
}
|
|
763
|
-
|
|
764
682
|
return thrown;
|
|
765
683
|
}
|
|
766
|
-
}
|
|
767
|
-
// argument that corresponds to a known catch block.
|
|
768
|
-
|
|
684
|
+
}
|
|
769
685
|
|
|
686
|
+
// The context.catch method must only be called with a location
|
|
687
|
+
// argument that corresponds to a known catch block.
|
|
770
688
|
throw new Error("illegal catch attempt");
|
|
771
689
|
},
|
|
772
690
|
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
|
|
@@ -775,27 +693,26 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
775
693
|
resultName: resultName,
|
|
776
694
|
nextLoc: nextLoc
|
|
777
695
|
};
|
|
778
|
-
|
|
779
696
|
if (this.method === "next") {
|
|
780
697
|
// Deliberately forget the last sent value so that we don't
|
|
781
698
|
// accidentally pass it on to the delegate.
|
|
782
699
|
this.arg = undefined$1;
|
|
783
700
|
}
|
|
784
|
-
|
|
785
701
|
return ContinueSentinel;
|
|
786
702
|
}
|
|
787
|
-
};
|
|
703
|
+
};
|
|
704
|
+
|
|
705
|
+
// Regardless of whether this script is executing as a CommonJS module
|
|
788
706
|
// or not, return the runtime object so that we can declare the variable
|
|
789
707
|
// regeneratorRuntime in the outer scope, which allows this module to be
|
|
790
708
|
// injected easily by `bin/regenerator --include-runtime script.js`.
|
|
791
|
-
|
|
792
709
|
return exports;
|
|
793
|
-
}(
|
|
710
|
+
}(
|
|
711
|
+
// If this script is executing as a CommonJS module, use module.exports
|
|
794
712
|
// as the regeneratorRuntime namespace. Otherwise create a new empty
|
|
795
713
|
// object. Either way, the resulting object will be used to initialize
|
|
796
714
|
// the regeneratorRuntime variable at the top of this file.
|
|
797
715
|
module.exports );
|
|
798
|
-
|
|
799
716
|
try {
|
|
800
717
|
regeneratorRuntime = runtime;
|
|
801
718
|
} catch (accidentalStrictMode) {
|
|
@@ -819,7 +736,6 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
819
736
|
|
|
820
737
|
function getError(errors, status) {
|
|
821
738
|
var _errors;
|
|
822
|
-
|
|
823
739
|
errors = (_errors = errors) != null ? _errors : [{
|
|
824
740
|
message: 'Failed to fetch Shopify API'
|
|
825
741
|
}];
|
|
@@ -831,7 +747,6 @@ function getError(errors, status) {
|
|
|
831
747
|
function getAsyncError(_x) {
|
|
832
748
|
return _getAsyncError.apply(this, arguments);
|
|
833
749
|
}
|
|
834
|
-
|
|
835
750
|
function _getAsyncError() {
|
|
836
751
|
_getAsyncError = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(res) {
|
|
837
752
|
var data;
|
|
@@ -841,11 +756,9 @@ function _getAsyncError() {
|
|
|
841
756
|
case 0:
|
|
842
757
|
_context2.next = 2;
|
|
843
758
|
return res.json();
|
|
844
|
-
|
|
845
759
|
case 2:
|
|
846
760
|
data = _context2.sent;
|
|
847
761
|
return _context2.abrupt("return", getError(data.errors, res.status));
|
|
848
|
-
|
|
849
762
|
case 4:
|
|
850
763
|
case "end":
|
|
851
764
|
return _context2.stop();
|
|
@@ -855,11 +768,9 @@ function _getAsyncError() {
|
|
|
855
768
|
}));
|
|
856
769
|
return _getAsyncError.apply(this, arguments);
|
|
857
770
|
}
|
|
858
|
-
|
|
859
771
|
var handleFetchResponse = /*#__PURE__*/function () {
|
|
860
772
|
var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(res) {
|
|
861
773
|
var _yield$res$json, data, errors;
|
|
862
|
-
|
|
863
774
|
return runtime_1.wrap(function _callee$(_context) {
|
|
864
775
|
while (1) {
|
|
865
776
|
switch (_context.prev = _context.next) {
|
|
@@ -868,32 +779,24 @@ var handleFetchResponse = /*#__PURE__*/function () {
|
|
|
868
779
|
_context.next = 9;
|
|
869
780
|
break;
|
|
870
781
|
}
|
|
871
|
-
|
|
872
782
|
_context.next = 3;
|
|
873
783
|
return res.json();
|
|
874
|
-
|
|
875
784
|
case 3:
|
|
876
785
|
_yield$res$json = _context.sent;
|
|
877
786
|
data = _yield$res$json.data;
|
|
878
787
|
errors = _yield$res$json.errors;
|
|
879
|
-
|
|
880
788
|
if (!(errors && errors.length)) {
|
|
881
789
|
_context.next = 8;
|
|
882
790
|
break;
|
|
883
791
|
}
|
|
884
|
-
|
|
885
792
|
throw getError(errors, res.status);
|
|
886
|
-
|
|
887
793
|
case 8:
|
|
888
794
|
return _context.abrupt("return", data);
|
|
889
|
-
|
|
890
795
|
case 9:
|
|
891
796
|
_context.next = 11;
|
|
892
797
|
return getAsyncError(res);
|
|
893
|
-
|
|
894
798
|
case 11:
|
|
895
799
|
throw _context.sent;
|
|
896
|
-
|
|
897
800
|
case 12:
|
|
898
801
|
case "end":
|
|
899
802
|
return _context.stop();
|
|
@@ -901,7 +804,6 @@ var handleFetchResponse = /*#__PURE__*/function () {
|
|
|
901
804
|
}
|
|
902
805
|
}, _callee);
|
|
903
806
|
}));
|
|
904
|
-
|
|
905
807
|
return function handleFetchResponse(_x2) {
|
|
906
808
|
return _ref.apply(this, arguments);
|
|
907
809
|
};
|
|
@@ -915,9 +817,7 @@ var getSortVariables = function getSortVariables(sort, isCategory) {
|
|
|
915
817
|
if (isCategory === void 0) {
|
|
916
818
|
isCategory = false;
|
|
917
819
|
}
|
|
918
|
-
|
|
919
820
|
var output = {};
|
|
920
|
-
|
|
921
821
|
switch (sort) {
|
|
922
822
|
case 'price-asc':
|
|
923
823
|
output = {
|
|
@@ -925,21 +825,18 @@ var getSortVariables = function getSortVariables(sort, isCategory) {
|
|
|
925
825
|
reverse: false
|
|
926
826
|
};
|
|
927
827
|
break;
|
|
928
|
-
|
|
929
828
|
case 'price-desc':
|
|
930
829
|
output = {
|
|
931
830
|
sortKey: 'PRICE',
|
|
932
831
|
reverse: true
|
|
933
832
|
};
|
|
934
833
|
break;
|
|
935
|
-
|
|
936
834
|
case 'trending-desc':
|
|
937
835
|
output = {
|
|
938
836
|
sortKey: 'BEST_SELLING',
|
|
939
837
|
reverse: false
|
|
940
838
|
};
|
|
941
839
|
break;
|
|
942
|
-
|
|
943
840
|
case 'latest-desc':
|
|
944
841
|
output = {
|
|
945
842
|
sortKey: isCategory ? 'CREATED' : 'CREATED_AT',
|
|
@@ -947,28 +844,24 @@ var getSortVariables = function getSortVariables(sort, isCategory) {
|
|
|
947
844
|
};
|
|
948
845
|
break;
|
|
949
846
|
}
|
|
950
|
-
|
|
951
847
|
return output;
|
|
952
848
|
};
|
|
953
849
|
|
|
954
850
|
var getSearchVariables = function getSearchVariables(_ref) {
|
|
955
851
|
var brandId = _ref.brandId,
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
852
|
+
search = _ref.search,
|
|
853
|
+
categoryId = _ref.categoryId,
|
|
854
|
+
sort = _ref.sort,
|
|
855
|
+
locale = _ref.locale,
|
|
856
|
+
count = _ref.count;
|
|
961
857
|
var query = "";
|
|
962
858
|
var searchQuery = search + "*";
|
|
963
|
-
|
|
964
859
|
if (search) {
|
|
965
860
|
query += "product_type:" + searchQuery + " OR title:" + searchQuery + " OR tag:" + searchQuery;
|
|
966
861
|
}
|
|
967
|
-
|
|
968
862
|
if (brandId) {
|
|
969
863
|
query += (search ? "AND " : "") + "vendor:" + brandId;
|
|
970
864
|
}
|
|
971
|
-
|
|
972
865
|
return _extends({
|
|
973
866
|
categoryId: categoryId,
|
|
974
867
|
query: query
|
|
@@ -983,7 +876,6 @@ var getSearchVariables = function getSearchVariables(_ref) {
|
|
|
983
876
|
Forked from https://github.com/vercel/commerce/tree/main/packages/shopify/src
|
|
984
877
|
Changes: None
|
|
985
878
|
*/
|
|
986
|
-
|
|
987
879
|
var getCheckoutId = function getCheckoutId(id) {
|
|
988
880
|
return id != null ? id : Cookies.get(SHOPIFY_CHECKOUT_ID_COOKIE);
|
|
989
881
|
};
|
|
@@ -992,25 +884,18 @@ var getCheckoutId = function getCheckoutId(id) {
|
|
|
992
884
|
Forked from https://github.com/vercel/commerce/tree/main/packages/shopify/src
|
|
993
885
|
Changes: None
|
|
994
886
|
*/
|
|
995
|
-
var checkoutDetailsFragment =
|
|
996
|
-
/* GraphQL */
|
|
997
|
-
"\n fragment checkoutDetails on Checkout {\n id\n webUrl\n subtotalPriceV2 {\n amount\n currencyCode\n }\n totalTaxV2 {\n amount\n currencyCode\n }\n totalPriceV2 {\n amount\n currencyCode\n }\n completedAt\n createdAt\n taxesIncluded\n lineItems(first: 250) {\n pageInfo {\n hasNextPage\n hasPreviousPage\n }\n edges {\n node {\n id\n title\n variant {\n id\n sku\n title\n selectedOptions {\n name\n value\n }\n image {\n originalSrc\n altText\n width\n height\n }\n priceV2 {\n amount\n currencyCode\n }\n compareAtPriceV2 {\n amount\n currencyCode\n }\n product {\n handle\n }\n }\n quantity\n }\n }\n }\n }\n";
|
|
998
|
-
var getCheckoutQuery =
|
|
999
|
-
/* GraphQL */
|
|
1000
|
-
"\n query getCheckout($checkoutId: ID!) {\n node(id: $checkoutId) {\n ...checkoutDetails\n }\n }\n " + checkoutDetailsFragment + "\n";
|
|
887
|
+
var checkoutDetailsFragment = /* GraphQL */"\n fragment checkoutDetails on Checkout {\n id\n webUrl\n subtotalPriceV2 {\n amount\n currencyCode\n }\n totalTaxV2 {\n amount\n currencyCode\n }\n totalPriceV2 {\n amount\n currencyCode\n }\n completedAt\n createdAt\n taxesIncluded\n lineItems(first: 250) {\n pageInfo {\n hasNextPage\n hasPreviousPage\n }\n edges {\n node {\n id\n title\n variant {\n id\n sku\n title\n selectedOptions {\n name\n value\n }\n image {\n originalSrc\n altText\n width\n height\n }\n priceV2 {\n amount\n currencyCode\n }\n compareAtPriceV2 {\n amount\n currencyCode\n }\n product {\n handle\n }\n }\n quantity\n }\n }\n }\n }\n";
|
|
888
|
+
var getCheckoutQuery = /* GraphQL */"\n query getCheckout($checkoutId: ID!) {\n node(id: $checkoutId) {\n ...checkoutDetails\n }\n }\n " + checkoutDetailsFragment + "\n";
|
|
1001
889
|
|
|
1002
890
|
/*
|
|
1003
891
|
Forked from https://github.com/vercel/commerce/tree/main/packages/shopify/src
|
|
1004
892
|
Changes: None
|
|
1005
893
|
*/
|
|
1006
|
-
var checkoutCreateMutation =
|
|
1007
|
-
/* GraphQL */
|
|
1008
|
-
"\n mutation checkoutCreate($input: CheckoutCreateInput = {}) {\n checkoutCreate(input: $input) {\n checkoutUserErrors {\n code\n field\n message\n }\n checkout {\n ...checkoutDetails\n }\n }\n }\n\n " + checkoutDetailsFragment + "\n";
|
|
894
|
+
var checkoutCreateMutation = /* GraphQL */"\n mutation checkoutCreate($input: CheckoutCreateInput = {}) {\n checkoutCreate(input: $input) {\n checkoutUserErrors {\n code\n field\n message\n }\n checkout {\n ...checkoutDetails\n }\n }\n }\n\n " + checkoutDetailsFragment + "\n";
|
|
1009
895
|
|
|
1010
896
|
var checkoutCreate = /*#__PURE__*/function () {
|
|
1011
897
|
var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(fetch, lineItems) {
|
|
1012
898
|
var _yield$fetch, checkoutCreate, checkout, checkoutId, options;
|
|
1013
|
-
|
|
1014
899
|
return runtime_1.wrap(function _callee$(_context) {
|
|
1015
900
|
while (1) {
|
|
1016
901
|
switch (_context.prev = _context.next) {
|
|
@@ -1024,12 +909,10 @@ var checkoutCreate = /*#__PURE__*/function () {
|
|
|
1024
909
|
}
|
|
1025
910
|
}
|
|
1026
911
|
});
|
|
1027
|
-
|
|
1028
912
|
case 2:
|
|
1029
913
|
_yield$fetch = _context.sent;
|
|
1030
914
|
checkoutCreate = _yield$fetch.checkoutCreate;
|
|
1031
915
|
checkout = checkoutCreate == null ? void 0 : checkoutCreate.checkout;
|
|
1032
|
-
|
|
1033
916
|
if (checkout) {
|
|
1034
917
|
checkoutId = checkout == null ? void 0 : checkout.id;
|
|
1035
918
|
options = {
|
|
@@ -1038,14 +921,11 @@ var checkoutCreate = /*#__PURE__*/function () {
|
|
|
1038
921
|
secure: true
|
|
1039
922
|
};
|
|
1040
923
|
Cookies.set(SHOPIFY_CHECKOUT_ID_COOKIE, checkoutId, options);
|
|
1041
|
-
|
|
1042
924
|
if (checkout != null && checkout.webUrl) {
|
|
1043
925
|
Cookies.set(SHOPIFY_CHECKOUT_URL_COOKIE, checkout.webUrl, options);
|
|
1044
926
|
}
|
|
1045
927
|
}
|
|
1046
|
-
|
|
1047
928
|
return _context.abrupt("return", checkoutCreate);
|
|
1048
|
-
|
|
1049
929
|
case 7:
|
|
1050
930
|
case "end":
|
|
1051
931
|
return _context.stop();
|
|
@@ -1053,7 +933,6 @@ var checkoutCreate = /*#__PURE__*/function () {
|
|
|
1053
933
|
}
|
|
1054
934
|
}, _callee);
|
|
1055
935
|
}));
|
|
1056
|
-
|
|
1057
936
|
return function checkoutCreate(_x, _x2) {
|
|
1058
937
|
return _ref.apply(this, arguments);
|
|
1059
938
|
};
|
|
@@ -1219,25 +1098,22 @@ var colorMap = {
|
|
|
1219
1098
|
};
|
|
1220
1099
|
|
|
1221
1100
|
var _excluded = ["originalSrc"],
|
|
1222
|
-
|
|
1223
|
-
|
|
1101
|
+
_excluded2 = ["id", "title", "vendor", "images", "variants", "description", "descriptionHtml", "handle", "priceRange", "options", "metafields"];
|
|
1224
1102
|
var money = function money(_ref) {
|
|
1225
1103
|
var amount = _ref.amount,
|
|
1226
|
-
|
|
1104
|
+
currencyCode = _ref.currencyCode;
|
|
1227
1105
|
return {
|
|
1228
1106
|
value: +amount,
|
|
1229
1107
|
currencyCode: currencyCode
|
|
1230
1108
|
};
|
|
1231
1109
|
};
|
|
1232
|
-
|
|
1233
1110
|
var isDefaultOption = function isDefaultOption(selectedOption) {
|
|
1234
1111
|
return selectedOption.name === "Title";
|
|
1235
1112
|
};
|
|
1236
|
-
|
|
1237
1113
|
var normalizeProductOption = function normalizeProductOption(_ref2) {
|
|
1238
1114
|
var id = _ref2.id,
|
|
1239
|
-
|
|
1240
|
-
|
|
1115
|
+
displayName = _ref2.name,
|
|
1116
|
+
values = _ref2.values;
|
|
1241
1117
|
return {
|
|
1242
1118
|
__typename: 'MultipleChoiceOption',
|
|
1243
1119
|
id: id,
|
|
@@ -1246,47 +1122,41 @@ var normalizeProductOption = function normalizeProductOption(_ref2) {
|
|
|
1246
1122
|
var output = {
|
|
1247
1123
|
label: value
|
|
1248
1124
|
};
|
|
1249
|
-
|
|
1250
1125
|
if (displayName.match(/colou?r/gi)) {
|
|
1251
1126
|
var mapedColor = colorMap[value.toLowerCase().replace(/ /g, '')];
|
|
1252
|
-
|
|
1253
1127
|
if (mapedColor) {
|
|
1254
1128
|
output = _extends({}, output, {
|
|
1255
1129
|
hexColors: [mapedColor]
|
|
1256
1130
|
});
|
|
1257
1131
|
}
|
|
1258
1132
|
}
|
|
1259
|
-
|
|
1260
1133
|
return output;
|
|
1261
1134
|
})
|
|
1262
1135
|
};
|
|
1263
1136
|
};
|
|
1264
|
-
|
|
1265
1137
|
var normalizeProductImages = function normalizeProductImages(_ref3) {
|
|
1266
1138
|
var edges = _ref3.edges;
|
|
1267
1139
|
return edges == null ? void 0 : edges.map(function (_ref4) {
|
|
1268
1140
|
var _ref4$node = _ref4.node,
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1141
|
+
url = _ref4$node.originalSrc,
|
|
1142
|
+
rest = _objectWithoutPropertiesLoose(_ref4$node, _excluded);
|
|
1272
1143
|
return _extends({
|
|
1273
1144
|
url: url
|
|
1274
1145
|
}, rest);
|
|
1275
1146
|
});
|
|
1276
1147
|
};
|
|
1277
|
-
|
|
1278
1148
|
var normalizeProductVariants = function normalizeProductVariants(_ref5) {
|
|
1279
1149
|
var edges = _ref5.edges;
|
|
1280
1150
|
return edges == null ? void 0 : edges.map(function (_ref6) {
|
|
1281
1151
|
var _ref6$node = _ref6.node,
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1152
|
+
id = _ref6$node.id,
|
|
1153
|
+
selectedOptions = _ref6$node.selectedOptions,
|
|
1154
|
+
sku = _ref6$node.sku,
|
|
1155
|
+
title = _ref6$node.title,
|
|
1156
|
+
priceV2 = _ref6$node.priceV2,
|
|
1157
|
+
compareAtPriceV2 = _ref6$node.compareAtPriceV2,
|
|
1158
|
+
requiresShipping = _ref6$node.requiresShipping,
|
|
1159
|
+
availableForSale = _ref6$node.availableForSale;
|
|
1290
1160
|
return {
|
|
1291
1161
|
id: id,
|
|
1292
1162
|
name: selectedOptions.some(function (o) {
|
|
@@ -1299,7 +1169,7 @@ var normalizeProductVariants = function normalizeProductVariants(_ref5) {
|
|
|
1299
1169
|
availableForSale: availableForSale,
|
|
1300
1170
|
options: selectedOptions.map(function (_ref7) {
|
|
1301
1171
|
var name = _ref7.name,
|
|
1302
|
-
|
|
1172
|
+
value = _ref7.value;
|
|
1303
1173
|
var options = normalizeProductOption({
|
|
1304
1174
|
id: id,
|
|
1305
1175
|
name: name,
|
|
@@ -1310,20 +1180,18 @@ var normalizeProductVariants = function normalizeProductVariants(_ref5) {
|
|
|
1310
1180
|
};
|
|
1311
1181
|
});
|
|
1312
1182
|
};
|
|
1313
|
-
|
|
1314
1183
|
function normalizeProduct(_ref8) {
|
|
1315
1184
|
var id = _ref8.id,
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1185
|
+
name = _ref8.title,
|
|
1186
|
+
vendor = _ref8.vendor,
|
|
1187
|
+
images = _ref8.images,
|
|
1188
|
+
variants = _ref8.variants,
|
|
1189
|
+
description = _ref8.description,
|
|
1190
|
+
descriptionHtml = _ref8.descriptionHtml,
|
|
1191
|
+
handle = _ref8.handle,
|
|
1192
|
+
priceRange = _ref8.priceRange,
|
|
1193
|
+
options = _ref8.options,
|
|
1194
|
+
rest = _objectWithoutPropertiesLoose(_ref8, _excluded2);
|
|
1327
1195
|
return _extends({
|
|
1328
1196
|
id: id,
|
|
1329
1197
|
name: name,
|
|
@@ -1347,7 +1215,6 @@ function normalizeProduct(_ref8) {
|
|
|
1347
1215
|
}
|
|
1348
1216
|
function normalizeCart(checkout) {
|
|
1349
1217
|
var _checkout$totalPriceV, _checkout$lineItems, _checkout$subtotalPri, _checkout$subtotalPri2, _checkout$totalPriceV2;
|
|
1350
|
-
|
|
1351
1218
|
return {
|
|
1352
1219
|
id: checkout.id,
|
|
1353
1220
|
url: checkout.webUrl,
|
|
@@ -1365,15 +1232,13 @@ function normalizeCart(checkout) {
|
|
|
1365
1232
|
discounts: []
|
|
1366
1233
|
};
|
|
1367
1234
|
}
|
|
1368
|
-
|
|
1369
1235
|
function normalizeLineItem(_ref9) {
|
|
1370
1236
|
var _variant$sku, _variant$image, _variant$requiresShip, _variant$priceV, _variant$compareAtPri, _variant$product;
|
|
1371
|
-
|
|
1372
1237
|
var _ref9$node = _ref9.node,
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1238
|
+
id = _ref9$node.id,
|
|
1239
|
+
title = _ref9$node.title,
|
|
1240
|
+
variant = _ref9$node.variant,
|
|
1241
|
+
quantity = _ref9$node.quantity;
|
|
1377
1242
|
return {
|
|
1378
1243
|
id: id,
|
|
1379
1244
|
variantId: String(variant == null ? void 0 : variant.id),
|
|
@@ -1409,13 +1274,11 @@ export const normalizePage = (
|
|
|
1409
1274
|
export const normalizePages = (edges: PageEdge[], locale?: string): Page[] =>
|
|
1410
1275
|
edges?.map((edge) => normalizePage(edge.node, locale))
|
|
1411
1276
|
*/
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
1277
|
var normalizeCategory = function normalizeCategory(_ref10) {
|
|
1415
1278
|
var name = _ref10.title,
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1279
|
+
handle = _ref10.handle,
|
|
1280
|
+
id = _ref10.id,
|
|
1281
|
+
products = _ref10.products;
|
|
1419
1282
|
return {
|
|
1420
1283
|
id: id,
|
|
1421
1284
|
name: name,
|
|
@@ -1429,23 +1292,20 @@ var normalizeCategory = function normalizeCategory(_ref10) {
|
|
|
1429
1292
|
Forked from https://github.com/vercel/commerce/tree/main/packages/shopify/src
|
|
1430
1293
|
Changes: None
|
|
1431
1294
|
*/
|
|
1432
|
-
|
|
1433
1295
|
var getCustomMessage = function getCustomMessage(code, message) {
|
|
1434
1296
|
switch (code) {
|
|
1435
1297
|
case 'UNIDENTIFIED_CUSTOMER':
|
|
1436
1298
|
message = 'Cannot find an account that matches the provided credentials';
|
|
1437
1299
|
break;
|
|
1438
1300
|
}
|
|
1439
|
-
|
|
1440
1301
|
return message;
|
|
1441
1302
|
};
|
|
1442
|
-
|
|
1443
1303
|
var throwUserErrors = function throwUserErrors(errors) {
|
|
1444
1304
|
if (errors && errors.length) {
|
|
1445
1305
|
throw new commerce.ValidationError({
|
|
1446
1306
|
errors: errors.map(function (_ref) {
|
|
1447
1307
|
var code = _ref.code,
|
|
1448
|
-
|
|
1308
|
+
message = _ref.message;
|
|
1449
1309
|
return {
|
|
1450
1310
|
code: code != null ? code : 'validation_error',
|
|
1451
1311
|
message: getCustomMessage(code, message)
|
|
@@ -1457,94 +1317,69 @@ var throwUserErrors = function throwUserErrors(errors) {
|
|
|
1457
1317
|
|
|
1458
1318
|
var checkoutToCart = function checkoutToCart(checkoutPayload) {
|
|
1459
1319
|
throwUserErrors(checkoutPayload == null ? void 0 : checkoutPayload.checkoutUserErrors);
|
|
1460
|
-
|
|
1461
1320
|
if (!(checkoutPayload != null && checkoutPayload.checkout)) {
|
|
1462
1321
|
throw new commerce.CommerceError({
|
|
1463
1322
|
message: 'Missing checkout object from response'
|
|
1464
1323
|
});
|
|
1465
1324
|
}
|
|
1466
|
-
|
|
1467
1325
|
return normalizeCart(checkoutPayload == null ? void 0 : checkoutPayload.checkout);
|
|
1468
1326
|
};
|
|
1469
1327
|
|
|
1470
1328
|
var simpleProductConnection = "\nfragment simpleProductConnection on ProductConnection {\n edges {\n node {\n id\n }\n }\n}\n";
|
|
1471
1329
|
var collectionFieldsFragment = "\n fragment collectionFieldsFragment on Collection {\n id\n title\n handle,\n products(first: $first) {\n ...simpleProductConnection\n }\n }\n " + simpleProductConnection + "\n";
|
|
1472
|
-
var getCollectionQueryById =
|
|
1473
|
-
/* GraphQL */
|
|
1474
|
-
"\n query getSiteCollection($id: ID, $handle: String, $first: Int = 1) {\n collection(id: $id, handle: $handle) {\n ...collectionFieldsFragment\n }\n }\n " + collectionFieldsFragment + "\n";
|
|
1330
|
+
var getCollectionQueryById = /* GraphQL */"\n query getSiteCollection($id: ID, $handle: String, $first: Int = 1) {\n collection(id: $id, handle: $handle) {\n ...collectionFieldsFragment\n }\n }\n " + collectionFieldsFragment + "\n";
|
|
1475
1331
|
|
|
1476
1332
|
/*
|
|
1477
1333
|
Forked from https://github.com/vercel/commerce/tree/main/packages/shopify/src
|
|
1478
1334
|
Changes: None
|
|
1479
1335
|
*/
|
|
1480
|
-
|
|
1481
|
-
var getSiteCollectionsQuery =
|
|
1482
|
-
/* GraphQL */
|
|
1483
|
-
"\n query getSiteCollections($first: Int!) {\n collections(first: $first) {\n edges {\n node {\n ...collectionFieldsFragment\n }\n }\n }\n }\n\n " + collectionFieldsFragment + "\n";
|
|
1336
|
+
var getSiteCollectionsQuery = /* GraphQL */"\n query getSiteCollections($first: Int!) {\n collections(first: $first) {\n edges {\n node {\n ...collectionFieldsFragment\n }\n }\n }\n }\n\n " + collectionFieldsFragment + "\n";
|
|
1484
1337
|
|
|
1485
1338
|
/*
|
|
1486
1339
|
Forked from https://github.com/vercel/commerce/tree/main/packages/shopify/src
|
|
1487
1340
|
Changes: Added query by product id
|
|
1488
1341
|
*/
|
|
1489
1342
|
var productFieldsFragment = "\n fragment productFields on Product {\n id\n handle\n availableForSale\n title\n productType\n vendor\n description\n descriptionHtml\n options {\n id\n name\n values\n }\n priceRange {\n maxVariantPrice {\n amount\n currencyCode\n }\n minVariantPrice {\n amount\n currencyCode\n }\n }\n variants(first: 250) {\n pageInfo {\n hasNextPage\n hasPreviousPage\n }\n edges {\n node {\n id\n title\n sku\n availableForSale\n requiresShipping\n selectedOptions {\n name\n value\n }\n priceV2 {\n amount\n currencyCode\n }\n compareAtPriceV2 {\n amount\n currencyCode\n }\n }\n }\n }\n images(first: 250) {\n pageInfo {\n hasNextPage\n hasPreviousPage\n }\n edges {\n node {\n originalSrc\n altText\n width\n height\n }\n }\n }\n }\n";
|
|
1490
|
-
var getProductQueryBySlug =
|
|
1491
|
-
/* GraphQL */
|
|
1492
|
-
"\n query getProductBySlug($slug: String!) {\n productByHandle(handle: $slug) {\n ...productFields\n }\n }\n\n " + productFieldsFragment + "\n";
|
|
1493
|
-
var getProductQueryById =
|
|
1494
|
-
/* GraphQL */
|
|
1495
|
-
"\n query getProductById($id: ID!) {\n product(id: $id) {\n ...productFields\n }\n }\n\n " + productFieldsFragment + "\n";
|
|
1343
|
+
var getProductQueryBySlug = /* GraphQL */"\n query getProductBySlug($slug: String!) {\n productByHandle(handle: $slug) {\n ...productFields\n }\n }\n\n " + productFieldsFragment + "\n";
|
|
1344
|
+
var getProductQueryById = /* GraphQL */"\n query getProductById($id: ID!) {\n product(id: $id) {\n ...productFields\n }\n }\n\n " + productFieldsFragment + "\n";
|
|
1496
1345
|
|
|
1497
1346
|
/*
|
|
1498
1347
|
Forked from https://github.com/vercel/commerce/tree/main/packages/shopify/src
|
|
1499
1348
|
Changes:
|
|
1500
1349
|
- Added variants info to the query
|
|
1501
1350
|
*/
|
|
1502
|
-
var productConnectionFragment =
|
|
1503
|
-
/* GraphQL */
|
|
1504
|
-
"\n fragment productConnection on ProductConnection {\n pageInfo {\n hasNextPage\n hasPreviousPage\n }\n edges {\n node {\n id\n handle\n title\n vendor\n handle\n description\n descriptionHtml\n priceRange {\n minVariantPrice {\n amount\n currencyCode\n }\n }\n options {\n id\n name\n values\n }\n variants(first: 250) {\n pageInfo {\n hasNextPage\n hasPreviousPage\n }\n edges {\n node {\n id\n title\n sku\n availableForSale\n requiresShipping\n selectedOptions {\n name\n value\n }\n priceV2 {\n amount\n currencyCode\n }\n compareAtPriceV2 {\n amount\n currencyCode\n }\n }\n }\n }\n images(first: 250) {\n pageInfo {\n hasNextPage\n hasPreviousPage\n }\n edges {\n node {\n originalSrc\n altText\n width\n height\n }\n }\n }\n }\n }\n }\n";
|
|
1505
|
-
var getAllProductsQuery =
|
|
1506
|
-
/* GraphQL */
|
|
1507
|
-
"\n query getAllProducts(\n $first: Int = 250\n $query: String = \"\"\n $sortKey: ProductSortKeys = RELEVANCE\n $reverse: Boolean = false\n ) {\n products(\n first: $first\n sortKey: $sortKey\n reverse: $reverse\n query: $query\n ) {\n ...productConnection\n }\n }\n\n " + productConnectionFragment + "\n";
|
|
1351
|
+
var productConnectionFragment = /* GraphQL */"\n fragment productConnection on ProductConnection {\n pageInfo {\n hasNextPage\n hasPreviousPage\n }\n edges {\n node {\n id\n handle\n title\n vendor\n handle\n description\n descriptionHtml\n priceRange {\n minVariantPrice {\n amount\n currencyCode\n }\n }\n options {\n id\n name\n values\n }\n variants(first: 250) {\n pageInfo {\n hasNextPage\n hasPreviousPage\n }\n edges {\n node {\n id\n title\n sku\n availableForSale\n requiresShipping\n selectedOptions {\n name\n value\n }\n priceV2 {\n amount\n currencyCode\n }\n compareAtPriceV2 {\n amount\n currencyCode\n }\n }\n }\n }\n images(first: 250) {\n pageInfo {\n hasNextPage\n hasPreviousPage\n }\n edges {\n node {\n originalSrc\n altText\n width\n height\n }\n }\n }\n }\n }\n }\n";
|
|
1352
|
+
var getAllProductsQuery = /* GraphQL */"\n query getAllProducts(\n $first: Int = 250\n $query: String = \"\"\n $sortKey: ProductSortKeys = RELEVANCE\n $reverse: Boolean = false\n ) {\n products(\n first: $first\n sortKey: $sortKey\n reverse: $reverse\n query: $query\n ) {\n ...productConnection\n }\n }\n\n " + productConnectionFragment + "\n";
|
|
1508
1353
|
|
|
1509
1354
|
/*
|
|
1510
1355
|
Forked from https://github.com/vercel/commerce/tree/main/packages/shopify/src
|
|
1511
1356
|
Changes: None
|
|
1512
1357
|
*/
|
|
1513
|
-
var getAllProductVendors =
|
|
1514
|
-
/* GraphQL */
|
|
1515
|
-
"\n query getAllProductVendors($first: Int = 250, $cursor: String) {\n products(first: $first, after: $cursor) {\n pageInfo {\n hasNextPage\n hasPreviousPage\n }\n edges {\n node {\n vendor\n }\n cursor\n }\n }\n }\n";
|
|
1358
|
+
var getAllProductVendors = /* GraphQL */"\n query getAllProductVendors($first: Int = 250, $cursor: String) {\n products(first: $first, after: $cursor) {\n pageInfo {\n hasNextPage\n hasPreviousPage\n }\n edges {\n node {\n vendor\n }\n cursor\n }\n }\n }\n";
|
|
1516
1359
|
|
|
1517
1360
|
/*
|
|
1518
1361
|
Forked from https://github.com/vercel/commerce/tree/main/packages/shopify/src
|
|
1519
1362
|
Changes: None
|
|
1520
1363
|
*/
|
|
1521
|
-
var getCollectionProductsQuery =
|
|
1522
|
-
/* GraphQL */
|
|
1523
|
-
"\n query getProductsFromCollection(\n $categoryId: ID!\n $first: Int = 250\n $sortKey: ProductCollectionSortKeys = RELEVANCE\n $reverse: Boolean = false\n ) {\n node(id: $categoryId) {\n id\n ... on Collection {\n products(first: $first, sortKey: $sortKey, reverse: $reverse) {\n ...productConnection\n }\n }\n }\n }\n " + productConnectionFragment + "\n";
|
|
1364
|
+
var getCollectionProductsQuery = /* GraphQL */"\n query getProductsFromCollection(\n $categoryId: ID!\n $first: Int = 250\n $sortKey: ProductCollectionSortKeys = RELEVANCE\n $reverse: Boolean = false\n ) {\n node(id: $categoryId) {\n id\n ... on Collection {\n products(first: $first, sortKey: $sortKey, reverse: $reverse) {\n ...productConnection\n }\n }\n }\n }\n " + productConnectionFragment + "\n";
|
|
1524
1365
|
|
|
1525
1366
|
/*
|
|
1526
1367
|
Forked from https://github.com/vercel/commerce/tree/main/packages/shopify/src
|
|
1527
1368
|
Changes: None
|
|
1528
1369
|
*/
|
|
1529
|
-
var checkoutLineItemAddMutation =
|
|
1530
|
-
/* GraphQL */
|
|
1531
|
-
"\n mutation checkoutLineItemAdd(\n $checkoutId: ID!\n $lineItems: [CheckoutLineItemInput!]!\n ) {\n checkoutLineItemsAdd(checkoutId: $checkoutId, lineItems: $lineItems) {\n checkoutUserErrors {\n code\n field\n message\n }\n checkout {\n ...checkoutDetails\n }\n }\n }\n\n " + checkoutDetailsFragment + "\n";
|
|
1370
|
+
var checkoutLineItemAddMutation = /* GraphQL */"\n mutation checkoutLineItemAdd(\n $checkoutId: ID!\n $lineItems: [CheckoutLineItemInput!]!\n ) {\n checkoutLineItemsAdd(checkoutId: $checkoutId, lineItems: $lineItems) {\n checkoutUserErrors {\n code\n field\n message\n }\n checkout {\n ...checkoutDetails\n }\n }\n }\n\n " + checkoutDetailsFragment + "\n";
|
|
1532
1371
|
|
|
1533
1372
|
/*
|
|
1534
1373
|
Forked from https://github.com/vercel/commerce/tree/main/packages/shopify/src
|
|
1535
1374
|
Changes: None
|
|
1536
1375
|
*/
|
|
1537
|
-
var checkoutLineItemUpdateMutation =
|
|
1538
|
-
/* GraphQL */
|
|
1539
|
-
"\n mutation checkoutLineItemUpdate(\n $checkoutId: ID!\n $lineItems: [CheckoutLineItemUpdateInput!]!\n ) {\n checkoutLineItemsUpdate(checkoutId: $checkoutId, lineItems: $lineItems) {\n checkoutUserErrors {\n code\n field\n message\n }\n checkout {\n ...checkoutDetails\n }\n }\n }\n\n " + checkoutDetailsFragment + "\n";
|
|
1376
|
+
var checkoutLineItemUpdateMutation = /* GraphQL */"\n mutation checkoutLineItemUpdate(\n $checkoutId: ID!\n $lineItems: [CheckoutLineItemUpdateInput!]!\n ) {\n checkoutLineItemsUpdate(checkoutId: $checkoutId, lineItems: $lineItems) {\n checkoutUserErrors {\n code\n field\n message\n }\n checkout {\n ...checkoutDetails\n }\n }\n }\n\n " + checkoutDetailsFragment + "\n";
|
|
1540
1377
|
|
|
1541
1378
|
/*
|
|
1542
1379
|
Forked from https://github.com/vercel/commerce/tree/main/packages/shopify/src
|
|
1543
1380
|
Changes: None
|
|
1544
1381
|
*/
|
|
1545
|
-
var checkoutLineItemRemoveMutation =
|
|
1546
|
-
/* GraphQL */
|
|
1547
|
-
"\n mutation checkoutLineItemRemove($checkoutId: ID!, $lineItemIds: [ID!]!) {\n checkoutLineItemsRemove(\n checkoutId: $checkoutId\n lineItemIds: $lineItemIds\n ) {\n checkoutUserErrors {\n code\n field\n message\n }\n checkout {\n ...checkoutDetails\n }\n }\n }\n " + checkoutDetailsFragment + "\n";
|
|
1382
|
+
var checkoutLineItemRemoveMutation = /* GraphQL */"\n mutation checkoutLineItemRemove($checkoutId: ID!, $lineItemIds: [ID!]!) {\n checkoutLineItemsRemove(\n checkoutId: $checkoutId\n lineItemIds: $lineItemIds\n ) {\n checkoutUserErrors {\n code\n field\n message\n }\n checkout {\n ...checkoutDetails\n }\n }\n }\n " + checkoutDetailsFragment + "\n";
|
|
1548
1383
|
|
|
1549
1384
|
var handler = {
|
|
1550
1385
|
fetchOptions: {
|
|
@@ -1553,9 +1388,7 @@ var handler = {
|
|
|
1553
1388
|
fetcher: function fetcher(_ref) {
|
|
1554
1389
|
return _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
|
|
1555
1390
|
var _products, _products2;
|
|
1556
|
-
|
|
1557
1391
|
var input, options, fetch, categoryId, brandId, method, variables, products, _data$node, _data$node$products, _data$node$products$e, _data$node2, _data$node2$products, data, _data$products, _data;
|
|
1558
|
-
|
|
1559
1392
|
return runtime_1.wrap(function _callee$(_context) {
|
|
1560
1393
|
while (1) {
|
|
1561
1394
|
switch (_context.prev = _context.next) {
|
|
@@ -1564,12 +1397,10 @@ var handler = {
|
|
|
1564
1397
|
categoryId = input.categoryId, brandId = input.brandId;
|
|
1565
1398
|
method = options == null ? void 0 : options.method;
|
|
1566
1399
|
variables = getSearchVariables(input);
|
|
1567
|
-
|
|
1568
1400
|
if (!categoryId) {
|
|
1569
1401
|
_context.next = 11;
|
|
1570
1402
|
break;
|
|
1571
1403
|
}
|
|
1572
|
-
|
|
1573
1404
|
_context.next = 7;
|
|
1574
1405
|
return fetch({
|
|
1575
1406
|
query: getCollectionProductsQuery,
|
|
@@ -1578,7 +1409,6 @@ var handler = {
|
|
|
1578
1409
|
first: undefined
|
|
1579
1410
|
})
|
|
1580
1411
|
});
|
|
1581
|
-
|
|
1582
1412
|
case 7:
|
|
1583
1413
|
data = _context.sent;
|
|
1584
1414
|
// filter on client when brandId & categoryId are set since is not available on collection product query
|
|
@@ -1588,7 +1418,6 @@ var handler = {
|
|
|
1588
1418
|
}).slice(0, input.count) : (_data$node2 = data.node) == null ? void 0 : (_data$node2$products = _data$node2.products) == null ? void 0 : _data$node2$products.edges.slice(0, input.count);
|
|
1589
1419
|
_context.next = 15;
|
|
1590
1420
|
break;
|
|
1591
|
-
|
|
1592
1421
|
case 11:
|
|
1593
1422
|
_context.next = 13;
|
|
1594
1423
|
return fetch({
|
|
@@ -1596,11 +1425,9 @@ var handler = {
|
|
|
1596
1425
|
method: method,
|
|
1597
1426
|
variables: variables
|
|
1598
1427
|
});
|
|
1599
|
-
|
|
1600
1428
|
case 13:
|
|
1601
1429
|
_data = _context.sent;
|
|
1602
1430
|
products = (_data$products = _data.products) == null ? void 0 : _data$products.edges;
|
|
1603
|
-
|
|
1604
1431
|
case 15:
|
|
1605
1432
|
return _context.abrupt("return", {
|
|
1606
1433
|
products: (_products = products) == null ? void 0 : _products.map(function (_ref3) {
|
|
@@ -1609,7 +1436,6 @@ var handler = {
|
|
|
1609
1436
|
}),
|
|
1610
1437
|
found: !!((_products2 = products) != null && _products2.length)
|
|
1611
1438
|
});
|
|
1612
|
-
|
|
1613
1439
|
case 16:
|
|
1614
1440
|
case "end":
|
|
1615
1441
|
return _context.stop();
|
|
@@ -1624,7 +1450,6 @@ var handler = {
|
|
|
1624
1450
|
if (input === void 0) {
|
|
1625
1451
|
input = {};
|
|
1626
1452
|
}
|
|
1627
|
-
|
|
1628
1453
|
return useData({
|
|
1629
1454
|
input: [['search', input.search], ['categoryId', input.categoryId], ['brandId', input.brandId], ['sort', input.sort], ['locale', input.locale], ['count', input.count]],
|
|
1630
1455
|
swrOptions: _extends({
|
|
@@ -1642,29 +1467,23 @@ var handler$1 = {
|
|
|
1642
1467
|
fetcher: function fetcher(_ref) {
|
|
1643
1468
|
return _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
|
|
1644
1469
|
var input, options, fetch, id, product, data, _data;
|
|
1645
|
-
|
|
1646
1470
|
return runtime_1.wrap(function _callee$(_context) {
|
|
1647
1471
|
while (1) {
|
|
1648
1472
|
switch (_context.prev = _context.next) {
|
|
1649
1473
|
case 0:
|
|
1650
1474
|
input = _ref.input, options = _ref.options, fetch = _ref.fetch;
|
|
1651
1475
|
id = input.id;
|
|
1652
|
-
|
|
1653
1476
|
if (id) {
|
|
1654
1477
|
_context.next = 4;
|
|
1655
1478
|
break;
|
|
1656
1479
|
}
|
|
1657
|
-
|
|
1658
1480
|
return _context.abrupt("return", null);
|
|
1659
|
-
|
|
1660
1481
|
case 4:
|
|
1661
1482
|
product = null;
|
|
1662
|
-
|
|
1663
1483
|
if (!id.startsWith("gid://shopify")) {
|
|
1664
1484
|
_context.next = 12;
|
|
1665
1485
|
break;
|
|
1666
1486
|
}
|
|
1667
|
-
|
|
1668
1487
|
_context.next = 8;
|
|
1669
1488
|
return fetch({
|
|
1670
1489
|
query: getProductQueryById,
|
|
@@ -1672,13 +1491,11 @@ var handler$1 = {
|
|
|
1672
1491
|
id: id
|
|
1673
1492
|
}
|
|
1674
1493
|
});
|
|
1675
|
-
|
|
1676
1494
|
case 8:
|
|
1677
1495
|
data = _context.sent;
|
|
1678
1496
|
product = data.product;
|
|
1679
1497
|
_context.next = 16;
|
|
1680
1498
|
break;
|
|
1681
|
-
|
|
1682
1499
|
case 12:
|
|
1683
1500
|
_context.next = 14;
|
|
1684
1501
|
return fetch({
|
|
@@ -1687,17 +1504,13 @@ var handler$1 = {
|
|
|
1687
1504
|
slug: id
|
|
1688
1505
|
}
|
|
1689
1506
|
});
|
|
1690
|
-
|
|
1691
1507
|
case 14:
|
|
1692
1508
|
_data = _context.sent;
|
|
1693
|
-
|
|
1694
1509
|
if (_data.productByHandle) {
|
|
1695
1510
|
product = _data.productByHandle;
|
|
1696
1511
|
}
|
|
1697
|
-
|
|
1698
1512
|
case 16:
|
|
1699
1513
|
return _context.abrupt("return", product ? normalizeProduct(product) : null);
|
|
1700
|
-
|
|
1701
1514
|
case 17:
|
|
1702
1515
|
case "end":
|
|
1703
1516
|
return _context.stop();
|
|
@@ -1712,7 +1525,6 @@ var handler$1 = {
|
|
|
1712
1525
|
if (input === void 0) {
|
|
1713
1526
|
input = {};
|
|
1714
1527
|
}
|
|
1715
|
-
|
|
1716
1528
|
return useData({
|
|
1717
1529
|
input: [['id', input.id]],
|
|
1718
1530
|
swrOptions: _extends({
|
|
@@ -1730,46 +1542,37 @@ var handler$2 = {
|
|
|
1730
1542
|
fetcher: function fetcher(_ref) {
|
|
1731
1543
|
return _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
|
|
1732
1544
|
var cartId, options, fetch, _yield$fetch, checkout;
|
|
1733
|
-
|
|
1734
1545
|
return runtime_1.wrap(function _callee$(_context) {
|
|
1735
1546
|
while (1) {
|
|
1736
1547
|
switch (_context.prev = _context.next) {
|
|
1737
1548
|
case 0:
|
|
1738
1549
|
cartId = _ref.input.cartId, options = _ref.options, fetch = _ref.fetch;
|
|
1739
|
-
|
|
1740
1550
|
if (!cartId) {
|
|
1741
1551
|
_context.next = 13;
|
|
1742
1552
|
break;
|
|
1743
1553
|
}
|
|
1744
|
-
|
|
1745
1554
|
_context.next = 4;
|
|
1746
1555
|
return fetch(_extends({}, options, {
|
|
1747
1556
|
variables: {
|
|
1748
1557
|
checkoutId: cartId
|
|
1749
1558
|
}
|
|
1750
1559
|
}));
|
|
1751
|
-
|
|
1752
1560
|
case 4:
|
|
1753
1561
|
_yield$fetch = _context.sent;
|
|
1754
1562
|
checkout = _yield$fetch.node;
|
|
1755
|
-
|
|
1756
1563
|
if (!(checkout != null && checkout.completedAt)) {
|
|
1757
1564
|
_context.next = 12;
|
|
1758
1565
|
break;
|
|
1759
1566
|
}
|
|
1760
|
-
|
|
1761
1567
|
Cookies.remove(SHOPIFY_CHECKOUT_ID_COOKIE);
|
|
1762
1568
|
Cookies.remove(SHOPIFY_CHECKOUT_URL_COOKIE);
|
|
1763
1569
|
return _context.abrupt("return", null);
|
|
1764
|
-
|
|
1765
1570
|
case 12:
|
|
1766
1571
|
return _context.abrupt("return", checkoutToCart({
|
|
1767
1572
|
checkout: checkout
|
|
1768
1573
|
}));
|
|
1769
|
-
|
|
1770
1574
|
case 13:
|
|
1771
1575
|
return _context.abrupt("return", null);
|
|
1772
|
-
|
|
1773
1576
|
case 14:
|
|
1774
1577
|
case "end":
|
|
1775
1578
|
return _context.stop();
|
|
@@ -1791,7 +1594,6 @@ var handler$2 = {
|
|
|
1791
1594
|
isEmpty: {
|
|
1792
1595
|
get: function get() {
|
|
1793
1596
|
var _response$data$lineIt, _response$data;
|
|
1794
|
-
|
|
1795
1597
|
return ((_response$data$lineIt = (_response$data = response.data) == null ? void 0 : _response$data.lineItems.length) != null ? _response$data$lineIt : 0) <= 0;
|
|
1796
1598
|
},
|
|
1797
1599
|
enumerable: true
|
|
@@ -1809,44 +1611,35 @@ var handler$3 = {
|
|
|
1809
1611
|
fetcher: function fetcher(_ref) {
|
|
1810
1612
|
return _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
|
|
1811
1613
|
var _item$quantity;
|
|
1812
|
-
|
|
1813
1614
|
var item, options, fetch, lineItems, checkoutId, _yield$fetch, checkoutLineItemsAdd;
|
|
1814
|
-
|
|
1815
1615
|
return runtime_1.wrap(function _callee$(_context) {
|
|
1816
1616
|
while (1) {
|
|
1817
1617
|
switch (_context.prev = _context.next) {
|
|
1818
1618
|
case 0:
|
|
1819
1619
|
item = _ref.input, options = _ref.options, fetch = _ref.fetch;
|
|
1820
|
-
|
|
1821
1620
|
if (!(item.quantity && (!Number.isInteger(item.quantity) || item.quantity < 1))) {
|
|
1822
1621
|
_context.next = 3;
|
|
1823
1622
|
break;
|
|
1824
1623
|
}
|
|
1825
|
-
|
|
1826
1624
|
throw new commerce.CommerceError({
|
|
1827
1625
|
message: 'The item quantity has to be a valid integer greater than 0'
|
|
1828
1626
|
});
|
|
1829
|
-
|
|
1830
1627
|
case 3:
|
|
1831
1628
|
lineItems = [{
|
|
1832
1629
|
variantId: item.variantId,
|
|
1833
1630
|
quantity: (_item$quantity = item.quantity) != null ? _item$quantity : 1
|
|
1834
1631
|
}];
|
|
1835
1632
|
checkoutId = getCheckoutId();
|
|
1836
|
-
|
|
1837
1633
|
if (checkoutId) {
|
|
1838
1634
|
_context.next = 13;
|
|
1839
1635
|
break;
|
|
1840
1636
|
}
|
|
1841
|
-
|
|
1842
1637
|
_context.t0 = checkoutToCart;
|
|
1843
1638
|
_context.next = 9;
|
|
1844
1639
|
return checkoutCreate(fetch, lineItems);
|
|
1845
|
-
|
|
1846
1640
|
case 9:
|
|
1847
1641
|
_context.t1 = _context.sent;
|
|
1848
1642
|
return _context.abrupt("return", (0, _context.t0)(_context.t1));
|
|
1849
|
-
|
|
1850
1643
|
case 13:
|
|
1851
1644
|
_context.next = 15;
|
|
1852
1645
|
return fetch(_extends({}, options, {
|
|
@@ -1855,12 +1648,10 @@ var handler$3 = {
|
|
|
1855
1648
|
lineItems: lineItems
|
|
1856
1649
|
}
|
|
1857
1650
|
}));
|
|
1858
|
-
|
|
1859
1651
|
case 15:
|
|
1860
1652
|
_yield$fetch = _context.sent;
|
|
1861
1653
|
checkoutLineItemsAdd = _yield$fetch.checkoutLineItemsAdd;
|
|
1862
1654
|
return _context.abrupt("return", checkoutToCart(checkoutLineItemsAdd));
|
|
1863
|
-
|
|
1864
1655
|
case 18:
|
|
1865
1656
|
case "end":
|
|
1866
1657
|
return _context.stop();
|
|
@@ -1873,8 +1664,7 @@ var handler$3 = {
|
|
|
1873
1664
|
var fetch = _ref2.fetch;
|
|
1874
1665
|
return function () {
|
|
1875
1666
|
var _useCart = commerce.useCart(),
|
|
1876
|
-
|
|
1877
|
-
|
|
1667
|
+
mutate = _useCart.mutate;
|
|
1878
1668
|
return React.useCallback( /*#__PURE__*/function () {
|
|
1879
1669
|
var _addItem = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(input) {
|
|
1880
1670
|
var data;
|
|
@@ -1886,15 +1676,12 @@ var handler$3 = {
|
|
|
1886
1676
|
return fetch({
|
|
1887
1677
|
input: input
|
|
1888
1678
|
});
|
|
1889
|
-
|
|
1890
1679
|
case 2:
|
|
1891
1680
|
data = _context2.sent;
|
|
1892
1681
|
_context2.next = 5;
|
|
1893
1682
|
return mutate(data, false);
|
|
1894
|
-
|
|
1895
1683
|
case 5:
|
|
1896
1684
|
return _context2.abrupt("return", data);
|
|
1897
|
-
|
|
1898
1685
|
case 6:
|
|
1899
1686
|
case "end":
|
|
1900
1687
|
return _context2.stop();
|
|
@@ -1902,11 +1689,9 @@ var handler$3 = {
|
|
|
1902
1689
|
}
|
|
1903
1690
|
}, _callee2);
|
|
1904
1691
|
}));
|
|
1905
|
-
|
|
1906
1692
|
function addItem(_x) {
|
|
1907
1693
|
return _addItem.apply(this, arguments);
|
|
1908
1694
|
}
|
|
1909
|
-
|
|
1910
1695
|
return addItem;
|
|
1911
1696
|
}(), [fetch, mutate]);
|
|
1912
1697
|
};
|
|
@@ -1932,11 +1717,9 @@ var handler$4 = {
|
|
|
1932
1717
|
lineItemIds: [itemId]
|
|
1933
1718
|
}
|
|
1934
1719
|
}));
|
|
1935
|
-
|
|
1936
1720
|
case 3:
|
|
1937
1721
|
data = _context.sent;
|
|
1938
1722
|
return _context.abrupt("return", checkoutToCart(data.checkoutLineItemsRemove));
|
|
1939
|
-
|
|
1940
1723
|
case 5:
|
|
1941
1724
|
case "end":
|
|
1942
1725
|
return _context.stop();
|
|
@@ -1951,33 +1734,26 @@ var handler$4 = {
|
|
|
1951
1734
|
if (ctx === void 0) {
|
|
1952
1735
|
ctx = {};
|
|
1953
1736
|
}
|
|
1954
|
-
|
|
1955
1737
|
var _ctx = ctx,
|
|
1956
|
-
|
|
1957
|
-
|
|
1738
|
+
item = _ctx.item;
|
|
1958
1739
|
var _useCart = commerce.useCart(),
|
|
1959
|
-
|
|
1960
|
-
|
|
1740
|
+
mutate = _useCart.mutate;
|
|
1961
1741
|
var removeItem = /*#__PURE__*/function () {
|
|
1962
1742
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(input) {
|
|
1963
1743
|
var _input$id;
|
|
1964
|
-
|
|
1965
1744
|
var itemId, data;
|
|
1966
1745
|
return runtime_1.wrap(function _callee2$(_context2) {
|
|
1967
1746
|
while (1) {
|
|
1968
1747
|
switch (_context2.prev = _context2.next) {
|
|
1969
1748
|
case 0:
|
|
1970
1749
|
itemId = (_input$id = input == null ? void 0 : input.id) != null ? _input$id : item == null ? void 0 : item.id;
|
|
1971
|
-
|
|
1972
1750
|
if (itemId) {
|
|
1973
1751
|
_context2.next = 3;
|
|
1974
1752
|
break;
|
|
1975
1753
|
}
|
|
1976
|
-
|
|
1977
1754
|
throw new commerce.ValidationError({
|
|
1978
1755
|
message: 'Invalid input used for this operation'
|
|
1979
1756
|
});
|
|
1980
|
-
|
|
1981
1757
|
case 3:
|
|
1982
1758
|
_context2.next = 5;
|
|
1983
1759
|
return fetch({
|
|
@@ -1985,15 +1761,12 @@ var handler$4 = {
|
|
|
1985
1761
|
itemId: itemId
|
|
1986
1762
|
}
|
|
1987
1763
|
});
|
|
1988
|
-
|
|
1989
1764
|
case 5:
|
|
1990
1765
|
data = _context2.sent;
|
|
1991
1766
|
_context2.next = 8;
|
|
1992
1767
|
return mutate(data, false);
|
|
1993
|
-
|
|
1994
1768
|
case 8:
|
|
1995
1769
|
return _context2.abrupt("return", data);
|
|
1996
|
-
|
|
1997
1770
|
case 9:
|
|
1998
1771
|
case "end":
|
|
1999
1772
|
return _context2.stop();
|
|
@@ -2001,12 +1774,10 @@ var handler$4 = {
|
|
|
2001
1774
|
}
|
|
2002
1775
|
}, _callee2);
|
|
2003
1776
|
}));
|
|
2004
|
-
|
|
2005
1777
|
return function removeItem(_x) {
|
|
2006
1778
|
return _ref3.apply(this, arguments);
|
|
2007
1779
|
};
|
|
2008
1780
|
}();
|
|
2009
|
-
|
|
2010
1781
|
return React.useCallback(removeItem, [fetch, mutate]);
|
|
2011
1782
|
};
|
|
2012
1783
|
}
|
|
@@ -2019,23 +1790,19 @@ var handler$5 = {
|
|
|
2019
1790
|
fetcher: function fetcher(_ref) {
|
|
2020
1791
|
return _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
|
|
2021
1792
|
var _ref$input, itemId, item, options, fetch, _yield$fetch, checkoutLineItemsUpdate;
|
|
2022
|
-
|
|
2023
1793
|
return runtime_1.wrap(function _callee$(_context) {
|
|
2024
1794
|
while (1) {
|
|
2025
1795
|
switch (_context.prev = _context.next) {
|
|
2026
1796
|
case 0:
|
|
2027
1797
|
_ref$input = _ref.input, itemId = _ref$input.itemId, item = _ref$input.item, options = _ref.options, fetch = _ref.fetch;
|
|
2028
|
-
|
|
2029
1798
|
if (!Number.isInteger(item.quantity)) {
|
|
2030
1799
|
_context.next = 6;
|
|
2031
1800
|
break;
|
|
2032
1801
|
}
|
|
2033
|
-
|
|
2034
1802
|
if (!(item.quantity < 1)) {
|
|
2035
1803
|
_context.next = 4;
|
|
2036
1804
|
break;
|
|
2037
1805
|
}
|
|
2038
|
-
|
|
2039
1806
|
return _context.abrupt("return", handler$4.fetcher({
|
|
2040
1807
|
options: handler$4.fetchOptions,
|
|
2041
1808
|
input: {
|
|
@@ -2043,21 +1810,17 @@ var handler$5 = {
|
|
|
2043
1810
|
},
|
|
2044
1811
|
fetch: fetch
|
|
2045
1812
|
}));
|
|
2046
|
-
|
|
2047
1813
|
case 4:
|
|
2048
1814
|
_context.next = 8;
|
|
2049
1815
|
break;
|
|
2050
|
-
|
|
2051
1816
|
case 6:
|
|
2052
1817
|
if (!item.quantity) {
|
|
2053
1818
|
_context.next = 8;
|
|
2054
1819
|
break;
|
|
2055
1820
|
}
|
|
2056
|
-
|
|
2057
1821
|
throw new commerce.ValidationError({
|
|
2058
1822
|
message: "The item quantity has to be a valid integer"
|
|
2059
1823
|
});
|
|
2060
|
-
|
|
2061
1824
|
case 8:
|
|
2062
1825
|
_context.next = 10;
|
|
2063
1826
|
return fetch(_extends({}, options, {
|
|
@@ -2069,12 +1832,10 @@ var handler$5 = {
|
|
|
2069
1832
|
}]
|
|
2070
1833
|
}
|
|
2071
1834
|
}));
|
|
2072
|
-
|
|
2073
1835
|
case 10:
|
|
2074
1836
|
_yield$fetch = _context.sent;
|
|
2075
1837
|
checkoutLineItemsUpdate = _yield$fetch.checkoutLineItemsUpdate;
|
|
2076
1838
|
return _context.abrupt("return", checkoutToCart(checkoutLineItemsUpdate));
|
|
2077
|
-
|
|
2078
1839
|
case 13:
|
|
2079
1840
|
case "end":
|
|
2080
1841
|
return _context.stop();
|
|
@@ -2087,21 +1848,16 @@ var handler$5 = {
|
|
|
2087
1848
|
var fetch = _ref2.fetch;
|
|
2088
1849
|
return function (ctx) {
|
|
2089
1850
|
var _ctx$wait;
|
|
2090
|
-
|
|
2091
1851
|
if (ctx === void 0) {
|
|
2092
1852
|
ctx = {};
|
|
2093
1853
|
}
|
|
2094
|
-
|
|
2095
1854
|
var _ctx = ctx,
|
|
2096
|
-
|
|
2097
|
-
|
|
1855
|
+
item = _ctx.item;
|
|
2098
1856
|
var _useCart = commerce.useCart(),
|
|
2099
|
-
|
|
2100
|
-
|
|
1857
|
+
mutate = _useCart.mutate;
|
|
2101
1858
|
return React.useCallback(debounce( /*#__PURE__*/function () {
|
|
2102
1859
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(input) {
|
|
2103
1860
|
var _input$id, _input$productId, _input$productId2;
|
|
2104
|
-
|
|
2105
1861
|
var itemId, productId, variantId, data;
|
|
2106
1862
|
return runtime_1.wrap(function _callee2$(_context2) {
|
|
2107
1863
|
while (1) {
|
|
@@ -2110,16 +1866,13 @@ var handler$5 = {
|
|
|
2110
1866
|
itemId = (_input$id = input.id) != null ? _input$id : item == null ? void 0 : item.id;
|
|
2111
1867
|
productId = (_input$productId = input.productId) != null ? _input$productId : item == null ? void 0 : item.productId;
|
|
2112
1868
|
variantId = (_input$productId2 = input.productId) != null ? _input$productId2 : item == null ? void 0 : item.variantId;
|
|
2113
|
-
|
|
2114
1869
|
if (!(!itemId || !productId || !variantId)) {
|
|
2115
1870
|
_context2.next = 5;
|
|
2116
1871
|
break;
|
|
2117
1872
|
}
|
|
2118
|
-
|
|
2119
1873
|
throw new commerce.ValidationError({
|
|
2120
1874
|
message: "Invalid input used for this operation"
|
|
2121
1875
|
});
|
|
2122
|
-
|
|
2123
1876
|
case 5:
|
|
2124
1877
|
_context2.next = 7;
|
|
2125
1878
|
return fetch({
|
|
@@ -2132,15 +1885,12 @@ var handler$5 = {
|
|
|
2132
1885
|
itemId: itemId
|
|
2133
1886
|
}
|
|
2134
1887
|
});
|
|
2135
|
-
|
|
2136
1888
|
case 7:
|
|
2137
1889
|
data = _context2.sent;
|
|
2138
1890
|
_context2.next = 10;
|
|
2139
1891
|
return mutate(data, false);
|
|
2140
|
-
|
|
2141
1892
|
case 10:
|
|
2142
1893
|
return _context2.abrupt("return", data);
|
|
2143
|
-
|
|
2144
1894
|
case 11:
|
|
2145
1895
|
case "end":
|
|
2146
1896
|
return _context2.stop();
|
|
@@ -2148,7 +1898,6 @@ var handler$5 = {
|
|
|
2148
1898
|
}
|
|
2149
1899
|
}, _callee2);
|
|
2150
1900
|
}));
|
|
2151
|
-
|
|
2152
1901
|
return function (_x) {
|
|
2153
1902
|
return _ref3.apply(this, arguments);
|
|
2154
1903
|
};
|
|
@@ -2164,19 +1913,16 @@ var handler$6 = {
|
|
|
2164
1913
|
fetcher: function fetcher(_ref) {
|
|
2165
1914
|
return _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
|
|
2166
1915
|
var input, options, fetch, categoryId, _data$collections$edg, _data$collections, _data$collections$edg2, data, _data;
|
|
2167
|
-
|
|
2168
1916
|
return runtime_1.wrap(function _callee$(_context) {
|
|
2169
1917
|
while (1) {
|
|
2170
1918
|
switch (_context.prev = _context.next) {
|
|
2171
1919
|
case 0:
|
|
2172
1920
|
input = _ref.input, options = _ref.options, fetch = _ref.fetch;
|
|
2173
1921
|
categoryId = input.categoryId;
|
|
2174
|
-
|
|
2175
1922
|
if (categoryId) {
|
|
2176
1923
|
_context.next = 9;
|
|
2177
1924
|
break;
|
|
2178
1925
|
}
|
|
2179
|
-
|
|
2180
1926
|
_context.next = 5;
|
|
2181
1927
|
return fetch({
|
|
2182
1928
|
query: options.query,
|
|
@@ -2184,14 +1930,12 @@ var handler$6 = {
|
|
|
2184
1930
|
first: 250
|
|
2185
1931
|
}
|
|
2186
1932
|
});
|
|
2187
|
-
|
|
2188
1933
|
case 5:
|
|
2189
1934
|
data = _context.sent;
|
|
2190
1935
|
return _context.abrupt("return", (_data$collections$edg = data == null ? void 0 : (_data$collections = data.collections) == null ? void 0 : (_data$collections$edg2 = _data$collections.edges) == null ? void 0 : _data$collections$edg2.map(function (_ref2) {
|
|
2191
1936
|
var node = _ref2.node;
|
|
2192
1937
|
return normalizeCategory(node);
|
|
2193
1938
|
})) != null ? _data$collections$edg : []);
|
|
2194
|
-
|
|
2195
1939
|
case 9:
|
|
2196
1940
|
_context.next = 11;
|
|
2197
1941
|
return fetch({
|
|
@@ -2202,11 +1946,9 @@ var handler$6 = {
|
|
|
2202
1946
|
handle: categoryId
|
|
2203
1947
|
})
|
|
2204
1948
|
});
|
|
2205
|
-
|
|
2206
1949
|
case 11:
|
|
2207
1950
|
_data = _context.sent;
|
|
2208
1951
|
return _context.abrupt("return", !!(_data != null && _data.collection) ? [normalizeCategory(_data == null ? void 0 : _data.collection)] : []);
|
|
2209
|
-
|
|
2210
1952
|
case 13:
|
|
2211
1953
|
case "end":
|
|
2212
1954
|
return _context.stop();
|
|
@@ -2229,7 +1971,6 @@ var handler$6 = {
|
|
|
2229
1971
|
isEmpty: {
|
|
2230
1972
|
get: function get() {
|
|
2231
1973
|
var _response$data$length, _response$data;
|
|
2232
|
-
|
|
2233
1974
|
return ((_response$data$length = (_response$data = response.data) == null ? void 0 : _response$data.length) != null ? _response$data$length : 0) <= 0;
|
|
2234
1975
|
},
|
|
2235
1976
|
enumerable: true
|
|
@@ -2259,7 +2000,6 @@ var handler$7 = {
|
|
|
2259
2000
|
first: 250
|
|
2260
2001
|
}
|
|
2261
2002
|
});
|
|
2262
|
-
|
|
2263
2003
|
case 3:
|
|
2264
2004
|
data = _context.sent;
|
|
2265
2005
|
vendorsStrings = data.products.edges.map(function (_ref2) {
|
|
@@ -2274,7 +2014,6 @@ var handler$7 = {
|
|
|
2274
2014
|
path: "brands/" + id
|
|
2275
2015
|
};
|
|
2276
2016
|
}));
|
|
2277
|
-
|
|
2278
2017
|
case 6:
|
|
2279
2018
|
case "end":
|
|
2280
2019
|
return _context.stop();
|
|
@@ -2296,7 +2035,6 @@ var handler$7 = {
|
|
|
2296
2035
|
isEmpty: {
|
|
2297
2036
|
get: function get() {
|
|
2298
2037
|
var _response$data$length, _response$data;
|
|
2299
|
-
|
|
2300
2038
|
return ((_response$data$length = (_response$data = response.data) == null ? void 0 : _response$data.length) != null ? _response$data$length : 0) <= 0;
|
|
2301
2039
|
},
|
|
2302
2040
|
enumerable: true
|
|
@@ -2312,7 +2050,6 @@ var getFetcher = function getFetcher(storeDomain, accessToken) {
|
|
|
2312
2050
|
return /*#__PURE__*/function () {
|
|
2313
2051
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(_ref) {
|
|
2314
2052
|
var _ref$url, url, _ref$method, method, variables, query, _ref3, locale, vars;
|
|
2315
|
-
|
|
2316
2053
|
return runtime_1.wrap(function _callee$(_context) {
|
|
2317
2054
|
while (1) {
|
|
2318
2055
|
switch (_context.prev = _context.next) {
|
|
@@ -2334,11 +2071,9 @@ var getFetcher = function getFetcher(storeDomain, accessToken) {
|
|
|
2334
2071
|
'Accept-Language': locale
|
|
2335
2072
|
})
|
|
2336
2073
|
});
|
|
2337
|
-
|
|
2338
2074
|
case 5:
|
|
2339
2075
|
_context.t1 = _context.sent;
|
|
2340
2076
|
return _context.abrupt("return", (0, _context.t0)(_context.t1));
|
|
2341
|
-
|
|
2342
2077
|
case 7:
|
|
2343
2078
|
case "end":
|
|
2344
2079
|
return _context.stop();
|
|
@@ -2346,7 +2081,6 @@ var getFetcher = function getFetcher(storeDomain, accessToken) {
|
|
|
2346
2081
|
}
|
|
2347
2082
|
}, _callee);
|
|
2348
2083
|
}));
|
|
2349
|
-
|
|
2350
2084
|
return function (_x) {
|
|
2351
2085
|
return _ref2.apply(this, arguments);
|
|
2352
2086
|
};
|
|
@@ -2412,8 +2146,8 @@ var commerceProviderMeta = {
|
|
|
2412
2146
|
};
|
|
2413
2147
|
function CommerceProviderComponent(props) {
|
|
2414
2148
|
var storeDomain = props.storeDomain,
|
|
2415
|
-
|
|
2416
|
-
|
|
2149
|
+
accessToken = props.accessToken,
|
|
2150
|
+
children = props.children;
|
|
2417
2151
|
var CommerceProvider = React__default.useMemo(function () {
|
|
2418
2152
|
return getCommerceProvider(storeDomain, accessToken);
|
|
2419
2153
|
}, [storeDomain, accessToken]);
|
|
@@ -2423,7 +2157,6 @@ function registerCommerceProvider(loader, customCommerceProviderMeta) {
|
|
|
2423
2157
|
var doRegisterComponent = function doRegisterComponent() {
|
|
2424
2158
|
return loader ? loader.registerGlobalContext.apply(loader, arguments) : registerGlobalContext.apply(void 0, arguments);
|
|
2425
2159
|
};
|
|
2426
|
-
|
|
2427
2160
|
doRegisterComponent(CommerceProviderComponent, customCommerceProviderMeta != null ? customCommerceProviderMeta : commerceProviderMeta);
|
|
2428
2161
|
}
|
|
2429
2162
|
|