@plasmicpkgs/plasmic-yotpo 0.0.88 → 0.0.89

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.
@@ -36,306 +36,113 @@ function _asyncToGenerator(n) {
36
36
  });
37
37
  };
38
38
  }
39
- function _regeneratorRuntime() {
40
- _regeneratorRuntime = function () {
41
- return e;
42
- };
43
- var t,
44
- e = {},
45
- r = Object.prototype,
46
- n = r.hasOwnProperty,
47
- o = Object.defineProperty || function (t, e, r) {
48
- t[e] = r.value;
49
- },
50
- i = "function" == typeof Symbol ? Symbol : {},
51
- a = i.iterator || "@@iterator",
52
- c = i.asyncIterator || "@@asyncIterator",
53
- u = i.toStringTag || "@@toStringTag";
54
- function define(t, e, r) {
55
- return Object.defineProperty(t, e, {
56
- value: r,
57
- enumerable: !0,
58
- configurable: !0,
59
- writable: !0
60
- }), t[e];
61
- }
62
- try {
63
- define({}, "");
64
- } catch (t) {
65
- define = function (t, e, r) {
66
- return t[e] = r;
67
- };
68
- }
69
- function wrap(t, e, r, n) {
70
- var i = e && e.prototype instanceof Generator ? e : Generator,
71
- a = Object.create(i.prototype),
72
- c = new Context(n || []);
73
- return o(a, "_invoke", {
74
- value: makeInvokeMethod(t, r, c)
75
- }), a;
76
- }
77
- function tryCatch(t, e, r) {
78
- try {
79
- return {
80
- type: "normal",
81
- arg: t.call(e, r)
82
- };
83
- } catch (t) {
84
- return {
85
- type: "throw",
86
- arg: t
87
- };
88
- }
89
- }
90
- e.wrap = wrap;
91
- var h = "suspendedStart",
92
- l = "suspendedYield",
93
- f = "executing",
94
- s = "completed",
95
- y = {};
96
- function Generator() {}
97
- function GeneratorFunction() {}
98
- function GeneratorFunctionPrototype() {}
99
- var p = {};
100
- define(p, a, function () {
101
- return this;
102
- });
103
- var d = Object.getPrototypeOf,
104
- v = d && d(d(values([])));
105
- v && v !== r && n.call(v, a) && (p = v);
106
- var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
107
- function defineIteratorMethods(t) {
108
- ["next", "throw", "return"].forEach(function (e) {
109
- define(t, e, function (t) {
110
- return this._invoke(e, t);
111
- });
112
- });
113
- }
114
- function AsyncIterator(t, e) {
115
- function invoke(r, o, i, a) {
116
- var c = tryCatch(t[r], t, o);
117
- if ("throw" !== c.type) {
118
- var u = c.arg,
119
- h = u.value;
120
- return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
121
- invoke("next", t, i, a);
122
- }, function (t) {
123
- invoke("throw", t, i, a);
124
- }) : e.resolve(h).then(function (t) {
125
- u.value = t, i(u);
126
- }, function (t) {
127
- return invoke("throw", t, i, a);
128
- });
129
- }
130
- a(c.arg);
131
- }
132
- var r;
133
- o(this, "_invoke", {
134
- value: function (t, n) {
135
- function callInvokeWithMethodAndArg() {
136
- return new e(function (e, r) {
137
- invoke(t, n, e, r);
138
- });
39
+ function _regenerator() {
40
+ /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
41
+ var e,
42
+ t,
43
+ r = "function" == typeof Symbol ? Symbol : {},
44
+ n = r.iterator || "@@iterator",
45
+ o = r.toStringTag || "@@toStringTag";
46
+ function i(r, n, o, i) {
47
+ var c = n && n.prototype instanceof Generator ? n : Generator,
48
+ u = Object.create(c.prototype);
49
+ return _regeneratorDefine(u, "_invoke", function (r, n, o) {
50
+ var i,
51
+ c,
52
+ u,
53
+ f = 0,
54
+ p = o || [],
55
+ y = !1,
56
+ G = {
57
+ p: 0,
58
+ n: 0,
59
+ v: e,
60
+ a: d,
61
+ f: d.bind(e, 4),
62
+ d: function (t, r) {
63
+ return i = t, c = 0, u = e, G.n = r, a;
64
+ }
65
+ };
66
+ function d(r, n) {
67
+ for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) {
68
+ var o,
69
+ i = p[t],
70
+ d = G.p,
71
+ l = i[2];
72
+ 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));
139
73
  }
140
- return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
74
+ if (o || r > 1) return a;
75
+ throw y = !0, n;
141
76
  }
142
- });
143
- }
144
- function makeInvokeMethod(e, r, n) {
145
- var o = h;
146
- return function (i, a) {
147
- if (o === f) throw Error("Generator is already running");
148
- if (o === s) {
149
- if ("throw" === i) throw a;
77
+ return function (o, p, l) {
78
+ if (f > 1) throw TypeError("Generator is already running");
79
+ for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) {
80
+ i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u);
81
+ try {
82
+ if (f = 2, i) {
83
+ if (c || (o = "next"), t = i[o]) {
84
+ if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object");
85
+ if (!t.done) return t;
86
+ u = t.value, c < 2 && (c = 0);
87
+ } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1);
88
+ i = e;
89
+ } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break;
90
+ } catch (t) {
91
+ i = e, c = 1, u = t;
92
+ } finally {
93
+ f = 1;
94
+ }
95
+ }
150
96
  return {
151
97
  value: t,
152
- done: !0
98
+ done: y
153
99
  };
154
- }
155
- for (n.method = i, n.arg = a;;) {
156
- var c = n.delegate;
157
- if (c) {
158
- var u = maybeInvokeDelegate(c, n);
159
- if (u) {
160
- if (u === y) continue;
161
- return u;
162
- }
163
- }
164
- if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
165
- if (o === h) throw o = s, n.arg;
166
- n.dispatchException(n.arg);
167
- } else "return" === n.method && n.abrupt("return", n.arg);
168
- o = f;
169
- var p = tryCatch(e, r, n);
170
- if ("normal" === p.type) {
171
- if (o = n.done ? s : l, p.arg === y) continue;
172
- return {
173
- value: p.arg,
174
- done: n.done
175
- };
176
- }
177
- "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
178
- }
179
- };
180
- }
181
- function maybeInvokeDelegate(e, r) {
182
- var n = r.method,
183
- o = e.iterator[n];
184
- 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;
185
- var i = tryCatch(o, e.iterator, r.arg);
186
- if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
187
- var a = i.arg;
188
- 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);
189
- }
190
- function pushTryEntry(t) {
191
- var e = {
192
- tryLoc: t[0]
193
- };
194
- 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
195
- }
196
- function resetTryEntry(t) {
197
- var e = t.completion || {};
198
- e.type = "normal", delete e.arg, t.completion = e;
199
- }
200
- function Context(t) {
201
- this.tryEntries = [{
202
- tryLoc: "root"
203
- }], t.forEach(pushTryEntry, this), this.reset(!0);
100
+ };
101
+ }(r, o, i), !0), u;
204
102
  }
205
- function values(e) {
206
- if (e || "" === e) {
207
- var r = e[a];
208
- if (r) return r.call(e);
209
- if ("function" == typeof e.next) return e;
210
- if (!isNaN(e.length)) {
211
- var o = -1,
212
- i = function next() {
213
- for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
214
- return next.value = t, next.done = !0, next;
215
- };
216
- return i.next = i;
217
- }
218
- }
219
- throw new TypeError(typeof e + " is not iterable");
103
+ var a = {};
104
+ function Generator() {}
105
+ function GeneratorFunction() {}
106
+ function GeneratorFunctionPrototype() {}
107
+ t = Object.getPrototypeOf;
108
+ var c = [][n] ? t(t([][n]())) : (_regeneratorDefine(t = {}, n, function () {
109
+ return this;
110
+ }), t),
111
+ u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c);
112
+ function f(e) {
113
+ return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e;
220
114
  }
221
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
222
- value: GeneratorFunctionPrototype,
223
- configurable: !0
224
- }), o(GeneratorFunctionPrototype, "constructor", {
225
- value: GeneratorFunction,
226
- configurable: !0
227
- }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
228
- var e = "function" == typeof t && t.constructor;
229
- return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
230
- }, e.mark = function (t) {
231
- return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
232
- }, e.awrap = function (t) {
233
- return {
234
- __await: t
235
- };
236
- }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
115
+ 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 () {
237
116
  return this;
238
- }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
239
- void 0 === i && (i = Promise);
240
- var a = new AsyncIterator(wrap(t, r, n, o), i);
241
- return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
242
- return t.done ? t.value : a.next();
243
- });
244
- }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
245
- return this;
246
- }), define(g, "toString", function () {
117
+ }), _regeneratorDefine(u, "toString", function () {
247
118
  return "[object Generator]";
248
- }), e.keys = function (t) {
249
- var e = Object(t),
250
- r = [];
251
- for (var n in e) r.push(n);
252
- return r.reverse(), function next() {
253
- for (; r.length;) {
254
- var t = r.pop();
255
- if (t in e) return next.value = t, next.done = !1, next;
256
- }
257
- return next.done = !0, next;
119
+ }), (_regenerator = function () {
120
+ return {
121
+ w: i,
122
+ m: f
258
123
  };
259
- }, e.values = values, Context.prototype = {
260
- constructor: Context,
261
- reset: function (e) {
262
- if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
263
- },
264
- stop: function () {
265
- this.done = !0;
266
- var t = this.tryEntries[0].completion;
267
- if ("throw" === t.type) throw t.arg;
268
- return this.rval;
269
- },
270
- dispatchException: function (e) {
271
- if (this.done) throw e;
272
- var r = this;
273
- function handle(n, o) {
274
- return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
275
- }
276
- for (var o = this.tryEntries.length - 1; o >= 0; --o) {
277
- var i = this.tryEntries[o],
278
- a = i.completion;
279
- if ("root" === i.tryLoc) return handle("end");
280
- if (i.tryLoc <= this.prev) {
281
- var c = n.call(i, "catchLoc"),
282
- u = n.call(i, "finallyLoc");
283
- if (c && u) {
284
- if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
285
- if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
286
- } else if (c) {
287
- if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
288
- } else {
289
- if (!u) throw Error("try statement without catch or finally");
290
- if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
291
- }
292
- }
293
- }
294
- },
295
- abrupt: function (t, e) {
296
- for (var r = this.tryEntries.length - 1; r >= 0; --r) {
297
- var o = this.tryEntries[r];
298
- if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
299
- var i = o;
300
- break;
301
- }
302
- }
303
- i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
304
- var a = i ? i.completion : {};
305
- return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
306
- },
307
- complete: function (t, e) {
308
- if ("throw" === t.type) throw t.arg;
309
- 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;
310
- },
311
- finish: function (t) {
312
- for (var e = this.tryEntries.length - 1; e >= 0; --e) {
313
- var r = this.tryEntries[e];
314
- if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
315
- }
316
- },
317
- catch: function (t) {
318
- for (var e = this.tryEntries.length - 1; e >= 0; --e) {
319
- var r = this.tryEntries[e];
320
- if (r.tryLoc === t) {
321
- var n = r.completion;
322
- if ("throw" === n.type) {
323
- var o = n.arg;
324
- resetTryEntry(r);
325
- }
326
- return o;
327
- }
328
- }
329
- throw Error("illegal catch attempt");
330
- },
331
- delegateYield: function (e, r, n) {
332
- return this.delegate = {
333
- iterator: values(e),
334
- resultName: r,
335
- nextLoc: n
336
- }, "next" === this.method && (this.arg = t), y;
124
+ })();
125
+ }
126
+ function _regeneratorDefine(e, r, n, t) {
127
+ var i = Object.defineProperty;
128
+ try {
129
+ i({}, "", {});
130
+ } catch (e) {
131
+ i = 0;
132
+ }
133
+ _regeneratorDefine = function (e, r, n, t) {
134
+ function o(r, n) {
135
+ _regeneratorDefine(e, r, function (e) {
136
+ return this._invoke(r, n, e);
137
+ });
337
138
  }
338
- }, e;
139
+ r ? i ? i(e, r, {
140
+ value: n,
141
+ enumerable: !t,
142
+ configurable: !t,
143
+ writable: !t
144
+ }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2));
145
+ }, _regeneratorDefine(e, r, n, t);
339
146
  }
340
147
 
341
148
  function ensure(x) {
@@ -437,10 +244,10 @@ function YotpoReviews(_ref2) {
437
244
  document.body.removeChild(script);
438
245
  };
439
246
  }, [creds]);
440
- var _usePlasmicQueryData = query.usePlasmicQueryData(cacheKey + "/reviews", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
247
+ var _usePlasmicQueryData = query.usePlasmicQueryData(cacheKey + "/reviews", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
441
248
  var options, res;
442
- return _regeneratorRuntime().wrap(function _callee$(_context) {
443
- while (1) switch (_context.prev = _context.next) {
249
+ return _regenerator().w(function (_context) {
250
+ while (1) switch (_context.n) {
444
251
  case 0:
445
252
  options = {
446
253
  method: "GET",
@@ -449,29 +256,26 @@ function YotpoReviews(_ref2) {
449
256
  "Content-Type": "application/json"
450
257
  }
451
258
  };
452
- _context.next = 3;
259
+ _context.n = 1;
453
260
  return fetch("https://api.yotpo.com/v1/apps/" + creds.appKey + "/reviews?utoken=" + creds.uToken, options);
454
- case 3:
455
- res = _context.sent;
456
- return _context.abrupt("return", res.json());
457
- case 5:
458
- case "end":
459
- return _context.stop();
261
+ case 1:
262
+ res = _context.v;
263
+ return _context.a(2, res.json());
460
264
  }
461
265
  }, _callee);
462
266
  }))),
463
267
  reviewsData = _usePlasmicQueryData.data;
464
- var _usePlasmicQueryData2 = query.usePlasmicQueryData(cacheKey + "/review", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
268
+ var _usePlasmicQueryData2 = query.usePlasmicQueryData(cacheKey + "/review", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
465
269
  var options, res;
466
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
467
- while (1) switch (_context2.prev = _context2.next) {
270
+ return _regenerator().w(function (_context2) {
271
+ while (1) switch (_context2.n) {
468
272
  case 0:
469
273
  if (reviewId) {
470
- _context2.next = 2;
274
+ _context2.n = 1;
471
275
  break;
472
276
  }
473
- return _context2.abrupt("return", undefined);
474
- case 2:
277
+ return _context2.a(2, undefined);
278
+ case 1:
475
279
  options = {
476
280
  method: "GET",
477
281
  headers: {
@@ -479,14 +283,11 @@ function YotpoReviews(_ref2) {
479
283
  "Content-Type": "application/json"
480
284
  }
481
285
  };
482
- _context2.next = 5;
286
+ _context2.n = 2;
483
287
  return fetch("https://api.yotpo.com/reviews/" + reviewId + "?utoken=" + creds.uToken, options);
484
- case 5:
485
- res = _context2.sent;
486
- return _context2.abrupt("return", res.json());
487
- case 7:
488
- case "end":
489
- return _context2.stop();
288
+ case 2:
289
+ res = _context2.v;
290
+ return _context2.a(2, res.json());
490
291
  }
491
292
  }, _callee2);
492
293
  }))),
@@ -577,10 +378,10 @@ function YotpoStarRating(_ref5) {
577
378
  document.body.removeChild(script);
578
379
  };
579
380
  }, [creds]);
580
- var _usePlasmicQueryData3 = query.usePlasmicQueryData(cacheKey + "/starReviews", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
381
+ var _usePlasmicQueryData3 = query.usePlasmicQueryData(cacheKey + "/starReviews", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
581
382
  var options, res;
582
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
583
- while (1) switch (_context3.prev = _context3.next) {
383
+ return _regenerator().w(function (_context3) {
384
+ while (1) switch (_context3.n) {
584
385
  case 0:
585
386
  options = {
586
387
  method: "GET",
@@ -589,29 +390,26 @@ function YotpoStarRating(_ref5) {
589
390
  "Content-Type": "application/json"
590
391
  }
591
392
  };
592
- _context3.next = 3;
393
+ _context3.n = 1;
593
394
  return fetch("https://api.yotpo.com/v1/apps/" + creds.appKey + "/reviews?utoken=" + creds.uToken, options);
594
- case 3:
595
- res = _context3.sent;
596
- return _context3.abrupt("return", res.json());
597
- case 5:
598
- case "end":
599
- return _context3.stop();
395
+ case 1:
396
+ res = _context3.v;
397
+ return _context3.a(2, res.json());
600
398
  }
601
399
  }, _callee3);
602
400
  }))),
603
401
  reviews = _usePlasmicQueryData3.data;
604
- var _usePlasmicQueryData4 = query.usePlasmicQueryData(cacheKey + "/starReview", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
402
+ var _usePlasmicQueryData4 = query.usePlasmicQueryData(cacheKey + "/starReview", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
605
403
  var options, res;
606
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
607
- while (1) switch (_context4.prev = _context4.next) {
404
+ return _regenerator().w(function (_context4) {
405
+ while (1) switch (_context4.n) {
608
406
  case 0:
609
407
  if (productId) {
610
- _context4.next = 2;
408
+ _context4.n = 1;
611
409
  break;
612
410
  }
613
- return _context4.abrupt("return", undefined);
614
- case 2:
411
+ return _context4.a(2, undefined);
412
+ case 1:
615
413
  options = {
616
414
  method: "GET",
617
415
  headers: {
@@ -619,14 +417,11 @@ function YotpoStarRating(_ref5) {
619
417
  "Content-Type": "application/json"
620
418
  }
621
419
  };
622
- _context4.next = 5;
420
+ _context4.n = 2;
623
421
  return fetch("https://api.yotpo.com/reviews/" + productId + "?utoken=" + creds.uToken, options);
624
- case 5:
625
- res = _context4.sent;
626
- return _context4.abrupt("return", res.json());
627
- case 7:
628
- case "end":
629
- return _context4.stop();
422
+ case 2:
423
+ res = _context4.v;
424
+ return _context4.a(2, res.json());
630
425
  }
631
426
  }, _callee4);
632
427
  }))),