@plasmicpkgs/commerce-shopify 0.0.4 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
- import registerComponent from '@plasmicapp/host/registerComponent';
2
1
  import React, { useMemo, useCallback } from 'react';
3
2
  import { FetcherError, ValidationError, CommerceError, useCart, useCommerce as useCommerce$1, getCommerceProvider as getCommerceProvider$1 } from '@plasmicpkgs/commerce';
4
3
  import Cookies from 'js-cookie';
5
- import debounce from 'lodash.debounce';
4
+ import debounce from 'lodash-es/debounce';
5
+ import registerGlobalContext from '@plasmicapp/host/registerGlobalContext';
6
6
 
7
7
  /*
8
8
  Forked from https://github.com/vercel/commerce/tree/main/packages/shopify/src
@@ -85,201 +85,198 @@ function createCommonjsModule(fn, module) {
85
85
  return module = { exports: {} }, fn(module, module.exports), module.exports;
86
86
  }
87
87
 
88
- var runtime_1 = createCommonjsModule(function (module) {
89
- /**
90
- * Copyright (c) 2014-present, Facebook, Inc.
91
- *
92
- * This source code is licensed under the MIT license found in the
93
- * LICENSE file in the root directory of this source tree.
94
- */
95
-
96
- var runtime = (function (exports) {
97
-
98
- var Op = Object.prototype;
99
- var hasOwn = Op.hasOwnProperty;
100
- var undefined$1; // More compressible than void 0.
101
- var $Symbol = typeof Symbol === "function" ? Symbol : {};
102
- var iteratorSymbol = $Symbol.iterator || "@@iterator";
103
- var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
104
- var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
105
-
106
- function define(obj, key, value) {
107
- Object.defineProperty(obj, key, {
108
- value: value,
109
- enumerable: true,
110
- configurable: true,
111
- writable: true
112
- });
113
- return obj[key];
114
- }
115
- try {
116
- // IE 8 has a broken Object.defineProperty that only works on DOM objects.
117
- define({}, "");
118
- } catch (err) {
119
- define = function(obj, key, value) {
120
- return obj[key] = value;
121
- };
122
- }
123
-
124
- function wrap(innerFn, outerFn, self, tryLocsList) {
125
- // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
126
- var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
127
- var generator = Object.create(protoGenerator.prototype);
128
- var context = new Context(tryLocsList || []);
129
-
130
- // The ._invoke method unifies the implementations of the .next,
131
- // .throw, and .return methods.
132
- generator._invoke = makeInvokeMethod(innerFn, self, context);
88
+ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
89
+ /**
90
+ * Copyright (c) 2014-present, Facebook, Inc.
91
+ *
92
+ * This source code is licensed under the MIT license found in the
93
+ * LICENSE file in the root directory of this source tree.
94
+ */
95
+ var runtime = function (exports) {
96
+
97
+ var Op = Object.prototype;
98
+ var hasOwn = Op.hasOwnProperty;
99
+ var undefined$1; // More compressible than void 0.
100
+
101
+ var $Symbol = typeof Symbol === "function" ? Symbol : {};
102
+ var iteratorSymbol = $Symbol.iterator || "@@iterator";
103
+ var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
104
+ var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
105
+
106
+ function define(obj, key, value) {
107
+ Object.defineProperty(obj, key, {
108
+ value: value,
109
+ enumerable: true,
110
+ configurable: true,
111
+ writable: true
112
+ });
113
+ return obj[key];
114
+ }
133
115
 
134
- return generator;
135
- }
136
- exports.wrap = wrap;
137
-
138
- // Try/catch helper to minimize deoptimizations. Returns a completion
139
- // record like context.tryEntries[i].completion. This interface could
140
- // have been (and was previously) designed to take a closure to be
141
- // invoked without arguments, but in all the cases we care about we
142
- // already have an existing method we want to call, so there's no need
143
- // to create a new function object. We can even get away with assuming
144
- // the method takes exactly one argument, since that happens to be true
145
- // in every case, so we don't have to touch the arguments object. The
146
- // only additional allocation required is the completion record, which
147
- // has a stable shape and so hopefully should be cheap to allocate.
148
- function tryCatch(fn, obj, arg) {
149
116
  try {
150
- return { type: "normal", arg: fn.call(obj, arg) };
117
+ // IE 8 has a broken Object.defineProperty that only works on DOM objects.
118
+ define({}, "");
151
119
  } catch (err) {
152
- return { type: "throw", arg: err };
120
+ define = function define(obj, key, value) {
121
+ return obj[key] = value;
122
+ };
153
123
  }
154
- }
155
124
 
156
- var GenStateSuspendedStart = "suspendedStart";
157
- var GenStateSuspendedYield = "suspendedYield";
158
- var GenStateExecuting = "executing";
159
- var GenStateCompleted = "completed";
160
-
161
- // Returning this object from the innerFn has the same effect as
162
- // breaking out of the dispatch switch statement.
163
- var ContinueSentinel = {};
164
-
165
- // Dummy constructor functions that we use as the .constructor and
166
- // .constructor.prototype properties for functions that return Generator
167
- // objects. For full spec compliance, you may wish to configure your
168
- // minifier not to mangle the names of these two functions.
169
- function Generator() {}
170
- function GeneratorFunction() {}
171
- function GeneratorFunctionPrototype() {}
172
-
173
- // This is a polyfill for %IteratorPrototype% for environments that
174
- // don't natively support it.
175
- var IteratorPrototype = {};
176
- define(IteratorPrototype, iteratorSymbol, function () {
177
- return this;
178
- });
125
+ function wrap(innerFn, outerFn, self, tryLocsList) {
126
+ // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
127
+ var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
128
+ var generator = Object.create(protoGenerator.prototype);
129
+ var context = new Context(tryLocsList || []); // The ._invoke method unifies the implementations of the .next,
130
+ // .throw, and .return methods.
179
131
 
180
- var getProto = Object.getPrototypeOf;
181
- var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
182
- if (NativeIteratorPrototype &&
183
- NativeIteratorPrototype !== Op &&
184
- hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
185
- // This environment has a native %IteratorPrototype%; use it instead
186
- // of the polyfill.
187
- IteratorPrototype = NativeIteratorPrototype;
188
- }
132
+ generator._invoke = makeInvokeMethod(innerFn, self, context);
133
+ return generator;
134
+ }
189
135
 
190
- var Gp = GeneratorFunctionPrototype.prototype =
191
- Generator.prototype = Object.create(IteratorPrototype);
192
- GeneratorFunction.prototype = GeneratorFunctionPrototype;
193
- define(Gp, "constructor", GeneratorFunctionPrototype);
194
- define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
195
- GeneratorFunction.displayName = define(
196
- GeneratorFunctionPrototype,
197
- toStringTagSymbol,
198
- "GeneratorFunction"
199
- );
200
-
201
- // Helper for defining the .next, .throw, and .return methods of the
202
- // Iterator interface in terms of a single ._invoke method.
203
- function defineIteratorMethods(prototype) {
204
- ["next", "throw", "return"].forEach(function(method) {
205
- define(prototype, method, function(arg) {
206
- return this._invoke(method, arg);
207
- });
208
- });
209
- }
136
+ exports.wrap = wrap; // Try/catch helper to minimize deoptimizations. Returns a completion
137
+ // record like context.tryEntries[i].completion. This interface could
138
+ // have been (and was previously) designed to take a closure to be
139
+ // invoked without arguments, but in all the cases we care about we
140
+ // already have an existing method we want to call, so there's no need
141
+ // to create a new function object. We can even get away with assuming
142
+ // the method takes exactly one argument, since that happens to be true
143
+ // in every case, so we don't have to touch the arguments object. The
144
+ // only additional allocation required is the completion record, which
145
+ // has a stable shape and so hopefully should be cheap to allocate.
146
+
147
+ function tryCatch(fn, obj, arg) {
148
+ try {
149
+ return {
150
+ type: "normal",
151
+ arg: fn.call(obj, arg)
152
+ };
153
+ } catch (err) {
154
+ return {
155
+ type: "throw",
156
+ arg: err
157
+ };
158
+ }
159
+ }
160
+
161
+ var GenStateSuspendedStart = "suspendedStart";
162
+ var GenStateSuspendedYield = "suspendedYield";
163
+ var GenStateExecuting = "executing";
164
+ var GenStateCompleted = "completed"; // Returning this object from the innerFn has the same effect as
165
+ // breaking out of the dispatch switch statement.
166
+
167
+ var ContinueSentinel = {}; // Dummy constructor functions that we use as the .constructor and
168
+ // .constructor.prototype properties for functions that return Generator
169
+ // objects. For full spec compliance, you may wish to configure your
170
+ // minifier not to mangle the names of these two functions.
171
+
172
+ function Generator() {}
173
+
174
+ function GeneratorFunction() {}
175
+
176
+ function GeneratorFunctionPrototype() {} // This is a polyfill for %IteratorPrototype% for environments that
177
+ // don't natively support it.
210
178
 
211
- exports.isGeneratorFunction = function(genFun) {
212
- var ctor = typeof genFun === "function" && genFun.constructor;
213
- return ctor
214
- ? ctor === GeneratorFunction ||
215
- // For the native GeneratorFunction constructor, the best we can
216
- // do is to check its .name property.
217
- (ctor.displayName || ctor.name) === "GeneratorFunction"
218
- : false;
219
- };
220
179
 
221
- exports.mark = function(genFun) {
222
- if (Object.setPrototypeOf) {
223
- Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
224
- } else {
225
- genFun.__proto__ = GeneratorFunctionPrototype;
226
- define(genFun, toStringTagSymbol, "GeneratorFunction");
180
+ var IteratorPrototype = {};
181
+
182
+ IteratorPrototype[iteratorSymbol] = function () {
183
+ return this;
184
+ };
185
+
186
+ var getProto = Object.getPrototypeOf;
187
+ var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
188
+
189
+ if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
190
+ // This environment has a native %IteratorPrototype%; use it instead
191
+ // of the polyfill.
192
+ IteratorPrototype = NativeIteratorPrototype;
227
193
  }
228
- genFun.prototype = Object.create(Gp);
229
- return genFun;
230
- };
231
194
 
232
- // Within the body of any async function, `await x` is transformed to
233
- // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
234
- // `hasOwn.call(value, "__await")` to determine if the yielded value is
235
- // meant to be awaited.
236
- exports.awrap = function(arg) {
237
- return { __await: arg };
238
- };
195
+ var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
196
+ GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
197
+ GeneratorFunctionPrototype.constructor = GeneratorFunction;
198
+ GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"); // Helper for defining the .next, .throw, and .return methods of the
199
+ // Iterator interface in terms of a single ._invoke method.
239
200
 
240
- function AsyncIterator(generator, PromiseImpl) {
241
- function invoke(method, arg, resolve, reject) {
242
- var record = tryCatch(generator[method], generator, arg);
243
- if (record.type === "throw") {
244
- reject(record.arg);
201
+ function defineIteratorMethods(prototype) {
202
+ ["next", "throw", "return"].forEach(function (method) {
203
+ define(prototype, method, function (arg) {
204
+ return this._invoke(method, arg);
205
+ });
206
+ });
207
+ }
208
+
209
+ exports.isGeneratorFunction = function (genFun) {
210
+ var ctor = typeof genFun === "function" && genFun.constructor;
211
+ return ctor ? ctor === GeneratorFunction || // For the native GeneratorFunction constructor, the best we can
212
+ // do is to check its .name property.
213
+ (ctor.displayName || ctor.name) === "GeneratorFunction" : false;
214
+ };
215
+
216
+ exports.mark = function (genFun) {
217
+ if (Object.setPrototypeOf) {
218
+ Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
245
219
  } else {
246
- var result = record.arg;
247
- var value = result.value;
248
- if (value &&
249
- typeof value === "object" &&
250
- hasOwn.call(value, "__await")) {
251
- return PromiseImpl.resolve(value.__await).then(function(value) {
252
- invoke("next", value, resolve, reject);
253
- }, function(err) {
254
- invoke("throw", err, resolve, reject);
220
+ genFun.__proto__ = GeneratorFunctionPrototype;
221
+ define(genFun, toStringTagSymbol, "GeneratorFunction");
222
+ }
223
+
224
+ genFun.prototype = Object.create(Gp);
225
+ return genFun;
226
+ }; // Within the body of any async function, `await x` is transformed to
227
+ // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
228
+ // `hasOwn.call(value, "__await")` to determine if the yielded value is
229
+ // meant to be awaited.
230
+
231
+
232
+ exports.awrap = function (arg) {
233
+ return {
234
+ __await: arg
235
+ };
236
+ };
237
+
238
+ function AsyncIterator(generator, PromiseImpl) {
239
+ function invoke(method, arg, resolve, reject) {
240
+ var record = tryCatch(generator[method], generator, arg);
241
+
242
+ if (record.type === "throw") {
243
+ reject(record.arg);
244
+ } else {
245
+ var result = record.arg;
246
+ var value = result.value;
247
+
248
+ if (value && typeof value === "object" && hasOwn.call(value, "__await")) {
249
+ return PromiseImpl.resolve(value.__await).then(function (value) {
250
+ invoke("next", value, resolve, reject);
251
+ }, function (err) {
252
+ invoke("throw", err, resolve, reject);
253
+ });
254
+ }
255
+
256
+ return PromiseImpl.resolve(value).then(function (unwrapped) {
257
+ // When a yielded Promise is resolved, its final value becomes
258
+ // the .value of the Promise<{value,done}> result for the
259
+ // current iteration.
260
+ result.value = unwrapped;
261
+ resolve(result);
262
+ }, function (error) {
263
+ // If a rejected Promise was yielded, throw the rejection back
264
+ // into the async generator function so it can be handled there.
265
+ return invoke("throw", error, resolve, reject);
255
266
  });
256
267
  }
257
-
258
- return PromiseImpl.resolve(value).then(function(unwrapped) {
259
- // When a yielded Promise is resolved, its final value becomes
260
- // the .value of the Promise<{value,done}> result for the
261
- // current iteration.
262
- result.value = unwrapped;
263
- resolve(result);
264
- }, function(error) {
265
- // If a rejected Promise was yielded, throw the rejection back
266
- // into the async generator function so it can be handled there.
267
- return invoke("throw", error, resolve, reject);
268
- });
269
268
  }
270
- }
271
269
 
272
- var previousPromise;
270
+ var previousPromise;
273
271
 
274
- function enqueue(method, arg) {
275
- function callInvokeWithMethodAndArg() {
276
- return new PromiseImpl(function(resolve, reject) {
277
- invoke(method, arg, resolve, reject);
278
- });
279
- }
272
+ function enqueue(method, arg) {
273
+ function callInvokeWithMethodAndArg() {
274
+ return new PromiseImpl(function (resolve, reject) {
275
+ invoke(method, arg, resolve, reject);
276
+ });
277
+ }
280
278
 
281
- return previousPromise =
282
- // If enqueue has been called before, then we want to wait until
279
+ return previousPromise = // If enqueue has been called before, then we want to wait until
283
280
  // all previous Promises have been resolved before calling invoke,
284
281
  // so that results are always delivered in the correct order. If
285
282
  // enqueue has not been called before, then it is important to
@@ -291,554 +288,525 @@ var runtime = (function (exports) {
291
288
  // execute code before the first await. Since we implement simple
292
289
  // async functions in terms of async generators, it is especially
293
290
  // important to get this right, even though it requires care.
294
- previousPromise ? previousPromise.then(
295
- callInvokeWithMethodAndArg,
296
- // Avoid propagating failures to Promises returned by later
297
- // invocations of the iterator.
298
- callInvokeWithMethodAndArg
299
- ) : callInvokeWithMethodAndArg();
291
+ previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, // Avoid propagating failures to Promises returned by later
292
+ // invocations of the iterator.
293
+ callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
294
+ } // Define the unified helper method that is used to implement .next,
295
+ // .throw, and .return (see defineIteratorMethods).
296
+
297
+
298
+ this._invoke = enqueue;
300
299
  }
301
300
 
302
- // Define the unified helper method that is used to implement .next,
303
- // .throw, and .return (see defineIteratorMethods).
304
- this._invoke = enqueue;
305
- }
301
+ defineIteratorMethods(AsyncIterator.prototype);
306
302
 
307
- defineIteratorMethods(AsyncIterator.prototype);
308
- define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
309
- return this;
310
- });
311
- exports.AsyncIterator = AsyncIterator;
312
-
313
- // Note that simple async functions are implemented on top of
314
- // AsyncIterator objects; they just return a Promise for the value of
315
- // the final result produced by the iterator.
316
- exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
317
- if (PromiseImpl === void 0) PromiseImpl = Promise;
318
-
319
- var iter = new AsyncIterator(
320
- wrap(innerFn, outerFn, self, tryLocsList),
321
- PromiseImpl
322
- );
323
-
324
- return exports.isGeneratorFunction(outerFn)
325
- ? iter // If outerFn is a generator, return the full iterator.
326
- : iter.next().then(function(result) {
327
- return result.done ? result.value : iter.next();
328
- });
329
- };
303
+ AsyncIterator.prototype[asyncIteratorSymbol] = function () {
304
+ return this;
305
+ };
330
306
 
331
- function makeInvokeMethod(innerFn, self, context) {
332
- var state = GenStateSuspendedStart;
307
+ exports.AsyncIterator = AsyncIterator; // Note that simple async functions are implemented on top of
308
+ // AsyncIterator objects; they just return a Promise for the value of
309
+ // the final result produced by the iterator.
333
310
 
334
- return function invoke(method, arg) {
335
- if (state === GenStateExecuting) {
336
- throw new Error("Generator is already running");
337
- }
311
+ exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
312
+ if (PromiseImpl === void 0) PromiseImpl = Promise;
313
+ var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
314
+ return exports.isGeneratorFunction(outerFn) ? iter // If outerFn is a generator, return the full iterator.
315
+ : iter.next().then(function (result) {
316
+ return result.done ? result.value : iter.next();
317
+ });
318
+ };
338
319
 
339
- if (state === GenStateCompleted) {
340
- if (method === "throw") {
341
- throw arg;
320
+ function makeInvokeMethod(innerFn, self, context) {
321
+ var state = GenStateSuspendedStart;
322
+ return function invoke(method, arg) {
323
+ if (state === GenStateExecuting) {
324
+ throw new Error("Generator is already running");
342
325
  }
343
326
 
344
- // Be forgiving, per 25.3.3.3.3 of the spec:
345
- // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
346
- return doneResult();
347
- }
327
+ if (state === GenStateCompleted) {
328
+ if (method === "throw") {
329
+ throw arg;
330
+ } // Be forgiving, per 25.3.3.3.3 of the spec:
331
+ // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
348
332
 
349
- context.method = method;
350
- context.arg = arg;
351
333
 
352
- while (true) {
353
- var delegate = context.delegate;
354
- if (delegate) {
355
- var delegateResult = maybeInvokeDelegate(delegate, context);
356
- if (delegateResult) {
357
- if (delegateResult === ContinueSentinel) continue;
358
- return delegateResult;
359
- }
334
+ return doneResult();
360
335
  }
361
336
 
362
- if (context.method === "next") {
363
- // Setting context._sent for legacy support of Babel's
364
- // function.sent implementation.
365
- context.sent = context._sent = context.arg;
337
+ context.method = method;
338
+ context.arg = arg;
339
+
340
+ while (true) {
341
+ var delegate = context.delegate;
342
+
343
+ if (delegate) {
344
+ var delegateResult = maybeInvokeDelegate(delegate, context);
345
+
346
+ if (delegateResult) {
347
+ if (delegateResult === ContinueSentinel) continue;
348
+ return delegateResult;
349
+ }
350
+ }
351
+
352
+ if (context.method === "next") {
353
+ // Setting context._sent for legacy support of Babel's
354
+ // function.sent implementation.
355
+ context.sent = context._sent = context.arg;
356
+ } else if (context.method === "throw") {
357
+ if (state === GenStateSuspendedStart) {
358
+ state = GenStateCompleted;
359
+ throw context.arg;
360
+ }
366
361
 
367
- } else if (context.method === "throw") {
368
- if (state === GenStateSuspendedStart) {
369
- state = GenStateCompleted;
370
- throw context.arg;
362
+ context.dispatchException(context.arg);
363
+ } else if (context.method === "return") {
364
+ context.abrupt("return", context.arg);
371
365
  }
372
366
 
373
- context.dispatchException(context.arg);
367
+ state = GenStateExecuting;
368
+ var record = tryCatch(innerFn, self, context);
374
369
 
375
- } else if (context.method === "return") {
376
- context.abrupt("return", context.arg);
377
- }
370
+ if (record.type === "normal") {
371
+ // If an exception is thrown from innerFn, we leave state ===
372
+ // GenStateExecuting and loop back for another invocation.
373
+ state = context.done ? GenStateCompleted : GenStateSuspendedYield;
378
374
 
379
- state = GenStateExecuting;
375
+ if (record.arg === ContinueSentinel) {
376
+ continue;
377
+ }
380
378
 
381
- var record = tryCatch(innerFn, self, context);
382
- if (record.type === "normal") {
383
- // If an exception is thrown from innerFn, we leave state ===
384
- // GenStateExecuting and loop back for another invocation.
385
- state = context.done
386
- ? GenStateCompleted
387
- : GenStateSuspendedYield;
379
+ return {
380
+ value: record.arg,
381
+ done: context.done
382
+ };
383
+ } else if (record.type === "throw") {
384
+ state = GenStateCompleted; // Dispatch the exception by looping back around to the
385
+ // context.dispatchException(context.arg) call above.
388
386
 
389
- if (record.arg === ContinueSentinel) {
390
- continue;
387
+ context.method = "throw";
388
+ context.arg = record.arg;
389
+ }
390
+ }
391
+ };
392
+ } // Call delegate.iterator[context.method](context.arg) and handle the
393
+ // result, either by returning a { value, done } result from the
394
+ // delegate iterator, or by modifying context.method and context.arg,
395
+ // setting context.delegate to null, and returning the ContinueSentinel.
396
+
397
+
398
+ function maybeInvokeDelegate(delegate, context) {
399
+ var method = delegate.iterator[context.method];
400
+
401
+ if (method === undefined$1) {
402
+ // A .throw or .return when the delegate iterator has no .throw
403
+ // method always terminates the yield* loop.
404
+ context.delegate = null;
405
+
406
+ if (context.method === "throw") {
407
+ // Note: ["return"] must be used for ES3 parsing compatibility.
408
+ if (delegate.iterator["return"]) {
409
+ // If the delegate iterator has a return method, give it a
410
+ // chance to clean up.
411
+ context.method = "return";
412
+ context.arg = undefined$1;
413
+ maybeInvokeDelegate(delegate, context);
414
+
415
+ if (context.method === "throw") {
416
+ // If maybeInvokeDelegate(context) changed context.method from
417
+ // "return" to "throw", let that override the TypeError below.
418
+ return ContinueSentinel;
419
+ }
391
420
  }
392
421
 
393
- return {
394
- value: record.arg,
395
- done: context.done
396
- };
397
-
398
- } else if (record.type === "throw") {
399
- state = GenStateCompleted;
400
- // Dispatch the exception by looping back around to the
401
- // context.dispatchException(context.arg) call above.
402
422
  context.method = "throw";
403
- context.arg = record.arg;
423
+ context.arg = new TypeError("The iterator does not provide a 'throw' method");
404
424
  }
425
+
426
+ return ContinueSentinel;
405
427
  }
406
- };
407
- }
408
428
 
409
- // Call delegate.iterator[context.method](context.arg) and handle the
410
- // result, either by returning a { value, done } result from the
411
- // delegate iterator, or by modifying context.method and context.arg,
412
- // setting context.delegate to null, and returning the ContinueSentinel.
413
- function maybeInvokeDelegate(delegate, context) {
414
- var method = delegate.iterator[context.method];
415
- if (method === undefined$1) {
416
- // A .throw or .return when the delegate iterator has no .throw
417
- // method always terminates the yield* loop.
418
- context.delegate = null;
429
+ var record = tryCatch(method, delegate.iterator, context.arg);
419
430
 
420
- if (context.method === "throw") {
421
- // Note: ["return"] must be used for ES3 parsing compatibility.
422
- if (delegate.iterator["return"]) {
423
- // If the delegate iterator has a return method, give it a
424
- // chance to clean up.
425
- context.method = "return";
426
- context.arg = undefined$1;
427
- maybeInvokeDelegate(delegate, context);
431
+ if (record.type === "throw") {
432
+ context.method = "throw";
433
+ context.arg = record.arg;
434
+ context.delegate = null;
435
+ return ContinueSentinel;
436
+ }
428
437
 
429
- if (context.method === "throw") {
430
- // If maybeInvokeDelegate(context) changed context.method from
431
- // "return" to "throw", let that override the TypeError below.
432
- return ContinueSentinel;
433
- }
434
- }
438
+ var info = record.arg;
435
439
 
440
+ if (!info) {
436
441
  context.method = "throw";
437
- context.arg = new TypeError(
438
- "The iterator does not provide a 'throw' method");
442
+ context.arg = new TypeError("iterator result is not an object");
443
+ context.delegate = null;
444
+ return ContinueSentinel;
439
445
  }
440
446
 
441
- return ContinueSentinel;
442
- }
447
+ if (info.done) {
448
+ // Assign the result of the finished delegate to the temporary
449
+ // variable specified by delegate.resultName (see delegateYield).
450
+ context[delegate.resultName] = info.value; // Resume execution at the desired location (see delegateYield).
443
451
 
444
- var record = tryCatch(method, delegate.iterator, context.arg);
452
+ context.next = delegate.nextLoc; // If context.method was "throw" but the delegate handled the
453
+ // exception, let the outer generator proceed normally. If
454
+ // context.method was "next", forget context.arg since it has been
455
+ // "consumed" by the delegate iterator. If context.method was
456
+ // "return", allow the original .return call to continue in the
457
+ // outer generator.
445
458
 
446
- if (record.type === "throw") {
447
- context.method = "throw";
448
- context.arg = record.arg;
449
- context.delegate = null;
450
- return ContinueSentinel;
451
- }
459
+ if (context.method !== "return") {
460
+ context.method = "next";
461
+ context.arg = undefined$1;
462
+ }
463
+ } else {
464
+ // Re-yield the result returned by the delegate method.
465
+ return info;
466
+ } // The delegate iterator is finished, so forget it and continue with
467
+ // the outer generator.
452
468
 
453
- var info = record.arg;
454
469
 
455
- if (! info) {
456
- context.method = "throw";
457
- context.arg = new TypeError("iterator result is not an object");
458
470
  context.delegate = null;
459
471
  return ContinueSentinel;
460
- }
461
-
462
- if (info.done) {
463
- // Assign the result of the finished delegate to the temporary
464
- // variable specified by delegate.resultName (see delegateYield).
465
- context[delegate.resultName] = info.value;
466
-
467
- // Resume execution at the desired location (see delegateYield).
468
- context.next = delegate.nextLoc;
469
-
470
- // If context.method was "throw" but the delegate handled the
471
- // exception, let the outer generator proceed normally. If
472
- // context.method was "next", forget context.arg since it has been
473
- // "consumed" by the delegate iterator. If context.method was
474
- // "return", allow the original .return call to continue in the
475
- // outer generator.
476
- if (context.method !== "return") {
477
- context.method = "next";
478
- context.arg = undefined$1;
479
- }
472
+ } // Define Generator.prototype.{next,throw,return} in terms of the
473
+ // unified ._invoke helper method.
480
474
 
481
- } else {
482
- // Re-yield the result returned by the delegate method.
483
- return info;
484
- }
485
475
 
486
- // The delegate iterator is finished, so forget it and continue with
487
- // the outer generator.
488
- context.delegate = null;
489
- return ContinueSentinel;
490
- }
476
+ defineIteratorMethods(Gp);
477
+ define(Gp, toStringTagSymbol, "Generator"); // A Generator should always return itself as the iterator object when the
478
+ // @@iterator function is called on it. Some browsers' implementations of the
479
+ // iterator prototype chain incorrectly implement this, causing the Generator
480
+ // object to not be returned from this call. This ensures that doesn't happen.
481
+ // See https://github.com/facebook/regenerator/issues/274 for more details.
491
482
 
492
- // Define Generator.prototype.{next,throw,return} in terms of the
493
- // unified ._invoke helper method.
494
- defineIteratorMethods(Gp);
483
+ Gp[iteratorSymbol] = function () {
484
+ return this;
485
+ };
495
486
 
496
- define(Gp, toStringTagSymbol, "Generator");
487
+ Gp.toString = function () {
488
+ return "[object Generator]";
489
+ };
497
490
 
498
- // A Generator should always return itself as the iterator object when the
499
- // @@iterator function is called on it. Some browsers' implementations of the
500
- // iterator prototype chain incorrectly implement this, causing the Generator
501
- // object to not be returned from this call. This ensures that doesn't happen.
502
- // See https://github.com/facebook/regenerator/issues/274 for more details.
503
- define(Gp, iteratorSymbol, function() {
504
- return this;
505
- });
491
+ function pushTryEntry(locs) {
492
+ var entry = {
493
+ tryLoc: locs[0]
494
+ };
506
495
 
507
- define(Gp, "toString", function() {
508
- return "[object Generator]";
509
- });
496
+ if (1 in locs) {
497
+ entry.catchLoc = locs[1];
498
+ }
510
499
 
511
- function pushTryEntry(locs) {
512
- var entry = { tryLoc: locs[0] };
500
+ if (2 in locs) {
501
+ entry.finallyLoc = locs[2];
502
+ entry.afterLoc = locs[3];
503
+ }
513
504
 
514
- if (1 in locs) {
515
- entry.catchLoc = locs[1];
505
+ this.tryEntries.push(entry);
516
506
  }
517
507
 
518
- if (2 in locs) {
519
- entry.finallyLoc = locs[2];
520
- entry.afterLoc = locs[3];
508
+ function resetTryEntry(entry) {
509
+ var record = entry.completion || {};
510
+ record.type = "normal";
511
+ delete record.arg;
512
+ entry.completion = record;
521
513
  }
522
514
 
523
- this.tryEntries.push(entry);
524
- }
525
-
526
- function resetTryEntry(entry) {
527
- var record = entry.completion || {};
528
- record.type = "normal";
529
- delete record.arg;
530
- entry.completion = record;
531
- }
532
-
533
- function Context(tryLocsList) {
534
- // The root entry object (effectively a try statement without a catch
535
- // or a finally block) gives us a place to store values thrown from
536
- // locations where there is no enclosing try statement.
537
- this.tryEntries = [{ tryLoc: "root" }];
538
- tryLocsList.forEach(pushTryEntry, this);
539
- this.reset(true);
540
- }
541
-
542
- exports.keys = function(object) {
543
- var keys = [];
544
- for (var key in object) {
545
- keys.push(key);
515
+ function Context(tryLocsList) {
516
+ // The root entry object (effectively a try statement without a catch
517
+ // or a finally block) gives us a place to store values thrown from
518
+ // locations where there is no enclosing try statement.
519
+ this.tryEntries = [{
520
+ tryLoc: "root"
521
+ }];
522
+ tryLocsList.forEach(pushTryEntry, this);
523
+ this.reset(true);
546
524
  }
547
- keys.reverse();
548
-
549
- // Rather than returning an object with a next method, we keep
550
- // things simple and return the next function itself.
551
- return function next() {
552
- while (keys.length) {
553
- var key = keys.pop();
554
- if (key in object) {
555
- next.value = key;
556
- next.done = false;
557
- return next;
558
- }
559
- }
560
525
 
561
- // To avoid creating an additional object, we just hang the .value
562
- // and .done properties off the next function object itself. This
563
- // also ensures that the minifier will not anonymize the function.
564
- next.done = true;
565
- return next;
566
- };
567
- };
526
+ exports.keys = function (object) {
527
+ var keys = [];
568
528
 
569
- function values(iterable) {
570
- if (iterable) {
571
- var iteratorMethod = iterable[iteratorSymbol];
572
- if (iteratorMethod) {
573
- return iteratorMethod.call(iterable);
529
+ for (var key in object) {
530
+ keys.push(key);
574
531
  }
575
532
 
576
- if (typeof iterable.next === "function") {
577
- return iterable;
578
- }
533
+ keys.reverse(); // Rather than returning an object with a next method, we keep
534
+ // things simple and return the next function itself.
579
535
 
580
- if (!isNaN(iterable.length)) {
581
- var i = -1, next = function next() {
582
- while (++i < iterable.length) {
583
- if (hasOwn.call(iterable, i)) {
584
- next.value = iterable[i];
585
- next.done = false;
586
- return next;
587
- }
588
- }
536
+ return function next() {
537
+ while (keys.length) {
538
+ var key = keys.pop();
589
539
 
590
- next.value = undefined$1;
591
- next.done = true;
540
+ if (key in object) {
541
+ next.value = key;
542
+ next.done = false;
543
+ return next;
544
+ }
545
+ } // To avoid creating an additional object, we just hang the .value
546
+ // and .done properties off the next function object itself. This
547
+ // also ensures that the minifier will not anonymize the function.
592
548
 
593
- return next;
594
- };
595
549
 
596
- return next.next = next;
597
- }
598
- }
550
+ next.done = true;
551
+ return next;
552
+ };
553
+ };
599
554
 
600
- // Return an iterator with no values.
601
- return { next: doneResult };
602
- }
603
- exports.values = values;
555
+ function values(iterable) {
556
+ if (iterable) {
557
+ var iteratorMethod = iterable[iteratorSymbol];
604
558
 
605
- function doneResult() {
606
- return { value: undefined$1, done: true };
607
- }
559
+ if (iteratorMethod) {
560
+ return iteratorMethod.call(iterable);
561
+ }
608
562
 
609
- Context.prototype = {
610
- constructor: Context,
611
-
612
- reset: function(skipTempReset) {
613
- this.prev = 0;
614
- this.next = 0;
615
- // Resetting context._sent for legacy support of Babel's
616
- // function.sent implementation.
617
- this.sent = this._sent = undefined$1;
618
- this.done = false;
619
- this.delegate = null;
620
-
621
- this.method = "next";
622
- this.arg = undefined$1;
623
-
624
- this.tryEntries.forEach(resetTryEntry);
625
-
626
- if (!skipTempReset) {
627
- for (var name in this) {
628
- // Not sure about the optimal order of these conditions:
629
- if (name.charAt(0) === "t" &&
630
- hasOwn.call(this, name) &&
631
- !isNaN(+name.slice(1))) {
632
- this[name] = undefined$1;
633
- }
563
+ if (typeof iterable.next === "function") {
564
+ return iterable;
634
565
  }
635
- }
636
- },
637
566
 
638
- stop: function() {
639
- this.done = true;
567
+ if (!isNaN(iterable.length)) {
568
+ var i = -1,
569
+ next = function next() {
570
+ while (++i < iterable.length) {
571
+ if (hasOwn.call(iterable, i)) {
572
+ next.value = iterable[i];
573
+ next.done = false;
574
+ return next;
575
+ }
576
+ }
577
+
578
+ next.value = undefined$1;
579
+ next.done = true;
580
+ return next;
581
+ };
640
582
 
641
- var rootEntry = this.tryEntries[0];
642
- var rootRecord = rootEntry.completion;
643
- if (rootRecord.type === "throw") {
644
- throw rootRecord.arg;
645
- }
583
+ return next.next = next;
584
+ }
585
+ } // Return an iterator with no values.
646
586
 
647
- return this.rval;
648
- },
649
587
 
650
- dispatchException: function(exception) {
651
- if (this.done) {
652
- throw exception;
653
- }
588
+ return {
589
+ next: doneResult
590
+ };
591
+ }
654
592
 
655
- var context = this;
656
- function handle(loc, caught) {
657
- record.type = "throw";
658
- record.arg = exception;
659
- context.next = loc;
593
+ exports.values = values;
660
594
 
661
- if (caught) {
662
- // If the dispatched exception was caught by a catch block,
663
- // then let that catch block handle the exception normally.
664
- context.method = "next";
665
- context.arg = undefined$1;
666
- }
595
+ function doneResult() {
596
+ return {
597
+ value: undefined$1,
598
+ done: true
599
+ };
600
+ }
667
601
 
668
- return !! caught;
669
- }
602
+ Context.prototype = {
603
+ constructor: Context,
604
+ reset: function reset(skipTempReset) {
605
+ this.prev = 0;
606
+ this.next = 0; // Resetting context._sent for legacy support of Babel's
607
+ // function.sent implementation.
670
608
 
671
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
672
- var entry = this.tryEntries[i];
673
- var record = entry.completion;
609
+ this.sent = this._sent = undefined$1;
610
+ this.done = false;
611
+ this.delegate = null;
612
+ this.method = "next";
613
+ this.arg = undefined$1;
614
+ this.tryEntries.forEach(resetTryEntry);
674
615
 
675
- if (entry.tryLoc === "root") {
676
- // Exception thrown outside of any try block that could handle
677
- // it, so set the completion value of the entire function to
678
- // throw the exception.
679
- return handle("end");
616
+ if (!skipTempReset) {
617
+ for (var name in this) {
618
+ // Not sure about the optimal order of these conditions:
619
+ if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) {
620
+ this[name] = undefined$1;
621
+ }
622
+ }
680
623
  }
624
+ },
625
+ stop: function stop() {
626
+ this.done = true;
627
+ var rootEntry = this.tryEntries[0];
628
+ var rootRecord = rootEntry.completion;
681
629
 
682
- if (entry.tryLoc <= this.prev) {
683
- var hasCatch = hasOwn.call(entry, "catchLoc");
684
- var hasFinally = hasOwn.call(entry, "finallyLoc");
630
+ if (rootRecord.type === "throw") {
631
+ throw rootRecord.arg;
632
+ }
685
633
 
686
- if (hasCatch && hasFinally) {
687
- if (this.prev < entry.catchLoc) {
688
- return handle(entry.catchLoc, true);
689
- } else if (this.prev < entry.finallyLoc) {
690
- return handle(entry.finallyLoc);
691
- }
634
+ return this.rval;
635
+ },
636
+ dispatchException: function dispatchException(exception) {
637
+ if (this.done) {
638
+ throw exception;
639
+ }
692
640
 
693
- } else if (hasCatch) {
694
- if (this.prev < entry.catchLoc) {
695
- return handle(entry.catchLoc, true);
696
- }
641
+ var context = this;
697
642
 
698
- } else if (hasFinally) {
699
- if (this.prev < entry.finallyLoc) {
700
- return handle(entry.finallyLoc);
701
- }
643
+ function handle(loc, caught) {
644
+ record.type = "throw";
645
+ record.arg = exception;
646
+ context.next = loc;
702
647
 
703
- } else {
704
- throw new Error("try statement without catch or finally");
648
+ if (caught) {
649
+ // If the dispatched exception was caught by a catch block,
650
+ // then let that catch block handle the exception normally.
651
+ context.method = "next";
652
+ context.arg = undefined$1;
705
653
  }
706
- }
707
- }
708
- },
709
654
 
710
- abrupt: function(type, arg) {
711
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
712
- var entry = this.tryEntries[i];
713
- if (entry.tryLoc <= this.prev &&
714
- hasOwn.call(entry, "finallyLoc") &&
715
- this.prev < entry.finallyLoc) {
716
- var finallyEntry = entry;
717
- break;
655
+ return !!caught;
718
656
  }
719
- }
720
657
 
721
- if (finallyEntry &&
722
- (type === "break" ||
723
- type === "continue") &&
724
- finallyEntry.tryLoc <= arg &&
725
- arg <= finallyEntry.finallyLoc) {
726
- // Ignore the finally entry if control is not jumping to a
727
- // location outside the try/catch block.
728
- finallyEntry = null;
729
- }
658
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
659
+ var entry = this.tryEntries[i];
660
+ var record = entry.completion;
730
661
 
731
- var record = finallyEntry ? finallyEntry.completion : {};
732
- record.type = type;
733
- record.arg = arg;
662
+ if (entry.tryLoc === "root") {
663
+ // Exception thrown outside of any try block that could handle
664
+ // it, so set the completion value of the entire function to
665
+ // throw the exception.
666
+ return handle("end");
667
+ }
734
668
 
735
- if (finallyEntry) {
736
- this.method = "next";
737
- this.next = finallyEntry.finallyLoc;
738
- return ContinueSentinel;
739
- }
669
+ if (entry.tryLoc <= this.prev) {
670
+ var hasCatch = hasOwn.call(entry, "catchLoc");
671
+ var hasFinally = hasOwn.call(entry, "finallyLoc");
740
672
 
741
- return this.complete(record);
742
- },
673
+ if (hasCatch && hasFinally) {
674
+ if (this.prev < entry.catchLoc) {
675
+ return handle(entry.catchLoc, true);
676
+ } else if (this.prev < entry.finallyLoc) {
677
+ return handle(entry.finallyLoc);
678
+ }
679
+ } else if (hasCatch) {
680
+ if (this.prev < entry.catchLoc) {
681
+ return handle(entry.catchLoc, true);
682
+ }
683
+ } else if (hasFinally) {
684
+ if (this.prev < entry.finallyLoc) {
685
+ return handle(entry.finallyLoc);
686
+ }
687
+ } else {
688
+ throw new Error("try statement without catch or finally");
689
+ }
690
+ }
691
+ }
692
+ },
693
+ abrupt: function abrupt(type, arg) {
694
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
695
+ var entry = this.tryEntries[i];
743
696
 
744
- complete: function(record, afterLoc) {
745
- if (record.type === "throw") {
746
- throw record.arg;
747
- }
697
+ if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
698
+ var finallyEntry = entry;
699
+ break;
700
+ }
701
+ }
748
702
 
749
- if (record.type === "break" ||
750
- record.type === "continue") {
751
- this.next = record.arg;
752
- } else if (record.type === "return") {
753
- this.rval = this.arg = record.arg;
754
- this.method = "return";
755
- this.next = "end";
756
- } else if (record.type === "normal" && afterLoc) {
757
- this.next = afterLoc;
758
- }
703
+ if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
704
+ // Ignore the finally entry if control is not jumping to a
705
+ // location outside the try/catch block.
706
+ finallyEntry = null;
707
+ }
759
708
 
760
- return ContinueSentinel;
761
- },
709
+ var record = finallyEntry ? finallyEntry.completion : {};
710
+ record.type = type;
711
+ record.arg = arg;
762
712
 
763
- finish: function(finallyLoc) {
764
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
765
- var entry = this.tryEntries[i];
766
- if (entry.finallyLoc === finallyLoc) {
767
- this.complete(entry.completion, entry.afterLoc);
768
- resetTryEntry(entry);
713
+ if (finallyEntry) {
714
+ this.method = "next";
715
+ this.next = finallyEntry.finallyLoc;
769
716
  return ContinueSentinel;
770
717
  }
771
- }
772
- },
773
718
 
774
- "catch": function(tryLoc) {
775
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
776
- var entry = this.tryEntries[i];
777
- if (entry.tryLoc === tryLoc) {
778
- var record = entry.completion;
779
- if (record.type === "throw") {
780
- var thrown = record.arg;
719
+ return this.complete(record);
720
+ },
721
+ complete: function complete(record, afterLoc) {
722
+ if (record.type === "throw") {
723
+ throw record.arg;
724
+ }
725
+
726
+ if (record.type === "break" || record.type === "continue") {
727
+ this.next = record.arg;
728
+ } else if (record.type === "return") {
729
+ this.rval = this.arg = record.arg;
730
+ this.method = "return";
731
+ this.next = "end";
732
+ } else if (record.type === "normal" && afterLoc) {
733
+ this.next = afterLoc;
734
+ }
735
+
736
+ return ContinueSentinel;
737
+ },
738
+ finish: function finish(finallyLoc) {
739
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
740
+ var entry = this.tryEntries[i];
741
+
742
+ if (entry.finallyLoc === finallyLoc) {
743
+ this.complete(entry.completion, entry.afterLoc);
781
744
  resetTryEntry(entry);
745
+ return ContinueSentinel;
782
746
  }
783
- return thrown;
784
747
  }
785
- }
748
+ },
749
+ "catch": function _catch(tryLoc) {
750
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
751
+ var entry = this.tryEntries[i];
786
752
 
787
- // The context.catch method must only be called with a location
788
- // argument that corresponds to a known catch block.
789
- throw new Error("illegal catch attempt");
790
- },
753
+ if (entry.tryLoc === tryLoc) {
754
+ var record = entry.completion;
791
755
 
792
- delegateYield: function(iterable, resultName, nextLoc) {
793
- this.delegate = {
794
- iterator: values(iterable),
795
- resultName: resultName,
796
- nextLoc: nextLoc
797
- };
756
+ if (record.type === "throw") {
757
+ var thrown = record.arg;
758
+ resetTryEntry(entry);
759
+ }
798
760
 
799
- if (this.method === "next") {
800
- // Deliberately forget the last sent value so that we don't
801
- // accidentally pass it on to the delegate.
802
- this.arg = undefined$1;
803
- }
761
+ return thrown;
762
+ }
763
+ } // The context.catch method must only be called with a location
764
+ // argument that corresponds to a known catch block.
804
765
 
805
- return ContinueSentinel;
806
- }
807
- };
808
766
 
809
- // Regardless of whether this script is executing as a CommonJS module
810
- // or not, return the runtime object so that we can declare the variable
811
- // regeneratorRuntime in the outer scope, which allows this module to be
812
- // injected easily by `bin/regenerator --include-runtime script.js`.
813
- return exports;
767
+ throw new Error("illegal catch attempt");
768
+ },
769
+ delegateYield: function delegateYield(iterable, resultName, nextLoc) {
770
+ this.delegate = {
771
+ iterator: values(iterable),
772
+ resultName: resultName,
773
+ nextLoc: nextLoc
774
+ };
775
+
776
+ if (this.method === "next") {
777
+ // Deliberately forget the last sent value so that we don't
778
+ // accidentally pass it on to the delegate.
779
+ this.arg = undefined$1;
780
+ }
814
781
 
815
- }(
816
- // If this script is executing as a CommonJS module, use module.exports
782
+ return ContinueSentinel;
783
+ }
784
+ }; // Regardless of whether this script is executing as a CommonJS module
785
+ // or not, return the runtime object so that we can declare the variable
786
+ // regeneratorRuntime in the outer scope, which allows this module to be
787
+ // injected easily by `bin/regenerator --include-runtime script.js`.
788
+
789
+ return exports;
790
+ }( // If this script is executing as a CommonJS module, use module.exports
817
791
  // as the regeneratorRuntime namespace. Otherwise create a new empty
818
792
  // object. Either way, the resulting object will be used to initialize
819
793
  // the regeneratorRuntime variable at the top of this file.
820
- module.exports
821
- ));
822
-
823
- try {
824
- regeneratorRuntime = runtime;
825
- } catch (accidentalStrictMode) {
826
- // This module should not be running in strict mode, so the above
827
- // assignment should always work unless something is misconfigured. Just
828
- // in case runtime.js accidentally runs in strict mode, in modern engines
829
- // we can explicitly access globalThis. In older engines we can escape
830
- // strict mode using a global Function call. This could conceivably fail
831
- // if a Content Security Policy forbids using Function, but in that case
832
- // the proper solution is to fix the accidental strict mode problem. If
833
- // you've misconfigured your bundler to force strict mode and applied a
834
- // CSP to forbid Function, and you're not willing to fix either of those
835
- // problems, please detail your unique predicament in a GitHub issue.
836
- if (typeof globalThis === "object") {
837
- globalThis.regeneratorRuntime = runtime;
838
- } else {
794
+ module.exports );
795
+
796
+ try {
797
+ regeneratorRuntime = runtime;
798
+ } catch (accidentalStrictMode) {
799
+ // This module should not be running in strict mode, so the above
800
+ // assignment should always work unless something is misconfigured. Just
801
+ // in case runtime.js accidentally runs in strict mode, we can escape
802
+ // strict mode using a global Function call. This could conceivably fail
803
+ // if a Content Security Policy forbids using Function, but in that case
804
+ // the proper solution is to fix the accidental strict mode problem. If
805
+ // you've misconfigured your bundler to force strict mode and applied a
806
+ // CSP to forbid Function, and you're not willing to fix either of those
807
+ // problems, please detail your unique predicament in a GitHub issue.
839
808
  Function("r", "regeneratorRuntime = r")(runtime);
840
809
  }
841
- }
842
810
  });
843
811
 
844
812
  function getError(errors, status) {
@@ -1503,7 +1471,7 @@ var getSiteCollectionsQuery =
1503
1471
  */
1504
1472
  var productConnectionFragment =
1505
1473
  /* GraphQL */
1506
- "\n fragment productConnection on ProductConnection {\n pageInfo {\n hasNextPage\n hasPreviousPage\n }\n edges {\n node {\n id\n title\n vendor\n handle\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";
1474
+ "\n fragment productConnection on ProductConnection {\n pageInfo {\n hasNextPage\n hasPreviousPage\n }\n edges {\n node {\n id\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";
1507
1475
  var getAllProductsQuery =
1508
1476
  /* GraphQL */
1509
1477
  "\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";
@@ -2289,9 +2257,6 @@ var commerceProviderMeta = {
2289
2257
  name: "plasmic-commerce-shopify-provider",
2290
2258
  displayName: "Shopify Provider",
2291
2259
  props: {
2292
- children: {
2293
- type: "slot"
2294
- },
2295
2260
  storeDomain: "string",
2296
2261
  accessToken: "string"
2297
2262
  },
@@ -2303,20 +2268,13 @@ function CommerceProviderComponent(props) {
2303
2268
  var storeDomain = props.storeDomain,
2304
2269
  accessToken = props.accessToken,
2305
2270
  children = props.children;
2306
-
2307
- if (!storeDomain) {
2308
- return React.createElement("p", null, " You must set the store domain url ");
2309
- } else if (!accessToken) {
2310
- return React.createElement("p", null, " You must set the access token ");
2311
- }
2312
-
2313
2271
  var CommerceProvider = getCommerceProvider(storeDomain, accessToken);
2314
2272
  return React.createElement(CommerceProvider, null, children);
2315
2273
  }
2316
2274
 
2317
2275
  function registerCommerceProvider(loader, customCommerceProviderMeta) {
2318
2276
  var doRegisterComponent = function doRegisterComponent() {
2319
- return loader ? loader.registerComponent.apply(loader, arguments) : registerComponent.apply(void 0, arguments);
2277
+ return loader ? loader.registerGlobalContext.apply(loader, arguments) : registerGlobalContext.apply(void 0, arguments);
2320
2278
  };
2321
2279
 
2322
2280
  doRegisterComponent(CommerceProviderComponent, customCommerceProviderMeta != null ? customCommerceProviderMeta : commerceProviderMeta);