@plasmicpkgs/commerce-commercetools 0.0.193 → 0.0.194
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
|
@@ -41,306 +41,113 @@ function _extends() {
|
|
|
41
41
|
return n;
|
|
42
42
|
}, _extends.apply(null, arguments);
|
|
43
43
|
}
|
|
44
|
-
function
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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
|
-
return o(a, "_invoke", {
|
|
79
|
-
value: makeInvokeMethod(t, r, c)
|
|
80
|
-
}), a;
|
|
81
|
-
}
|
|
82
|
-
function tryCatch(t, e, r) {
|
|
83
|
-
try {
|
|
84
|
-
return {
|
|
85
|
-
type: "normal",
|
|
86
|
-
arg: t.call(e, r)
|
|
87
|
-
};
|
|
88
|
-
} catch (t) {
|
|
89
|
-
return {
|
|
90
|
-
type: "throw",
|
|
91
|
-
arg: t
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
e.wrap = wrap;
|
|
96
|
-
var h = "suspendedStart",
|
|
97
|
-
l = "suspendedYield",
|
|
98
|
-
f = "executing",
|
|
99
|
-
s = "completed",
|
|
100
|
-
y = {};
|
|
101
|
-
function Generator() {}
|
|
102
|
-
function GeneratorFunction() {}
|
|
103
|
-
function GeneratorFunctionPrototype() {}
|
|
104
|
-
var p = {};
|
|
105
|
-
define(p, a, function () {
|
|
106
|
-
return this;
|
|
107
|
-
});
|
|
108
|
-
var d = Object.getPrototypeOf,
|
|
109
|
-
v = d && d(d(values([])));
|
|
110
|
-
v && v !== r && n.call(v, a) && (p = v);
|
|
111
|
-
var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
|
|
112
|
-
function defineIteratorMethods(t) {
|
|
113
|
-
["next", "throw", "return"].forEach(function (e) {
|
|
114
|
-
define(t, e, function (t) {
|
|
115
|
-
return this._invoke(e, t);
|
|
116
|
-
});
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
function AsyncIterator(t, e) {
|
|
120
|
-
function invoke(r, o, i, a) {
|
|
121
|
-
var c = tryCatch(t[r], t, o);
|
|
122
|
-
if ("throw" !== c.type) {
|
|
123
|
-
var u = c.arg,
|
|
124
|
-
h = u.value;
|
|
125
|
-
return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
|
|
126
|
-
invoke("next", t, i, a);
|
|
127
|
-
}, function (t) {
|
|
128
|
-
invoke("throw", t, i, a);
|
|
129
|
-
}) : e.resolve(h).then(function (t) {
|
|
130
|
-
u.value = t, i(u);
|
|
131
|
-
}, function (t) {
|
|
132
|
-
return invoke("throw", t, i, a);
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
a(c.arg);
|
|
136
|
-
}
|
|
137
|
-
var r;
|
|
138
|
-
o(this, "_invoke", {
|
|
139
|
-
value: function (t, n) {
|
|
140
|
-
function callInvokeWithMethodAndArg() {
|
|
141
|
-
return new e(function (e, r) {
|
|
142
|
-
invoke(t, n, e, r);
|
|
143
|
-
});
|
|
44
|
+
function _regenerator() {
|
|
45
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
|
46
|
+
var e,
|
|
47
|
+
t,
|
|
48
|
+
r = "function" == typeof Symbol ? Symbol : {},
|
|
49
|
+
n = r.iterator || "@@iterator",
|
|
50
|
+
o = r.toStringTag || "@@toStringTag";
|
|
51
|
+
function i(r, n, o, i) {
|
|
52
|
+
var c = n && n.prototype instanceof Generator ? n : Generator,
|
|
53
|
+
u = Object.create(c.prototype);
|
|
54
|
+
return _regeneratorDefine(u, "_invoke", function (r, n, o) {
|
|
55
|
+
var i,
|
|
56
|
+
c,
|
|
57
|
+
u,
|
|
58
|
+
f = 0,
|
|
59
|
+
p = o || [],
|
|
60
|
+
y = !1,
|
|
61
|
+
G = {
|
|
62
|
+
p: 0,
|
|
63
|
+
n: 0,
|
|
64
|
+
v: e,
|
|
65
|
+
a: d,
|
|
66
|
+
f: d.bind(e, 4),
|
|
67
|
+
d: function (t, r) {
|
|
68
|
+
return i = t, c = 0, u = e, G.n = r, a;
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
function d(r, n) {
|
|
72
|
+
for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) {
|
|
73
|
+
var o,
|
|
74
|
+
i = p[t],
|
|
75
|
+
d = G.p,
|
|
76
|
+
l = i[2];
|
|
77
|
+
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));
|
|
144
78
|
}
|
|
145
|
-
|
|
79
|
+
if (o || r > 1) return a;
|
|
80
|
+
throw y = !0, n;
|
|
146
81
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
82
|
+
return function (o, p, l) {
|
|
83
|
+
if (f > 1) throw TypeError("Generator is already running");
|
|
84
|
+
for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) {
|
|
85
|
+
i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u);
|
|
86
|
+
try {
|
|
87
|
+
if (f = 2, i) {
|
|
88
|
+
if (c || (o = "next"), t = i[o]) {
|
|
89
|
+
if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object");
|
|
90
|
+
if (!t.done) return t;
|
|
91
|
+
u = t.value, c < 2 && (c = 0);
|
|
92
|
+
} else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1);
|
|
93
|
+
i = e;
|
|
94
|
+
} else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break;
|
|
95
|
+
} catch (t) {
|
|
96
|
+
i = e, c = 1, u = t;
|
|
97
|
+
} finally {
|
|
98
|
+
f = 1;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
155
101
|
return {
|
|
156
102
|
value: t,
|
|
157
|
-
done:
|
|
103
|
+
done: y
|
|
158
104
|
};
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
var c = n.delegate;
|
|
162
|
-
if (c) {
|
|
163
|
-
var u = maybeInvokeDelegate(c, n);
|
|
164
|
-
if (u) {
|
|
165
|
-
if (u === y) continue;
|
|
166
|
-
return u;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
|
|
170
|
-
if (o === h) throw o = s, n.arg;
|
|
171
|
-
n.dispatchException(n.arg);
|
|
172
|
-
} else "return" === n.method && n.abrupt("return", n.arg);
|
|
173
|
-
o = f;
|
|
174
|
-
var p = tryCatch(e, r, n);
|
|
175
|
-
if ("normal" === p.type) {
|
|
176
|
-
if (o = n.done ? s : l, p.arg === y) continue;
|
|
177
|
-
return {
|
|
178
|
-
value: p.arg,
|
|
179
|
-
done: n.done
|
|
180
|
-
};
|
|
181
|
-
}
|
|
182
|
-
"throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
|
|
183
|
-
}
|
|
184
|
-
};
|
|
185
|
-
}
|
|
186
|
-
function maybeInvokeDelegate(e, r) {
|
|
187
|
-
var n = r.method,
|
|
188
|
-
o = e.iterator[n];
|
|
189
|
-
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;
|
|
190
|
-
var i = tryCatch(o, e.iterator, r.arg);
|
|
191
|
-
if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
|
|
192
|
-
var a = i.arg;
|
|
193
|
-
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);
|
|
194
|
-
}
|
|
195
|
-
function pushTryEntry(t) {
|
|
196
|
-
var e = {
|
|
197
|
-
tryLoc: t[0]
|
|
198
|
-
};
|
|
199
|
-
1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
|
|
200
|
-
}
|
|
201
|
-
function resetTryEntry(t) {
|
|
202
|
-
var e = t.completion || {};
|
|
203
|
-
e.type = "normal", delete e.arg, t.completion = e;
|
|
204
|
-
}
|
|
205
|
-
function Context(t) {
|
|
206
|
-
this.tryEntries = [{
|
|
207
|
-
tryLoc: "root"
|
|
208
|
-
}], t.forEach(pushTryEntry, this), this.reset(!0);
|
|
105
|
+
};
|
|
106
|
+
}(r, o, i), !0), u;
|
|
209
107
|
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
return i.next = i;
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
throw new TypeError(typeof e + " is not iterable");
|
|
108
|
+
var a = {};
|
|
109
|
+
function Generator() {}
|
|
110
|
+
function GeneratorFunction() {}
|
|
111
|
+
function GeneratorFunctionPrototype() {}
|
|
112
|
+
t = Object.getPrototypeOf;
|
|
113
|
+
var c = [][n] ? t(t([][n]())) : (_regeneratorDefine(t = {}, n, function () {
|
|
114
|
+
return this;
|
|
115
|
+
}), t),
|
|
116
|
+
u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c);
|
|
117
|
+
function f(e) {
|
|
118
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e;
|
|
225
119
|
}
|
|
226
|
-
return GeneratorFunction.prototype = GeneratorFunctionPrototype,
|
|
227
|
-
value: GeneratorFunctionPrototype,
|
|
228
|
-
configurable: !0
|
|
229
|
-
}), o(GeneratorFunctionPrototype, "constructor", {
|
|
230
|
-
value: GeneratorFunction,
|
|
231
|
-
configurable: !0
|
|
232
|
-
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
|
|
233
|
-
var e = "function" == typeof t && t.constructor;
|
|
234
|
-
return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
|
|
235
|
-
}, e.mark = function (t) {
|
|
236
|
-
return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
|
|
237
|
-
}, e.awrap = function (t) {
|
|
238
|
-
return {
|
|
239
|
-
__await: t
|
|
240
|
-
};
|
|
241
|
-
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
|
|
120
|
+
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 () {
|
|
242
121
|
return this;
|
|
243
|
-
}),
|
|
244
|
-
void 0 === i && (i = Promise);
|
|
245
|
-
var a = new AsyncIterator(wrap(t, r, n, o), i);
|
|
246
|
-
return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
|
|
247
|
-
return t.done ? t.value : a.next();
|
|
248
|
-
});
|
|
249
|
-
}, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
|
|
250
|
-
return this;
|
|
251
|
-
}), define(g, "toString", function () {
|
|
122
|
+
}), _regeneratorDefine(u, "toString", function () {
|
|
252
123
|
return "[object Generator]";
|
|
253
|
-
}),
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
return r.reverse(), function next() {
|
|
258
|
-
for (; r.length;) {
|
|
259
|
-
var t = r.pop();
|
|
260
|
-
if (t in e) return next.value = t, next.done = !1, next;
|
|
261
|
-
}
|
|
262
|
-
return next.done = !0, next;
|
|
124
|
+
}), (_regenerator = function () {
|
|
125
|
+
return {
|
|
126
|
+
w: i,
|
|
127
|
+
m: f
|
|
263
128
|
};
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
function handle(n, o) {
|
|
279
|
-
return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
|
|
280
|
-
}
|
|
281
|
-
for (var o = this.tryEntries.length - 1; o >= 0; --o) {
|
|
282
|
-
var i = this.tryEntries[o],
|
|
283
|
-
a = i.completion;
|
|
284
|
-
if ("root" === i.tryLoc) return handle("end");
|
|
285
|
-
if (i.tryLoc <= this.prev) {
|
|
286
|
-
var c = n.call(i, "catchLoc"),
|
|
287
|
-
u = n.call(i, "finallyLoc");
|
|
288
|
-
if (c && u) {
|
|
289
|
-
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
290
|
-
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
291
|
-
} else if (c) {
|
|
292
|
-
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
293
|
-
} else {
|
|
294
|
-
if (!u) throw Error("try statement without catch or finally");
|
|
295
|
-
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
},
|
|
300
|
-
abrupt: function (t, e) {
|
|
301
|
-
for (var r = this.tryEntries.length - 1; r >= 0; --r) {
|
|
302
|
-
var o = this.tryEntries[r];
|
|
303
|
-
if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
|
|
304
|
-
var i = o;
|
|
305
|
-
break;
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
|
|
309
|
-
var a = i ? i.completion : {};
|
|
310
|
-
return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
|
|
311
|
-
},
|
|
312
|
-
complete: function (t, e) {
|
|
313
|
-
if ("throw" === t.type) throw t.arg;
|
|
314
|
-
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;
|
|
315
|
-
},
|
|
316
|
-
finish: function (t) {
|
|
317
|
-
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
318
|
-
var r = this.tryEntries[e];
|
|
319
|
-
if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
|
|
320
|
-
}
|
|
321
|
-
},
|
|
322
|
-
catch: function (t) {
|
|
323
|
-
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
324
|
-
var r = this.tryEntries[e];
|
|
325
|
-
if (r.tryLoc === t) {
|
|
326
|
-
var n = r.completion;
|
|
327
|
-
if ("throw" === n.type) {
|
|
328
|
-
var o = n.arg;
|
|
329
|
-
resetTryEntry(r);
|
|
330
|
-
}
|
|
331
|
-
return o;
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
throw Error("illegal catch attempt");
|
|
335
|
-
},
|
|
336
|
-
delegateYield: function (e, r, n) {
|
|
337
|
-
return this.delegate = {
|
|
338
|
-
iterator: values(e),
|
|
339
|
-
resultName: r,
|
|
340
|
-
nextLoc: n
|
|
341
|
-
}, "next" === this.method && (this.arg = t), y;
|
|
129
|
+
})();
|
|
130
|
+
}
|
|
131
|
+
function _regeneratorDefine(e, r, n, t) {
|
|
132
|
+
var i = Object.defineProperty;
|
|
133
|
+
try {
|
|
134
|
+
i({}, "", {});
|
|
135
|
+
} catch (e) {
|
|
136
|
+
i = 0;
|
|
137
|
+
}
|
|
138
|
+
_regeneratorDefine = function (e, r, n, t) {
|
|
139
|
+
function o(r, n) {
|
|
140
|
+
_regeneratorDefine(e, r, function (e) {
|
|
141
|
+
return this._invoke(r, n, e);
|
|
142
|
+
});
|
|
342
143
|
}
|
|
343
|
-
|
|
144
|
+
r ? i ? i(e, r, {
|
|
145
|
+
value: n,
|
|
146
|
+
enumerable: !t,
|
|
147
|
+
configurable: !t,
|
|
148
|
+
writable: !t
|
|
149
|
+
}) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2));
|
|
150
|
+
}, _regeneratorDefine(e, r, n, t);
|
|
344
151
|
}
|
|
345
152
|
|
|
346
153
|
var getSortVariables = function getSortVariables(sort, isCategory) {
|
|
@@ -393,32 +200,29 @@ var removeCartCookie = function removeCartCookie() {
|
|
|
393
200
|
};
|
|
394
201
|
|
|
395
202
|
var createCart = /*#__PURE__*/function () {
|
|
396
|
-
var _ref = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/
|
|
203
|
+
var _ref = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(fetch) {
|
|
397
204
|
var draft, cart;
|
|
398
|
-
return
|
|
399
|
-
while (1) switch (_context.
|
|
205
|
+
return _regenerator().w(function (_context) {
|
|
206
|
+
while (1) switch (_context.n) {
|
|
400
207
|
case 0:
|
|
401
208
|
draft = {
|
|
402
209
|
currency: 'USD',
|
|
403
210
|
country: 'US'
|
|
404
211
|
};
|
|
405
|
-
_context.
|
|
212
|
+
_context.n = 1;
|
|
406
213
|
return fetch({
|
|
407
214
|
query: 'carts',
|
|
408
215
|
method: 'post',
|
|
409
216
|
body: draft
|
|
410
217
|
});
|
|
411
|
-
case
|
|
412
|
-
cart = _context.
|
|
218
|
+
case 1:
|
|
219
|
+
cart = _context.v;
|
|
413
220
|
if (!cart.body) {
|
|
414
221
|
removeCartCookie();
|
|
415
222
|
} else {
|
|
416
223
|
setCartId(cart.body.id);
|
|
417
224
|
}
|
|
418
|
-
return _context.
|
|
419
|
-
case 6:
|
|
420
|
-
case "end":
|
|
421
|
-
return _context.stop();
|
|
225
|
+
return _context.a(2, cart.body);
|
|
422
226
|
}
|
|
423
227
|
}, _callee);
|
|
424
228
|
}));
|
|
@@ -428,17 +232,17 @@ var createCart = /*#__PURE__*/function () {
|
|
|
428
232
|
}();
|
|
429
233
|
|
|
430
234
|
var getActiveCart = /*#__PURE__*/function () {
|
|
431
|
-
var _ref = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/
|
|
235
|
+
var _ref = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(fetch) {
|
|
432
236
|
var cartId, activeCart;
|
|
433
|
-
return
|
|
434
|
-
while (1) switch (_context.
|
|
237
|
+
return _regenerator().w(function (_context) {
|
|
238
|
+
while (1) switch (_context.n) {
|
|
435
239
|
case 0:
|
|
436
240
|
cartId = getCartId();
|
|
437
241
|
if (!cartId) {
|
|
438
|
-
_context.
|
|
242
|
+
_context.n = 2;
|
|
439
243
|
break;
|
|
440
244
|
}
|
|
441
|
-
_context.
|
|
245
|
+
_context.n = 1;
|
|
442
246
|
return fetch({
|
|
443
247
|
query: 'carts',
|
|
444
248
|
method: 'get',
|
|
@@ -446,25 +250,22 @@ var getActiveCart = /*#__PURE__*/function () {
|
|
|
446
250
|
id: cartId
|
|
447
251
|
}
|
|
448
252
|
});
|
|
449
|
-
case
|
|
450
|
-
activeCart = _context.
|
|
451
|
-
_context.
|
|
253
|
+
case 1:
|
|
254
|
+
activeCart = _context.v.body;
|
|
255
|
+
_context.n = 4;
|
|
452
256
|
break;
|
|
453
|
-
case
|
|
454
|
-
_context.
|
|
257
|
+
case 2:
|
|
258
|
+
_context.n = 3;
|
|
455
259
|
return createCart(fetch);
|
|
456
|
-
case
|
|
457
|
-
activeCart = _context.
|
|
458
|
-
case
|
|
260
|
+
case 3:
|
|
261
|
+
activeCart = _context.v;
|
|
262
|
+
case 4:
|
|
459
263
|
if (!activeCart) {
|
|
460
264
|
removeCartCookie();
|
|
461
265
|
} else {
|
|
462
266
|
setCartId(activeCart.id);
|
|
463
267
|
}
|
|
464
|
-
return _context.
|
|
465
|
-
case 12:
|
|
466
|
-
case "end":
|
|
467
|
-
return _context.stop();
|
|
268
|
+
return _context.a(2, activeCart);
|
|
468
269
|
}
|
|
469
270
|
}, _callee);
|
|
470
271
|
}));
|
|
@@ -638,20 +439,17 @@ var handler = {
|
|
|
638
439
|
method: "get"
|
|
639
440
|
},
|
|
640
441
|
fetcher: function fetcher(_ref) {
|
|
641
|
-
return _asyncToGenerator(/*#__PURE__*/
|
|
442
|
+
return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
642
443
|
var fetch, provider, activeCart;
|
|
643
|
-
return
|
|
644
|
-
while (1) switch (_context.
|
|
444
|
+
return _regenerator().w(function (_context) {
|
|
445
|
+
while (1) switch (_context.n) {
|
|
645
446
|
case 0:
|
|
646
447
|
fetch = _ref.fetch, provider = _ref.provider;
|
|
647
|
-
_context.
|
|
448
|
+
_context.n = 1;
|
|
648
449
|
return getActiveCart(fetch);
|
|
649
|
-
case
|
|
650
|
-
activeCart = _context.
|
|
651
|
-
return _context.
|
|
652
|
-
case 5:
|
|
653
|
-
case "end":
|
|
654
|
-
return _context.stop();
|
|
450
|
+
case 1:
|
|
451
|
+
activeCart = _context.v;
|
|
452
|
+
return _context.a(2, activeCart ? normalizeCart(activeCart, provider.locale) : null);
|
|
655
453
|
}
|
|
656
454
|
}, _callee);
|
|
657
455
|
}))();
|
|
@@ -685,24 +483,24 @@ var handler$1 = {
|
|
|
685
483
|
method: "post"
|
|
686
484
|
},
|
|
687
485
|
fetcher: function fetcher(_ref) {
|
|
688
|
-
return _asyncToGenerator(/*#__PURE__*/
|
|
486
|
+
return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
689
487
|
var _item$quantity;
|
|
690
488
|
var item, fetch, provider, activeCart, updatedCart;
|
|
691
|
-
return
|
|
692
|
-
while (1) switch (_context.
|
|
489
|
+
return _regenerator().w(function (_context) {
|
|
490
|
+
while (1) switch (_context.n) {
|
|
693
491
|
case 0:
|
|
694
492
|
item = _ref.input, fetch = _ref.fetch, provider = _ref.provider;
|
|
695
|
-
_context.
|
|
493
|
+
_context.n = 1;
|
|
696
494
|
return getActiveCart(fetch);
|
|
697
|
-
case
|
|
698
|
-
activeCart = _context.
|
|
495
|
+
case 1:
|
|
496
|
+
activeCart = _context.v;
|
|
699
497
|
if (!(item.quantity && (!Number.isInteger(item.quantity) || item.quantity < 1) || !activeCart)) {
|
|
700
|
-
_context.
|
|
498
|
+
_context.n = 2;
|
|
701
499
|
break;
|
|
702
500
|
}
|
|
703
|
-
return _context.
|
|
704
|
-
case
|
|
705
|
-
_context.
|
|
501
|
+
return _context.a(2, undefined);
|
|
502
|
+
case 2:
|
|
503
|
+
_context.n = 3;
|
|
706
504
|
return fetch({
|
|
707
505
|
query: "carts",
|
|
708
506
|
method: "post",
|
|
@@ -719,17 +517,14 @@ var handler$1 = {
|
|
|
719
517
|
}]
|
|
720
518
|
}
|
|
721
519
|
});
|
|
722
|
-
case
|
|
723
|
-
updatedCart = _context.
|
|
520
|
+
case 3:
|
|
521
|
+
updatedCart = _context.v;
|
|
724
522
|
if (updatedCart.body) {
|
|
725
523
|
setCartId(updatedCart.body.id);
|
|
726
524
|
} else {
|
|
727
525
|
removeCartCookie();
|
|
728
526
|
}
|
|
729
|
-
return _context.
|
|
730
|
-
case 11:
|
|
731
|
-
case "end":
|
|
732
|
-
return _context.stop();
|
|
527
|
+
return _context.a(2, updatedCart.body ? normalizeCart(updatedCart.body, provider.locale) : undefined);
|
|
733
528
|
}
|
|
734
529
|
}, _callee);
|
|
735
530
|
}))();
|
|
@@ -740,24 +535,21 @@ var handler$1 = {
|
|
|
740
535
|
var _useCart = useCart(),
|
|
741
536
|
mutate = _useCart.mutate;
|
|
742
537
|
return useCallback(/*#__PURE__*/function () {
|
|
743
|
-
var _addItem = _asyncToGenerator(/*#__PURE__*/
|
|
538
|
+
var _addItem = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(input) {
|
|
744
539
|
var data;
|
|
745
|
-
return
|
|
746
|
-
while (1) switch (_context2.
|
|
540
|
+
return _regenerator().w(function (_context2) {
|
|
541
|
+
while (1) switch (_context2.n) {
|
|
747
542
|
case 0:
|
|
748
|
-
_context2.
|
|
543
|
+
_context2.n = 1;
|
|
749
544
|
return fetch({
|
|
750
545
|
input: input
|
|
751
546
|
});
|
|
752
|
-
case
|
|
753
|
-
data = _context2.
|
|
754
|
-
_context2.
|
|
547
|
+
case 1:
|
|
548
|
+
data = _context2.v;
|
|
549
|
+
_context2.n = 2;
|
|
755
550
|
return mutate(data, false);
|
|
756
|
-
case
|
|
757
|
-
return _context2.
|
|
758
|
-
case 6:
|
|
759
|
-
case "end":
|
|
760
|
-
return _context2.stop();
|
|
551
|
+
case 2:
|
|
552
|
+
return _context2.a(2, data);
|
|
761
553
|
}
|
|
762
554
|
}, _callee2);
|
|
763
555
|
}));
|
|
@@ -776,23 +568,23 @@ var handler$2 = {
|
|
|
776
568
|
method: "post"
|
|
777
569
|
},
|
|
778
570
|
fetcher: function fetcher(_ref) {
|
|
779
|
-
return _asyncToGenerator(/*#__PURE__*/
|
|
571
|
+
return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
780
572
|
var itemId, fetch, provider, activeCart, updatedCart;
|
|
781
|
-
return
|
|
782
|
-
while (1) switch (_context.
|
|
573
|
+
return _regenerator().w(function (_context) {
|
|
574
|
+
while (1) switch (_context.n) {
|
|
783
575
|
case 0:
|
|
784
576
|
itemId = _ref.input.itemId, fetch = _ref.fetch, provider = _ref.provider;
|
|
785
|
-
_context.
|
|
577
|
+
_context.n = 1;
|
|
786
578
|
return getActiveCart(fetch);
|
|
787
|
-
case
|
|
788
|
-
activeCart = _context.
|
|
579
|
+
case 1:
|
|
580
|
+
activeCart = _context.v;
|
|
789
581
|
if (!(!itemId || !activeCart)) {
|
|
790
|
-
_context.
|
|
582
|
+
_context.n = 2;
|
|
791
583
|
break;
|
|
792
584
|
}
|
|
793
|
-
return _context.
|
|
794
|
-
case
|
|
795
|
-
_context.
|
|
585
|
+
return _context.a(2, undefined);
|
|
586
|
+
case 2:
|
|
587
|
+
_context.n = 3;
|
|
796
588
|
return fetch({
|
|
797
589
|
query: "carts",
|
|
798
590
|
method: "post",
|
|
@@ -807,17 +599,14 @@ var handler$2 = {
|
|
|
807
599
|
}]
|
|
808
600
|
}
|
|
809
601
|
});
|
|
810
|
-
case
|
|
811
|
-
updatedCart = _context.
|
|
602
|
+
case 3:
|
|
603
|
+
updatedCart = _context.v;
|
|
812
604
|
if (updatedCart.body) {
|
|
813
605
|
setCartId(updatedCart.body.id);
|
|
814
606
|
} else {
|
|
815
607
|
removeCartCookie();
|
|
816
608
|
}
|
|
817
|
-
return _context.
|
|
818
|
-
case 11:
|
|
819
|
-
case "end":
|
|
820
|
-
return _context.stop();
|
|
609
|
+
return _context.a(2, normalizeCart(updatedCart.body, provider.locale));
|
|
821
610
|
}
|
|
822
611
|
}, _callee);
|
|
823
612
|
}))();
|
|
@@ -833,36 +622,33 @@ var handler$2 = {
|
|
|
833
622
|
var _useCart = useCart(),
|
|
834
623
|
mutate = _useCart.mutate;
|
|
835
624
|
var removeItem = /*#__PURE__*/function () {
|
|
836
|
-
var _ref3 = _asyncToGenerator(/*#__PURE__*/
|
|
625
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(input) {
|
|
837
626
|
var _input$id;
|
|
838
627
|
var itemId, data;
|
|
839
|
-
return
|
|
840
|
-
while (1) switch (_context2.
|
|
628
|
+
return _regenerator().w(function (_context2) {
|
|
629
|
+
while (1) switch (_context2.n) {
|
|
841
630
|
case 0:
|
|
842
631
|
itemId = (_input$id = input == null ? void 0 : input.id) != null ? _input$id : item == null ? void 0 : item.id;
|
|
843
632
|
if (itemId) {
|
|
844
|
-
_context2.
|
|
633
|
+
_context2.n = 1;
|
|
845
634
|
break;
|
|
846
635
|
}
|
|
847
636
|
throw new ValidationError({
|
|
848
637
|
message: "Invalid input used for this operation"
|
|
849
638
|
});
|
|
850
|
-
case
|
|
851
|
-
_context2.
|
|
639
|
+
case 1:
|
|
640
|
+
_context2.n = 2;
|
|
852
641
|
return fetch({
|
|
853
642
|
input: {
|
|
854
643
|
itemId: itemId
|
|
855
644
|
}
|
|
856
645
|
});
|
|
857
|
-
case
|
|
858
|
-
data = _context2.
|
|
859
|
-
_context2.
|
|
646
|
+
case 2:
|
|
647
|
+
data = _context2.v;
|
|
648
|
+
_context2.n = 3;
|
|
860
649
|
return mutate(data, false);
|
|
861
|
-
case
|
|
862
|
-
return _context2.
|
|
863
|
-
case 9:
|
|
864
|
-
case "end":
|
|
865
|
-
return _context2.stop();
|
|
650
|
+
case 3:
|
|
651
|
+
return _context2.a(2, data);
|
|
866
652
|
}
|
|
867
653
|
}, _callee2);
|
|
868
654
|
}));
|
|
@@ -881,22 +667,22 @@ var handler$3 = {
|
|
|
881
667
|
method: "post"
|
|
882
668
|
},
|
|
883
669
|
fetcher: function fetcher(_ref) {
|
|
884
|
-
return _asyncToGenerator(/*#__PURE__*/
|
|
670
|
+
return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
885
671
|
var _item$quantity;
|
|
886
672
|
var _ref$input, item, itemId, fetch, provider, activeCart, updatedCart;
|
|
887
|
-
return
|
|
888
|
-
while (1) switch (_context.
|
|
673
|
+
return _regenerator().w(function (_context) {
|
|
674
|
+
while (1) switch (_context.n) {
|
|
889
675
|
case 0:
|
|
890
676
|
_ref$input = _ref.input, item = _ref$input.item, itemId = _ref$input.itemId, fetch = _ref.fetch, provider = _ref.provider;
|
|
891
677
|
if (!Number.isInteger(item.quantity)) {
|
|
892
|
-
_context.
|
|
678
|
+
_context.n = 2;
|
|
893
679
|
break;
|
|
894
680
|
}
|
|
895
681
|
if (!(item.quantity < 1)) {
|
|
896
|
-
_context.
|
|
682
|
+
_context.n = 1;
|
|
897
683
|
break;
|
|
898
684
|
}
|
|
899
|
-
return _context.
|
|
685
|
+
return _context.a(2, handler$2.fetcher == null ? void 0 : handler$2.fetcher({
|
|
900
686
|
options: handler$2.fetchOptions,
|
|
901
687
|
input: {
|
|
902
688
|
itemId: itemId
|
|
@@ -904,29 +690,29 @@ var handler$3 = {
|
|
|
904
690
|
fetch: fetch,
|
|
905
691
|
provider: provider
|
|
906
692
|
}));
|
|
907
|
-
case
|
|
908
|
-
_context.
|
|
693
|
+
case 1:
|
|
694
|
+
_context.n = 3;
|
|
909
695
|
break;
|
|
910
|
-
case
|
|
696
|
+
case 2:
|
|
911
697
|
if (!item.quantity) {
|
|
912
|
-
_context.
|
|
698
|
+
_context.n = 3;
|
|
913
699
|
break;
|
|
914
700
|
}
|
|
915
701
|
throw new ValidationError({
|
|
916
702
|
message: "The item quantity has to be a valid integer"
|
|
917
703
|
});
|
|
918
|
-
case
|
|
919
|
-
_context.
|
|
704
|
+
case 3:
|
|
705
|
+
_context.n = 4;
|
|
920
706
|
return getActiveCart(fetch);
|
|
921
|
-
case
|
|
922
|
-
activeCart = _context.
|
|
707
|
+
case 4:
|
|
708
|
+
activeCart = _context.v;
|
|
923
709
|
if (!(item.quantity && (!Number.isInteger(item.quantity) || item.quantity < 1) || !activeCart)) {
|
|
924
|
-
_context.
|
|
710
|
+
_context.n = 5;
|
|
925
711
|
break;
|
|
926
712
|
}
|
|
927
|
-
return _context.
|
|
928
|
-
case
|
|
929
|
-
_context.
|
|
713
|
+
return _context.a(2, undefined);
|
|
714
|
+
case 5:
|
|
715
|
+
_context.n = 6;
|
|
930
716
|
return fetch({
|
|
931
717
|
query: "carts",
|
|
932
718
|
method: "post",
|
|
@@ -942,17 +728,14 @@ var handler$3 = {
|
|
|
942
728
|
}]
|
|
943
729
|
}
|
|
944
730
|
});
|
|
945
|
-
case
|
|
946
|
-
updatedCart = _context.
|
|
731
|
+
case 6:
|
|
732
|
+
updatedCart = _context.v;
|
|
947
733
|
if (updatedCart.body) {
|
|
948
734
|
setCartId(updatedCart.body.id);
|
|
949
735
|
} else {
|
|
950
736
|
removeCartCookie();
|
|
951
737
|
}
|
|
952
|
-
return _context.
|
|
953
|
-
case 18:
|
|
954
|
-
case "end":
|
|
955
|
-
return _context.stop();
|
|
738
|
+
return _context.a(2, updatedCart.body ? normalizeCart(updatedCart.body, provider.locale) : undefined);
|
|
956
739
|
}
|
|
957
740
|
}, _callee);
|
|
958
741
|
}))();
|
|
@@ -969,22 +752,22 @@ var handler$3 = {
|
|
|
969
752
|
var _useCart = useCart(),
|
|
970
753
|
mutate = _useCart.mutate;
|
|
971
754
|
return useCallback(debounce(/*#__PURE__*/function () {
|
|
972
|
-
var _ref3 = _asyncToGenerator(/*#__PURE__*/
|
|
755
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(input) {
|
|
973
756
|
var _input$id;
|
|
974
757
|
var itemId, data;
|
|
975
|
-
return
|
|
976
|
-
while (1) switch (_context2.
|
|
758
|
+
return _regenerator().w(function (_context2) {
|
|
759
|
+
while (1) switch (_context2.n) {
|
|
977
760
|
case 0:
|
|
978
761
|
itemId = (_input$id = input.id) != null ? _input$id : item == null ? void 0 : item.id;
|
|
979
762
|
if (!(!itemId || input.quantity == null)) {
|
|
980
|
-
_context2.
|
|
763
|
+
_context2.n = 1;
|
|
981
764
|
break;
|
|
982
765
|
}
|
|
983
766
|
throw new ValidationError({
|
|
984
767
|
message: "Invalid input used for this operation"
|
|
985
768
|
});
|
|
986
|
-
case
|
|
987
|
-
_context2.
|
|
769
|
+
case 1:
|
|
770
|
+
_context2.n = 2;
|
|
988
771
|
return fetch({
|
|
989
772
|
input: {
|
|
990
773
|
item: {
|
|
@@ -993,15 +776,12 @@ var handler$3 = {
|
|
|
993
776
|
itemId: itemId
|
|
994
777
|
}
|
|
995
778
|
});
|
|
996
|
-
case
|
|
997
|
-
data = _context2.
|
|
998
|
-
_context2.
|
|
779
|
+
case 2:
|
|
780
|
+
data = _context2.v;
|
|
781
|
+
_context2.n = 3;
|
|
999
782
|
return mutate(data, false);
|
|
1000
|
-
case
|
|
1001
|
-
return _context2.
|
|
1002
|
-
case 9:
|
|
1003
|
-
case "end":
|
|
1004
|
-
return _context2.stop();
|
|
783
|
+
case 3:
|
|
784
|
+
return _context2.a(2, data);
|
|
1005
785
|
}
|
|
1006
786
|
}, _callee2);
|
|
1007
787
|
}));
|
|
@@ -1041,10 +821,10 @@ var getFetcher = function getFetcher(creds) {
|
|
|
1041
821
|
projectKey: creds.projectKey
|
|
1042
822
|
});
|
|
1043
823
|
return /*#__PURE__*/function () {
|
|
1044
|
-
var _ref2 = _asyncToGenerator(/*#__PURE__*/
|
|
824
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
|
|
1045
825
|
var method, variables, query, body, queryBuilder;
|
|
1046
|
-
return
|
|
1047
|
-
while (1) switch (_context.
|
|
826
|
+
return _regenerator().w(function (_context) {
|
|
827
|
+
while (1) switch (_context.n) {
|
|
1048
828
|
case 0:
|
|
1049
829
|
method = _ref.method, variables = _ref.variables, query = _ref.query, body = _ref.body;
|
|
1050
830
|
queryBuilder = apiRoot;
|
|
@@ -1059,7 +839,7 @@ var getFetcher = function getFetcher(creds) {
|
|
|
1059
839
|
if (variables != null && variables.search) {
|
|
1060
840
|
queryBuilder = queryBuilder.search();
|
|
1061
841
|
}
|
|
1062
|
-
_context.
|
|
842
|
+
_context.n = 1;
|
|
1063
843
|
return queryBuilder[method]({
|
|
1064
844
|
body: body,
|
|
1065
845
|
queryArgs: _extends({
|
|
@@ -1073,11 +853,8 @@ var getFetcher = function getFetcher(creds) {
|
|
|
1073
853
|
where: variables.where
|
|
1074
854
|
} : {})
|
|
1075
855
|
}).execute();
|
|
1076
|
-
case
|
|
1077
|
-
return _context.
|
|
1078
|
-
case 8:
|
|
1079
|
-
case "end":
|
|
1080
|
-
return _context.stop();
|
|
856
|
+
case 1:
|
|
857
|
+
return _context.a(2, _context.v);
|
|
1081
858
|
}
|
|
1082
859
|
}, _callee);
|
|
1083
860
|
}));
|
|
@@ -1093,31 +870,28 @@ var handler$4 = {
|
|
|
1093
870
|
method: "get"
|
|
1094
871
|
},
|
|
1095
872
|
fetcher: function fetcher(_ref) {
|
|
1096
|
-
return _asyncToGenerator(/*#__PURE__*/
|
|
873
|
+
return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
1097
874
|
var input, options, fetch, provider, id, product;
|
|
1098
|
-
return
|
|
1099
|
-
while (1) switch (_context.
|
|
875
|
+
return _regenerator().w(function (_context) {
|
|
876
|
+
while (1) switch (_context.n) {
|
|
1100
877
|
case 0:
|
|
1101
878
|
input = _ref.input, options = _ref.options, fetch = _ref.fetch, provider = _ref.provider;
|
|
1102
879
|
id = input.id;
|
|
1103
880
|
if (id) {
|
|
1104
|
-
_context.
|
|
881
|
+
_context.n = 1;
|
|
1105
882
|
break;
|
|
1106
883
|
}
|
|
1107
|
-
return _context.
|
|
1108
|
-
case
|
|
1109
|
-
_context.
|
|
884
|
+
return _context.a(2, null);
|
|
885
|
+
case 1:
|
|
886
|
+
_context.n = 2;
|
|
1110
887
|
return fetch(_extends({}, options, {
|
|
1111
888
|
variables: {
|
|
1112
889
|
id: id
|
|
1113
890
|
}
|
|
1114
891
|
}));
|
|
1115
|
-
case
|
|
1116
|
-
product = _context.
|
|
1117
|
-
return _context.
|
|
1118
|
-
case 8:
|
|
1119
|
-
case "end":
|
|
1120
|
-
return _context.stop();
|
|
892
|
+
case 2:
|
|
893
|
+
product = _context.v;
|
|
894
|
+
return _context.a(2, product.body ? normalizeProduct(product.body, provider.locale) : null);
|
|
1121
895
|
}
|
|
1122
896
|
}, _callee);
|
|
1123
897
|
}))();
|
|
@@ -1144,15 +918,15 @@ var handler$5 = {
|
|
|
1144
918
|
query: "productProjections"
|
|
1145
919
|
},
|
|
1146
920
|
fetcher: function fetcher(_ref) {
|
|
1147
|
-
return _asyncToGenerator(/*#__PURE__*/
|
|
921
|
+
return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
1148
922
|
var _search;
|
|
1149
923
|
var input, options, fetch, provider, search, categoryId, sort, count, response;
|
|
1150
|
-
return
|
|
1151
|
-
while (1) switch (_context.
|
|
924
|
+
return _regenerator().w(function (_context) {
|
|
925
|
+
while (1) switch (_context.n) {
|
|
1152
926
|
case 0:
|
|
1153
927
|
input = _ref.input, options = _ref.options, fetch = _ref.fetch, provider = _ref.provider;
|
|
1154
928
|
search = input.search, categoryId = input.categoryId, sort = input.sort, count = input.count;
|
|
1155
|
-
_context.
|
|
929
|
+
_context.n = 1;
|
|
1156
930
|
return fetch(_extends({}, options, {
|
|
1157
931
|
variables: _extends({
|
|
1158
932
|
expand: ["masterData.current"],
|
|
@@ -1166,17 +940,14 @@ var handler$5 = {
|
|
|
1166
940
|
filters: "categories.id: subtree(\"" + categoryId + "\")"
|
|
1167
941
|
} : {})
|
|
1168
942
|
}));
|
|
1169
|
-
case
|
|
1170
|
-
response = _context.
|
|
1171
|
-
return _context.
|
|
943
|
+
case 1:
|
|
944
|
+
response = _context.v;
|
|
945
|
+
return _context.a(2, {
|
|
1172
946
|
products: response.body.results.map(function (product) {
|
|
1173
947
|
return normalizeProduct(product, provider.locale);
|
|
1174
948
|
}),
|
|
1175
949
|
found: response.body.count > 0
|
|
1176
950
|
});
|
|
1177
|
-
case 6:
|
|
1178
|
-
case "end":
|
|
1179
|
-
return _context.stop();
|
|
1180
951
|
}
|
|
1181
952
|
}, _callee);
|
|
1182
953
|
}))();
|
|
@@ -1202,14 +973,11 @@ var handler$6 = {
|
|
|
1202
973
|
query: ""
|
|
1203
974
|
},
|
|
1204
975
|
fetcher: function fetcher(_ref) {
|
|
1205
|
-
return _asyncToGenerator(/*#__PURE__*/
|
|
1206
|
-
return
|
|
1207
|
-
while (1) switch (_context.
|
|
976
|
+
return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
977
|
+
return _regenerator().w(function (_context) {
|
|
978
|
+
while (1) switch (_context.n) {
|
|
1208
979
|
case 0:
|
|
1209
|
-
return _context.
|
|
1210
|
-
case 2:
|
|
1211
|
-
case "end":
|
|
1212
|
-
return _context.stop();
|
|
980
|
+
return _context.a(2, null);
|
|
1213
981
|
}
|
|
1214
982
|
}, _callee);
|
|
1215
983
|
}))();
|
|
@@ -1243,37 +1011,36 @@ var handler$7 = {
|
|
|
1243
1011
|
method: "get"
|
|
1244
1012
|
},
|
|
1245
1013
|
fetcher: function fetcher(_ref) {
|
|
1246
|
-
return _asyncToGenerator(/*#__PURE__*/
|
|
1014
|
+
return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
1247
1015
|
var input, options, fetch, provider, categoryId, categories, category;
|
|
1248
|
-
return
|
|
1249
|
-
while (1) switch (_context.
|
|
1016
|
+
return _regenerator().w(function (_context) {
|
|
1017
|
+
while (1) switch (_context.n) {
|
|
1250
1018
|
case 0:
|
|
1251
1019
|
input = _ref.input, options = _ref.options, fetch = _ref.fetch, provider = _ref.provider;
|
|
1252
1020
|
categoryId = input.categoryId;
|
|
1253
1021
|
if (categoryId) {
|
|
1254
|
-
_context.
|
|
1022
|
+
_context.n = 2;
|
|
1255
1023
|
break;
|
|
1256
1024
|
}
|
|
1257
|
-
_context.
|
|
1025
|
+
_context.n = 1;
|
|
1258
1026
|
return fetch(_extends({}, options));
|
|
1259
|
-
case
|
|
1260
|
-
categories = _context.
|
|
1261
|
-
return _context.
|
|
1027
|
+
case 1:
|
|
1028
|
+
categories = _context.v;
|
|
1029
|
+
return _context.a(2, categories.body ? categories.body.results.map(function (category) {
|
|
1262
1030
|
return normalizeCategory(category, provider.locale);
|
|
1263
1031
|
}) : []);
|
|
1264
|
-
case
|
|
1265
|
-
_context.
|
|
1032
|
+
case 2:
|
|
1033
|
+
_context.n = 3;
|
|
1266
1034
|
return fetch(_extends({}, options, {
|
|
1267
1035
|
variables: _extends({}, categoryId ? {
|
|
1268
1036
|
id: categoryId
|
|
1269
1037
|
} : {})
|
|
1270
1038
|
}));
|
|
1271
|
-
case
|
|
1272
|
-
category = _context.
|
|
1273
|
-
return _context.
|
|
1274
|
-
case
|
|
1275
|
-
|
|
1276
|
-
return _context.stop();
|
|
1039
|
+
case 3:
|
|
1040
|
+
category = _context.v;
|
|
1041
|
+
return _context.a(2, category.body ? [normalizeCategory(category.body, provider.locale)] : []);
|
|
1042
|
+
case 4:
|
|
1043
|
+
return _context.a(2);
|
|
1277
1044
|
}
|
|
1278
1045
|
}, _callee);
|
|
1279
1046
|
}))();
|
|
@@ -1376,22 +1143,19 @@ function CommerceProviderComponent(props) {
|
|
|
1376
1143
|
}, [projectKey, clientId, clientSecret, region]);
|
|
1377
1144
|
var _usePlasmicQueryData = usePlasmicQueryData(JSON.stringify({
|
|
1378
1145
|
creds: creds
|
|
1379
|
-
}) + "locale", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/
|
|
1146
|
+
}) + "locale", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
1380
1147
|
var fetcher, project;
|
|
1381
|
-
return
|
|
1382
|
-
while (1) switch (_context.
|
|
1148
|
+
return _regenerator().w(function (_context) {
|
|
1149
|
+
while (1) switch (_context.n) {
|
|
1383
1150
|
case 0:
|
|
1384
1151
|
fetcher = getFetcher(creds);
|
|
1385
|
-
_context.
|
|
1152
|
+
_context.n = 1;
|
|
1386
1153
|
return fetcher({
|
|
1387
1154
|
method: "get"
|
|
1388
1155
|
});
|
|
1389
|
-
case
|
|
1390
|
-
project = _context.
|
|
1391
|
-
return _context.
|
|
1392
|
-
case 5:
|
|
1393
|
-
case "end":
|
|
1394
|
-
return _context.stop();
|
|
1156
|
+
case 1:
|
|
1157
|
+
project = _context.v;
|
|
1158
|
+
return _context.a(2, project.body ? project.body.languages[0] : undefined);
|
|
1395
1159
|
}
|
|
1396
1160
|
}, _callee);
|
|
1397
1161
|
}))),
|