@plasmicpkgs/commerce-commercetools 0.0.33 → 0.0.34
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-commercetools.cjs.development.js +118 -283
- package/dist/commerce-commercetools.cjs.development.js.map +1 -1
- package/dist/commerce-commercetools.cjs.production.min.js +1 -1
- package/dist/commerce-commercetools.cjs.production.min.js.map +1 -1
- package/dist/commerce-commercetools.esm.js +118 -283
- package/dist/commerce-commercetools.esm.js.map +1 -1
- package/package.json +3 -3
|
@@ -21,49 +21,40 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
|
21
21
|
reject(error);
|
|
22
22
|
return;
|
|
23
23
|
}
|
|
24
|
-
|
|
25
24
|
if (info.done) {
|
|
26
25
|
resolve(value);
|
|
27
26
|
} else {
|
|
28
27
|
Promise.resolve(value).then(_next, _throw);
|
|
29
28
|
}
|
|
30
29
|
}
|
|
31
|
-
|
|
32
30
|
function _asyncToGenerator(fn) {
|
|
33
31
|
return function () {
|
|
34
32
|
var self = this,
|
|
35
|
-
|
|
33
|
+
args = arguments;
|
|
36
34
|
return new Promise(function (resolve, reject) {
|
|
37
35
|
var gen = fn.apply(self, args);
|
|
38
|
-
|
|
39
36
|
function _next(value) {
|
|
40
37
|
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
41
38
|
}
|
|
42
|
-
|
|
43
39
|
function _throw(err) {
|
|
44
40
|
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
45
41
|
}
|
|
46
|
-
|
|
47
42
|
_next(undefined);
|
|
48
43
|
});
|
|
49
44
|
};
|
|
50
45
|
}
|
|
51
|
-
|
|
52
46
|
function _extends() {
|
|
53
|
-
_extends = Object.assign
|
|
47
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
54
48
|
for (var i = 1; i < arguments.length; i++) {
|
|
55
49
|
var source = arguments[i];
|
|
56
|
-
|
|
57
50
|
for (var key in source) {
|
|
58
51
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
59
52
|
target[key] = source[key];
|
|
60
53
|
}
|
|
61
54
|
}
|
|
62
55
|
}
|
|
63
|
-
|
|
64
56
|
return target;
|
|
65
57
|
};
|
|
66
|
-
|
|
67
58
|
return _extends.apply(this, arguments);
|
|
68
59
|
}
|
|
69
60
|
|
|
@@ -78,17 +69,16 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
78
69
|
* This source code is licensed under the MIT license found in the
|
|
79
70
|
* LICENSE file in the root directory of this source tree.
|
|
80
71
|
*/
|
|
72
|
+
|
|
81
73
|
var runtime = function (exports) {
|
|
82
74
|
|
|
83
75
|
var Op = Object.prototype;
|
|
84
76
|
var hasOwn = Op.hasOwnProperty;
|
|
85
77
|
var undefined$1; // More compressible than void 0.
|
|
86
|
-
|
|
87
78
|
var $Symbol = typeof Symbol === "function" ? Symbol : {};
|
|
88
79
|
var iteratorSymbol = $Symbol.iterator || "@@iterator";
|
|
89
80
|
var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
|
|
90
81
|
var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
91
|
-
|
|
92
82
|
function define(obj, key, value) {
|
|
93
83
|
Object.defineProperty(obj, key, {
|
|
94
84
|
value: value,
|
|
@@ -98,7 +88,6 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
98
88
|
});
|
|
99
89
|
return obj[key];
|
|
100
90
|
}
|
|
101
|
-
|
|
102
91
|
try {
|
|
103
92
|
// IE 8 has a broken Object.defineProperty that only works on DOM objects.
|
|
104
93
|
define({}, "");
|
|
@@ -107,19 +96,20 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
107
96
|
return obj[key] = value;
|
|
108
97
|
};
|
|
109
98
|
}
|
|
110
|
-
|
|
111
99
|
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
112
100
|
// If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
|
|
113
101
|
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
|
|
114
102
|
var generator = Object.create(protoGenerator.prototype);
|
|
115
|
-
var context = new Context(tryLocsList || []);
|
|
116
|
-
// .throw, and .return methods.
|
|
103
|
+
var context = new Context(tryLocsList || []);
|
|
117
104
|
|
|
105
|
+
// The ._invoke method unifies the implementations of the .next,
|
|
106
|
+
// .throw, and .return methods.
|
|
118
107
|
generator._invoke = makeInvokeMethod(innerFn, self, context);
|
|
119
108
|
return generator;
|
|
120
109
|
}
|
|
110
|
+
exports.wrap = wrap;
|
|
121
111
|
|
|
122
|
-
|
|
112
|
+
// Try/catch helper to minimize deoptimizations. Returns a completion
|
|
123
113
|
// record like context.tryEntries[i].completion. This interface could
|
|
124
114
|
// have been (and was previously) designed to take a closure to be
|
|
125
115
|
// invoked without arguments, but in all the cases we care about we
|
|
@@ -129,7 +119,6 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
129
119
|
// in every case, so we don't have to touch the arguments object. The
|
|
130
120
|
// only additional allocation required is the completion record, which
|
|
131
121
|
// has a stable shape and so hopefully should be cheap to allocate.
|
|
132
|
-
|
|
133
122
|
function tryCatch(fn, obj, arg) {
|
|
134
123
|
try {
|
|
135
124
|
return {
|
|
@@ -143,46 +132,44 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
143
132
|
};
|
|
144
133
|
}
|
|
145
134
|
}
|
|
146
|
-
|
|
147
135
|
var GenStateSuspendedStart = "suspendedStart";
|
|
148
136
|
var GenStateSuspendedYield = "suspendedYield";
|
|
149
137
|
var GenStateExecuting = "executing";
|
|
150
|
-
var GenStateCompleted = "completed";
|
|
138
|
+
var GenStateCompleted = "completed";
|
|
139
|
+
|
|
140
|
+
// Returning this object from the innerFn has the same effect as
|
|
151
141
|
// breaking out of the dispatch switch statement.
|
|
142
|
+
var ContinueSentinel = {};
|
|
152
143
|
|
|
153
|
-
|
|
144
|
+
// Dummy constructor functions that we use as the .constructor and
|
|
154
145
|
// .constructor.prototype properties for functions that return Generator
|
|
155
146
|
// objects. For full spec compliance, you may wish to configure your
|
|
156
147
|
// minifier not to mangle the names of these two functions.
|
|
157
|
-
|
|
158
148
|
function Generator() {}
|
|
159
|
-
|
|
160
149
|
function GeneratorFunction() {}
|
|
150
|
+
function GeneratorFunctionPrototype() {}
|
|
161
151
|
|
|
162
|
-
|
|
152
|
+
// This is a polyfill for %IteratorPrototype% for environments that
|
|
163
153
|
// don't natively support it.
|
|
164
|
-
|
|
165
|
-
|
|
166
154
|
var IteratorPrototype = {};
|
|
167
155
|
define(IteratorPrototype, iteratorSymbol, function () {
|
|
168
156
|
return this;
|
|
169
157
|
});
|
|
170
158
|
var getProto = Object.getPrototypeOf;
|
|
171
159
|
var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
172
|
-
|
|
173
160
|
if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
|
|
174
161
|
// This environment has a native %IteratorPrototype%; use it instead
|
|
175
162
|
// of the polyfill.
|
|
176
163
|
IteratorPrototype = NativeIteratorPrototype;
|
|
177
164
|
}
|
|
178
|
-
|
|
179
165
|
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
180
166
|
GeneratorFunction.prototype = GeneratorFunctionPrototype;
|
|
181
167
|
define(Gp, "constructor", GeneratorFunctionPrototype);
|
|
182
168
|
define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
|
|
183
|
-
GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction");
|
|
184
|
-
// Iterator interface in terms of a single ._invoke method.
|
|
169
|
+
GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction");
|
|
185
170
|
|
|
171
|
+
// Helper for defining the .next, .throw, and .return methods of the
|
|
172
|
+
// Iterator interface in terms of a single ._invoke method.
|
|
186
173
|
function defineIteratorMethods(prototype) {
|
|
187
174
|
["next", "throw", "return"].forEach(function (method) {
|
|
188
175
|
define(prototype, method, function (arg) {
|
|
@@ -190,14 +177,13 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
190
177
|
});
|
|
191
178
|
});
|
|
192
179
|
}
|
|
193
|
-
|
|
194
180
|
exports.isGeneratorFunction = function (genFun) {
|
|
195
181
|
var ctor = typeof genFun === "function" && genFun.constructor;
|
|
196
|
-
return ctor ? ctor === GeneratorFunction ||
|
|
182
|
+
return ctor ? ctor === GeneratorFunction ||
|
|
183
|
+
// For the native GeneratorFunction constructor, the best we can
|
|
197
184
|
// do is to check its .name property.
|
|
198
185
|
(ctor.displayName || ctor.name) === "GeneratorFunction" : false;
|
|
199
186
|
};
|
|
200
|
-
|
|
201
187
|
exports.mark = function (genFun) {
|
|
202
188
|
if (Object.setPrototypeOf) {
|
|
203
189
|
Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
|
|
@@ -205,31 +191,27 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
205
191
|
genFun.__proto__ = GeneratorFunctionPrototype;
|
|
206
192
|
define(genFun, toStringTagSymbol, "GeneratorFunction");
|
|
207
193
|
}
|
|
208
|
-
|
|
209
194
|
genFun.prototype = Object.create(Gp);
|
|
210
195
|
return genFun;
|
|
211
|
-
};
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
// Within the body of any async function, `await x` is transformed to
|
|
212
199
|
// `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
|
|
213
200
|
// `hasOwn.call(value, "__await")` to determine if the yielded value is
|
|
214
201
|
// meant to be awaited.
|
|
215
|
-
|
|
216
|
-
|
|
217
202
|
exports.awrap = function (arg) {
|
|
218
203
|
return {
|
|
219
204
|
__await: arg
|
|
220
205
|
};
|
|
221
206
|
};
|
|
222
|
-
|
|
223
207
|
function AsyncIterator(generator, PromiseImpl) {
|
|
224
208
|
function invoke(method, arg, resolve, reject) {
|
|
225
209
|
var record = tryCatch(generator[method], generator, arg);
|
|
226
|
-
|
|
227
210
|
if (record.type === "throw") {
|
|
228
211
|
reject(record.arg);
|
|
229
212
|
} else {
|
|
230
213
|
var result = record.arg;
|
|
231
214
|
var value = result.value;
|
|
232
|
-
|
|
233
215
|
if (value && typeof value === "object" && hasOwn.call(value, "__await")) {
|
|
234
216
|
return PromiseImpl.resolve(value.__await).then(function (value) {
|
|
235
217
|
invoke("next", value, resolve, reject);
|
|
@@ -237,7 +219,6 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
237
219
|
invoke("throw", err, resolve, reject);
|
|
238
220
|
});
|
|
239
221
|
}
|
|
240
|
-
|
|
241
222
|
return PromiseImpl.resolve(value).then(function (unwrapped) {
|
|
242
223
|
// When a yielded Promise is resolved, its final value becomes
|
|
243
224
|
// the .value of the Promise<{value,done}> result for the
|
|
@@ -251,17 +232,15 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
251
232
|
});
|
|
252
233
|
}
|
|
253
234
|
}
|
|
254
|
-
|
|
255
235
|
var previousPromise;
|
|
256
|
-
|
|
257
236
|
function enqueue(method, arg) {
|
|
258
237
|
function callInvokeWithMethodAndArg() {
|
|
259
238
|
return new PromiseImpl(function (resolve, reject) {
|
|
260
239
|
invoke(method, arg, resolve, reject);
|
|
261
240
|
});
|
|
262
241
|
}
|
|
263
|
-
|
|
264
|
-
|
|
242
|
+
return previousPromise =
|
|
243
|
+
// If enqueue has been called before, then we want to wait until
|
|
265
244
|
// all previous Promises have been resolved before calling invoke,
|
|
266
245
|
// so that results are always delivered in the correct order. If
|
|
267
246
|
// enqueue has not been called before, then it is important to
|
|
@@ -273,24 +252,25 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
273
252
|
// execute code before the first await. Since we implement simple
|
|
274
253
|
// async functions in terms of async generators, it is especially
|
|
275
254
|
// important to get this right, even though it requires care.
|
|
276
|
-
previousPromise ? previousPromise.then(callInvokeWithMethodAndArg,
|
|
255
|
+
previousPromise ? previousPromise.then(callInvokeWithMethodAndArg,
|
|
256
|
+
// Avoid propagating failures to Promises returned by later
|
|
277
257
|
// invocations of the iterator.
|
|
278
258
|
callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
279
|
-
}
|
|
280
|
-
// .throw, and .return (see defineIteratorMethods).
|
|
281
|
-
|
|
259
|
+
}
|
|
282
260
|
|
|
261
|
+
// Define the unified helper method that is used to implement .next,
|
|
262
|
+
// .throw, and .return (see defineIteratorMethods).
|
|
283
263
|
this._invoke = enqueue;
|
|
284
264
|
}
|
|
285
|
-
|
|
286
265
|
defineIteratorMethods(AsyncIterator.prototype);
|
|
287
266
|
define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
288
267
|
return this;
|
|
289
268
|
});
|
|
290
|
-
exports.AsyncIterator = AsyncIterator;
|
|
269
|
+
exports.AsyncIterator = AsyncIterator;
|
|
270
|
+
|
|
271
|
+
// Note that simple async functions are implemented on top of
|
|
291
272
|
// AsyncIterator objects; they just return a Promise for the value of
|
|
292
273
|
// the final result produced by the iterator.
|
|
293
|
-
|
|
294
274
|
exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
295
275
|
if (PromiseImpl === void 0) PromiseImpl = Promise;
|
|
296
276
|
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
|
@@ -299,39 +279,32 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
299
279
|
return result.done ? result.value : iter.next();
|
|
300
280
|
});
|
|
301
281
|
};
|
|
302
|
-
|
|
303
282
|
function makeInvokeMethod(innerFn, self, context) {
|
|
304
283
|
var state = GenStateSuspendedStart;
|
|
305
284
|
return function invoke(method, arg) {
|
|
306
285
|
if (state === GenStateExecuting) {
|
|
307
286
|
throw new Error("Generator is already running");
|
|
308
287
|
}
|
|
309
|
-
|
|
310
288
|
if (state === GenStateCompleted) {
|
|
311
289
|
if (method === "throw") {
|
|
312
290
|
throw arg;
|
|
313
|
-
}
|
|
314
|
-
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
|
|
315
|
-
|
|
291
|
+
}
|
|
316
292
|
|
|
293
|
+
// Be forgiving, per 25.3.3.3.3 of the spec:
|
|
294
|
+
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
|
|
317
295
|
return doneResult();
|
|
318
296
|
}
|
|
319
|
-
|
|
320
297
|
context.method = method;
|
|
321
298
|
context.arg = arg;
|
|
322
|
-
|
|
323
299
|
while (true) {
|
|
324
300
|
var delegate = context.delegate;
|
|
325
|
-
|
|
326
301
|
if (delegate) {
|
|
327
302
|
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
328
|
-
|
|
329
303
|
if (delegateResult) {
|
|
330
304
|
if (delegateResult === ContinueSentinel) continue;
|
|
331
305
|
return delegateResult;
|
|
332
306
|
}
|
|
333
307
|
}
|
|
334
|
-
|
|
335
308
|
if (context.method === "next") {
|
|
336
309
|
// Setting context._sent for legacy support of Babel's
|
|
337
310
|
// function.sent implementation.
|
|
@@ -341,51 +314,44 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
341
314
|
state = GenStateCompleted;
|
|
342
315
|
throw context.arg;
|
|
343
316
|
}
|
|
344
|
-
|
|
345
317
|
context.dispatchException(context.arg);
|
|
346
318
|
} else if (context.method === "return") {
|
|
347
319
|
context.abrupt("return", context.arg);
|
|
348
320
|
}
|
|
349
|
-
|
|
350
321
|
state = GenStateExecuting;
|
|
351
322
|
var record = tryCatch(innerFn, self, context);
|
|
352
|
-
|
|
353
323
|
if (record.type === "normal") {
|
|
354
324
|
// If an exception is thrown from innerFn, we leave state ===
|
|
355
325
|
// GenStateExecuting and loop back for another invocation.
|
|
356
326
|
state = context.done ? GenStateCompleted : GenStateSuspendedYield;
|
|
357
|
-
|
|
358
327
|
if (record.arg === ContinueSentinel) {
|
|
359
328
|
continue;
|
|
360
329
|
}
|
|
361
|
-
|
|
362
330
|
return {
|
|
363
331
|
value: record.arg,
|
|
364
332
|
done: context.done
|
|
365
333
|
};
|
|
366
334
|
} else if (record.type === "throw") {
|
|
367
|
-
state = GenStateCompleted;
|
|
335
|
+
state = GenStateCompleted;
|
|
336
|
+
// Dispatch the exception by looping back around to the
|
|
368
337
|
// context.dispatchException(context.arg) call above.
|
|
369
|
-
|
|
370
338
|
context.method = "throw";
|
|
371
339
|
context.arg = record.arg;
|
|
372
340
|
}
|
|
373
341
|
}
|
|
374
342
|
};
|
|
375
|
-
}
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
// Call delegate.iterator[context.method](context.arg) and handle the
|
|
376
346
|
// result, either by returning a { value, done } result from the
|
|
377
347
|
// delegate iterator, or by modifying context.method and context.arg,
|
|
378
348
|
// setting context.delegate to null, and returning the ContinueSentinel.
|
|
379
|
-
|
|
380
|
-
|
|
381
349
|
function maybeInvokeDelegate(delegate, context) {
|
|
382
350
|
var method = delegate.iterator[context.method];
|
|
383
|
-
|
|
384
351
|
if (method === undefined$1) {
|
|
385
352
|
// A .throw or .return when the delegate iterator has no .throw
|
|
386
353
|
// method always terminates the yield* loop.
|
|
387
354
|
context.delegate = null;
|
|
388
|
-
|
|
389
355
|
if (context.method === "throw") {
|
|
390
356
|
// Note: ["return"] must be used for ES3 parsing compatibility.
|
|
391
357
|
if (delegate.iterator["return"]) {
|
|
@@ -394,51 +360,45 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
394
360
|
context.method = "return";
|
|
395
361
|
context.arg = undefined$1;
|
|
396
362
|
maybeInvokeDelegate(delegate, context);
|
|
397
|
-
|
|
398
363
|
if (context.method === "throw") {
|
|
399
364
|
// If maybeInvokeDelegate(context) changed context.method from
|
|
400
365
|
// "return" to "throw", let that override the TypeError below.
|
|
401
366
|
return ContinueSentinel;
|
|
402
367
|
}
|
|
403
368
|
}
|
|
404
|
-
|
|
405
369
|
context.method = "throw";
|
|
406
370
|
context.arg = new TypeError("The iterator does not provide a 'throw' method");
|
|
407
371
|
}
|
|
408
|
-
|
|
409
372
|
return ContinueSentinel;
|
|
410
373
|
}
|
|
411
|
-
|
|
412
374
|
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
413
|
-
|
|
414
375
|
if (record.type === "throw") {
|
|
415
376
|
context.method = "throw";
|
|
416
377
|
context.arg = record.arg;
|
|
417
378
|
context.delegate = null;
|
|
418
379
|
return ContinueSentinel;
|
|
419
380
|
}
|
|
420
|
-
|
|
421
381
|
var info = record.arg;
|
|
422
|
-
|
|
423
382
|
if (!info) {
|
|
424
383
|
context.method = "throw";
|
|
425
384
|
context.arg = new TypeError("iterator result is not an object");
|
|
426
385
|
context.delegate = null;
|
|
427
386
|
return ContinueSentinel;
|
|
428
387
|
}
|
|
429
|
-
|
|
430
388
|
if (info.done) {
|
|
431
389
|
// Assign the result of the finished delegate to the temporary
|
|
432
390
|
// variable specified by delegate.resultName (see delegateYield).
|
|
433
|
-
context[delegate.resultName] = info.value;
|
|
391
|
+
context[delegate.resultName] = info.value;
|
|
392
|
+
|
|
393
|
+
// Resume execution at the desired location (see delegateYield).
|
|
394
|
+
context.next = delegate.nextLoc;
|
|
434
395
|
|
|
435
|
-
|
|
396
|
+
// If context.method was "throw" but the delegate handled the
|
|
436
397
|
// exception, let the outer generator proceed normally. If
|
|
437
398
|
// context.method was "next", forget context.arg since it has been
|
|
438
399
|
// "consumed" by the delegate iterator. If context.method was
|
|
439
400
|
// "return", allow the original .return call to continue in the
|
|
440
401
|
// outer generator.
|
|
441
|
-
|
|
442
402
|
if (context.method !== "return") {
|
|
443
403
|
context.method = "next";
|
|
444
404
|
context.arg = undefined$1;
|
|
@@ -446,54 +406,49 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
446
406
|
} else {
|
|
447
407
|
// Re-yield the result returned by the delegate method.
|
|
448
408
|
return info;
|
|
449
|
-
}
|
|
450
|
-
// the outer generator.
|
|
451
|
-
|
|
409
|
+
}
|
|
452
410
|
|
|
411
|
+
// The delegate iterator is finished, so forget it and continue with
|
|
412
|
+
// the outer generator.
|
|
453
413
|
context.delegate = null;
|
|
454
414
|
return ContinueSentinel;
|
|
455
|
-
}
|
|
456
|
-
// unified ._invoke helper method.
|
|
457
|
-
|
|
415
|
+
}
|
|
458
416
|
|
|
417
|
+
// Define Generator.prototype.{next,throw,return} in terms of the
|
|
418
|
+
// unified ._invoke helper method.
|
|
459
419
|
defineIteratorMethods(Gp);
|
|
460
|
-
define(Gp, toStringTagSymbol, "Generator");
|
|
420
|
+
define(Gp, toStringTagSymbol, "Generator");
|
|
421
|
+
|
|
422
|
+
// A Generator should always return itself as the iterator object when the
|
|
461
423
|
// @@iterator function is called on it. Some browsers' implementations of the
|
|
462
424
|
// iterator prototype chain incorrectly implement this, causing the Generator
|
|
463
425
|
// object to not be returned from this call. This ensures that doesn't happen.
|
|
464
426
|
// See https://github.com/facebook/regenerator/issues/274 for more details.
|
|
465
|
-
|
|
466
427
|
define(Gp, iteratorSymbol, function () {
|
|
467
428
|
return this;
|
|
468
429
|
});
|
|
469
430
|
define(Gp, "toString", function () {
|
|
470
431
|
return "[object Generator]";
|
|
471
432
|
});
|
|
472
|
-
|
|
473
433
|
function pushTryEntry(locs) {
|
|
474
434
|
var entry = {
|
|
475
435
|
tryLoc: locs[0]
|
|
476
436
|
};
|
|
477
|
-
|
|
478
437
|
if (1 in locs) {
|
|
479
438
|
entry.catchLoc = locs[1];
|
|
480
439
|
}
|
|
481
|
-
|
|
482
440
|
if (2 in locs) {
|
|
483
441
|
entry.finallyLoc = locs[2];
|
|
484
442
|
entry.afterLoc = locs[3];
|
|
485
443
|
}
|
|
486
|
-
|
|
487
444
|
this.tryEntries.push(entry);
|
|
488
445
|
}
|
|
489
|
-
|
|
490
446
|
function resetTryEntry(entry) {
|
|
491
447
|
var record = entry.completion || {};
|
|
492
448
|
record.type = "normal";
|
|
493
449
|
delete record.arg;
|
|
494
450
|
entry.completion = record;
|
|
495
451
|
}
|
|
496
|
-
|
|
497
452
|
function Context(tryLocsList) {
|
|
498
453
|
// The root entry object (effectively a try statement without a catch
|
|
499
454
|
// or a finally block) gives us a place to store values thrown from
|
|
@@ -504,97 +459,84 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
504
459
|
tryLocsList.forEach(pushTryEntry, this);
|
|
505
460
|
this.reset(true);
|
|
506
461
|
}
|
|
507
|
-
|
|
508
462
|
exports.keys = function (object) {
|
|
509
463
|
var keys = [];
|
|
510
|
-
|
|
511
464
|
for (var key in object) {
|
|
512
465
|
keys.push(key);
|
|
513
466
|
}
|
|
467
|
+
keys.reverse();
|
|
514
468
|
|
|
515
|
-
|
|
469
|
+
// Rather than returning an object with a next method, we keep
|
|
516
470
|
// things simple and return the next function itself.
|
|
517
|
-
|
|
518
471
|
return function next() {
|
|
519
472
|
while (keys.length) {
|
|
520
473
|
var key = keys.pop();
|
|
521
|
-
|
|
522
474
|
if (key in object) {
|
|
523
475
|
next.value = key;
|
|
524
476
|
next.done = false;
|
|
525
477
|
return next;
|
|
526
478
|
}
|
|
527
|
-
}
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
// To avoid creating an additional object, we just hang the .value
|
|
528
482
|
// and .done properties off the next function object itself. This
|
|
529
483
|
// also ensures that the minifier will not anonymize the function.
|
|
530
|
-
|
|
531
|
-
|
|
532
484
|
next.done = true;
|
|
533
485
|
return next;
|
|
534
486
|
};
|
|
535
487
|
};
|
|
536
|
-
|
|
537
488
|
function values(iterable) {
|
|
538
489
|
if (iterable) {
|
|
539
490
|
var iteratorMethod = iterable[iteratorSymbol];
|
|
540
|
-
|
|
541
491
|
if (iteratorMethod) {
|
|
542
492
|
return iteratorMethod.call(iterable);
|
|
543
493
|
}
|
|
544
|
-
|
|
545
494
|
if (typeof iterable.next === "function") {
|
|
546
495
|
return iterable;
|
|
547
496
|
}
|
|
548
|
-
|
|
549
497
|
if (!isNaN(iterable.length)) {
|
|
550
498
|
var i = -1,
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
499
|
+
next = function next() {
|
|
500
|
+
while (++i < iterable.length) {
|
|
501
|
+
if (hasOwn.call(iterable, i)) {
|
|
502
|
+
next.value = iterable[i];
|
|
503
|
+
next.done = false;
|
|
504
|
+
return next;
|
|
505
|
+
}
|
|
557
506
|
}
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
return next;
|
|
563
|
-
};
|
|
564
|
-
|
|
507
|
+
next.value = undefined$1;
|
|
508
|
+
next.done = true;
|
|
509
|
+
return next;
|
|
510
|
+
};
|
|
565
511
|
return next.next = next;
|
|
566
512
|
}
|
|
567
|
-
}
|
|
568
|
-
|
|
513
|
+
}
|
|
569
514
|
|
|
515
|
+
// Return an iterator with no values.
|
|
570
516
|
return {
|
|
571
517
|
next: doneResult
|
|
572
518
|
};
|
|
573
519
|
}
|
|
574
|
-
|
|
575
520
|
exports.values = values;
|
|
576
|
-
|
|
577
521
|
function doneResult() {
|
|
578
522
|
return {
|
|
579
523
|
value: undefined$1,
|
|
580
524
|
done: true
|
|
581
525
|
};
|
|
582
526
|
}
|
|
583
|
-
|
|
584
527
|
Context.prototype = {
|
|
585
528
|
constructor: Context,
|
|
586
529
|
reset: function reset(skipTempReset) {
|
|
587
530
|
this.prev = 0;
|
|
588
|
-
this.next = 0;
|
|
531
|
+
this.next = 0;
|
|
532
|
+
// Resetting context._sent for legacy support of Babel's
|
|
589
533
|
// function.sent implementation.
|
|
590
|
-
|
|
591
534
|
this.sent = this._sent = undefined$1;
|
|
592
535
|
this.done = false;
|
|
593
536
|
this.delegate = null;
|
|
594
537
|
this.method = "next";
|
|
595
538
|
this.arg = undefined$1;
|
|
596
539
|
this.tryEntries.forEach(resetTryEntry);
|
|
597
|
-
|
|
598
540
|
if (!skipTempReset) {
|
|
599
541
|
for (var name in this) {
|
|
600
542
|
// Not sure about the optimal order of these conditions:
|
|
@@ -608,50 +550,40 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
608
550
|
this.done = true;
|
|
609
551
|
var rootEntry = this.tryEntries[0];
|
|
610
552
|
var rootRecord = rootEntry.completion;
|
|
611
|
-
|
|
612
553
|
if (rootRecord.type === "throw") {
|
|
613
554
|
throw rootRecord.arg;
|
|
614
555
|
}
|
|
615
|
-
|
|
616
556
|
return this.rval;
|
|
617
557
|
},
|
|
618
558
|
dispatchException: function dispatchException(exception) {
|
|
619
559
|
if (this.done) {
|
|
620
560
|
throw exception;
|
|
621
561
|
}
|
|
622
|
-
|
|
623
562
|
var context = this;
|
|
624
|
-
|
|
625
563
|
function handle(loc, caught) {
|
|
626
564
|
record.type = "throw";
|
|
627
565
|
record.arg = exception;
|
|
628
566
|
context.next = loc;
|
|
629
|
-
|
|
630
567
|
if (caught) {
|
|
631
568
|
// If the dispatched exception was caught by a catch block,
|
|
632
569
|
// then let that catch block handle the exception normally.
|
|
633
570
|
context.method = "next";
|
|
634
571
|
context.arg = undefined$1;
|
|
635
572
|
}
|
|
636
|
-
|
|
637
573
|
return !!caught;
|
|
638
574
|
}
|
|
639
|
-
|
|
640
575
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
641
576
|
var entry = this.tryEntries[i];
|
|
642
577
|
var record = entry.completion;
|
|
643
|
-
|
|
644
578
|
if (entry.tryLoc === "root") {
|
|
645
579
|
// Exception thrown outside of any try block that could handle
|
|
646
580
|
// it, so set the completion value of the entire function to
|
|
647
581
|
// throw the exception.
|
|
648
582
|
return handle("end");
|
|
649
583
|
}
|
|
650
|
-
|
|
651
584
|
if (entry.tryLoc <= this.prev) {
|
|
652
585
|
var hasCatch = hasOwn.call(entry, "catchLoc");
|
|
653
586
|
var hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
654
|
-
|
|
655
587
|
if (hasCatch && hasFinally) {
|
|
656
588
|
if (this.prev < entry.catchLoc) {
|
|
657
589
|
return handle(entry.catchLoc, true);
|
|
@@ -675,36 +607,30 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
675
607
|
abrupt: function abrupt(type, arg) {
|
|
676
608
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
677
609
|
var entry = this.tryEntries[i];
|
|
678
|
-
|
|
679
610
|
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
680
611
|
var finallyEntry = entry;
|
|
681
612
|
break;
|
|
682
613
|
}
|
|
683
614
|
}
|
|
684
|
-
|
|
685
615
|
if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
|
|
686
616
|
// Ignore the finally entry if control is not jumping to a
|
|
687
617
|
// location outside the try/catch block.
|
|
688
618
|
finallyEntry = null;
|
|
689
619
|
}
|
|
690
|
-
|
|
691
620
|
var record = finallyEntry ? finallyEntry.completion : {};
|
|
692
621
|
record.type = type;
|
|
693
622
|
record.arg = arg;
|
|
694
|
-
|
|
695
623
|
if (finallyEntry) {
|
|
696
624
|
this.method = "next";
|
|
697
625
|
this.next = finallyEntry.finallyLoc;
|
|
698
626
|
return ContinueSentinel;
|
|
699
627
|
}
|
|
700
|
-
|
|
701
628
|
return this.complete(record);
|
|
702
629
|
},
|
|
703
630
|
complete: function complete(record, afterLoc) {
|
|
704
631
|
if (record.type === "throw") {
|
|
705
632
|
throw record.arg;
|
|
706
633
|
}
|
|
707
|
-
|
|
708
634
|
if (record.type === "break" || record.type === "continue") {
|
|
709
635
|
this.next = record.arg;
|
|
710
636
|
} else if (record.type === "return") {
|
|
@@ -714,13 +640,11 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
714
640
|
} else if (record.type === "normal" && afterLoc) {
|
|
715
641
|
this.next = afterLoc;
|
|
716
642
|
}
|
|
717
|
-
|
|
718
643
|
return ContinueSentinel;
|
|
719
644
|
},
|
|
720
645
|
finish: function finish(finallyLoc) {
|
|
721
646
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
722
647
|
var entry = this.tryEntries[i];
|
|
723
|
-
|
|
724
648
|
if (entry.finallyLoc === finallyLoc) {
|
|
725
649
|
this.complete(entry.completion, entry.afterLoc);
|
|
726
650
|
resetTryEntry(entry);
|
|
@@ -731,21 +655,18 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
731
655
|
"catch": function _catch(tryLoc) {
|
|
732
656
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
733
657
|
var entry = this.tryEntries[i];
|
|
734
|
-
|
|
735
658
|
if (entry.tryLoc === tryLoc) {
|
|
736
659
|
var record = entry.completion;
|
|
737
|
-
|
|
738
660
|
if (record.type === "throw") {
|
|
739
661
|
var thrown = record.arg;
|
|
740
662
|
resetTryEntry(entry);
|
|
741
663
|
}
|
|
742
|
-
|
|
743
664
|
return thrown;
|
|
744
665
|
}
|
|
745
|
-
}
|
|
746
|
-
// argument that corresponds to a known catch block.
|
|
747
|
-
|
|
666
|
+
}
|
|
748
667
|
|
|
668
|
+
// The context.catch method must only be called with a location
|
|
669
|
+
// argument that corresponds to a known catch block.
|
|
749
670
|
throw new Error("illegal catch attempt");
|
|
750
671
|
},
|
|
751
672
|
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
|
|
@@ -754,27 +675,26 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
754
675
|
resultName: resultName,
|
|
755
676
|
nextLoc: nextLoc
|
|
756
677
|
};
|
|
757
|
-
|
|
758
678
|
if (this.method === "next") {
|
|
759
679
|
// Deliberately forget the last sent value so that we don't
|
|
760
680
|
// accidentally pass it on to the delegate.
|
|
761
681
|
this.arg = undefined$1;
|
|
762
682
|
}
|
|
763
|
-
|
|
764
683
|
return ContinueSentinel;
|
|
765
684
|
}
|
|
766
|
-
};
|
|
685
|
+
};
|
|
686
|
+
|
|
687
|
+
// Regardless of whether this script is executing as a CommonJS module
|
|
767
688
|
// or not, return the runtime object so that we can declare the variable
|
|
768
689
|
// regeneratorRuntime in the outer scope, which allows this module to be
|
|
769
690
|
// injected easily by `bin/regenerator --include-runtime script.js`.
|
|
770
|
-
|
|
771
691
|
return exports;
|
|
772
|
-
}(
|
|
692
|
+
}(
|
|
693
|
+
// If this script is executing as a CommonJS module, use module.exports
|
|
773
694
|
// as the regeneratorRuntime namespace. Otherwise create a new empty
|
|
774
695
|
// object. Either way, the resulting object will be used to initialize
|
|
775
696
|
// the regeneratorRuntime variable at the top of this file.
|
|
776
697
|
module.exports );
|
|
777
|
-
|
|
778
698
|
try {
|
|
779
699
|
regeneratorRuntime = runtime;
|
|
780
700
|
} catch (accidentalStrictMode) {
|
|
@@ -797,28 +717,22 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
797
717
|
});
|
|
798
718
|
|
|
799
719
|
var getSortVariables = function getSortVariables(sort, isCategory) {
|
|
800
|
-
|
|
801
720
|
var output = undefined;
|
|
802
|
-
|
|
803
721
|
switch (sort) {
|
|
804
722
|
case 'price-asc':
|
|
805
723
|
output = 'price asc';
|
|
806
724
|
break;
|
|
807
|
-
|
|
808
725
|
case 'price-desc':
|
|
809
726
|
output = 'price desc';
|
|
810
727
|
break;
|
|
811
|
-
|
|
812
728
|
case 'trending-desc':
|
|
813
729
|
// default option
|
|
814
730
|
output = undefined;
|
|
815
731
|
break;
|
|
816
|
-
|
|
817
732
|
case 'latest-desc':
|
|
818
733
|
output = 'createdAt desc';
|
|
819
734
|
break;
|
|
820
735
|
}
|
|
821
|
-
|
|
822
736
|
return output;
|
|
823
737
|
};
|
|
824
738
|
|
|
@@ -868,18 +782,14 @@ var createCart = /*#__PURE__*/function () {
|
|
|
868
782
|
method: 'post',
|
|
869
783
|
body: draft
|
|
870
784
|
});
|
|
871
|
-
|
|
872
785
|
case 3:
|
|
873
786
|
cart = _context.sent;
|
|
874
|
-
|
|
875
787
|
if (!cart.body) {
|
|
876
788
|
removeCartCookie();
|
|
877
789
|
} else {
|
|
878
790
|
setCartId(cart.body.id);
|
|
879
791
|
}
|
|
880
|
-
|
|
881
792
|
return _context.abrupt("return", cart.body);
|
|
882
|
-
|
|
883
793
|
case 6:
|
|
884
794
|
case "end":
|
|
885
795
|
return _context.stop();
|
|
@@ -887,7 +797,6 @@ var createCart = /*#__PURE__*/function () {
|
|
|
887
797
|
}
|
|
888
798
|
}, _callee);
|
|
889
799
|
}));
|
|
890
|
-
|
|
891
800
|
return function createCart(_x) {
|
|
892
801
|
return _ref.apply(this, arguments);
|
|
893
802
|
};
|
|
@@ -901,12 +810,10 @@ var getActiveCart = /*#__PURE__*/function () {
|
|
|
901
810
|
switch (_context.prev = _context.next) {
|
|
902
811
|
case 0:
|
|
903
812
|
cartId = getCartId();
|
|
904
|
-
|
|
905
813
|
if (!cartId) {
|
|
906
814
|
_context.next = 7;
|
|
907
815
|
break;
|
|
908
816
|
}
|
|
909
|
-
|
|
910
817
|
_context.next = 4;
|
|
911
818
|
return fetch({
|
|
912
819
|
query: 'carts',
|
|
@@ -915,28 +822,22 @@ var getActiveCart = /*#__PURE__*/function () {
|
|
|
915
822
|
id: cartId
|
|
916
823
|
}
|
|
917
824
|
});
|
|
918
|
-
|
|
919
825
|
case 4:
|
|
920
826
|
activeCart = _context.sent.body;
|
|
921
827
|
_context.next = 10;
|
|
922
828
|
break;
|
|
923
|
-
|
|
924
829
|
case 7:
|
|
925
830
|
_context.next = 9;
|
|
926
831
|
return createCart(fetch);
|
|
927
|
-
|
|
928
832
|
case 9:
|
|
929
833
|
activeCart = _context.sent;
|
|
930
|
-
|
|
931
834
|
case 10:
|
|
932
835
|
if (!activeCart) {
|
|
933
836
|
removeCartCookie();
|
|
934
837
|
} else {
|
|
935
838
|
setCartId(activeCart.id);
|
|
936
839
|
}
|
|
937
|
-
|
|
938
840
|
return _context.abrupt("return", activeCart);
|
|
939
|
-
|
|
940
841
|
case 12:
|
|
941
842
|
case "end":
|
|
942
843
|
return _context.stop();
|
|
@@ -944,7 +845,6 @@ var getActiveCart = /*#__PURE__*/function () {
|
|
|
944
845
|
}
|
|
945
846
|
}, _callee);
|
|
946
847
|
}));
|
|
947
|
-
|
|
948
848
|
return function getActiveCart(_x) {
|
|
949
849
|
return _ref.apply(this, arguments);
|
|
950
850
|
};
|
|
@@ -964,11 +864,9 @@ var dedup = function dedup(xs) {
|
|
|
964
864
|
};
|
|
965
865
|
|
|
966
866
|
var currencyCode = 'USD';
|
|
967
|
-
|
|
968
867
|
var stringify = function stringify(value) {
|
|
969
868
|
return typeof value === 'string' ? value : JSON.stringify(value);
|
|
970
869
|
};
|
|
971
|
-
|
|
972
870
|
var money = function money(price) {
|
|
973
871
|
return price ? {
|
|
974
872
|
value: price.centAmount / 100,
|
|
@@ -978,7 +876,6 @@ var money = function money(price) {
|
|
|
978
876
|
currencyCode: currencyCode
|
|
979
877
|
};
|
|
980
878
|
};
|
|
981
|
-
|
|
982
879
|
var normalizeProductOption = function normalizeProductOption(option) {
|
|
983
880
|
return {
|
|
984
881
|
__typename: 'MultipleChoiceOption',
|
|
@@ -998,7 +895,6 @@ var normalizeProductOption = function normalizeProductOption(option) {
|
|
|
998
895
|
})
|
|
999
896
|
};
|
|
1000
897
|
};
|
|
1001
|
-
|
|
1002
898
|
var normalizeProductImages = function normalizeProductImages(images) {
|
|
1003
899
|
return images.map(function (image) {
|
|
1004
900
|
return _extends({
|
|
@@ -1011,10 +907,8 @@ var normalizeProductImages = function normalizeProductImages(images) {
|
|
|
1011
907
|
});
|
|
1012
908
|
});
|
|
1013
909
|
};
|
|
1014
|
-
|
|
1015
910
|
var normalizeProductVariant = function normalizeProductVariant(variant) {
|
|
1016
911
|
var _variant$prices$find$, _variant$prices, _variant$prices$find, _variant$prices2, _variant$prices2$, _variant$sku, _variant$attributes$m, _variant$attributes;
|
|
1017
|
-
|
|
1018
912
|
var price = money((_variant$prices$find$ = (_variant$prices = variant.prices) == null ? void 0 : (_variant$prices$find = _variant$prices.find(function (price) {
|
|
1019
913
|
return price.value.currencyCode === currencyCode;
|
|
1020
914
|
})) == null ? void 0 : _variant$prices$find.value) != null ? _variant$prices$find$ : (_variant$prices2 = variant.prices) == null ? void 0 : (_variant$prices2$ = _variant$prices2[0]) == null ? void 0 : _variant$prices2$.value).value;
|
|
@@ -1033,10 +927,8 @@ var normalizeProductVariant = function normalizeProductVariant(variant) {
|
|
|
1033
927
|
listPrice: price
|
|
1034
928
|
};
|
|
1035
929
|
};
|
|
1036
|
-
|
|
1037
930
|
var normalizeProduct = function normalizeProduct(product, locale) {
|
|
1038
931
|
var _getLocalizedString, _getLocalizedString2, _product$masterVarian, _product$masterVarian2, _product$masterVarian3, _product$masterVarian4, _product$masterVarian5;
|
|
1039
|
-
|
|
1040
932
|
return {
|
|
1041
933
|
id: product.id,
|
|
1042
934
|
name: (_getLocalizedString = getLocalizedString(product.name, locale)) != null ? _getLocalizedString : "",
|
|
@@ -1056,7 +948,6 @@ var normalizeProduct = function normalizeProduct(product, locale) {
|
|
|
1056
948
|
var groupedAttribute = groupedAttributes.find(function (gAttr) {
|
|
1057
949
|
return gAttr.name === attribute.name;
|
|
1058
950
|
});
|
|
1059
|
-
|
|
1060
951
|
if (groupedAttribute) {
|
|
1061
952
|
groupedAttribute.value.push(stringify(attribute.value.key));
|
|
1062
953
|
} else {
|
|
@@ -1065,15 +956,12 @@ var normalizeProduct = function normalizeProduct(product, locale) {
|
|
|
1065
956
|
value: [stringify(attribute.value.key)]
|
|
1066
957
|
});
|
|
1067
958
|
}
|
|
1068
|
-
|
|
1069
959
|
return groupedAttributes;
|
|
1070
960
|
}, []).map(normalizeProductOption)
|
|
1071
961
|
};
|
|
1072
962
|
};
|
|
1073
|
-
|
|
1074
963
|
var normalizeLineItem = function normalizeLineItem(lineItem, locale) {
|
|
1075
964
|
var _getLocalizedString3, _lineItem$variant$att, _lineItem$variant$att2;
|
|
1076
|
-
|
|
1077
965
|
return {
|
|
1078
966
|
id: lineItem.id,
|
|
1079
967
|
variantId: "" + lineItem.variant.id,
|
|
@@ -1092,7 +980,6 @@ var normalizeLineItem = function normalizeLineItem(lineItem, locale) {
|
|
|
1092
980
|
})) != null ? _lineItem$variant$att : []
|
|
1093
981
|
};
|
|
1094
982
|
};
|
|
1095
|
-
|
|
1096
983
|
var normalizeCart = function normalizeCart(cart, locale) {
|
|
1097
984
|
return {
|
|
1098
985
|
id: cart.id,
|
|
@@ -1114,7 +1001,6 @@ var normalizeCart = function normalizeCart(cart, locale) {
|
|
|
1114
1001
|
};
|
|
1115
1002
|
var normalizeCategory = function normalizeCategory(category, locale) {
|
|
1116
1003
|
var _getLocalizedString4, _getLocalizedString5;
|
|
1117
|
-
|
|
1118
1004
|
return {
|
|
1119
1005
|
id: category.id,
|
|
1120
1006
|
name: (_getLocalizedString4 = getLocalizedString(category.name, locale)) != null ? _getLocalizedString4 : "",
|
|
@@ -1131,7 +1017,6 @@ var handler = {
|
|
|
1131
1017
|
fetcher: function fetcher(_ref) {
|
|
1132
1018
|
return _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
|
|
1133
1019
|
var _search;
|
|
1134
|
-
|
|
1135
1020
|
var input, options, fetch, provider, search, categoryId, sort, count, response;
|
|
1136
1021
|
return runtime_1.wrap(function _callee$(_context) {
|
|
1137
1022
|
while (1) {
|
|
@@ -1151,7 +1036,6 @@ var handler = {
|
|
|
1151
1036
|
filters: "categories.id: subtree(\"" + categoryId + "\")"
|
|
1152
1037
|
} : {})
|
|
1153
1038
|
}));
|
|
1154
|
-
|
|
1155
1039
|
case 4:
|
|
1156
1040
|
response = _context.sent;
|
|
1157
1041
|
return _context.abrupt("return", {
|
|
@@ -1160,7 +1044,6 @@ var handler = {
|
|
|
1160
1044
|
}),
|
|
1161
1045
|
found: response.body.count > 0
|
|
1162
1046
|
});
|
|
1163
|
-
|
|
1164
1047
|
case 6:
|
|
1165
1048
|
case "end":
|
|
1166
1049
|
return _context.stop();
|
|
@@ -1175,7 +1058,6 @@ var handler = {
|
|
|
1175
1058
|
if (input === void 0) {
|
|
1176
1059
|
input = {};
|
|
1177
1060
|
}
|
|
1178
|
-
|
|
1179
1061
|
return useData({
|
|
1180
1062
|
input: [['search', input.search], ['categoryId', input.categoryId], ['brandId', input.brandId], ['sort', input.sort], ['locale', input.locale], ['count', input.count]],
|
|
1181
1063
|
swrOptions: _extends({
|
|
@@ -1200,14 +1082,11 @@ var handler$1 = {
|
|
|
1200
1082
|
case 0:
|
|
1201
1083
|
input = _ref.input, options = _ref.options, fetch = _ref.fetch, provider = _ref.provider;
|
|
1202
1084
|
id = input.id;
|
|
1203
|
-
|
|
1204
1085
|
if (id) {
|
|
1205
1086
|
_context.next = 4;
|
|
1206
1087
|
break;
|
|
1207
1088
|
}
|
|
1208
|
-
|
|
1209
1089
|
return _context.abrupt("return", null);
|
|
1210
|
-
|
|
1211
1090
|
case 4:
|
|
1212
1091
|
_context.next = 6;
|
|
1213
1092
|
return fetch(_extends({}, options, {
|
|
@@ -1215,11 +1094,9 @@ var handler$1 = {
|
|
|
1215
1094
|
id: id
|
|
1216
1095
|
}
|
|
1217
1096
|
}));
|
|
1218
|
-
|
|
1219
1097
|
case 6:
|
|
1220
1098
|
product = _context.sent;
|
|
1221
1099
|
return _context.abrupt("return", product.body ? normalizeProduct(product.body, provider.locale) : null);
|
|
1222
|
-
|
|
1223
1100
|
case 8:
|
|
1224
1101
|
case "end":
|
|
1225
1102
|
return _context.stop();
|
|
@@ -1234,7 +1111,6 @@ var handler$1 = {
|
|
|
1234
1111
|
if (input === void 0) {
|
|
1235
1112
|
input = {};
|
|
1236
1113
|
}
|
|
1237
|
-
|
|
1238
1114
|
return useData({
|
|
1239
1115
|
input: [['id', input.id]],
|
|
1240
1116
|
swrOptions: _extends({
|
|
@@ -1260,11 +1136,9 @@ var handler$2 = {
|
|
|
1260
1136
|
fetch = _ref.fetch, provider = _ref.provider;
|
|
1261
1137
|
_context.next = 3;
|
|
1262
1138
|
return getActiveCart(fetch);
|
|
1263
|
-
|
|
1264
1139
|
case 3:
|
|
1265
1140
|
activeCart = _context.sent;
|
|
1266
1141
|
return _context.abrupt("return", activeCart ? normalizeCart(activeCart, provider.locale) : null);
|
|
1267
|
-
|
|
1268
1142
|
case 5:
|
|
1269
1143
|
case "end":
|
|
1270
1144
|
return _context.stop();
|
|
@@ -1286,7 +1160,6 @@ var handler$2 = {
|
|
|
1286
1160
|
isEmpty: {
|
|
1287
1161
|
get: function get() {
|
|
1288
1162
|
var _response$data$lineIt, _response$data;
|
|
1289
|
-
|
|
1290
1163
|
return ((_response$data$lineIt = (_response$data = response.data) == null ? void 0 : _response$data.lineItems.length) != null ? _response$data$lineIt : 0) <= 0;
|
|
1291
1164
|
},
|
|
1292
1165
|
enumerable: true
|
|
@@ -1305,7 +1178,6 @@ var handler$3 = {
|
|
|
1305
1178
|
fetcher: function fetcher(_ref) {
|
|
1306
1179
|
return _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
|
|
1307
1180
|
var _item$quantity;
|
|
1308
|
-
|
|
1309
1181
|
var item, fetch, provider, activeCart, lineItem, updatedCart;
|
|
1310
1182
|
return runtime_1.wrap(function _callee$(_context) {
|
|
1311
1183
|
while (1) {
|
|
@@ -1314,17 +1186,13 @@ var handler$3 = {
|
|
|
1314
1186
|
item = _ref.input, fetch = _ref.fetch, provider = _ref.provider;
|
|
1315
1187
|
_context.next = 3;
|
|
1316
1188
|
return getActiveCart(fetch);
|
|
1317
|
-
|
|
1318
1189
|
case 3:
|
|
1319
1190
|
activeCart = _context.sent;
|
|
1320
|
-
|
|
1321
1191
|
if (!(item.quantity && (!Number.isInteger(item.quantity) || item.quantity < 1) || !activeCart)) {
|
|
1322
1192
|
_context.next = 6;
|
|
1323
1193
|
break;
|
|
1324
1194
|
}
|
|
1325
|
-
|
|
1326
1195
|
return _context.abrupt("return", undefined);
|
|
1327
|
-
|
|
1328
1196
|
case 6:
|
|
1329
1197
|
lineItem = {
|
|
1330
1198
|
version: activeCart.version,
|
|
@@ -1344,18 +1212,14 @@ var handler$3 = {
|
|
|
1344
1212
|
},
|
|
1345
1213
|
body: lineItem
|
|
1346
1214
|
});
|
|
1347
|
-
|
|
1348
1215
|
case 9:
|
|
1349
1216
|
updatedCart = _context.sent;
|
|
1350
|
-
|
|
1351
1217
|
if (updatedCart.body) {
|
|
1352
1218
|
setCartId(updatedCart.body.id);
|
|
1353
1219
|
} else {
|
|
1354
1220
|
removeCartCookie();
|
|
1355
1221
|
}
|
|
1356
|
-
|
|
1357
1222
|
return _context.abrupt("return", updatedCart.body ? normalizeCart(updatedCart.body, provider.locale) : undefined);
|
|
1358
|
-
|
|
1359
1223
|
case 12:
|
|
1360
1224
|
case "end":
|
|
1361
1225
|
return _context.stop();
|
|
@@ -1368,8 +1232,7 @@ var handler$3 = {
|
|
|
1368
1232
|
var fetch = _ref2.fetch;
|
|
1369
1233
|
return function () {
|
|
1370
1234
|
var _useCart = commerce.useCart(),
|
|
1371
|
-
|
|
1372
|
-
|
|
1235
|
+
mutate = _useCart.mutate;
|
|
1373
1236
|
return React.useCallback( /*#__PURE__*/function () {
|
|
1374
1237
|
var _addItem = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(input) {
|
|
1375
1238
|
var data;
|
|
@@ -1381,15 +1244,12 @@ var handler$3 = {
|
|
|
1381
1244
|
return fetch({
|
|
1382
1245
|
input: input
|
|
1383
1246
|
});
|
|
1384
|
-
|
|
1385
1247
|
case 2:
|
|
1386
1248
|
data = _context2.sent;
|
|
1387
1249
|
_context2.next = 5;
|
|
1388
1250
|
return mutate(data, false);
|
|
1389
|
-
|
|
1390
1251
|
case 5:
|
|
1391
1252
|
return _context2.abrupt("return", data);
|
|
1392
|
-
|
|
1393
1253
|
case 6:
|
|
1394
1254
|
case "end":
|
|
1395
1255
|
return _context2.stop();
|
|
@@ -1397,11 +1257,9 @@ var handler$3 = {
|
|
|
1397
1257
|
}
|
|
1398
1258
|
}, _callee2);
|
|
1399
1259
|
}));
|
|
1400
|
-
|
|
1401
1260
|
function addItem(_x) {
|
|
1402
1261
|
return _addItem.apply(this, arguments);
|
|
1403
1262
|
}
|
|
1404
|
-
|
|
1405
1263
|
return addItem;
|
|
1406
1264
|
}(), [fetch, mutate]);
|
|
1407
1265
|
};
|
|
@@ -1422,21 +1280,17 @@ var handler$4 = {
|
|
|
1422
1280
|
case 0:
|
|
1423
1281
|
input = _ref.input, options = _ref.options, fetch = _ref.fetch, provider = _ref.provider;
|
|
1424
1282
|
categoryId = input.categoryId;
|
|
1425
|
-
|
|
1426
1283
|
if (categoryId) {
|
|
1427
1284
|
_context.next = 9;
|
|
1428
1285
|
break;
|
|
1429
1286
|
}
|
|
1430
|
-
|
|
1431
1287
|
_context.next = 5;
|
|
1432
1288
|
return fetch(_extends({}, options));
|
|
1433
|
-
|
|
1434
1289
|
case 5:
|
|
1435
1290
|
categories = _context.sent;
|
|
1436
1291
|
return _context.abrupt("return", categories.body ? categories.body.results.map(function (category) {
|
|
1437
1292
|
return normalizeCategory(category, provider.locale);
|
|
1438
1293
|
}) : []);
|
|
1439
|
-
|
|
1440
1294
|
case 9:
|
|
1441
1295
|
_context.next = 11;
|
|
1442
1296
|
return fetch(_extends({}, options, {
|
|
@@ -1444,11 +1298,9 @@ var handler$4 = {
|
|
|
1444
1298
|
id: categoryId
|
|
1445
1299
|
} : {})
|
|
1446
1300
|
}));
|
|
1447
|
-
|
|
1448
1301
|
case 11:
|
|
1449
1302
|
category = _context.sent;
|
|
1450
1303
|
return _context.abrupt("return", category.body ? [normalizeCategory(category.body, provider.locale)] : []);
|
|
1451
|
-
|
|
1452
1304
|
case 13:
|
|
1453
1305
|
case "end":
|
|
1454
1306
|
return _context.stop();
|
|
@@ -1471,7 +1323,6 @@ var handler$4 = {
|
|
|
1471
1323
|
isEmpty: {
|
|
1472
1324
|
get: function get() {
|
|
1473
1325
|
var _response$data$length, _response$data;
|
|
1474
|
-
|
|
1475
1326
|
return ((_response$data$length = (_response$data = response.data) == null ? void 0 : _response$data.length) != null ? _response$data$length : 0) <= 0;
|
|
1476
1327
|
},
|
|
1477
1328
|
enumerable: true
|
|
@@ -1493,7 +1344,6 @@ var handler$5 = {
|
|
|
1493
1344
|
switch (_context.prev = _context.next) {
|
|
1494
1345
|
case 0:
|
|
1495
1346
|
return _context.abrupt("return", null);
|
|
1496
|
-
|
|
1497
1347
|
case 2:
|
|
1498
1348
|
case "end":
|
|
1499
1349
|
return _context.stop();
|
|
@@ -1515,7 +1365,6 @@ var handler$5 = {
|
|
|
1515
1365
|
isEmpty: {
|
|
1516
1366
|
get: function get() {
|
|
1517
1367
|
var _response$data$length, _response$data;
|
|
1518
|
-
|
|
1519
1368
|
return ((_response$data$length = (_response$data = response.data) == null ? void 0 : _response$data.length) != null ? _response$data$length : 0) <= 0;
|
|
1520
1369
|
},
|
|
1521
1370
|
enumerable: true
|
|
@@ -1527,8 +1376,8 @@ var handler$5 = {
|
|
|
1527
1376
|
};
|
|
1528
1377
|
|
|
1529
1378
|
var initCommercetoolsSDKClient = function initCommercetoolsSDKClient(creds) {
|
|
1530
|
-
var scopes = ["manage_project:" + creds.projectKey];
|
|
1531
|
-
|
|
1379
|
+
var scopes = ["manage_project:" + creds.projectKey];
|
|
1380
|
+
// Configure authMiddlewareOptions
|
|
1532
1381
|
var authMiddlewareOptions = {
|
|
1533
1382
|
host: "https://auth." + creds.region + ".commercetools.com",
|
|
1534
1383
|
projectKey: creds.clientSecret,
|
|
@@ -1538,13 +1387,13 @@ var initCommercetoolsSDKClient = function initCommercetoolsSDKClient(creds) {
|
|
|
1538
1387
|
},
|
|
1539
1388
|
scopes: scopes,
|
|
1540
1389
|
fetch: fetch
|
|
1541
|
-
};
|
|
1542
|
-
|
|
1390
|
+
};
|
|
1391
|
+
// Configure httpMiddlewareOptions
|
|
1543
1392
|
var httpMiddlewareOptions = {
|
|
1544
1393
|
host: "https://api." + creds.region + ".commercetools.com",
|
|
1545
1394
|
fetch: fetch
|
|
1546
|
-
};
|
|
1547
|
-
|
|
1395
|
+
};
|
|
1396
|
+
// Export the ClientBuilder
|
|
1548
1397
|
return new sdkClientV2.ClientBuilder().withProjectKey(creds.projectKey).withClientCredentialsFlow(authMiddlewareOptions).withHttpMiddleware(httpMiddlewareOptions).build();
|
|
1549
1398
|
};
|
|
1550
1399
|
|
|
@@ -1562,21 +1411,17 @@ var getFetcher = function getFetcher(creds) {
|
|
|
1562
1411
|
case 0:
|
|
1563
1412
|
method = _ref.method, variables = _ref.variables, query = _ref.query, body = _ref.body;
|
|
1564
1413
|
queryBuilder = apiRoot;
|
|
1565
|
-
|
|
1566
1414
|
if (query) {
|
|
1567
1415
|
queryBuilder = queryBuilder[query]();
|
|
1568
1416
|
}
|
|
1569
|
-
|
|
1570
1417
|
if (variables != null && variables.id) {
|
|
1571
1418
|
queryBuilder = queryBuilder.withId({
|
|
1572
1419
|
ID: variables.id
|
|
1573
1420
|
});
|
|
1574
1421
|
}
|
|
1575
|
-
|
|
1576
1422
|
if (variables != null && variables.search) {
|
|
1577
1423
|
queryBuilder = queryBuilder.search();
|
|
1578
1424
|
}
|
|
1579
|
-
|
|
1580
1425
|
_context.next = 7;
|
|
1581
1426
|
return queryBuilder[method]({
|
|
1582
1427
|
body: body,
|
|
@@ -1591,10 +1436,8 @@ var getFetcher = function getFetcher(creds) {
|
|
|
1591
1436
|
where: variables.where
|
|
1592
1437
|
} : {})
|
|
1593
1438
|
}).execute();
|
|
1594
|
-
|
|
1595
1439
|
case 7:
|
|
1596
1440
|
return _context.abrupt("return", _context.sent);
|
|
1597
|
-
|
|
1598
1441
|
case 8:
|
|
1599
1442
|
case "end":
|
|
1600
1443
|
return _context.stop();
|
|
@@ -1602,7 +1445,6 @@ var getFetcher = function getFetcher(creds) {
|
|
|
1602
1445
|
}
|
|
1603
1446
|
}, _callee);
|
|
1604
1447
|
}));
|
|
1605
|
-
|
|
1606
1448
|
return function (_x) {
|
|
1607
1449
|
return _ref2.apply(this, arguments);
|
|
1608
1450
|
};
|
|
@@ -1663,10 +1505,10 @@ var commerceProviderMeta = {
|
|
|
1663
1505
|
};
|
|
1664
1506
|
function CommerceProviderComponent(props) {
|
|
1665
1507
|
var children = props.children,
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1508
|
+
projectKey = props.projectKey,
|
|
1509
|
+
clientId = props.clientId,
|
|
1510
|
+
clientSecret = props.clientSecret,
|
|
1511
|
+
region = props.region;
|
|
1670
1512
|
var creds = React__default.useMemo(function () {
|
|
1671
1513
|
return {
|
|
1672
1514
|
projectKey: projectKey,
|
|
@@ -1675,53 +1517,46 @@ function CommerceProviderComponent(props) {
|
|
|
1675
1517
|
region: region
|
|
1676
1518
|
};
|
|
1677
1519
|
}, [projectKey, clientId, clientSecret, region]);
|
|
1678
|
-
|
|
1679
1520
|
var _usePlasmicQueryData = query.usePlasmicQueryData(JSON.stringify({
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
return _context.stop();
|
|
1521
|
+
creds: creds
|
|
1522
|
+
}) + "locale", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
|
|
1523
|
+
var fetcher, project;
|
|
1524
|
+
return runtime_1.wrap(function _callee$(_context) {
|
|
1525
|
+
while (1) {
|
|
1526
|
+
switch (_context.prev = _context.next) {
|
|
1527
|
+
case 0:
|
|
1528
|
+
fetcher = getFetcher(creds);
|
|
1529
|
+
_context.next = 3;
|
|
1530
|
+
return fetcher({
|
|
1531
|
+
method: "get"
|
|
1532
|
+
});
|
|
1533
|
+
case 3:
|
|
1534
|
+
project = _context.sent;
|
|
1535
|
+
return _context.abrupt("return", project.body ? project.body.languages[0] : undefined);
|
|
1536
|
+
case 5:
|
|
1537
|
+
case "end":
|
|
1538
|
+
return _context.stop();
|
|
1539
|
+
}
|
|
1700
1540
|
}
|
|
1701
|
-
}
|
|
1702
|
-
},
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
isLoading = _usePlasmicQueryData.isLoading;
|
|
1707
|
-
|
|
1541
|
+
}, _callee);
|
|
1542
|
+
}))),
|
|
1543
|
+
locale = _usePlasmicQueryData.data,
|
|
1544
|
+
error = _usePlasmicQueryData.error,
|
|
1545
|
+
isLoading = _usePlasmicQueryData.isLoading;
|
|
1708
1546
|
var CommerceProvider = React__default.useMemo(function () {
|
|
1709
1547
|
return getCommerceProvider(creds, locale != null ? locale : "");
|
|
1710
1548
|
}, [creds, locale]);
|
|
1711
|
-
|
|
1712
1549
|
if (isLoading) {
|
|
1713
1550
|
return null;
|
|
1714
1551
|
} else if (error || !locale) {
|
|
1715
1552
|
throw new Error(error ? error.message : "Project language not found");
|
|
1716
1553
|
}
|
|
1717
|
-
|
|
1718
1554
|
return React__default.createElement(CommerceProvider, null, children);
|
|
1719
1555
|
}
|
|
1720
1556
|
function registerCommerceProvider(loader, customCommerceProviderMeta) {
|
|
1721
1557
|
var doRegisterComponent = function doRegisterComponent() {
|
|
1722
1558
|
return loader ? loader.registerGlobalContext.apply(loader, arguments) : registerGlobalContext.apply(void 0, arguments);
|
|
1723
1559
|
};
|
|
1724
|
-
|
|
1725
1560
|
doRegisterComponent(CommerceProviderComponent, customCommerceProviderMeta != null ? customCommerceProviderMeta : commerceProviderMeta);
|
|
1726
1561
|
}
|
|
1727
1562
|
|