@plasmicpkgs/commerce-commercetools 0.0.193 → 0.0.195
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 +251 -487
- 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 +251 -487
- package/dist/commerce-commercetools.esm.js.map +1 -1
- package/package.json +4 -4
|
@@ -48,306 +48,113 @@ function _extends() {
|
|
|
48
48
|
return n;
|
|
49
49
|
}, _extends.apply(null, arguments);
|
|
50
50
|
}
|
|
51
|
-
function
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
return o(a, "_invoke", {
|
|
86
|
-
value: makeInvokeMethod(t, r, c)
|
|
87
|
-
}), a;
|
|
88
|
-
}
|
|
89
|
-
function tryCatch(t, e, r) {
|
|
90
|
-
try {
|
|
91
|
-
return {
|
|
92
|
-
type: "normal",
|
|
93
|
-
arg: t.call(e, r)
|
|
94
|
-
};
|
|
95
|
-
} catch (t) {
|
|
96
|
-
return {
|
|
97
|
-
type: "throw",
|
|
98
|
-
arg: t
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
e.wrap = wrap;
|
|
103
|
-
var h = "suspendedStart",
|
|
104
|
-
l = "suspendedYield",
|
|
105
|
-
f = "executing",
|
|
106
|
-
s = "completed",
|
|
107
|
-
y = {};
|
|
108
|
-
function Generator() {}
|
|
109
|
-
function GeneratorFunction() {}
|
|
110
|
-
function GeneratorFunctionPrototype() {}
|
|
111
|
-
var p = {};
|
|
112
|
-
define(p, a, function () {
|
|
113
|
-
return this;
|
|
114
|
-
});
|
|
115
|
-
var d = Object.getPrototypeOf,
|
|
116
|
-
v = d && d(d(values([])));
|
|
117
|
-
v && v !== r && n.call(v, a) && (p = v);
|
|
118
|
-
var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
|
|
119
|
-
function defineIteratorMethods(t) {
|
|
120
|
-
["next", "throw", "return"].forEach(function (e) {
|
|
121
|
-
define(t, e, function (t) {
|
|
122
|
-
return this._invoke(e, t);
|
|
123
|
-
});
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
function AsyncIterator(t, e) {
|
|
127
|
-
function invoke(r, o, i, a) {
|
|
128
|
-
var c = tryCatch(t[r], t, o);
|
|
129
|
-
if ("throw" !== c.type) {
|
|
130
|
-
var u = c.arg,
|
|
131
|
-
h = u.value;
|
|
132
|
-
return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
|
|
133
|
-
invoke("next", t, i, a);
|
|
134
|
-
}, function (t) {
|
|
135
|
-
invoke("throw", t, i, a);
|
|
136
|
-
}) : e.resolve(h).then(function (t) {
|
|
137
|
-
u.value = t, i(u);
|
|
138
|
-
}, function (t) {
|
|
139
|
-
return invoke("throw", t, i, a);
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
a(c.arg);
|
|
143
|
-
}
|
|
144
|
-
var r;
|
|
145
|
-
o(this, "_invoke", {
|
|
146
|
-
value: function (t, n) {
|
|
147
|
-
function callInvokeWithMethodAndArg() {
|
|
148
|
-
return new e(function (e, r) {
|
|
149
|
-
invoke(t, n, e, r);
|
|
150
|
-
});
|
|
51
|
+
function _regenerator() {
|
|
52
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
|
53
|
+
var e,
|
|
54
|
+
t,
|
|
55
|
+
r = "function" == typeof Symbol ? Symbol : {},
|
|
56
|
+
n = r.iterator || "@@iterator",
|
|
57
|
+
o = r.toStringTag || "@@toStringTag";
|
|
58
|
+
function i(r, n, o, i) {
|
|
59
|
+
var c = n && n.prototype instanceof Generator ? n : Generator,
|
|
60
|
+
u = Object.create(c.prototype);
|
|
61
|
+
return _regeneratorDefine(u, "_invoke", function (r, n, o) {
|
|
62
|
+
var i,
|
|
63
|
+
c,
|
|
64
|
+
u,
|
|
65
|
+
f = 0,
|
|
66
|
+
p = o || [],
|
|
67
|
+
y = !1,
|
|
68
|
+
G = {
|
|
69
|
+
p: 0,
|
|
70
|
+
n: 0,
|
|
71
|
+
v: e,
|
|
72
|
+
a: d,
|
|
73
|
+
f: d.bind(e, 4),
|
|
74
|
+
d: function (t, r) {
|
|
75
|
+
return i = t, c = 0, u = e, G.n = r, a;
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
function d(r, n) {
|
|
79
|
+
for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) {
|
|
80
|
+
var o,
|
|
81
|
+
i = p[t],
|
|
82
|
+
d = G.p,
|
|
83
|
+
l = i[2];
|
|
84
|
+
r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0));
|
|
151
85
|
}
|
|
152
|
-
|
|
86
|
+
if (o || r > 1) return a;
|
|
87
|
+
throw y = !0, n;
|
|
153
88
|
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
89
|
+
return function (o, p, l) {
|
|
90
|
+
if (f > 1) throw TypeError("Generator is already running");
|
|
91
|
+
for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) {
|
|
92
|
+
i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u);
|
|
93
|
+
try {
|
|
94
|
+
if (f = 2, i) {
|
|
95
|
+
if (c || (o = "next"), t = i[o]) {
|
|
96
|
+
if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object");
|
|
97
|
+
if (!t.done) return t;
|
|
98
|
+
u = t.value, c < 2 && (c = 0);
|
|
99
|
+
} else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1);
|
|
100
|
+
i = e;
|
|
101
|
+
} else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break;
|
|
102
|
+
} catch (t) {
|
|
103
|
+
i = e, c = 1, u = t;
|
|
104
|
+
} finally {
|
|
105
|
+
f = 1;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
162
108
|
return {
|
|
163
109
|
value: t,
|
|
164
|
-
done:
|
|
110
|
+
done: y
|
|
165
111
|
};
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
var c = n.delegate;
|
|
169
|
-
if (c) {
|
|
170
|
-
var u = maybeInvokeDelegate(c, n);
|
|
171
|
-
if (u) {
|
|
172
|
-
if (u === y) continue;
|
|
173
|
-
return u;
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
|
|
177
|
-
if (o === h) throw o = s, n.arg;
|
|
178
|
-
n.dispatchException(n.arg);
|
|
179
|
-
} else "return" === n.method && n.abrupt("return", n.arg);
|
|
180
|
-
o = f;
|
|
181
|
-
var p = tryCatch(e, r, n);
|
|
182
|
-
if ("normal" === p.type) {
|
|
183
|
-
if (o = n.done ? s : l, p.arg === y) continue;
|
|
184
|
-
return {
|
|
185
|
-
value: p.arg,
|
|
186
|
-
done: n.done
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
|
-
"throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
|
|
190
|
-
}
|
|
191
|
-
};
|
|
192
|
-
}
|
|
193
|
-
function maybeInvokeDelegate(e, r) {
|
|
194
|
-
var n = r.method,
|
|
195
|
-
o = e.iterator[n];
|
|
196
|
-
if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
|
|
197
|
-
var i = tryCatch(o, e.iterator, r.arg);
|
|
198
|
-
if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
|
|
199
|
-
var a = i.arg;
|
|
200
|
-
return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
|
|
201
|
-
}
|
|
202
|
-
function pushTryEntry(t) {
|
|
203
|
-
var e = {
|
|
204
|
-
tryLoc: t[0]
|
|
205
|
-
};
|
|
206
|
-
1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
|
|
207
|
-
}
|
|
208
|
-
function resetTryEntry(t) {
|
|
209
|
-
var e = t.completion || {};
|
|
210
|
-
e.type = "normal", delete e.arg, t.completion = e;
|
|
211
|
-
}
|
|
212
|
-
function Context(t) {
|
|
213
|
-
this.tryEntries = [{
|
|
214
|
-
tryLoc: "root"
|
|
215
|
-
}], t.forEach(pushTryEntry, this), this.reset(!0);
|
|
112
|
+
};
|
|
113
|
+
}(r, o, i), !0), u;
|
|
216
114
|
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
return i.next = i;
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
throw new TypeError(typeof e + " is not iterable");
|
|
115
|
+
var a = {};
|
|
116
|
+
function Generator() {}
|
|
117
|
+
function GeneratorFunction() {}
|
|
118
|
+
function GeneratorFunctionPrototype() {}
|
|
119
|
+
t = Object.getPrototypeOf;
|
|
120
|
+
var c = [][n] ? t(t([][n]())) : (_regeneratorDefine(t = {}, n, function () {
|
|
121
|
+
return this;
|
|
122
|
+
}), t),
|
|
123
|
+
u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c);
|
|
124
|
+
function f(e) {
|
|
125
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e;
|
|
232
126
|
}
|
|
233
|
-
return GeneratorFunction.prototype = GeneratorFunctionPrototype,
|
|
234
|
-
value: GeneratorFunctionPrototype,
|
|
235
|
-
configurable: !0
|
|
236
|
-
}), o(GeneratorFunctionPrototype, "constructor", {
|
|
237
|
-
value: GeneratorFunction,
|
|
238
|
-
configurable: !0
|
|
239
|
-
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
|
|
240
|
-
var e = "function" == typeof t && t.constructor;
|
|
241
|
-
return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
|
|
242
|
-
}, e.mark = function (t) {
|
|
243
|
-
return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
|
|
244
|
-
}, e.awrap = function (t) {
|
|
245
|
-
return {
|
|
246
|
-
__await: t
|
|
247
|
-
};
|
|
248
|
-
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
|
|
127
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine(u), _regeneratorDefine(u, o, "Generator"), _regeneratorDefine(u, n, function () {
|
|
249
128
|
return this;
|
|
250
|
-
}),
|
|
251
|
-
void 0 === i && (i = Promise);
|
|
252
|
-
var a = new AsyncIterator(wrap(t, r, n, o), i);
|
|
253
|
-
return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
|
|
254
|
-
return t.done ? t.value : a.next();
|
|
255
|
-
});
|
|
256
|
-
}, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
|
|
257
|
-
return this;
|
|
258
|
-
}), define(g, "toString", function () {
|
|
129
|
+
}), _regeneratorDefine(u, "toString", function () {
|
|
259
130
|
return "[object Generator]";
|
|
260
|
-
}),
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
return r.reverse(), function next() {
|
|
265
|
-
for (; r.length;) {
|
|
266
|
-
var t = r.pop();
|
|
267
|
-
if (t in e) return next.value = t, next.done = !1, next;
|
|
268
|
-
}
|
|
269
|
-
return next.done = !0, next;
|
|
131
|
+
}), (_regenerator = function () {
|
|
132
|
+
return {
|
|
133
|
+
w: i,
|
|
134
|
+
m: f
|
|
270
135
|
};
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
function handle(n, o) {
|
|
286
|
-
return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
|
|
287
|
-
}
|
|
288
|
-
for (var o = this.tryEntries.length - 1; o >= 0; --o) {
|
|
289
|
-
var i = this.tryEntries[o],
|
|
290
|
-
a = i.completion;
|
|
291
|
-
if ("root" === i.tryLoc) return handle("end");
|
|
292
|
-
if (i.tryLoc <= this.prev) {
|
|
293
|
-
var c = n.call(i, "catchLoc"),
|
|
294
|
-
u = n.call(i, "finallyLoc");
|
|
295
|
-
if (c && u) {
|
|
296
|
-
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
297
|
-
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
298
|
-
} else if (c) {
|
|
299
|
-
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
300
|
-
} else {
|
|
301
|
-
if (!u) throw Error("try statement without catch or finally");
|
|
302
|
-
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
},
|
|
307
|
-
abrupt: function (t, e) {
|
|
308
|
-
for (var r = this.tryEntries.length - 1; r >= 0; --r) {
|
|
309
|
-
var o = this.tryEntries[r];
|
|
310
|
-
if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
|
|
311
|
-
var i = o;
|
|
312
|
-
break;
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
|
|
316
|
-
var a = i ? i.completion : {};
|
|
317
|
-
return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
|
|
318
|
-
},
|
|
319
|
-
complete: function (t, e) {
|
|
320
|
-
if ("throw" === t.type) throw t.arg;
|
|
321
|
-
return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
|
|
322
|
-
},
|
|
323
|
-
finish: function (t) {
|
|
324
|
-
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
325
|
-
var r = this.tryEntries[e];
|
|
326
|
-
if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
|
|
327
|
-
}
|
|
328
|
-
},
|
|
329
|
-
catch: function (t) {
|
|
330
|
-
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
331
|
-
var r = this.tryEntries[e];
|
|
332
|
-
if (r.tryLoc === t) {
|
|
333
|
-
var n = r.completion;
|
|
334
|
-
if ("throw" === n.type) {
|
|
335
|
-
var o = n.arg;
|
|
336
|
-
resetTryEntry(r);
|
|
337
|
-
}
|
|
338
|
-
return o;
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
throw Error("illegal catch attempt");
|
|
342
|
-
},
|
|
343
|
-
delegateYield: function (e, r, n) {
|
|
344
|
-
return this.delegate = {
|
|
345
|
-
iterator: values(e),
|
|
346
|
-
resultName: r,
|
|
347
|
-
nextLoc: n
|
|
348
|
-
}, "next" === this.method && (this.arg = t), y;
|
|
136
|
+
})();
|
|
137
|
+
}
|
|
138
|
+
function _regeneratorDefine(e, r, n, t) {
|
|
139
|
+
var i = Object.defineProperty;
|
|
140
|
+
try {
|
|
141
|
+
i({}, "", {});
|
|
142
|
+
} catch (e) {
|
|
143
|
+
i = 0;
|
|
144
|
+
}
|
|
145
|
+
_regeneratorDefine = function (e, r, n, t) {
|
|
146
|
+
function o(r, n) {
|
|
147
|
+
_regeneratorDefine(e, r, function (e) {
|
|
148
|
+
return this._invoke(r, n, e);
|
|
149
|
+
});
|
|
349
150
|
}
|
|
350
|
-
|
|
151
|
+
r ? i ? i(e, r, {
|
|
152
|
+
value: n,
|
|
153
|
+
enumerable: !t,
|
|
154
|
+
configurable: !t,
|
|
155
|
+
writable: !t
|
|
156
|
+
}) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2));
|
|
157
|
+
}, _regeneratorDefine(e, r, n, t);
|
|
351
158
|
}
|
|
352
159
|
|
|
353
160
|
var getSortVariables = function getSortVariables(sort, isCategory) {
|
|
@@ -400,32 +207,29 @@ var removeCartCookie = function removeCartCookie() {
|
|
|
400
207
|
};
|
|
401
208
|
|
|
402
209
|
var createCart = /*#__PURE__*/function () {
|
|
403
|
-
var _ref = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/
|
|
210
|
+
var _ref = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(fetch) {
|
|
404
211
|
var draft, cart;
|
|
405
|
-
return
|
|
406
|
-
while (1) switch (_context.
|
|
212
|
+
return _regenerator().w(function (_context) {
|
|
213
|
+
while (1) switch (_context.n) {
|
|
407
214
|
case 0:
|
|
408
215
|
draft = {
|
|
409
216
|
currency: 'USD',
|
|
410
217
|
country: 'US'
|
|
411
218
|
};
|
|
412
|
-
_context.
|
|
219
|
+
_context.n = 1;
|
|
413
220
|
return fetch({
|
|
414
221
|
query: 'carts',
|
|
415
222
|
method: 'post',
|
|
416
223
|
body: draft
|
|
417
224
|
});
|
|
418
|
-
case
|
|
419
|
-
cart = _context.
|
|
225
|
+
case 1:
|
|
226
|
+
cart = _context.v;
|
|
420
227
|
if (!cart.body) {
|
|
421
228
|
removeCartCookie();
|
|
422
229
|
} else {
|
|
423
230
|
setCartId(cart.body.id);
|
|
424
231
|
}
|
|
425
|
-
return _context.
|
|
426
|
-
case 6:
|
|
427
|
-
case "end":
|
|
428
|
-
return _context.stop();
|
|
232
|
+
return _context.a(2, cart.body);
|
|
429
233
|
}
|
|
430
234
|
}, _callee);
|
|
431
235
|
}));
|
|
@@ -435,17 +239,17 @@ var createCart = /*#__PURE__*/function () {
|
|
|
435
239
|
}();
|
|
436
240
|
|
|
437
241
|
var getActiveCart = /*#__PURE__*/function () {
|
|
438
|
-
var _ref = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/
|
|
242
|
+
var _ref = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(fetch) {
|
|
439
243
|
var cartId, activeCart;
|
|
440
|
-
return
|
|
441
|
-
while (1) switch (_context.
|
|
244
|
+
return _regenerator().w(function (_context) {
|
|
245
|
+
while (1) switch (_context.n) {
|
|
442
246
|
case 0:
|
|
443
247
|
cartId = getCartId();
|
|
444
248
|
if (!cartId) {
|
|
445
|
-
_context.
|
|
249
|
+
_context.n = 2;
|
|
446
250
|
break;
|
|
447
251
|
}
|
|
448
|
-
_context.
|
|
252
|
+
_context.n = 1;
|
|
449
253
|
return fetch({
|
|
450
254
|
query: 'carts',
|
|
451
255
|
method: 'get',
|
|
@@ -453,25 +257,22 @@ var getActiveCart = /*#__PURE__*/function () {
|
|
|
453
257
|
id: cartId
|
|
454
258
|
}
|
|
455
259
|
});
|
|
456
|
-
case
|
|
457
|
-
activeCart = _context.
|
|
458
|
-
_context.
|
|
260
|
+
case 1:
|
|
261
|
+
activeCart = _context.v.body;
|
|
262
|
+
_context.n = 4;
|
|
459
263
|
break;
|
|
460
|
-
case
|
|
461
|
-
_context.
|
|
264
|
+
case 2:
|
|
265
|
+
_context.n = 3;
|
|
462
266
|
return createCart(fetch);
|
|
463
|
-
case
|
|
464
|
-
activeCart = _context.
|
|
465
|
-
case
|
|
267
|
+
case 3:
|
|
268
|
+
activeCart = _context.v;
|
|
269
|
+
case 4:
|
|
466
270
|
if (!activeCart) {
|
|
467
271
|
removeCartCookie();
|
|
468
272
|
} else {
|
|
469
273
|
setCartId(activeCart.id);
|
|
470
274
|
}
|
|
471
|
-
return _context.
|
|
472
|
-
case 12:
|
|
473
|
-
case "end":
|
|
474
|
-
return _context.stop();
|
|
275
|
+
return _context.a(2, activeCart);
|
|
475
276
|
}
|
|
476
277
|
}, _callee);
|
|
477
278
|
}));
|
|
@@ -645,20 +446,17 @@ var handler = {
|
|
|
645
446
|
method: "get"
|
|
646
447
|
},
|
|
647
448
|
fetcher: function fetcher(_ref) {
|
|
648
|
-
return _asyncToGenerator(/*#__PURE__*/
|
|
449
|
+
return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
649
450
|
var fetch, provider, activeCart;
|
|
650
|
-
return
|
|
651
|
-
while (1) switch (_context.
|
|
451
|
+
return _regenerator().w(function (_context) {
|
|
452
|
+
while (1) switch (_context.n) {
|
|
652
453
|
case 0:
|
|
653
454
|
fetch = _ref.fetch, provider = _ref.provider;
|
|
654
|
-
_context.
|
|
455
|
+
_context.n = 1;
|
|
655
456
|
return getActiveCart(fetch);
|
|
656
|
-
case
|
|
657
|
-
activeCart = _context.
|
|
658
|
-
return _context.
|
|
659
|
-
case 5:
|
|
660
|
-
case "end":
|
|
661
|
-
return _context.stop();
|
|
457
|
+
case 1:
|
|
458
|
+
activeCart = _context.v;
|
|
459
|
+
return _context.a(2, activeCart ? normalizeCart(activeCart, provider.locale) : null);
|
|
662
460
|
}
|
|
663
461
|
}, _callee);
|
|
664
462
|
}))();
|
|
@@ -692,24 +490,24 @@ var handler$1 = {
|
|
|
692
490
|
method: "post"
|
|
693
491
|
},
|
|
694
492
|
fetcher: function fetcher(_ref) {
|
|
695
|
-
return _asyncToGenerator(/*#__PURE__*/
|
|
493
|
+
return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
696
494
|
var _item$quantity;
|
|
697
495
|
var item, fetch, provider, activeCart, updatedCart;
|
|
698
|
-
return
|
|
699
|
-
while (1) switch (_context.
|
|
496
|
+
return _regenerator().w(function (_context) {
|
|
497
|
+
while (1) switch (_context.n) {
|
|
700
498
|
case 0:
|
|
701
499
|
item = _ref.input, fetch = _ref.fetch, provider = _ref.provider;
|
|
702
|
-
_context.
|
|
500
|
+
_context.n = 1;
|
|
703
501
|
return getActiveCart(fetch);
|
|
704
|
-
case
|
|
705
|
-
activeCart = _context.
|
|
502
|
+
case 1:
|
|
503
|
+
activeCart = _context.v;
|
|
706
504
|
if (!(item.quantity && (!Number.isInteger(item.quantity) || item.quantity < 1) || !activeCart)) {
|
|
707
|
-
_context.
|
|
505
|
+
_context.n = 2;
|
|
708
506
|
break;
|
|
709
507
|
}
|
|
710
|
-
return _context.
|
|
711
|
-
case
|
|
712
|
-
_context.
|
|
508
|
+
return _context.a(2, undefined);
|
|
509
|
+
case 2:
|
|
510
|
+
_context.n = 3;
|
|
713
511
|
return fetch({
|
|
714
512
|
query: "carts",
|
|
715
513
|
method: "post",
|
|
@@ -726,17 +524,14 @@ var handler$1 = {
|
|
|
726
524
|
}]
|
|
727
525
|
}
|
|
728
526
|
});
|
|
729
|
-
case
|
|
730
|
-
updatedCart = _context.
|
|
527
|
+
case 3:
|
|
528
|
+
updatedCart = _context.v;
|
|
731
529
|
if (updatedCart.body) {
|
|
732
530
|
setCartId(updatedCart.body.id);
|
|
733
531
|
} else {
|
|
734
532
|
removeCartCookie();
|
|
735
533
|
}
|
|
736
|
-
return _context.
|
|
737
|
-
case 11:
|
|
738
|
-
case "end":
|
|
739
|
-
return _context.stop();
|
|
534
|
+
return _context.a(2, updatedCart.body ? normalizeCart(updatedCart.body, provider.locale) : undefined);
|
|
740
535
|
}
|
|
741
536
|
}, _callee);
|
|
742
537
|
}))();
|
|
@@ -747,24 +542,21 @@ var handler$1 = {
|
|
|
747
542
|
var _useCart = commerce.useCart(),
|
|
748
543
|
mutate = _useCart.mutate;
|
|
749
544
|
return React.useCallback(/*#__PURE__*/function () {
|
|
750
|
-
var _addItem = _asyncToGenerator(/*#__PURE__*/
|
|
545
|
+
var _addItem = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(input) {
|
|
751
546
|
var data;
|
|
752
|
-
return
|
|
753
|
-
while (1) switch (_context2.
|
|
547
|
+
return _regenerator().w(function (_context2) {
|
|
548
|
+
while (1) switch (_context2.n) {
|
|
754
549
|
case 0:
|
|
755
|
-
_context2.
|
|
550
|
+
_context2.n = 1;
|
|
756
551
|
return fetch({
|
|
757
552
|
input: input
|
|
758
553
|
});
|
|
759
|
-
case
|
|
760
|
-
data = _context2.
|
|
761
|
-
_context2.
|
|
554
|
+
case 1:
|
|
555
|
+
data = _context2.v;
|
|
556
|
+
_context2.n = 2;
|
|
762
557
|
return mutate(data, false);
|
|
763
|
-
case
|
|
764
|
-
return _context2.
|
|
765
|
-
case 6:
|
|
766
|
-
case "end":
|
|
767
|
-
return _context2.stop();
|
|
558
|
+
case 2:
|
|
559
|
+
return _context2.a(2, data);
|
|
768
560
|
}
|
|
769
561
|
}, _callee2);
|
|
770
562
|
}));
|
|
@@ -783,23 +575,23 @@ var handler$2 = {
|
|
|
783
575
|
method: "post"
|
|
784
576
|
},
|
|
785
577
|
fetcher: function fetcher(_ref) {
|
|
786
|
-
return _asyncToGenerator(/*#__PURE__*/
|
|
578
|
+
return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
787
579
|
var itemId, fetch, provider, activeCart, updatedCart;
|
|
788
|
-
return
|
|
789
|
-
while (1) switch (_context.
|
|
580
|
+
return _regenerator().w(function (_context) {
|
|
581
|
+
while (1) switch (_context.n) {
|
|
790
582
|
case 0:
|
|
791
583
|
itemId = _ref.input.itemId, fetch = _ref.fetch, provider = _ref.provider;
|
|
792
|
-
_context.
|
|
584
|
+
_context.n = 1;
|
|
793
585
|
return getActiveCart(fetch);
|
|
794
|
-
case
|
|
795
|
-
activeCart = _context.
|
|
586
|
+
case 1:
|
|
587
|
+
activeCart = _context.v;
|
|
796
588
|
if (!(!itemId || !activeCart)) {
|
|
797
|
-
_context.
|
|
589
|
+
_context.n = 2;
|
|
798
590
|
break;
|
|
799
591
|
}
|
|
800
|
-
return _context.
|
|
801
|
-
case
|
|
802
|
-
_context.
|
|
592
|
+
return _context.a(2, undefined);
|
|
593
|
+
case 2:
|
|
594
|
+
_context.n = 3;
|
|
803
595
|
return fetch({
|
|
804
596
|
query: "carts",
|
|
805
597
|
method: "post",
|
|
@@ -814,17 +606,14 @@ var handler$2 = {
|
|
|
814
606
|
}]
|
|
815
607
|
}
|
|
816
608
|
});
|
|
817
|
-
case
|
|
818
|
-
updatedCart = _context.
|
|
609
|
+
case 3:
|
|
610
|
+
updatedCart = _context.v;
|
|
819
611
|
if (updatedCart.body) {
|
|
820
612
|
setCartId(updatedCart.body.id);
|
|
821
613
|
} else {
|
|
822
614
|
removeCartCookie();
|
|
823
615
|
}
|
|
824
|
-
return _context.
|
|
825
|
-
case 11:
|
|
826
|
-
case "end":
|
|
827
|
-
return _context.stop();
|
|
616
|
+
return _context.a(2, normalizeCart(updatedCart.body, provider.locale));
|
|
828
617
|
}
|
|
829
618
|
}, _callee);
|
|
830
619
|
}))();
|
|
@@ -840,36 +629,33 @@ var handler$2 = {
|
|
|
840
629
|
var _useCart = commerce.useCart(),
|
|
841
630
|
mutate = _useCart.mutate;
|
|
842
631
|
var removeItem = /*#__PURE__*/function () {
|
|
843
|
-
var _ref3 = _asyncToGenerator(/*#__PURE__*/
|
|
632
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(input) {
|
|
844
633
|
var _input$id;
|
|
845
634
|
var itemId, data;
|
|
846
|
-
return
|
|
847
|
-
while (1) switch (_context2.
|
|
635
|
+
return _regenerator().w(function (_context2) {
|
|
636
|
+
while (1) switch (_context2.n) {
|
|
848
637
|
case 0:
|
|
849
638
|
itemId = (_input$id = input == null ? void 0 : input.id) != null ? _input$id : item == null ? void 0 : item.id;
|
|
850
639
|
if (itemId) {
|
|
851
|
-
_context2.
|
|
640
|
+
_context2.n = 1;
|
|
852
641
|
break;
|
|
853
642
|
}
|
|
854
643
|
throw new commerce.ValidationError({
|
|
855
644
|
message: "Invalid input used for this operation"
|
|
856
645
|
});
|
|
857
|
-
case
|
|
858
|
-
_context2.
|
|
646
|
+
case 1:
|
|
647
|
+
_context2.n = 2;
|
|
859
648
|
return fetch({
|
|
860
649
|
input: {
|
|
861
650
|
itemId: itemId
|
|
862
651
|
}
|
|
863
652
|
});
|
|
864
|
-
case
|
|
865
|
-
data = _context2.
|
|
866
|
-
_context2.
|
|
653
|
+
case 2:
|
|
654
|
+
data = _context2.v;
|
|
655
|
+
_context2.n = 3;
|
|
867
656
|
return mutate(data, false);
|
|
868
|
-
case
|
|
869
|
-
return _context2.
|
|
870
|
-
case 9:
|
|
871
|
-
case "end":
|
|
872
|
-
return _context2.stop();
|
|
657
|
+
case 3:
|
|
658
|
+
return _context2.a(2, data);
|
|
873
659
|
}
|
|
874
660
|
}, _callee2);
|
|
875
661
|
}));
|
|
@@ -888,22 +674,22 @@ var handler$3 = {
|
|
|
888
674
|
method: "post"
|
|
889
675
|
},
|
|
890
676
|
fetcher: function fetcher(_ref) {
|
|
891
|
-
return _asyncToGenerator(/*#__PURE__*/
|
|
677
|
+
return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
892
678
|
var _item$quantity;
|
|
893
679
|
var _ref$input, item, itemId, fetch, provider, activeCart, updatedCart;
|
|
894
|
-
return
|
|
895
|
-
while (1) switch (_context.
|
|
680
|
+
return _regenerator().w(function (_context) {
|
|
681
|
+
while (1) switch (_context.n) {
|
|
896
682
|
case 0:
|
|
897
683
|
_ref$input = _ref.input, item = _ref$input.item, itemId = _ref$input.itemId, fetch = _ref.fetch, provider = _ref.provider;
|
|
898
684
|
if (!Number.isInteger(item.quantity)) {
|
|
899
|
-
_context.
|
|
685
|
+
_context.n = 2;
|
|
900
686
|
break;
|
|
901
687
|
}
|
|
902
688
|
if (!(item.quantity < 1)) {
|
|
903
|
-
_context.
|
|
689
|
+
_context.n = 1;
|
|
904
690
|
break;
|
|
905
691
|
}
|
|
906
|
-
return _context.
|
|
692
|
+
return _context.a(2, handler$2.fetcher == null ? void 0 : handler$2.fetcher({
|
|
907
693
|
options: handler$2.fetchOptions,
|
|
908
694
|
input: {
|
|
909
695
|
itemId: itemId
|
|
@@ -911,29 +697,29 @@ var handler$3 = {
|
|
|
911
697
|
fetch: fetch,
|
|
912
698
|
provider: provider
|
|
913
699
|
}));
|
|
914
|
-
case
|
|
915
|
-
_context.
|
|
700
|
+
case 1:
|
|
701
|
+
_context.n = 3;
|
|
916
702
|
break;
|
|
917
|
-
case
|
|
703
|
+
case 2:
|
|
918
704
|
if (!item.quantity) {
|
|
919
|
-
_context.
|
|
705
|
+
_context.n = 3;
|
|
920
706
|
break;
|
|
921
707
|
}
|
|
922
708
|
throw new commerce.ValidationError({
|
|
923
709
|
message: "The item quantity has to be a valid integer"
|
|
924
710
|
});
|
|
925
|
-
case
|
|
926
|
-
_context.
|
|
711
|
+
case 3:
|
|
712
|
+
_context.n = 4;
|
|
927
713
|
return getActiveCart(fetch);
|
|
928
|
-
case
|
|
929
|
-
activeCart = _context.
|
|
714
|
+
case 4:
|
|
715
|
+
activeCart = _context.v;
|
|
930
716
|
if (!(item.quantity && (!Number.isInteger(item.quantity) || item.quantity < 1) || !activeCart)) {
|
|
931
|
-
_context.
|
|
717
|
+
_context.n = 5;
|
|
932
718
|
break;
|
|
933
719
|
}
|
|
934
|
-
return _context.
|
|
935
|
-
case
|
|
936
|
-
_context.
|
|
720
|
+
return _context.a(2, undefined);
|
|
721
|
+
case 5:
|
|
722
|
+
_context.n = 6;
|
|
937
723
|
return fetch({
|
|
938
724
|
query: "carts",
|
|
939
725
|
method: "post",
|
|
@@ -949,17 +735,14 @@ var handler$3 = {
|
|
|
949
735
|
}]
|
|
950
736
|
}
|
|
951
737
|
});
|
|
952
|
-
case
|
|
953
|
-
updatedCart = _context.
|
|
738
|
+
case 6:
|
|
739
|
+
updatedCart = _context.v;
|
|
954
740
|
if (updatedCart.body) {
|
|
955
741
|
setCartId(updatedCart.body.id);
|
|
956
742
|
} else {
|
|
957
743
|
removeCartCookie();
|
|
958
744
|
}
|
|
959
|
-
return _context.
|
|
960
|
-
case 18:
|
|
961
|
-
case "end":
|
|
962
|
-
return _context.stop();
|
|
745
|
+
return _context.a(2, updatedCart.body ? normalizeCart(updatedCart.body, provider.locale) : undefined);
|
|
963
746
|
}
|
|
964
747
|
}, _callee);
|
|
965
748
|
}))();
|
|
@@ -976,22 +759,22 @@ var handler$3 = {
|
|
|
976
759
|
var _useCart = commerce.useCart(),
|
|
977
760
|
mutate = _useCart.mutate;
|
|
978
761
|
return React.useCallback(debounce(/*#__PURE__*/function () {
|
|
979
|
-
var _ref3 = _asyncToGenerator(/*#__PURE__*/
|
|
762
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(input) {
|
|
980
763
|
var _input$id;
|
|
981
764
|
var itemId, data;
|
|
982
|
-
return
|
|
983
|
-
while (1) switch (_context2.
|
|
765
|
+
return _regenerator().w(function (_context2) {
|
|
766
|
+
while (1) switch (_context2.n) {
|
|
984
767
|
case 0:
|
|
985
768
|
itemId = (_input$id = input.id) != null ? _input$id : item == null ? void 0 : item.id;
|
|
986
769
|
if (!(!itemId || input.quantity == null)) {
|
|
987
|
-
_context2.
|
|
770
|
+
_context2.n = 1;
|
|
988
771
|
break;
|
|
989
772
|
}
|
|
990
773
|
throw new commerce.ValidationError({
|
|
991
774
|
message: "Invalid input used for this operation"
|
|
992
775
|
});
|
|
993
|
-
case
|
|
994
|
-
_context2.
|
|
776
|
+
case 1:
|
|
777
|
+
_context2.n = 2;
|
|
995
778
|
return fetch({
|
|
996
779
|
input: {
|
|
997
780
|
item: {
|
|
@@ -1000,15 +783,12 @@ var handler$3 = {
|
|
|
1000
783
|
itemId: itemId
|
|
1001
784
|
}
|
|
1002
785
|
});
|
|
1003
|
-
case
|
|
1004
|
-
data = _context2.
|
|
1005
|
-
_context2.
|
|
786
|
+
case 2:
|
|
787
|
+
data = _context2.v;
|
|
788
|
+
_context2.n = 3;
|
|
1006
789
|
return mutate(data, false);
|
|
1007
|
-
case
|
|
1008
|
-
return _context2.
|
|
1009
|
-
case 9:
|
|
1010
|
-
case "end":
|
|
1011
|
-
return _context2.stop();
|
|
790
|
+
case 3:
|
|
791
|
+
return _context2.a(2, data);
|
|
1012
792
|
}
|
|
1013
793
|
}, _callee2);
|
|
1014
794
|
}));
|
|
@@ -1048,10 +828,10 @@ var getFetcher = function getFetcher(creds) {
|
|
|
1048
828
|
projectKey: creds.projectKey
|
|
1049
829
|
});
|
|
1050
830
|
return /*#__PURE__*/function () {
|
|
1051
|
-
var _ref2 = _asyncToGenerator(/*#__PURE__*/
|
|
831
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
|
|
1052
832
|
var method, variables, query, body, queryBuilder;
|
|
1053
|
-
return
|
|
1054
|
-
while (1) switch (_context.
|
|
833
|
+
return _regenerator().w(function (_context) {
|
|
834
|
+
while (1) switch (_context.n) {
|
|
1055
835
|
case 0:
|
|
1056
836
|
method = _ref.method, variables = _ref.variables, query = _ref.query, body = _ref.body;
|
|
1057
837
|
queryBuilder = apiRoot;
|
|
@@ -1066,7 +846,7 @@ var getFetcher = function getFetcher(creds) {
|
|
|
1066
846
|
if (variables != null && variables.search) {
|
|
1067
847
|
queryBuilder = queryBuilder.search();
|
|
1068
848
|
}
|
|
1069
|
-
_context.
|
|
849
|
+
_context.n = 1;
|
|
1070
850
|
return queryBuilder[method]({
|
|
1071
851
|
body: body,
|
|
1072
852
|
queryArgs: _extends({
|
|
@@ -1080,11 +860,8 @@ var getFetcher = function getFetcher(creds) {
|
|
|
1080
860
|
where: variables.where
|
|
1081
861
|
} : {})
|
|
1082
862
|
}).execute();
|
|
1083
|
-
case
|
|
1084
|
-
return _context.
|
|
1085
|
-
case 8:
|
|
1086
|
-
case "end":
|
|
1087
|
-
return _context.stop();
|
|
863
|
+
case 1:
|
|
864
|
+
return _context.a(2, _context.v);
|
|
1088
865
|
}
|
|
1089
866
|
}, _callee);
|
|
1090
867
|
}));
|
|
@@ -1100,31 +877,28 @@ var handler$4 = {
|
|
|
1100
877
|
method: "get"
|
|
1101
878
|
},
|
|
1102
879
|
fetcher: function fetcher(_ref) {
|
|
1103
|
-
return _asyncToGenerator(/*#__PURE__*/
|
|
880
|
+
return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
1104
881
|
var input, options, fetch, provider, id, product;
|
|
1105
|
-
return
|
|
1106
|
-
while (1) switch (_context.
|
|
882
|
+
return _regenerator().w(function (_context) {
|
|
883
|
+
while (1) switch (_context.n) {
|
|
1107
884
|
case 0:
|
|
1108
885
|
input = _ref.input, options = _ref.options, fetch = _ref.fetch, provider = _ref.provider;
|
|
1109
886
|
id = input.id;
|
|
1110
887
|
if (id) {
|
|
1111
|
-
_context.
|
|
888
|
+
_context.n = 1;
|
|
1112
889
|
break;
|
|
1113
890
|
}
|
|
1114
|
-
return _context.
|
|
1115
|
-
case
|
|
1116
|
-
_context.
|
|
891
|
+
return _context.a(2, null);
|
|
892
|
+
case 1:
|
|
893
|
+
_context.n = 2;
|
|
1117
894
|
return fetch(_extends({}, options, {
|
|
1118
895
|
variables: {
|
|
1119
896
|
id: id
|
|
1120
897
|
}
|
|
1121
898
|
}));
|
|
1122
|
-
case
|
|
1123
|
-
product = _context.
|
|
1124
|
-
return _context.
|
|
1125
|
-
case 8:
|
|
1126
|
-
case "end":
|
|
1127
|
-
return _context.stop();
|
|
899
|
+
case 2:
|
|
900
|
+
product = _context.v;
|
|
901
|
+
return _context.a(2, product.body ? normalizeProduct(product.body, provider.locale) : null);
|
|
1128
902
|
}
|
|
1129
903
|
}, _callee);
|
|
1130
904
|
}))();
|
|
@@ -1151,15 +925,15 @@ var handler$5 = {
|
|
|
1151
925
|
query: "productProjections"
|
|
1152
926
|
},
|
|
1153
927
|
fetcher: function fetcher(_ref) {
|
|
1154
|
-
return _asyncToGenerator(/*#__PURE__*/
|
|
928
|
+
return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
1155
929
|
var _search;
|
|
1156
930
|
var input, options, fetch, provider, search, categoryId, sort, count, response;
|
|
1157
|
-
return
|
|
1158
|
-
while (1) switch (_context.
|
|
931
|
+
return _regenerator().w(function (_context) {
|
|
932
|
+
while (1) switch (_context.n) {
|
|
1159
933
|
case 0:
|
|
1160
934
|
input = _ref.input, options = _ref.options, fetch = _ref.fetch, provider = _ref.provider;
|
|
1161
935
|
search = input.search, categoryId = input.categoryId, sort = input.sort, count = input.count;
|
|
1162
|
-
_context.
|
|
936
|
+
_context.n = 1;
|
|
1163
937
|
return fetch(_extends({}, options, {
|
|
1164
938
|
variables: _extends({
|
|
1165
939
|
expand: ["masterData.current"],
|
|
@@ -1173,17 +947,14 @@ var handler$5 = {
|
|
|
1173
947
|
filters: "categories.id: subtree(\"" + categoryId + "\")"
|
|
1174
948
|
} : {})
|
|
1175
949
|
}));
|
|
1176
|
-
case
|
|
1177
|
-
response = _context.
|
|
1178
|
-
return _context.
|
|
950
|
+
case 1:
|
|
951
|
+
response = _context.v;
|
|
952
|
+
return _context.a(2, {
|
|
1179
953
|
products: response.body.results.map(function (product) {
|
|
1180
954
|
return normalizeProduct(product, provider.locale);
|
|
1181
955
|
}),
|
|
1182
956
|
found: response.body.count > 0
|
|
1183
957
|
});
|
|
1184
|
-
case 6:
|
|
1185
|
-
case "end":
|
|
1186
|
-
return _context.stop();
|
|
1187
958
|
}
|
|
1188
959
|
}, _callee);
|
|
1189
960
|
}))();
|
|
@@ -1209,14 +980,11 @@ var handler$6 = {
|
|
|
1209
980
|
query: ""
|
|
1210
981
|
},
|
|
1211
982
|
fetcher: function fetcher(_ref) {
|
|
1212
|
-
return _asyncToGenerator(/*#__PURE__*/
|
|
1213
|
-
return
|
|
1214
|
-
while (1) switch (_context.
|
|
983
|
+
return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
984
|
+
return _regenerator().w(function (_context) {
|
|
985
|
+
while (1) switch (_context.n) {
|
|
1215
986
|
case 0:
|
|
1216
|
-
return _context.
|
|
1217
|
-
case 2:
|
|
1218
|
-
case "end":
|
|
1219
|
-
return _context.stop();
|
|
987
|
+
return _context.a(2, null);
|
|
1220
988
|
}
|
|
1221
989
|
}, _callee);
|
|
1222
990
|
}))();
|
|
@@ -1250,37 +1018,36 @@ var handler$7 = {
|
|
|
1250
1018
|
method: "get"
|
|
1251
1019
|
},
|
|
1252
1020
|
fetcher: function fetcher(_ref) {
|
|
1253
|
-
return _asyncToGenerator(/*#__PURE__*/
|
|
1021
|
+
return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
1254
1022
|
var input, options, fetch, provider, categoryId, categories, category;
|
|
1255
|
-
return
|
|
1256
|
-
while (1) switch (_context.
|
|
1023
|
+
return _regenerator().w(function (_context) {
|
|
1024
|
+
while (1) switch (_context.n) {
|
|
1257
1025
|
case 0:
|
|
1258
1026
|
input = _ref.input, options = _ref.options, fetch = _ref.fetch, provider = _ref.provider;
|
|
1259
1027
|
categoryId = input.categoryId;
|
|
1260
1028
|
if (categoryId) {
|
|
1261
|
-
_context.
|
|
1029
|
+
_context.n = 2;
|
|
1262
1030
|
break;
|
|
1263
1031
|
}
|
|
1264
|
-
_context.
|
|
1032
|
+
_context.n = 1;
|
|
1265
1033
|
return fetch(_extends({}, options));
|
|
1266
|
-
case
|
|
1267
|
-
categories = _context.
|
|
1268
|
-
return _context.
|
|
1034
|
+
case 1:
|
|
1035
|
+
categories = _context.v;
|
|
1036
|
+
return _context.a(2, categories.body ? categories.body.results.map(function (category) {
|
|
1269
1037
|
return normalizeCategory(category, provider.locale);
|
|
1270
1038
|
}) : []);
|
|
1271
|
-
case
|
|
1272
|
-
_context.
|
|
1039
|
+
case 2:
|
|
1040
|
+
_context.n = 3;
|
|
1273
1041
|
return fetch(_extends({}, options, {
|
|
1274
1042
|
variables: _extends({}, categoryId ? {
|
|
1275
1043
|
id: categoryId
|
|
1276
1044
|
} : {})
|
|
1277
1045
|
}));
|
|
1278
|
-
case
|
|
1279
|
-
category = _context.
|
|
1280
|
-
return _context.
|
|
1281
|
-
case
|
|
1282
|
-
|
|
1283
|
-
return _context.stop();
|
|
1046
|
+
case 3:
|
|
1047
|
+
category = _context.v;
|
|
1048
|
+
return _context.a(2, category.body ? [normalizeCategory(category.body, provider.locale)] : []);
|
|
1049
|
+
case 4:
|
|
1050
|
+
return _context.a(2);
|
|
1284
1051
|
}
|
|
1285
1052
|
}, _callee);
|
|
1286
1053
|
}))();
|
|
@@ -1383,22 +1150,19 @@ function CommerceProviderComponent(props) {
|
|
|
1383
1150
|
}, [projectKey, clientId, clientSecret, region]);
|
|
1384
1151
|
var _usePlasmicQueryData = query.usePlasmicQueryData(JSON.stringify({
|
|
1385
1152
|
creds: creds
|
|
1386
|
-
}) + "locale", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/
|
|
1153
|
+
}) + "locale", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
1387
1154
|
var fetcher, project;
|
|
1388
|
-
return
|
|
1389
|
-
while (1) switch (_context.
|
|
1155
|
+
return _regenerator().w(function (_context) {
|
|
1156
|
+
while (1) switch (_context.n) {
|
|
1390
1157
|
case 0:
|
|
1391
1158
|
fetcher = getFetcher(creds);
|
|
1392
|
-
_context.
|
|
1159
|
+
_context.n = 1;
|
|
1393
1160
|
return fetcher({
|
|
1394
1161
|
method: "get"
|
|
1395
1162
|
});
|
|
1396
|
-
case
|
|
1397
|
-
project = _context.
|
|
1398
|
-
return _context.
|
|
1399
|
-
case 5:
|
|
1400
|
-
case "end":
|
|
1401
|
-
return _context.stop();
|
|
1163
|
+
case 1:
|
|
1164
|
+
project = _context.v;
|
|
1165
|
+
return _context.a(2, project.body ? project.body.languages[0] : undefined);
|
|
1402
1166
|
}
|
|
1403
1167
|
}, _callee);
|
|
1404
1168
|
}))),
|